Files
PrivateCaptcha/docker/docker-compose.base.yml
2026-01-28 08:52:31 +02:00

134 lines
3.4 KiB
YAML

services:
server:
build:
context: ..
dockerfile: ./docker/Dockerfile
args:
GIT_COMMIT: '${GIT_COMMIT}'
read_only: true
ports:
- 8080:8080
env_file:
- pc.env
environment:
PC_PORT: 8080
PC_VERBOSE: 1
PC_HEALTHCHECK_INTERVAL: 60
depends_on:
migration:
condition: service_completed_successfully
develop:
watch:
- action: rebuild
path: ../web
- action: rebuild
path: ../pkg
- action: rebuild
path: ../cmd/server
- action: rebuild
path: Dockerfile
- action: rebuild
path: pc.env
networks:
- postgres_network
- clickhouse_network
- server_network
migration:
build:
context: ..
dockerfile: ./docker/Dockerfile
args:
GIT_COMMIT: '${GIT_COMMIT}'
command:
/app/server -mode migrate -migrate-hash $GIT_COMMIT
read_only: true
env_file:
- pc.env
environment:
PC_POSTGRES: postgres://postgres:postgres@postgres:5432/privatecaptcha?sslmode=require&search_path=public
PC_CLICKHOUSE_HOST: clickhouse
PC_CLICKHOUSE_DB: privatecaptcha
PC_CLICKHOUSE_USER: default
PC_CLICKHOUSE_PASSWORD: ''
depends_on:
postgres:
condition: service_healthy
clickhouse:
condition: service_healthy
develop:
watch:
- action: rebuild
path: ../cmd/server
- action: rebuild
path: ../widget
- action: rebuild
path: ../pkg/db
- action: rebuild
path: Dockerfile
- action: rebuild
path: pc.env
networks:
- postgres_network
- clickhouse_network
postgres:
image: postgres:18
pull_policy: if_not_present
command: >
-c ssl=on
-c ssl_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
-c ssl_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
environment:
POSTGRES_DB: privatecaptcha
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
healthcheck:
test: pg_isready -U postgres -d privatecaptcha
interval: 3s
timeout: 3s
retries: 3
networks:
- postgres_network
volumes:
- ../pkg/db/migrations/init/postgres.sh:/docker-entrypoint-initdb.d/myinit.sh:ro
- postgres_data_volume:/var/lib/postgresql/18/main
clickhouse:
image: clickhouse/clickhouse-server:25.6.2-alpine
pull_policy: if_not_present
environment:
CLICKHOUSE_DB: privatecaptcha
networks:
- clickhouse_network
healthcheck:
test: wget --no-verbose --tries=1 -O - http://0.0.0.0:8123/?query=SELECT%201 || exit 1
interval: 3s
timeout: 3s
retries: 3
volumes:
- ./clickhouse-config.xml:/etc/clickhouse-server/config.d/myconfig.xml:ro
- ./clickhouse-users.xml:/etc/clickhouse-server/users.d/myusers.xml:ro
- ../pkg/db/migrations/init/clickhouse.sh:/docker-entrypoint-initdb.d/myinit.sh:ro
- clickhouse_data_volume:/var/lib/clickhouse
# uncomment for debugging
- ./clickhouse-logs:/var/log/clickhouse-server/
develop:
watch:
- action: sync+restart
path: clickhouse-config.xml
target: /etc/clickhouse-server/config.d/myconfig.xml
ulimits:
nofile:
soft: 262144
hard: 262144
networks:
postgres_network:
clickhouse_network:
server_network:
volumes:
postgres_data_volume:
clickhouse_data_volume: