Skip to content

.env.example

Download .env.example as it is.

deploy/compose/.env.example
# Copy to .env next to docker-compose.yml and fill in. Needs Docker Compose
# 2.24+ and Docker Engine 25+. The secrets below reach the containers as
# files in /run/secrets, not as environment variables; compose refuses to
# start a service while a secret it needs is not set.
COMPOSE_PROJECT_NAME=houradvantage
# The Hour Advantage image, loaded from the Hour Advantage distribution
# (`docker load -i <image file>` prints its name). Change it to move to a
# new version, then run rolling-update.sh (or .ps1).
HOURADVANTAGE_IMAGE=houradvantage:0.1.0
# Bundled Postgres. Not published on the host. (Not needed with an external
# database, see docker-compose.external-db.yml.) Required: a long random
# password of your own (`openssl rand -hex 24`); compose refuses to start
# without it.
POSTGRES_PASSWORD=
# The database the gateways use: the bundled one. For an external one, its
# URL instead, with sslmode=require (or verify-full) across a network:
# postgres://houradvantage:[email protected]:5432/houradvantage?sslmode=require
HOURADVANTAGE_DATABASE_URL=postgres://houradvantage:${POSTGRES_PASSWORD}@postgres:5432/houradvantage?sslmode=disable
# Admin API login, required because the admin API listens on the compose
# network. Make the hash with:
# docker run --rm -it houradvantage:0.1.0 houradm hash-password
# Keep the single quotes: the hash is full of $ signs, which compose would
# otherwise try to expand. `hourctl` in a gateway container logs in
# as this user; give it the password per command (-e HOURADVANTAGE_ADMIN_PASSWORD).
HOURADVANTAGE_ADMIN_USERNAME=admin
HOURADVANTAGE_ADMIN_PASSWORD_HASH='$argon2id$v=19$m=19456,t=2,p=1$REPLACE$ME'
# The password itself, for the one-shot `packages` service only
# (`docker compose run --rm packages`), which pushes the image's package
# bundles; the gateways never see it. Without it, push them by hand
# (the Docker Compose guide in the Hour Advantage docs).
# HOURADVANTAGE_ADMIN_PASSWORD=
# Required: uncomment and fill in. The key that seals the secrets kept in
# the database (broker passwords, webhook secrets, device keys); every
# gateway shares it. Make one with:
# docker run --rm houradvantage:0.1.0 houradm gen-secret-key
# Back it up: what it sealed cannot be read without it. To change it, put
# the new key here and the old one in HOURADVANTAGE_SECRET_KEYS_OLD, and
# restart the gateways one at a time. They keep sealing with the old key
# until every running gateway has the new one, then seal everything again
# with it; after that the old key can go.
# HOURADVANTAGE_SECRET_KEY=
# A comma (none) unless the key is being changed. Compose hands a secret to
# the gateways only when it is not empty, and they read this one as a secret.
HOURADVANTAGE_SECRET_KEYS_OLD=,
# The Valkey the instances share (the cache of what they keep of the devices, and the messages they send each other): the bundled
# one by default (the valkey service). Nothing in it is kept, everything is rebuilt from Postgres. For a Valkey you run
# yourself (Sentinel or a managed service for one that survives the loss of a host) put its URL here (redis://, redis-sentinel://,
# redis-cluster:// or rediss://) and remove the valkey service from the compose file. The install's id keeps what installs keep in
# one Valkey apart (the first part of every key).
# HOURADVANTAGE_CACHE_URL=redis://valkey:6379
HOURADVANTAGE_CACHE_INSTALL=default
# Time and Attendance beside Connect on every gateway: on or off. On, create
# its tenants with `hourctl attend tenants create` (the Docker Compose guide).
HOURADVANTAGE_ATTEND=off
# Gateway instances started by `docker compose up` (scale later with --scale).
GATEWAY_REPLICAS=3
# Processors and memory per instance. Worker threads, Lua concurrency and the
# database pool follow the CPU limit.
GATEWAY_CPUS=2
GATEWAY_MEMORY=1g
# Postgres needs max_connections >= replicas x (pool size + 2) + a few; the
# pool is 4 per CPU, between 8 and 32.
POSTGRES_MAX_CONNECTIONS=200
# Device ports are not settings: they are listed in docker-compose.yml (the
# haproxy service's ports) and haproxy.cfg (a frontend each); see the Docker Compose guide.
# HAProxy's stats page, bound to 127.0.0.1 only.
HAPROXY_STATS_PORT=28404
# The compose network, where HAProxy is. The gateways believe X-Forwarded-For
# from it once trusted_proxies in houradvantage-setup.toml (which must match this)
# has been applied.
COMPOSE_SUBNET=172.30.28.0/24
# What Docker keeps of each container's output (json-file): size per file
# and files kept.
LOG_MAX_SIZE=20m
LOG_MAX_FILES=5