2022-11-29 21:50:42 +01:00
#
# docker-compose base file used for local development, hobby deploys, and other compose use cases.
#
services :
2024-08-13 14:38:35 +02:00
proxy :
image : caddy
entrypoint : sh
restart : always
command : -c 'set -x && echo "$$CADDYFILE" > /etc/caddy/Caddyfile && exec caddy run -c /etc/caddy/Caddyfile'
volumes :
- /root/.caddy
environment :
CADDYFILE : |
http://localhost:8000 {
@replay-capture {
path /s
path /s/*
}
@capture {
path /e
path /e/*
path /i/v0/e
path /i/v0/e*
path /batch
path /batch*
path /capture
path /capture*
}
handle @capture {
reverse_proxy capture:3000
}
handle @replay-capture {
2024-08-21 14:14:56 +02:00
reverse_proxy replay-capture:3000
2024-08-13 14:38:35 +02:00
}
handle {
reverse_proxy web:8000
}
}
2022-11-29 21:50:42 +01:00
db :
2023-08-30 14:53:52 +02:00
image : postgres:12-alpine
2022-11-29 21:50:42 +01:00
restart : on -failure
environment :
POSTGRES_USER : posthog
POSTGRES_DB : posthog
POSTGRES_PASSWORD : posthog
2023-06-16 08:43:14 +02:00
healthcheck :
test : [ 'CMD-SHELL' , 'pg_isready -U posthog' ]
interval : 5s
timeout : 5s
2022-11-29 21:50:42 +01:00
redis :
2023-08-30 14:53:52 +02:00
image : redis:6.2.7-alpine
2022-11-29 21:50:42 +01:00
restart : on -failure
command : redis-server --maxmemory-policy allkeys-lru --maxmemory 200mb
2024-07-11 15:11:55 +02:00
healthcheck :
test : [ 'CMD' , 'redis-cli' , 'ping' ]
interval : 3s
timeout : 10s
retries : 10
2022-11-29 21:50:42 +01:00
2024-08-14 13:36:57 +02:00
redis7 :
image : redis:7.2-alpine
restart : on -failure
command : redis-server --maxmemory-policy allkeys-lru --maxmemory 200mb
healthcheck :
test : [ 'CMD' , 'redis-cli' , 'ping' ]
interval : 3s
timeout : 10s
retries : 10
2022-11-29 21:50:42 +01:00
clickhouse :
#
# Note: please keep the default version in sync across
# `posthog` and the `charts-clickhouse` repos
#
2024-10-03 00:29:04 +02:00
image : ${CLICKHOUSE_SERVER_IMAGE:-clickhouse/clickhouse-server:23.12.6.19}
2022-11-29 21:50:42 +01:00
restart : on -failure
2024-03-13 17:38:46 +01:00
2022-11-29 21:50:42 +01:00
zookeeper :
2023-08-30 14:53:52 +02:00
image : zookeeper:3.7.0
2022-11-29 21:50:42 +01:00
restart : on -failure
kafka :
2023-11-01 15:45:22 +01:00
image : ghcr.io/posthog/kafka-container:v2.8.2
2022-11-29 21:50:42 +01:00
restart : on -failure
environment :
KAFKA_BROKER_ID : 1001
KAFKA_CFG_RESERVED_BROKER_MAX_ID : 1001
KAFKA_CFG_LISTENERS : PLAINTEXT://:9092
KAFKA_CFG_ADVERTISED_LISTENERS : PLAINTEXT://kafka:9092
KAFKA_CFG_ZOOKEEPER_CONNECT : zookeeper:2181
ALLOW_PLAINTEXT_LISTENER : 'true'
2024-07-11 15:11:55 +02:00
healthcheck :
test : kafka-cluster.sh cluster-id --bootstrap-server localhost:9092 || exit 1
interval : 3s
timeout : 10s
retries : 10
2022-11-29 21:50:42 +01:00
2024-02-27 12:44:08 +01:00
kafka_ui :
image : provectuslabs/kafka-ui:latest
restart : on -failure
environment :
KAFKA_CLUSTERS_0_NAME : local
KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS : kafka:9092
DYNAMIC_CONFIG_ENABLED : 'true'
2024-05-09 11:44:03 +02:00
objectstorage :
2023-08-30 14:53:52 +02:00
image : minio/minio:RELEASE.2022-06-25T15-50-16Z
2022-11-29 21:50:42 +01:00
restart : on -failure
environment :
MINIO_ROOT_USER : object_storage_root_user
MINIO_ROOT_PASSWORD : object_storage_root_password
entrypoint : sh
command : -c 'mkdir -p /data/posthog && minio server --address ":19000" --console-address ":19001" /data' # create the 'posthog' bucket before starting the service
maildev :
2023-08-30 14:53:52 +02:00
image : maildev/maildev:2.0.5
2022-11-29 21:50:42 +01:00
restart : on -failure
2023-03-20 23:56:14 +01:00
2024-01-17 17:38:14 +01:00
flower :
image : mher/flower:2.0.0
restart : on -failure
environment :
FLOWER_PORT : 5555
CELERY_BROKER_URL : redis://redis:6379
2022-11-30 18:49:17 +01:00
worker : &worker
2023-05-09 17:20:16 +02:00
command : ./bin/docker-worker-celery --with-scheduler
2022-11-30 18:49:17 +01:00
restart : on -failure
2024-05-20 21:43:52 +02:00
environment : &worker_env
2022-11-30 18:49:17 +01:00
DISABLE_SECURE_SSL_REDIRECT : 'true'
IS_BEHIND_PROXY : 'true'
DATABASE_URL : 'postgres://posthog:posthog@db:5432/posthog'
CLICKHOUSE_HOST : 'clickhouse'
CLICKHOUSE_DATABASE : 'posthog'
CLICKHOUSE_SECURE : 'false'
CLICKHOUSE_VERIFY : 'false'
2023-06-19 13:15:17 +02:00
KAFKA_HOSTS : 'kafka'
2022-11-30 18:49:17 +01:00
REDIS_URL : 'redis://redis:6379/'
PGHOST : db
PGUSER : posthog
PGPASSWORD : posthog
DEPLOYMENT : hobby
web :
<< : *worker
2023-03-20 23:56:14 +01:00
command : ./bin/start-backend & ./bin/start-frontend
2022-11-30 18:49:17 +01:00
restart : on -failure
2023-10-25 17:58:12 +02:00
capture :
2024-08-08 17:57:13 +02:00
image : ghcr.io/posthog/posthog/capture:master
2024-08-21 14:14:56 +02:00
build :
context : rust/
args :
BIN : capture
2023-10-25 17:58:12 +02:00
restart : on -failure
environment :
ADDRESS : '0.0.0.0:3000'
KAFKA_TOPIC : 'events_plugin_ingestion'
KAFKA_HOSTS : 'kafka:9092'
REDIS_URL : 'redis://redis:6379/'
2024-08-21 14:14:56 +02:00
CAPTURE_MODE : events
2024-03-13 17:38:46 +01:00
2024-08-08 17:57:13 +02:00
replay-capture :
2024-08-21 14:14:56 +02:00
image : ghcr.io/posthog/posthog/capture:master
2024-08-08 17:57:13 +02:00
build :
2024-08-21 14:14:56 +02:00
context : rust/
args :
BIN : capture
2024-08-08 17:57:13 +02:00
restart : on -failure
environment :
2024-08-21 14:14:56 +02:00
ADDRESS : '0.0.0.0:3000'
KAFKA_TOPIC : 'session_recording_snapshot_item_events'
KAFKA_HOSTS : 'kafka:9092'
2024-08-08 17:57:13 +02:00
REDIS_URL : 'redis://redis:6379/'
2024-08-21 14:14:56 +02:00
CAPTURE_MODE : recordings
2024-08-08 17:57:13 +02:00
2024-09-24 20:32:07 +02:00
property-defs-rs :
image : ghcr.io/posthog/posthog/property-defs-rs:master
build :
context : rust/
args :
BIN : property-defs-rs
restart : on -failure
environment :
DATABASE_URL : 'postgres://posthog:posthog@db:5432/posthog'
KAFKA_HOSTS : 'kafka:9092'
SKIP_WRITES : 'false'
SKIP_READS : 'false'
FILTER_MODE : 'opt-out'
2022-11-30 18:49:17 +01:00
plugins :
command : ./bin/plugin-server --no-restart-loop
restart : on -failure
environment :
DATABASE_URL : 'postgres://posthog:posthog@db:5432/posthog'
KAFKA_HOSTS : 'kafka:9092'
REDIS_URL : 'redis://redis:6379/'
CLICKHOUSE_HOST : 'clickhouse'
2023-03-20 23:56:14 +01:00
CLICKHOUSE_DATABASE : 'posthog'
CLICKHOUSE_SECURE : 'false'
CLICKHOUSE_VERIFY : 'false'
2022-11-30 18:49:17 +01:00
2024-06-10 21:13:30 +02:00
livestream :
image : 'ghcr.io/posthog/livestream:main'
restart : on -failure
depends_on :
kafka :
condition : service_started
2023-03-20 23:56:14 +01:00
migrate :
<< : *worker
command : sh -c "
python manage.py migrate
&& python manage.py migrate_clickhouse
&& python manage.py run_async_migrations
"
restart : 'no'
deploy :
replicas : 0
2022-11-30 18:49:17 +01:00
asyncmigrationscheck :
<< : *worker
command : python manage.py run_async_migrations --check
restart : 'no'
deploy :
replicas : 0
2023-06-07 16:56:56 +02:00
environment :
2024-05-20 21:43:52 +02:00
<< : *worker_env
2023-06-07 16:56:56 +02:00
SKIP_ASYNC_MIGRATIONS_SETUP : 0
2023-03-20 23:56:14 +01:00
# Temporal containers
elasticsearch :
environment :
- cluster.routing.allocation.disk.threshold_enabled=true
- cluster.routing.allocation.disk.watermark.low=512mb
- cluster.routing.allocation.disk.watermark.high=256mb
- cluster.routing.allocation.disk.watermark.flood_stage=128mb
- discovery.type=single-node
- ES_JAVA_OPTS=-Xms256m -Xmx256m
- xpack.security.enabled=false
2023-08-30 14:53:52 +02:00
image : elasticsearch:7.16.2
2023-03-20 23:56:14 +01:00
expose :
- 9200
volumes :
- /var/lib/elasticsearch/data
temporal :
2024-04-17 16:34:20 +02:00
restart : on -failure
2023-03-20 23:56:14 +01:00
environment :
- DB=postgresql
- DB_PORT=5432
- POSTGRES_USER=posthog
- POSTGRES_PWD=posthog
- POSTGRES_SEEDS=db
- DYNAMIC_CONFIG_FILE_PATH=config/dynamicconfig/development-sql.yaml
- ENABLE_ES=true
- ES_SEEDS=elasticsearch
- ES_VERSION=v7
2023-08-30 14:53:52 +02:00
image : temporalio/auto-setup:1.20.0
2023-03-20 23:56:14 +01:00
ports :
- 7233 : 7233
labels :
kompose.volume.type : configMap
volumes :
- ./docker/temporal/dynamicconfig:/etc/temporal/config/dynamicconfig
2024-04-12 11:45:22 +02:00
depends_on :
2024-04-17 14:55:01 +02:00
db :
condition : service_healthy
elasticsearch :
condition : service_started
2023-03-20 23:56:14 +01:00
temporal-admin-tools :
environment :
- TEMPORAL_CLI_ADDRESS=temporal:7233
2023-08-30 14:53:52 +02:00
image : temporalio/admin-tools:1.20.0
2023-03-20 23:56:14 +01:00
stdin_open : true
tty : true
temporal-ui :
environment :
- TEMPORAL_ADDRESS=temporal:7233
- TEMPORAL_CORS_ORIGINS=http://localhost:3000
2024-10-30 16:13:03 +01:00
- TEMPORAL_CSRF_COOKIE_INSECURE=true
image : temporalio/ui:2.31.2
2023-03-20 23:56:14 +01:00
ports :
- 8081 : 8080
temporal-django-worker :
<< : *worker
command : ./bin/temporal-django-worker
restart : on -failure
environment :
2024-05-20 21:43:52 +02:00
<< : *worker_env
2023-05-05 11:40:53 +02:00
TEMPORAL_HOST : temporal