All CI/CD pipelines are implemented as GitHub workflow actions in .github/workflows
. Details regarding the deployed infrastructure is available at coursetable/infra.
Available Environments:
- Preview
- PR-specific Vercel frontend deployments that use the
Staging
backend environment. - URL:
[branch-name].preview.coursetable.com
- PR-specific Vercel frontend deployments that use the
- Staging
master
tracking Vercel frontend and Docker backend deployments.- URL:
- Frontend: staging.coursetable.com
- Backend: api-staging.coursetable.com
- Production
- Asynchronously tracking deploys of
master
on approval from a team lead. - URL:
- Frontend: coursetable.com
- Backend: api.coursetable.com
- Asynchronously tracking deploys of
Runs formatting, linting, and dependency checks. Required as a check for merging PRs.
- Trigger: PR and
master
commit - Environment: Preview, Staging, Production
Deploys frontend only to Vercel and assigns unique preview link to each commit and each PR. Required as a check for merging PRs.
- Trigger: PR commit
- Environment: Preview
Deploys both frontend to Vercel and backend to the staging API Docker Network. Builds latest Docker images and refreshes containers in-place. Allows for sanity-checking and robust testing of new commits before deploying to production.
- Trigger:
master
commit - Environment: Staging
Deploys both frontend to Vercel and backend to production API Docker Network. Builds latest Docker images and refreshes containers in-place.
- Trigger:
master
commit with team lead approval - Environment: Production
- Install
docker
- Install
docker-compose
- Install
sentry-cli
- Install
doppler
Ensure that doppler
is properly configured with access to the environment configs. We assume that all following commands will be run with root
unless otherwise specified.
# Fetch everything.
git clone git@github.com:coursetable/coursetable.git
git clone git@github.com:coursetable/infra.git
# Setup infra.
pushd infra
./deploy.sh
popd
# Setup coursetable.
cd coursetable/api
./start.sh -p
# Setup cron.
echo This should be the contents of the crontab:
cat <<EOF
23 7 * * * bash -l -c "source $HOME/.profile && cd $HOME/infra/db && ./cron_script.sh" 2>&1
EOF
read -p "Add to crontab. Press [enter] when done..."
# Create new user that GitHub Actions assumes as an identity
useradd -m app
usermod -aG sudo app
passwd app
# Make sure to install the self-hosted runner application as the `app` user
su app
Setup the new server as a self-hosted runner for GitHub Actions by following the instructions provided when adding a new self-hosted runner. Be sure to install the runner application as a service as well.
Important
On the current CourseTable server, ~
refers to /home/app
. If you logged in using any other user, you'll need to change the paths below.
The following instructions are only for manual deployments. Only use this in the case that the GitHub Actions CD workflow fails.
# Run these on the prod server.
cd ~/coursetable/api
git pull # Get changes onto server
./start.sh -p # Deploy the new version in prod