Skip to main content
Version: 3.21

Setup (with Docker Compose)

Using a .env.local (Custom .env)

It may be easier to manage your environment variables using a local file.

You can add a .env.local file at the root of this project and define a command function in your ~/.bashrc or ~/.zshrc:

# ~/.bashrc or ~/.zshrc
function dc() {
if [ -f .env.local ]; then
docker compose --env-file=.env --env-file=.env.local $@
else
docker compose $@
fi
}

Installation

Note: If one of the ports is already allocated, see the Changing ports section and run the command again.

  1. Clone this repository
  2. (Optional) Build all images for a fresh version:
bin/build.sh

Secure your installation

Change all the default passwords or secrets you find in .env.

They often start with __CHANGE_ME_.

Install dependencies and configure projects

  • Run the following script to set up databases and initial configurations:
bin/setup.sh

If the stack is already deployed, you should run the migration after a fresh build:

bin/migrate.sh

Configure Let's Encrypt

First, make sure you have set the PHRASEA_DOMAIN variable to your main domain. A wildcard certificate will be generated for that domain.

Add and configure the following lines in your .env.local:

TRAEFIK_PROVIDERS_FILE_FILENAME=
LETS_ENCRYPT_ENABLED=true
LETS_ENCRYPT_PROVIDER=gandiv5
LEGO_GANDIV5_API_KEY=<Your API key>

Then update the Traefik container:

dc up -d traefik

Wait for Traefik to obtain your certificate.

By default, Let's Encrypt's staging environment is used. To get a production certificate, set:

LETS_ENCRYPT_CA_SERVER=https://acme-v02.api.letsencrypt.org/directory

Setup cron jobs

You may want to setup cron jobs to run periodic tasks (like cleaning old data). If you plan to deploy the stack with docker-compose on a single host machine, you can use the provided bin/ops/cron-script.sh script to add cron jobs to your host machine.

Changing ports

You can change service ports by overriding the environment variables (see the .env file).

Using fixtures

You may want to populate databases with a set of fixtures:

# Warning! This will empty the databases, insert fixtures, and run bin/setup.sh again.
bin/install-fixtures.sh
  • Read the documentation for each group of services to customize environment variables:

  • Start the whole stack:

dc up -d

Logs

Install ELK stack to get report-api logs available in Kibana.

# set COMPOSE_FILE=docker-compose.yml:docker-compose.elk.yml
dc up -d

Next steps

If you are a developer, follow the dev setup guide