testdrivenio/django-github-digitalocean

Further elaboration steps in the tutorial for the build and deploy jobs

magedhelmy1 opened this issue · 0 comments

Thank you for a fantastic tutorial.
I was wondering if you had a the chance to further elaborate/update the tutorial on how to do the following steps.

Here, we defined a build job that will be triggered on all pushes where we:

1. Set the global WEB_IMAGE and NGINX_IMAGE environment variables
2. Check out the repository so the job has access to it
3. Add environment variables to a .env file
4. Set the WEB_IMAGE and NGINX_IMAGE environment variables with so they can be accessed within the Docker Compose file
5. Log in to GitHub Packages
6. Pull the images if they exist
7. Build the images
8. Push the images up to GitHub Packages

And the following

So, in the deploy job, which only runs if the build job completes successfully (via needs: build), we:

1. Check out the repository so the job has access to it
2. Add environment variables to a .env file
3. Add the private SSH key to the ssh-agent and run the agent
4. Copy over the .env and docker-compose.prod.yml files to the remote server
5. SSH to the remove server on DigitalOcean
6. Navigate to the deployment directory and set the environment variables
7. Log in to GitHub Packages
8. Pull the images
9. Spin up the containers
10. End the SSH session

These steps are not so easy to follow as a beginner. So if you can include the code/steps/examples for these parts.

Thanks again for your time!