Raft Demo / Documentation

Containerized Deployment

  1. Containerized Deployment
    1. Build Image
    2. Generate environment variables
    3. Launch Containers

This example uses Docker Compose as a foundation that can be adapted to Swarm or Kubernetes.

Missing:

  • Images are not pinned to specific versions
  • No resource limits
  • No centralized logging or rotation
  • No backup strategy
  • No service monitoring
  • No scaling: single container for each service

Build Image

git clone https://tangled.org/rewire.host/raft ~/raft
cd ~/raft
docker build -t raft .

Generate environment variables

Generate new secrets:

docker run -it --rm raft rake raft:env

Use these secrets to create an environment file:

STAGING=true
SITE_TITLE=Raft
SITE_DOMAIN=rafttest
LETSENCRYPT_EMAIL=admin@rewire.host

SECRET_KEY_BASE=1ec1f6b55300a48c8a8bade886638abb68d538c4904e8d98a21817aacb2f405e
SALT=0ba349e3ad4bce716057d8644bf1b002205dd4bcafb594c748a1fd8519305f52
DB_PASSWORD=EyPx0HnOOduENCCtk0Yi
JWT_SECRET=iAG2r4cYNN6zBMKg2sVl
S3_ACCESS_KEY=76FqxxvqYimuU191TUhW

Any variables in raft/config/defaults.yml may be overridden in the environment file. In this example, we define the minimally required variables.

NOTE: In this example, we are using docker compose, which CANNOT have quotes in the env file. Docker does not do variable expansion. You can put ${var} in the env file if the variable is intended for the raft app, which will do its own expansion. This does not work with environment variables needed for containers.

Check that the required variables are configured:

docker run -it --rm --env-file ./env raft rake conf

If you don’t see an error message, you are good to go.

Launch Containers

docker compose --env-file ./env -f ./container/production/compose.yml up -d

Check that the app can access the required services:

docker run -it --rm --env-file ./env raft rake raft:check