Skip to content

3. Production

Deden Bangkit edited this page Jan 20, 2022 · 2 revisions

For deploying the App in GCP Infra, store images to Google container registry will be recommended to access Google’s high-performing global network for fast deployment.

Read more: https://cloud.google.com/container-registry/docs

export IMG_PREFIX="eu.gcr.io/akvo-lumen/rtmis"

Otherwise:

export IMG_PREFIX="any-prefix"

Frontend Build

echo "PUBLIC_URL=/" > frontend/.env
docker-compose -f docker-compose.yml run --rm --no-deps frontend sh release.sh
docker build --tag "${IMG_PREFIX}/frontend:latest"

Backend Build

docker build --tag "${IMG_PREFIX}/frontend:latest"

Above command will generate two docker images: $IMG_PREFIX/rtmis/backend and $IMG_PREFIX/rtmis/frontend

docker-compose -f docker-compose.yml -f docker-compose.ci.yml up -d

Network Test

if ! docker-compose -f docker-compose.ci.yml run -T ci ./basic.sh; then
  dci logs
  echo "Build failed when running basic.sh"
  exit 1
fi

Network config: nginx

Choose application credentials based on application infrastructure and where it runs.

Storing Images (Optional)

Example for pushing images to Google container registry only

gcloud auth activate-service-account --key-file=/home/semaphore/.secrets/gcp.json
gcloud config set project <project_name>
gcloud config set container/cluster <zone_name e.g europe-west1-d>
gcloud config set compute/zone <zone_name e.g europe-west1-d>
gcloud config set container/use_client_certificate False
gcloud auth configure-docker "eu.gcr.io"

docker push "eu.gcr.io/<project_name>/rtmis/backend:latest
docker push "eu.gcr.io/<project_name>/rtmis/backend:latest

Dev Infra

Schema using GCP Screen Shot 2022-01-20 at 23 06 16

Clone this wiki locally