Our Docker stack - GatechVIP/gatech-swapr-provisioning GitHub Wiki

Our Docker stack

Our stack uses Docker Compose for provisioning local development environments and Docker Stack for deploying to external Docker hosts.

This document will describe what containers make up the stack, what they do, and how they interact with each other

Services

Our stack is currently made up of 5 services.

db (PostgreSQL server)

Runs a stock postgresql service from Docker. Communicates with backend via private networking.

Note that the db servie does not expose itself to the host machine by default. This will be fixed in a future update to the stack definition so that the database can be accessed locally for testing purposes.

client-watch

This service is built from the gatech-swapr-client submodule's Dockerfile. It is based on a node image from Docker for Node 8. This functions a live-reloading development server for the client that is served with SSL by the www container. This container is used in development only, and while running, automatically builds the client and reloads your web browser when you make any changes to the code.

Note: Whenever any dependencies are updated via npm or yarn, make sure to restart the Docker stack so that the dependencies are updated in the containers.

www (nginx proxy)

Based on the nginx service. Serves our static files in production, but proxies to the client-watch container in development. Also proxies relevant requests to the backend. Communicates with backend and client-watch via private networking.

In production, this container is build with multi-step builds, so that the static files are automatically built in a node.js container and provided to a standard nginx container.

Development

  • HTTPS port: 8443
  • Served at: swapr-dev.vip.gatech.edu

backend

This service is built from the gatech-swapr-server-node submodule's Dockerfile. It is based on a node image from Docker for Node 8. This functions as an internal container, as it only communicates with the db and www containers through private networking.

test

Defined in docker-compose.test.yaml. Built similarly to the backend service from Dockerfile.test in gatech-swapr-server-node, with a few key differences:

  • Does not persist the state of the database
  • Uses a separate database for testing
  • Meant to be run with docker-compose run as a one-off container