β¬οΈ Main Note
https://docs.google.com/document/d/19oDcieEkuX7xas-_Bai88iRlUeLBy-oaRVnXr9b-YSo/edit
GCP -> Create instance
Region : Seoul
Boot disk β ubuntu 20.04 // Balanced persistent disk //30
Click SSH(Secure Shell) - Terminal of new computer
This terminal is from the computer that we borrowed from GCP
Clone the file link into 'SSH'
Inside .env
file, put important keys that shouldn't be uploaded to git hub.
Edit docker.yaml
files (create docker.yaml file for all dev, prod, and stage)
git commit and clone in SSH =>
docker-compose -f docker-compose.prod.yaml build
version: '3.7'
services:
my-backend:
build:
context: .
dockerfile: Dockerfile
// volumes:
// - ./src:/myfolder/src
// volumesλ λ°°ν¬νμΌμμλ μ£Όμμ²λ¦¬ (κ°μκΈ° μ μ μ¬μ©μ€μΈλ° refreshλλ©΄ μλ¨)
env_file:
- ./.env
// docker-compose.dev.yaml
- ./.env.dev
// docker-compose.prod.yaml
- ./.env.prod
// docker-compose.stage.yaml
- ./.env.stage
ports:
- 3000:3000
my-database:
platform: linux/x86_64
image: mysql:latest
environment:
MYSQL_DATABASE: 'mydocker02'
MYSQL_ROOT_PASSWORD: 'root'
ports:
- 3306:3306
sudo apt update
sudo apt upgrade
sudo apt install docker.io
mkdir -p ~/.docker/cli-plugins/
curl -SL https://github.com/docker/compose/releases/download/v2.2.3/docker-compose-linux-x86_64 -o ~/.docker/cli-plugins/docker-compose
chmod +x ~/.docker/cli-plugins/docker-compose
docker compose version // just for chekcing
cat /etc/group
=> Adding user for security
sudo usermod -aG docker pjoobee
cat /etc/group
=> just for checking
git clone "//my repository address//"
Username & Password
β€ username : j00b33
β€ password : personal access token from git hub
vi .env.prod
--> i
:to get inside input mode
β€ Then copy the source code inside .env.prod
file
β€ Enter 'esc' and type :wq
β€ Do the same thing for .env.dev
and .env.stage
file
docker compose -f docker-compose.prod.yaml build
docker compose -f docker-compose.prod.yaml up
If you want the docker to be composed on the background, add -d
option=>
docker compose -f docker-compose.prod.yaml up -d
After deploying, copy External IP Address
β€ 34.64.33.115:3000/graphql
But this link won't work since there is a firewall.
To solve this problem, I should..
β€ 1. make a sticker
β€ 2. attach the sticker to the computer that I want to destroy the firewall.
Particualr port that I selected will only work since stickers aren't attached to all the ports.
Source : Starting point(the part whre the access request is made)
Destination : The computer that docker-compose up
is done, is becoming the destination.
Source IP Range : 0.0.0.0/0
β€ Everyone in the world is able to access to this port
TCP: 3000 (The port number that I'm going to open)
TCP Communication : Includes the logic that checks whether the receivng is well-done while communication with each other.
β€ High communication accuracy
UDP : Don't care whethere the receiving is well-done, but UDP keep sends the data
β€ Fast but communicatoin accuracy is quite low