76. DevOps Documentation¶
The DevOps guide provides structured documentation on DevOps practices, tools, and workflows used in software development and deployment.
76.1 Deploying with Docker¶
This document explains how users can perform various system administration tasks when deploying a site using Docker. The following deployment modes are supported:
- Production: Debugging is disabled, and a discrete database is used. Users should configure the production environment in
core.settings.prod_docker. ThisDJANGO_SETTINGS_MODULEis used when running in production mode. - Staging: Users should configure the staging environment in
core.settings.staging_docker. ThisDJANGO_SETTINGS_MODULEis used when running in staging mode.
76.2 Build Docker Images and Run Them¶
76.2.1 Production¶
Users can run the provided script to build and deploy Docker images in production mode:
cd deployment
# Allow PostgreSQL volume to be written to
sudo chmod -R a+rwX pg/postgres_data/
make deploy
sudo chmod -R a+rwX static
76.2.2 Running in Development Mode¶
Users can run makedev in the terminal.
Then, connect to the Django container and run:
Pycswruns on port8000.- Users can access the web container via port
8080or as defined in thefig.ymlfile.
To create a superuser account, run:
76.2.3 Staging¶
The staging deployment follows the same process as production, but users should precede each command with staging, e.g.,
Note: For staging deployment, users should use a
separate Git checkoutfrom the production checkout, as the Git checkout code is shared into the source tree.
76.3 Using Make¶
Key make commands for production include:
- build – Builds production containers.
- run – Builds and runs database and
uwsgiservices. - collectstatic – Collects static files for production.
- migrate – Runs Django migrations in production.
Additional make commands are available in the Makefile.
76.3.1 Running Arbitrary Commands¶
Users can execute arbitrary management commands easily within the container.
76.4 Setting Up an Nginx Reverse Proxy¶
Users should create a new Nginx virtual host. Example configurations are available in *-nginx.conf in the deployment directory, with separate configurations for production and staging.
To apply these configurations:
- Copy the example file (renaming if necessary) to
/etc/nginx/sites-enabled/. - Modify the contents to match the local file system paths.
- Verify the configuration:
- Reload or restart Nginx:
76.5 Managing Containers¶
For managing infrastructure, refer to the Fig documentation.
76.6 Configuration Options¶
Users can configure the base port, image organisation namespace, PostGIS user/password, and other settings by modifying the fig*.yml files.