zitadel/e2e/config/localhost/docker-compose.yaml
Elio Bischof 2bfdb72bf3
docs: fix reverse proxy guides (#9118)
# Which Problems Are Solved

Commands for installing compose stacks with reverse proxies don't work.

# How the Problems Are Solved

- The `docker compose up` commands are fixed by specifying all necessary
services to spin up. This is obviously not (or not with all docker
compose versions) resolved by the dependencies declarations.
- The initial postgres admin username is postgres.
- Fix postgres health check to succeed before the init job created the
DB.
- A hint tells the user to install the grpcurl binary.

# Additional Changes

- Passing `--wait` to `docker compose up` doesn't require us to sleep
for exactly three seconds.
- It looks to me like the order of the depends_on declaration for
zitadel matters, but I don't understand why. I changed it so that it's
for sure correct.
- Silenced some command outputs
- Removed the version property from all compose files to avoid the
following warning
```
WARN[0000] /tmp/caddy-example/docker-compose-base.yaml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion
```

# Additional Context

- Closes https://github.com/zitadel/zitadel/issues/9115

This is the easiest way to test the updated docs:

```bash
# Use this PR branches files:
export ZITADEL_CONFIG_FILES=https://raw.githubusercontent.com/zitadel/zitadel/refs/heads/fix-reverse-proxy-guides/docs/docs/self-hosting/manage/reverseproxy
```

The rest of the commands as described in
https://docs-git-fix-reverse-proxy-guides-zitadel.vercel.app/docs/self-hosting/manage/reverseproxy/caddy


![image](https://github.com/user-attachments/assets/949d2c2a-246a-49a2-916a-e77250771074)
2025-01-03 15:00:27 +01:00

44 lines
1.2 KiB
YAML

services:
zitadel:
user: '$UID'
restart: 'always'
image: '${ZITADEL_IMAGE:-ghcr.io/zitadel/zitadel:latest}'
build:
context: ../../..
dockerfile: ./build/Dockerfile
target: artifact
cache_from:
- type=gha
cache_to:
- type=gha,mode=max
command: 'start-from-init --masterkey "MasterkeyNeedsToHave32Characters" --tlsMode disabled --config /zitadel.yaml --steps /zitadel.yaml'
depends_on:
db:
condition: 'service_healthy'
volumes:
- ./zitadel.yaml:/zitadel.yaml
ports:
- "8080:8080"
healthcheck:
test: ["CMD", "/app/zitadel", "ready", "--config", "/zitadel.yaml" ]
interval: '10s'
timeout: '5s'
retries: 5
start_period: '10s'
extra_hosts:
- "host.docker.internal:host-gateway"
db:
restart: 'always'
image: 'cockroachdb/cockroach:v24.2.1'
command: 'start-single-node --insecure --http-addr :9090'
healthcheck:
test: ['CMD', 'curl', '-f', 'http://localhost:9090/health?ready=1']
interval: '10s'
timeout: '30s'
retries: 5
start_period: '20s'
ports:
- "26257:26257"
- "9090:9090"