containers/haproxy/README.md

33 lines
1.2 KiB
Markdown
Raw Normal View History

2023-05-02 03:17:30 +02:00
# Docker Compose
## Environment
Prepare an environment file following the example in [env/fqdn_context.env.example](env/fqdn_context.env.example):
```
CONTEXT=foodstuffs_hongkong
DOCKER_SUBNET=172.24.23.0/24
HAPROXY_VERSION=latest
```
Var `${DOCKER_SUBNET}` is optional and defaults to `${DOCKER_SUBNET-172.24.23.0/24}`. Treat `CONTEXT` as a team name, purpose or scope. If the same Docker application can run multiple times and serve different tenants then `CONTEXT` is what distinguishes one instance from the other. Here `foodstuffs_hongkong` indicates for example a Hong Kong-based foodstuffs team of some sort.
## Vars
Define Docker Compose variables, use the `COMPOSE_ENV_FILE` defined above in [Environment](#environment):
```
export COMPOSE_DIR='/opt/containers' # Or wherever this repo is checked out
export COMPOSE_FILE="${COMPOSE_DIR}"'/docker-compose.yml'
export COMPOSE_ENV_FILE=<add accordingly>
```
Run like so:
```
docker compose --file "${COMPOSE_FILE}" --env-file "${COMPOSE_ENV_FILE}" up --detach
```
Log entries will just be something along the lines of:
```
haproxy-CONTEXT | [NOTICE] (1) : New worker (8) forked
haproxy-CONTEXT | [NOTICE] (1) : Loading success.
```