lago/docker-compose.dev.yml
2024-02-07 09:20:07 +01:00

327 lines
12 KiB
YAML

version: "3.8"
volumes:
front_node_modules:
front_dist:
postgres_data:
redis_data:
redpanda_data:
clickhouse_data:
services:
traefik:
image: "traefik:v2.5.4"
container_name: lago_traefik
ports:
- 80:80
- 443:443
volumes:
- ./traefik/traefik.yml:/etc/traefik/traefik.yml
- ./traefik/dynamic.yml:/etc/traefik/dynamic.yml
- ./traefik/certs:/etc/certs
- "/var/run/docker.sock:/var/run/docker.sock:ro"
labels:
- "traefik.enable=true"
- "traefik.http.routers.traefik.rule=Host(`traefik.lago.dev`)"
- "traefik.http.routers.traefik.entrypoints=web,websecure"
- "traefik.http.routers.traefik.tls=true"
- "traefik.http.services.traefik.loadbalancer.server.port=8080"
db:
image: postgres:14.0-alpine
container_name: lago_db
restart: unless-stopped
environment:
POSTGRES_USER: ${POSTGRES_USER:-lago}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-changeme}
PGDATA: /data/postgres
POSTGRES_MULTIPLE_DATABASES: lago,lago_test
volumes:
- ./pg-init-scripts:/docker-entrypoint-initdb.d
- postgres_data:/data/postgres
ports:
- 5432:5432
redis:
image: redis:6.2-alpine
container_name: lago_redis
restart: unless-stopped
volumes:
- redis_data:/data
ports:
- 6379:6379
front:
image: front
container_name: lago_front
stdin_open: true
restart: unless-stopped
build:
context: ./front
dockerfile: $LAGO_PATH/front/Dockerfile.dev
volumes:
- $LAGO_PATH/front:/app:delegated
- front_node_modules:/app/node_modules:delegated
- front_dist:/app/dist:delegated
environment:
- NODE_ENV=development
- API_URL=https://api.lago.dev
- APP_DOMAIN=https://app.lago.dev
- CODEGEN_API=https://api.lago.dev:3000
- LAGO_DISABLE_SIGNUP=${LAGO_DISABLE_SIGNUP:-}
labels:
- "traefik.enable=true"
- "traefik.http.routers.app.rule=Host(`app.lago.dev`)"
- "traefik.http.routers.app.entrypoints=web,ws,websecure"
- "traefik.http.routers.app.tls=true"
- "traefik.http.services.app.loadbalancer.server.port=8080"
api:
image: api
container_name: lago_api
restart: unless-stopped
command: ["./scripts/start.dev.sh"]
build:
context: ./api
dockerfile: $LAGO_PATH/api/Dockerfile.dev
volumes:
- $LAGO_PATH/api:/app:delegated
environment:
- LAGO_API_URL=https://api.lago.dev
- DATABASE_URL=postgresql://${POSTGRES_USER:-lago}:${POSTGRES_PASSWORD:-changeme}@db:5432/${POSTGRES_DB:-lago}
- DATABASE_TEST_URL=postgresql://${POSTGRES_USER:-lago}:${POSTGRES_PASSWORD:-changeme}@db:5432/${POSTGRES_DB:-lago_test}
- REDIS_URL=redis://redis:6379
- SECRET_KEY_BASE=${SECRET_KEY_BASE:-your-secret-key-base-hex-64}
- LAGO_FRONT_URL=${FRONT_URL:-https://app.lago.dev}
- ENCRYPTION_PRIMARY_KEY=${ENCRYPTION_PRIMARY_KEY:-your-encrpytion-primary-key}
- ENCRYPTION_DETERMINISTIC_KEY=${ENCRYPTION_DETERMINISTIC_KEY:-your-encrpytion-deterministic-key}
- ENCRYPTION_KEY_DERIVATION_SALT=${ENCRYPTION_KEY_DERIVATION_SALT:-your-encrpytion-derivation-salt}
- LAGO_USE_AWS_S3=${LAGO_USE_AWS_S3:-false}
- LAGO_PDF_URL=${LAGO_PDF_URL:-http://pdf:3000}
- LAGO_REDIS_CACHE_URL=redis://redis:6379
- SEGMENT_WRITE_KEY=${SEGMENT_WRITE_KEY:-}
- LAGO_DISABLE_SEGMENT=${LAGO_DISABLE_SEGMENT:-}
- LAGO_LICENSE=${LAGO_LICENSE:-}
- LAGO_FROM_EMAIL=${LAGO_FROM_EMAIL:-noreply@getlago.com}
- LAGO_SIDEKIQ_WEB=true
- SIDEKIQ_EVENTS=true
- LAGO_CLICKHOUSE_ENABLED=true
- LAGO_KAFKA_BOOTSTRAP_SERVERS=redpanda:9092
- LAGO_KAFKA_RAW_EVENTS_TOPIC=events-raw
- LAGO_KAFKA_CLICKHOUSE_CONSUMER_GROUP=clickhouse
labels:
- "traefik.enable=true"
- "traefik.http.routers.api_http.rule=Host(`api.lago.dev`)"
- "traefik.http.routers.api_http.entrypoints=web"
- "traefik.http.routers.api_http.service=api_http"
- "traefik.http.services.api_http.loadbalancer.server.port=3000"
- "traefik.http.routers.api.rule=Host(`api.lago.dev`)"
- "traefik.http.routers.api.entrypoints=websecure"
- "traefik.http.routers.api.service=api"
- "traefik.http.routers.api.tls=true"
- "traefik.http.services.api.loadbalancer.server.port=3000"
api-worker:
image: api
container_name: lago_api_worker
restart: unless-stopped
command: ["./scripts/start.worker.dev.sh"]
build:
context: ./api
dockerfile: $LAGO_PATH/api/Dockerfile.dev
volumes:
- $LAGO_PATH/api:/app:delegated
environment:
- LAGO_API_URL=https://api.lago.dev
- DATABASE_URL=postgresql://${POSTGRES_USER:-lago}:${POSTGRES_PASSWORD:-changeme}@db:5432/${POSTGRES_DB:-lago}
- REDIS_URL=redis://redis:6379
- SECRET_KEY_BASE=${SECRET_KEY_BASE:-your-secret-key-base-hex-64}
- ENCRYPTION_PRIMARY_KEY=${ENCRYPTION_PRIMARY_KEY:-your-encrpytion-primary-key}
- ENCRYPTION_DETERMINISTIC_KEY=${ENCRYPTION_DETERMINISTIC_KEY:-your-encrpytion-deterministic-key}
- ENCRYPTION_KEY_DERIVATION_SALT=${ENCRYPTION_KEY_DERIVATION_SALT:-your-encrpytion-derivation-salt}
- LAGO_USE_AWS_S3=${LAGO_USE_AWS_S3:-false}
- LAGO_FRONT_URL=${FRONT_URL:-https://app.lago.dev}
- LAGO_PDF_URL=${LAGO_PDF_URL:-http://pdf:3000}
- LAGO_REDIS_CACHE_URL=redis://redis:6379
- SEGMENT_WRITE_KEY=${SEGMENT_WRITE_KEY:-}
- LAGO_DISABLE_SEGMENT=${LAGO_DISABLE_SEGMENT:-}
- LAGO_FROM_EMAIL=${LAGO_FROM_EMAIL:-noreply@getlago.com}
- SIDEKIQ_EVENTS=true
- LAGO_CLICKHOUSE_ENABLED=true
- LAGO_KAFKA_BOOTSTRAP_SERVERS=redpanda:9092
- LAGO_KAFKA_RAW_EVENTS_TOPIC=events-raw
- LAGO_KAFKA_CLICKHOUSE_CONSUMER_GROUP=clickhouse
api-events-worker:
image: api
container_name: lago_api_events_worker
restart: unless-stopped
command: ["./scripts/start.events.worker.dev.sh"]
build:
context: ./api
dockerfile: $LAGO_PATH/api/Dockerfile.dev
volumes:
- $LAGO_PATH/api:/app:delegated
environment:
- LAGO_API_URL=https://api.lago.dev
- DATABASE_URL=postgresql://${POSTGRES_USER:-lago}:${POSTGRES_PASSWORD:-changeme}@db:5432/${POSTGRES_DB:-lago}
- REDIS_URL=redis://redis:6379
- SECRET_KEY_BASE=${SECRET_KEY_BASE:-your-secret-key-base-hex-64}
- ENCRYPTION_PRIMARY_KEY=${ENCRYPTION_PRIMARY_KEY:-your-encrpytion-primary-key}
- ENCRYPTION_DETERMINISTIC_KEY=${ENCRYPTION_DETERMINISTIC_KEY:-your-encrpytion-deterministic-key}
- ENCRYPTION_KEY_DERIVATION_SALT=${ENCRYPTION_KEY_DERIVATION_SALT:-your-encrpytion-derivation-salt}
- LAGO_USE_AWS_S3=${LAGO_USE_AWS_S3:-false}
- LAGO_FRONT_URL=${FRONT_URL:-https://app.lago.dev}
- LAGO_PDF_URL=${LAGO_PDF_URL:-http://pdf:3000}
- LAGO_REDIS_CACHE_URL=redis://redis:6379
- SEGMENT_WRITE_KEY=${SEGMENT_WRITE_KEY:-}
- LAGO_DISABLE_SEGMENT=${LAGO_DISABLE_SEGMENT:-}
- LAGO_FROM_EMAIL=${LAGO_FROM_EMAIL:-noreply@getlago.com}
- SIDEKIQ_EVENTS=true
- LAGO_CLICKHOUSE_ENABLED=true
- LAGO_KAFKA_BOOTSTRAP_SERVERS=redpanda:9092
- LAGO_KAFKA_RAW_EVENTS_TOPIC=events-raw
- LAGO_KAFKA_CLICKHOUSE_CONSUMER_GROUP=clickhouse
api-clock:
image: api
container_name: lago_api_clock
restart: unless-stopped
command: ["./scripts/start.clock.dev.sh"]
build:
context: ./api
dockerfile: $LAGO_PATH/api/Dockerfile.dev
volumes:
- $LAGO_PATH/api:/app:delegated
environment:
- LAGO_API_URL=https://api.lago.dev
- DATABASE_URL=postgresql://${POSTGRES_USER:-lago}:${POSTGRES_PASSWORD:-changeme}@db:5432/${POSTGRES_DB:-lago}
- REDIS_URL=redis://redis:6379
- SECRET_KEY_BASE=${SECRET_KEY_BASE:-your-secret-key-base-hex-64}
- ENCRYPTION_PRIMARY_KEY=${ENCRYPTION_PRIMARY_KEY:-your-encrpytion-primary-key}
- ENCRYPTION_DETERMINISTIC_KEY=${ENCRYPTION_DETERMINISTIC_KEY:-your-encrpytion-deterministic-key}
- ENCRYPTION_KEY_DERIVATION_SALT=${ENCRYPTION_KEY_DERIVATION_SALT:-your-encrpytion-derivation-salt}
- SEGMENT_WRITE_KEY=${SEGMENT_WRITE_KEY:-}
- LAGO_DISABLE_SEGMENT=${LAGO_DISABLE_SEGMENT:-}
- LAGO_CLICKHOUSE_ENABLED=true
- LAGO_KAFKA_BOOTSTRAP_SERVERS=redpanda:9092
- LAGO_KAFKA_RAW_EVENTS_TOPIC=events-raw
- LAGO_KAFKA_CLICKHOUSE_CONSUMER_GROUP=clickhouse
pdf:
image: getlago/lago-gotenberg:7
command:
- "gotenberg"
- "--log-level=debug"
labels:
- "traefik.enable=true"
- "traefik.http.routers.pdf.rule=Host(`pdf.lago.dev`)"
- "traefik.http.routers.pdf.entrypoints=web,websecure"
- "traefik.http.routers.pdf.tls=true"
- "traefik.http.services.pdf.loadbalancer.server.port=3000"
mailhog:
image: mailhog/mailhog
container_name: lago_mailhog
restart: unless-stopped
labels:
- "traefik.enable=true"
- "traefik.http.routers.mail.rule=Host(`mail.lago.dev`)"
- "traefik.http.routers.mail.entrypoints=websecure"
- "traefik.http.routers.mail.tls=true"
- "traefik.http.services.mail.loadbalancer.server.port=8025"
redpanda:
image: docker.redpanda.com/redpandadata/redpanda:v23.2.9
container_name: redpanda
hostname: redpanda
command:
- redpanda start
- --smp 1
- --overprovisioned
- --kafka-addr internal://0.0.0.0:9092,external://0.0.0.0:19092
- --advertise-kafka-addr internal://redpanda:9092,external://localhost:19092
volumes:
- redpanda_data:/var/lib/redpanda/data
redpandacreatetopics:
image: docker.redpanda.com/redpandadata/redpanda:v23.2.9
depends_on:
- redpanda
entrypoint: >
rpk topic create events-raw --brokers redpanda:9092
redpanda-console:
image: docker.redpanda.com/redpandadata/console:v2.3.1
entrypoint: /bin/sh
command: -c "echo \"$$CONSOLE_CONFIG_FILE\" > /tmp/config.yml; /app/console"
environment:
CONFIG_FILEPATH: /tmp/config.yml
CONSOLE_CONFIG_FILE: |
kafka:
brokers: ["redpanda:9092"]
schemaRegistry:
enabled: false
urls: ["http://redpanda:8081"]
redpanda:
adminApi:
enabled: true
urls: ["http://redpanda:9644"]
depends_on:
- redpanda
labels:
- "traefik.enable=true"
- "traefik.http.routers.console.rule=Host(`console.lago.dev`)"
- "traefik.http.routers.console.entrypoints=websecure"
- "traefik.http.routers.console.tls=true"
- "traefik.http.services.console.loadbalancer.server.port=8080"
clickhouse:
image: clickhouse/clickhouse-server
container_name: clickhouse
hostname: clickhouse
user: '101:101'
depends_on:
- db
- minio
- miniocreatebuckets
- redpanda
- redpandacreatetopics
volumes:
- clickhouse_data:/var/lib/clickhouse
- ./extra/clickhouse/config.d/config.xml:/etc/clickhouse-server/config.d/config.xml
- ./extra/clickhouse/users.d/users.xml:/etc/clickhouse-server/users.d/users.xml
ports:
- 9000:9000
- 8123:8123
minio:
image: quay.io/minio/minio
container_name: minio
hostname: minio
command: server --address 0.0.0.0:10000 --console-address 0.0.0.0:10001 /data
ports:
- 10000:10000
environment:
MINIO_ROOT_USER: lago
MINIO_ROOT_PASSWORD: lagopassword
labels:
- "traefik.enable=true"
- "traefik.http.routers.minio.rule=Host(`minio.lago.dev`)"
- "traefik.http.routers.minio.entrypoints=websecure"
- "traefik.http.routers.minio.tls=true"
- "traefik.http.services.minio.loadbalancer.server.port=10001"
miniocreatebuckets:
image: minio/mc
depends_on:
- minio
entrypoint: >
/bin/sh -c "
/usr/bin/mc alias set lagominio http://minio:10000 lago lagopassword;
/usr/bin/mc admin info lagominio;
/usr/bin/mc mb lagominio/clickhouse;
/usr/bin/mc policy set public lagominio/clickhouse;
exit 0;
"