Skip to content

Resources for deploying the full Trade Wars stack with Docker Compose

Notifications You must be signed in to change notification settings

TradeWars/deployment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Trade Wars Deployment

This repository holds the necessary configuration files for performing a full production deployment of the Trade Wars stack. This includes the gamemode and all additional services that it depends on.

Deployment uses Docker Compose and also makes use of Watchtower for automatic restarts when new versions of dependencies are available. In future, this will be modified or built upon to provide a graceful restart cycle that ensures players and operators are notified of an incoming restart and given a grace period as well as a way to cancel a restart.

Usage (Services)

Services must use the following three primary branches to be compatible with this deployment setup:

  • master represents the stable, public, live version - the code running here must have gone through testing with other components in develop as well as a staging release on staging.
  • staging represents the next stable version - the version running here will eventually run in production providing no last-minute issues are discovered.
  • develop is a rolling release for testing new features and merging feature branches for integration testing.

Simply by pushing to those branches will trigger the Watchtower application running on the deployment server to automatically update the running images once it sees new ones hit the Docker Hub.

Usage (Full Deployment)

To perform a deployment, you must clone this repository to your local machine and cd into it. Once you've done that, proceed with the deployment commands detailed below.

Environment

First, you must declare whether you are deploying to a development environment or a production environment.

Environments are defined in "env-files". The environment that will be used by the deployment is stored in the file named .env. This doesn't exist on the repository because it may contain sensitive information. Deployment is split between environments by storing configuration variables in a .env file either called dev.env or prod.env which is then copied to a "live file" named simply .env which is used by the docker-compose command. The dev.env file is included in this repository because it contains simple database credentials.

If you are deploying a development environment, you already have the dev.env file so all you need to do is run the following command that will simply copy dev.env to the live file .env:

make dev

But if you are deploying to production, you must first manually create the file prod.env which must contain all necessary environment variables. Copy the dev.env file and change each variable appropriately:

  • ALWAYS generate long, strong, complex passwords
  • NEVER re-use passwords across deployments
  • ALWAYS store passwords in a safe location
  • NEVER commit sensitive credentials to source control

Once you've done that, run the following command to set the live .env file to the production settings:

make prod

Deployment

Once the environment has been set up and .env contains your target variables, you can deploy the entire stack with:

make up

This simply runs docker-compose up with any necessary options.

Releases

No releases published

Packages

No packages published