Skip to content

0.9.0

Latest
Compare
Choose a tag to compare
@mmtftr mmtftr released this 16 Dec 18:59
· 5 commits to main since this release
5bb654b

Group 1 CMPE 451 2024 Fall Final Release

Final Release

Deployment

We use DigitalOcean's App Platform with the DigitalOcean Container Registry. We have a single registry that all images are pulled from. The app platform will automatically deploy the latest image from the registry when a push happens.

The deployment process is very simple. When following the sets, if two sets of commands are given, execute only the commands for the environment you're deploying to:

Prerequisites

Make sure your DigitalOcean CLI has been set up and you have logged in (doctl auth init).

Authorize with the registry (only need to do once):

doctl registry login

Deploying the Application

Important

Note that you need to use docker compose and NOT docker-compose. Dashed version is the older version that uses Python and may have conflicts with your local Python environment. We also don't provide version which may cause an error with the old Compose V1. For more details, please check the Docker documentation.

When you're going to deploy only the application (no changes to infrastructre), you can follow the steps below:

  1. Build images using the docker compose setup.
docker compose build
  1. Tag images for the registry.
# for prod
docker tag bounswe2024group1-451-web:latest registry.digitalocean.com/programming-languages-2/web:latest
docker tag bounswe2024group1-451-backend:latest registry.digitalocean.com/programming-languages-2/backend:latest

# for staging
docker tag bounswe2024group1-451-web:latest registry.digitalocean.com/programming-languages-2/web:staging
docker tag bounswe2024group1-451-backend:latest registry.digitalocean.com/programming-languages-2/backend:staging
  1. Push images to the registry.
# for prod
docker push registry.digitalocean.com/programming-languages-2/web:latest
docker push registry.digitalocean.com/programming-languages-2/backend:latest

# for staging
docker push registry.digitalocean.com/programming-languages-2/web:staging
docker push registry.digitalocean.com/programming-languages-2/backend:staging

This will trigger a deployment on the DigitalOcean backend.

  1. Make sure your deployment is successful by checking the logs.

Deploying the Infrastructure

GUI Changes

When you have made changes to the infrastructure, make sure you keep .do/app-{env}.yml up to date. If you've used the GUI, pull spec changes using doctl:

# for prod
doctl apps spec get <app-id> > .do/app-prod.yml

# for staging
doctl apps spec get <app-id> > .do/app-staging.yml

To get <app-id> you can use doctl apps list and find the app id for the environment you're deploying to.

App Spec Changes

When you've changed the app spec, you can use doctl apps update to update the app. Make sure you've updated the spec file before running the command.

# for prod
doctl apps update --spec .do/app-prod.yml

# for staging
doctl apps update --spec .do/app-staging.yml

It is paramount that staging and prod are kept in sync. If you've made changes to the staging environment, make sure to update the prod environment as well.

What's Changed

Full Changelog: customer-milestone-2...customer-presentation-3