Files
zitadel/.devcontainer/base/docker-compose.yml

226 lines
6.6 KiB
YAML
Raw Normal View History

services:
2025-07-20 20:44:33 +02:00
devcontainer:
2025-07-22 14:13:44 +02:00
container_name: devcontainer
2025-07-21 17:13:29 +00:00
build:
context: .
volumes:
2025-07-22 14:13:44 +02:00
- ../../:/workspaces:cached
2025-07-21 17:13:29 +00:00
- /tmp/.X11-unix:/tmp/.X11-unix:cached
2025-07-22 17:46:26 +02:00
- home-dir:/home/node:delegated
command: sleep infinity
2025-07-21 17:13:29 +00:00
working_dir: /workspaces
environment:
docs: fix and harmonize docker compose files (#8839) # Which Problems Are Solved 1. Postgres spams FATAL: role "root" does not exist as mentioned in https://github.com/zitadel/zitadel/discussions/7832 (even with -U) 2. The compose commands for a ZITADEL deployment with initial service account key don't work out-of-the box with a non-root user, because docker creates non-existing directories to bind-mount with root ownership. ![image](https://github.com/user-attachments/assets/f2fc92d5-2ff4-47a4-bf4d-e9657aa2bb94) ``` time="2024-10-29T09:37:13Z" level=error msg="migration failed" caller="/home/runner/work/zitadel/zitadel/internal/migration/migration.go:68" error="open /machinekey/zitadel-admin-sa.json: permission denied" name=03_default_instance time="2024-10-29T09:37:13Z" level=fatal msg="migration failed" caller="/home/runner/work/zitadel/zitadel/cmd/setup/setup.go:248" error="open /machinekey/zitadel-admin-sa.json: permission denied" name=03_default_instance ``` # How the Problems Are Solved 1. The branch bases on https://github.com/zitadel/zitadel/pull/8826. The env vars are cleaned up and prettified across compose files. 2. A command is added to the docs that creates the directory with the current users permission. The ZITADEL container runs with the current users ID. # Additional Context - Replaces https://github.com/zitadel/zitadel/pull/8826 - Discussion https://github.com/zitadel/zitadel/discussions/7832 - Closes https://github.com/zitadel/zitadel/issues/7725 --------- Co-authored-by: m4tu4g <71326926+m4tu4g@users.noreply.github.com>
2024-10-29 20:02:04 +01:00
ZITADEL_DATABASE_POSTGRES_HOST: db
ZITADEL_EXTERNALSECURE: false
2025-07-20 20:44:33 +02:00
db:
2025-07-21 00:34:54 +02:00
container_name: db
2025-07-20 23:37:05 +02:00
image: postgres:17.0-alpine3.19
restart: unless-stopped
volumes:
- postgres-data:/var/lib/postgresql/data
environment:
docs: fix and harmonize docker compose files (#8839) # Which Problems Are Solved 1. Postgres spams FATAL: role "root" does not exist as mentioned in https://github.com/zitadel/zitadel/discussions/7832 (even with -U) 2. The compose commands for a ZITADEL deployment with initial service account key don't work out-of-the box with a non-root user, because docker creates non-existing directories to bind-mount with root ownership. ![image](https://github.com/user-attachments/assets/f2fc92d5-2ff4-47a4-bf4d-e9657aa2bb94) ``` time="2024-10-29T09:37:13Z" level=error msg="migration failed" caller="/home/runner/work/zitadel/zitadel/internal/migration/migration.go:68" error="open /machinekey/zitadel-admin-sa.json: permission denied" name=03_default_instance time="2024-10-29T09:37:13Z" level=fatal msg="migration failed" caller="/home/runner/work/zitadel/zitadel/cmd/setup/setup.go:248" error="open /machinekey/zitadel-admin-sa.json: permission denied" name=03_default_instance ``` # How the Problems Are Solved 1. The branch bases on https://github.com/zitadel/zitadel/pull/8826. The env vars are cleaned up and prettified across compose files. 2. A command is added to the docs that creates the directory with the current users permission. The ZITADEL container runs with the current users ID. # Additional Context - Replaces https://github.com/zitadel/zitadel/pull/8826 - Discussion https://github.com/zitadel/zitadel/discussions/7832 - Closes https://github.com/zitadel/zitadel/issues/7725 --------- Co-authored-by: m4tu4g <71326926+m4tu4g@users.noreply.github.com>
2024-10-29 20:02:04 +01:00
PGUSER: postgres
POSTGRES_PASSWORD: postgres
2025-07-20 23:37:05 +02:00
healthcheck:
test: ["CMD-SHELL", "pg_isready"]
interval: "10s"
timeout: "30s"
retries: 5
start_period: "20s"
ports:
- "5432:5432"
2025-07-20 20:44:33 +02:00
mock-zitadel:
2025-07-21 00:34:54 +02:00
container_name: mock-zitadel
2025-07-20 20:44:33 +02:00
build:
2025-07-23 11:29:21 +02:00
context: ../../apps/login/integration/core-mock
2025-07-20 20:44:33 +02:00
ports:
- 22220:22220
- 22222:22222
2025-07-21 17:13:29 +00:00
login-integration:
container_name: login-integration
2025-07-23 11:04:23 +02:00
build:
context: ../..
dockerfile: dockerfiles/login.Dockerfile
2025-07-23 04:06:17 +02:00
image: "${LOGIN_TAG:-zitadel-login:local}"
2025-07-23 11:29:21 +02:00
env_file: ../../apps/login/.env.test
2025-07-21 17:13:29 +00:00
network_mode: service:devcontainer
environment:
2025-07-22 16:56:13 +02:00
NODE_ENV: test
2025-07-21 17:13:29 +00:00
PORT: 3001
depends_on:
mock-zitadel:
condition: service_started
2025-07-20 23:37:05 +02:00
zitadel:
image: "${ZITADEL_TAG:-ghcr.io/zitadel/zitadel:v4.0.0-rc.2}"
container_name: zitadel
command: 'start-from-init --masterkey "MasterkeyNeedsToHave32Characters" --config /zitadel.yaml --steps /zitadel.yaml'
volumes:
2025-07-23 11:29:21 +02:00
- ../../apps/login/acceptance/pat:/pat:delegated
- ../../apps/login/acceptance/zitadel.yaml:/zitadel.yaml:cached
2025-07-20 23:56:52 +02:00
network_mode: service:devcontainer
2025-07-20 23:37:05 +02:00
healthcheck:
test:
- CMD
- /app/zitadel
- ready
- --config
- /zitadel.yaml
depends_on:
db:
condition: "service_healthy"
2025-07-20 20:44:33 +02:00
configure-login:
container_name: configure-login
restart: no
build:
2025-07-23 11:29:21 +02:00
context: ../../apps/login/acceptance/setup
2025-07-20 23:37:05 +02:00
dockerfile: ../go-command.Dockerfile
2025-07-20 20:44:33 +02:00
entrypoint: "./setup.sh"
2025-07-20 23:56:52 +02:00
network_mode: service:devcontainer
2025-07-20 20:44:33 +02:00
environment:
PAT_FILE: /pat/zitadel-admin-sa.pat
2025-07-20 23:37:05 +02:00
ZITADEL_API_URL: http://localhost:8080
2025-07-20 20:44:33 +02:00
WRITE_ENVIRONMENT_FILE: /login-env/.env.test.local
SINK_EMAIL_INTERNAL_URL: http://sink:3333/email
SINK_SMS_INTERNAL_URL: http://sink:3333/sms
2025-07-21 17:13:29 +00:00
SINK_NOTIFICATION_URL: http://sink:3333/notification
2025-07-20 23:37:05 +02:00
LOGIN_BASE_URL: http://localhost:3000/ui/v2/login/
ZITADEL_API_DOMAIN: localhost
ZITADEL_ADMIN_USER: zitadel-admin@zitadel.localhost
2025-07-20 20:44:33 +02:00
volumes:
2025-07-23 11:29:21 +02:00
- ../../apps/login/acceptance/pat:/pat:cached # Read the PAT file from zitadels setup
- ../../apps/login:/login-env:delegated # Write the environment variables file for the login
2025-07-20 20:44:33 +02:00
depends_on:
2025-07-20 23:37:05 +02:00
zitadel:
2025-07-20 20:44:33 +02:00
condition: "service_healthy"
2025-07-22 14:13:44 +02:00
login-acceptance:
2025-07-20 23:56:52 +02:00
container_name: login
2025-07-21 00:34:54 +02:00
image: "${LOGIN_TAG:-ghcr.io/zitadel/zitadel-login:v4.0.0-rc.2}"
2025-07-20 23:56:52 +02:00
network_mode: service:devcontainer
2025-07-21 00:21:29 +02:00
volumes:
2025-07-23 11:29:21 +02:00
- ../../apps/login/.env.test.local:/env-files/.env:cached
2025-07-20 23:56:52 +02:00
depends_on:
configure-login:
condition: service_completed_successfully
2025-07-20 20:44:33 +02:00
mock-notifications:
container_name: mock-notifications
build:
2025-07-23 11:29:21 +02:00
context: ../../apps/login/acceptance/sink
2025-07-20 23:37:05 +02:00
dockerfile: ../go-command.Dockerfile
2025-07-20 20:44:33 +02:00
args:
- LOGIN_TEST_ACCEPTANCE_GOLANG_TAG=${LOGIN_TEST_ACCEPTANCE_GOLANG_TAG:-golang:1.24-alpine}
environment:
PORT: '3333'
command:
- -port
- '3333'
- -email
- '/email'
- -sms
- '/sms'
- -notification
- '/notification'
ports:
- "3333:3333"
depends_on:
configure-login:
condition: "service_completed_successfully"
mock-oidcrp:
container_name: mock-oidcrp
build:
2025-07-23 11:29:21 +02:00
context: ../../apps/login/acceptance/oidcrp
2025-07-20 23:37:05 +02:00
dockerfile: ../go-command.Dockerfile
2025-07-20 20:44:33 +02:00
args:
- LOGIN_TEST_ACCEPTANCE_GOLANG_TAG=${LOGIN_TEST_ACCEPTANCE_GOLANG_TAG:-golang:1.24-alpine}
2025-07-20 23:56:52 +02:00
network_mode: service:devcontainer
2025-07-20 20:44:33 +02:00
environment:
2025-07-20 23:37:05 +02:00
API_URL: 'http://localhost:8080'
API_DOMAIN: 'localhost'
2025-07-20 20:44:33 +02:00
PAT_FILE: '/pat/zitadel-admin-sa.pat'
2025-07-20 23:37:05 +02:00
LOGIN_URL: 'http://localhost:3000/ui/v2/login'
ISSUER: 'http://localhost:8000'
HOST: 'localhost'
2025-07-20 20:44:33 +02:00
PORT: '8000'
SCOPES: 'openid profile email'
volumes:
2025-07-23 11:29:21 +02:00
- ../../apps/login/acceptance/pat:/pat:cached
2025-07-20 20:44:33 +02:00
depends_on:
configure-login:
condition: "service_completed_successfully"
2025-07-20 23:56:52 +02:00
# mock-oidcop:
# container_name: mock-oidcop
# build:
2025-07-23 11:29:21 +02:00
# context: ../../apps/login/acceptance/idp/oidc
2025-07-20 23:56:52 +02:00
# dockerfile: ../../go-command.Dockerfile
# args:
# - LOGIN_TEST_ACCEPTANCE_GOLANG_TAG=${LOGIN_TEST_ACCEPTANCE_GOLANG_TAG:-golang:1.24-alpine}
# network_mode: service:devcontainer
# environment:
# API_URL: 'http://localhost:8080'
# API_DOMAIN: 'localhost'
# PAT_FILE: '/pat/zitadel-admin-sa.pat'
# SCHEMA: 'http'
# HOST: 'localhost'
# PORT: "8004"
# volumes:
# - "../apps/login/packages/acceptance/pat:/pat:cached"
# depends_on:
# configure-login:
# condition: "service_completed_successfully"
2025-07-20 20:44:33 +02:00
mock-samlsp:
2025-07-20 23:37:05 +02:00
container_name: mock-samlsp
2025-07-20 20:44:33 +02:00
build:
2025-07-23 11:29:21 +02:00
context: ../../apps/login/acceptance/samlsp
2025-07-20 23:37:05 +02:00
dockerfile: ../go-command.Dockerfile
2025-07-20 20:44:33 +02:00
args:
- LOGIN_TEST_ACCEPTANCE_GOLANG_TAG=${LOGIN_TEST_ACCEPTANCE_GOLANG_TAG:-golang:1.24-alpine}
2025-07-20 23:56:52 +02:00
network_mode: service:devcontainer
2025-07-20 20:44:33 +02:00
environment:
2025-07-20 23:37:05 +02:00
API_URL: 'http://localhost:8080'
API_DOMAIN: 'localhost'
2025-07-20 20:44:33 +02:00
PAT_FILE: '/pat/zitadel-admin-sa.pat'
2025-07-20 23:37:05 +02:00
LOGIN_URL: 'http://localhost:3000/ui/v2/login'
IDP_URL: 'http://localhost:8080/saml/v2/metadata'
HOST: 'http://localhost:8001'
2025-07-20 20:44:33 +02:00
PORT: '8001'
volumes:
2025-07-20 23:37:05 +02:00
- "../apps/login/packages/acceptance/pat:/pat:cached"
2025-07-20 20:44:33 +02:00
depends_on:
configure-login:
condition: "service_completed_successfully"
2025-07-20 23:56:52 +02:00
# mock-samlidp:
# container_name: mock-samlidp
# build:
2025-07-23 11:29:21 +02:00
# context: ../../apps/login/acceptance/idp/saml
2025-07-20 23:56:52 +02:00
# dockerfile: ../../go-command.Dockerfile
# args:
# - LOGIN_TEST_ACCEPTANCE_GOLANG_TAG=${LOGIN_TEST_ACCEPTANCE_GOLANG_TAG:-golang:1.24-alpine}
# network_mode: service:devcontainer
# environment:
# API_URL: 'http://localhost:8080'
# API_DOMAIN: 'localhost'
# PAT_FILE: '/pat/zitadel-admin-sa.pat'
# SCHEMA: 'http'
# HOST: 'localhost'
# PORT: "8003"
# volumes:
# - "../apps/login/packages/acceptance/pat:/pat"
# depends_on:
# configure-login:
# condition: "service_completed_successfully"
2025-07-20 20:44:33 +02:00
volumes:
postgres-data:
2025-07-22 17:46:26 +02:00
home-dir: