Deploying Django with Docker Swarm

An example project for deploying Django on Docker Swarm.

This originally began as a playground and documentation for IEEE UofT’s development needs to serve our hackathon template. As such, the original requirements were:

  • Runs on a single server, but the option to add more nodes in the future is preferred

  • Postgres is installed natively on the server

  • Nginx is installed natively on the server, handling SSL and static file serving

  • The application should be deployed as a docker container than Nginx can reverse proxy to

To begin, fork the grahamhoyes/django-docker-swarm-example repository, and clone it locally. This example will make use of GitHub Actions and Packages. These are free (with some limitations) for public repositories, so I recommend you keep your fork public.

Start by reading about the Django project that this example uses. From there, follow the pages to configure servers, github actions, and the deployment.