lago/docker-compose.dev.yml
2024-12-05 16:55:24 +01:00

436 lines
17 KiB
YAML

volumes:
front_node_modules_dev:
front_dist_dev:
postgres_data_dev:
redis_data_dev:
redpanda_data_dev:
clickhouse_data_dev:
services:
traefik:
image: "traefik:v2.5.4"
container_name: lago_traefik_dev
restart: unless-stopped
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_dev
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_dev:/data/postgres
ports:
- 5432:5432
redis:
image: redis:6.2-alpine
container_name: lago_redis_dev
restart: unless-stopped
volumes:
- redis_data_dev:/data
ports:
- 6379:6379
front:
image: front_dev
container_name: lago_front_dev
stdin_open: true
restart: unless-stopped
depends_on:
- api
build:
context: ./front
dockerfile: $LAGO_PATH/front/Dockerfile.dev
volumes:
- $LAGO_PATH/front:/app:delegated
- front_node_modules_dev:/app/node_modules:delegated
- front_dist_dev:/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/graphql
- LAGO_DISABLE_SIGNUP=${LAGO_DISABLE_SIGNUP:-}
- NANGO_SECRET_KEY=${NANGO_SECRET_KEY:-}
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_dev
container_name: lago_api_dev
restart: unless-stopped
command: ["./scripts/start.dev.sh"]
depends_on:
- db
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=${LAGO_FRONT_URL:-https://app.lago.dev}
- LAGO_ENCRYPTION_PRIMARY_KEY=${ENCRYPTION_PRIMARY_KEY:-your-encrpytion-primary-key}
- LAGO_ENCRYPTION_DETERMINISTIC_KEY=${ENCRYPTION_DETERMINISTIC_KEY:-your-encrpytion-deterministic-key}
- LAGO_ENCRYPTION_KEY_DERIVATION_SALT=${ENCRYPTION_KEY_DERIVATION_SALT:-your-encrpytion-derivation-salt}
- LAGO_USE_AWS_S3=${LAGO_USE_AWS_S3:-false}
- LAGO_PARALLEL_THREADS_COUNT=${LAGO_PARALLEL_THREADS_COUNT:-4}
- 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_DISABLE_WALLET_REFRESH=${LAGO_DISABLE_WALLET_REFRESH:-}
- LAGO_LICENSE=${LAGO_LICENSE:-}
- LAGO_FROM_EMAIL=${LAGO_FROM_EMAIL:-noreply@getlago.com}
- LAGO_SIDEKIQ_WEB=true
- SIDEKIQ_EVENTS=true
- SIDEKIQ_PDFS=true
- SIDEKIQ_BILLING=true
- LAGO_CLICKHOUSE_ENABLED=true
- LAGO_CLICKHOUSE_MIGRATIONS_ENABLED=true
- LAGO_KAFKA_BOOTSTRAP_SERVERS=redpanda:9092
- LAGO_KAFKA_RAW_EVENTS_TOPIC=events-raw
- LAGO_KAFKA_ENRICHED_EVENTS_TOPIC=events_enriched
- LAGO_KAFKA_CLICKHOUSE_CONSUMER_GROUP=clickhouse
- GOOGLE_AUTH_CLIENT_ID=${GOOGLE_AUTH_CLIENT_ID:-}
- GOOGLE_AUTH_CLIENT_SECRET=${GOOGLE_AUTH_CLIENT_SECRET:-}
- NANGO_SECRET_KEY=${NANGO_SECRET_KEY:-}
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_dev
container_name: lago_api_worker
restart: unless-stopped
command: bash -c "bundle install && ./scripts/start.worker.sh"
depends_on:
- api
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}
- LAGO_ENCRYPTION_PRIMARY_KEY=${ENCRYPTION_PRIMARY_KEY:-your-encrpytion-primary-key}
- LAGO_ENCRYPTION_DETERMINISTIC_KEY=${ENCRYPTION_DETERMINISTIC_KEY:-your-encrpytion-deterministic-key}
- LAGO_ENCRYPTION_KEY_DERIVATION_SALT=${ENCRYPTION_KEY_DERIVATION_SALT:-your-encrpytion-derivation-salt}
- LAGO_USE_AWS_S3=${LAGO_USE_AWS_S3:-false}
- LAGO_FRONT_URL=${LAGO_FRONT_URL:-https://app.lago.dev}
- LAGO_PARALLEL_THREADS_COUNT=${LAGO_PARALLEL_THREADS_COUNT:-4}
- 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_DISABLE_WALLET_REFRESH=${LAGO_DISABLE_WALLET_REFRESH:-}
- LAGO_FROM_EMAIL=${LAGO_FROM_EMAIL:-noreply@getlago.com}
- SIDEKIQ_EVENTS=true
- SIDEKIQ_PDFS=true
- SIDEKIQ_BILLING=true
- LAGO_CLICKHOUSE_ENABLED=true
- LAGO_CLICKHOUSE_MIGRATIONS_ENABLED=true
- LAGO_KAFKA_BOOTSTRAP_SERVERS=redpanda:9092
- LAGO_KAFKA_RAW_EVENTS_TOPIC=events_raw
- LAGO_KAFKA_ENRICHED_EVENTS_TOPIC=events_enriched
- LAGO_KAFKA_CLICKHOUSE_CONSUMER_GROUP=clickhouse
- NANGO_SECRET_KEY=${NANGO_SECRET_KEY:-}
- LAGO_LICENSE=${LAGO_LICENSE:-}
api-events-worker:
image: api_dev
container_name: lago_api_events_worker_dev
depends_on:
- api
restart: unless-stopped
command: bash -c "bundle install && ./scripts/start.events.worker.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}
- LAGO_ENCRYPTION_PRIMARY_KEY=${ENCRYPTION_PRIMARY_KEY:-your-encrpytion-primary-key}
- LAGO_ENCRYPTION_DETERMINISTIC_KEY=${ENCRYPTION_DETERMINISTIC_KEY:-your-encrpytion-deterministic-key}
- LAGO_ENCRYPTION_KEY_DERIVATION_SALT=${ENCRYPTION_KEY_DERIVATION_SALT:-your-encrpytion-derivation-salt}
- LAGO_USE_AWS_S3=${LAGO_USE_AWS_S3:-false}
- LAGO_FRONT_URL=${LAGO_FRONT_URL:-https://app.lago.dev}
- LAGO_PARALLEL_THREADS_COUNT=${LAGO_PARALLEL_THREADS_COUNT:-4}
- 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_DISABLE_WALLET_REFRESH=${LAGO_DISABLE_WALLET_REFRESH:-}
- LAGO_FROM_EMAIL=${LAGO_FROM_EMAIL:-noreply@getlago.com}
- SIDEKIQ_EVENTS=true
- SIDEKIQ_BILLING=true
- LAGO_CLICKHOUSE_ENABLED=true
- LAGO_CLICKHOUSE_MIGRATIONS_ENABLED=true
- LAGO_KAFKA_BOOTSTRAP_SERVERS=redpanda:9092
- LAGO_KAFKA_RAW_EVENTS_TOPIC=events-raw
- LAGO_KAFKA_ENRICHED_EVENTS_TOPIC=events_enriched
- LAGO_KAFKA_CLICKHOUSE_CONSUMER_GROUP=clickhouse
- NANGO_SECRET_KEY=${NANGO_SECRET_KEY:-}
- LAGO_LICENSE=${LAGO_LICENSE:-}
api-pdfs-worker:
image: api_dev
container_name: lago_api_pdfs_worker_dev
depends_on:
- api
restart: unless-stopped
command: bash -c "bundle install && ./scripts/start.pdfs.worker.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}
- LAGO_ENCRYPTION_PRIMARY_KEY=${ENCRYPTION_PRIMARY_KEY:-your-encrpytion-primary-key}
- LAGO_ENCRYPTION_DETERMINISTIC_KEY=${ENCRYPTION_DETERMINISTIC_KEY:-your-encrpytion-deterministic-key}
- LAGO_ENCRYPTION_KEY_DERIVATION_SALT=${ENCRYPTION_KEY_DERIVATION_SALT:-your-encrpytion-derivation-salt}
- LAGO_USE_AWS_S3=${LAGO_USE_AWS_S3:-false}
- LAGO_FRONT_URL=${LAGO_FRONT_URL:-https://app.lago.dev}
- LAGO_PARALLEL_THREADS_COUNT=${LAGO_PARALLEL_THREADS_COUNT:-4}
- 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_DISABLE_WALLET_REFRESH=${LAGO_DISABLE_WALLET_REFRESH:-}
- LAGO_FROM_EMAIL=${LAGO_FROM_EMAIL:-noreply@getlago.com}
- SIDEKIQ_PDFS=true
- LAGO_CLICKHOUSE_ENABLED=true
- LAGO_CLICKHOUSE_MIGRATIONS_ENABLED=true
- LAGO_KAFKA_BOOTSTRAP_SERVERS=redpanda:9092
- LAGO_KAFKA_RAW_EVENTS_TOPIC=events-raw
- LAGO_KAFKA_ENRICHED_EVENTS_TOPIC=events_enriched
- LAGO_KAFKA_CLICKHOUSE_CONSUMER_GROUP=clickhouse
- NANGO_SECRET_KEY=${NANGO_SECRET_KEY:-}
- LAGO_LICENSE=${LAGO_LICENSE:-}
api-billing-worker:
image: api_dev
container_name: lago_api_billing_worker_dev
depends_on:
- api
restart: unless-stopped
command: bash -c "bundle install && ./scripts/start.billing.worker.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}
- LAGO_ENCRYPTION_PRIMARY_KEY=${ENCRYPTION_PRIMARY_KEY:-your-encrpytion-primary-key}
- LAGO_ENCRYPTION_DETERMINISTIC_KEY=${ENCRYPTION_DETERMINISTIC_KEY:-your-encrpytion-deterministic-key}
- LAGO_ENCRYPTION_KEY_DERIVATION_SALT=${ENCRYPTION_KEY_DERIVATION_SALT:-your-encrpytion-derivation-salt}
- LAGO_USE_AWS_S3=${LAGO_USE_AWS_S3:-false}
- LAGO_FRONT_URL=${LAGO_FRONT_URL:-https://app.lago.dev}
- LAGO_PARALLEL_THREADS_COUNT=${LAGO_PARALLEL_THREADS_COUNT:-4}
- 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_DISABLE_WALLET_REFRESH=${LAGO_DISABLE_WALLET_REFRESH:-}
- LAGO_FROM_EMAIL=${LAGO_FROM_EMAIL:-noreply@getlago.com}
- SIDEKIQ_PDFS=true
- SIDEKIQ_BILLING=true
- LAGO_CLICKHOUSE_ENABLED=true
- LAGO_CLICKHOUSE_MIGRATIONS_ENABLED=true
- LAGO_KAFKA_BOOTSTRAP_SERVERS=redpanda:9092
- LAGO_KAFKA_RAW_EVENTS_TOPIC=events-raw
- LAGO_KAFKA_ENRICHED_EVENTS_TOPIC=events_enriched
- LAGO_KAFKA_CLICKHOUSE_CONSUMER_GROUP=clickhouse
- NANGO_SECRET_KEY=${NANGO_SECRET_KEY:-}
- LAGO_LICENSE=${LAGO_LICENSE:-}
api-clock:
image: api_dev
container_name: lago_api_clock_dev
restart: unless-stopped
command: bash -c "bundle install && ./scripts/start.clock.sh"
depends_on:
- api
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}
- LAGO_ENCRYPTION_PRIMARY_KEY=${ENCRYPTION_PRIMARY_KEY:-your-encrpytion-primary-key}
- LAGO_ENCRYPTION_DETERMINISTIC_KEY=${ENCRYPTION_DETERMINISTIC_KEY:-your-encrpytion-deterministic-key}
- LAGO_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_DISABLE_WALLET_REFRESH=${LAGO_DISABLE_WALLET_REFRESH:-}
- LAGO_CLICKHOUSE_ENABLED=true
- LAGO_CLICKHOUSE_MIGRATIONS_ENABLED=true
- LAGO_KAFKA_BOOTSTRAP_SERVERS=redpanda:9092
- LAGO_KAFKA_RAW_EVENTS_TOPIC=events-raw
- LAGO_KAFKA_ENRICHED_EVENTS_TOPIC=events_enriched
- LAGO_KAFKA_CLICKHOUSE_CONSUMER_GROUP=clickhouse
- NANGO_SECRET_KEY=${NANGO_SECRET_KEY:-}
- LAGO_LICENSE=${LAGO_LICENSE:-}
pdf:
image: getlago/lago-gotenberg:7
container_name: lago_pdf_dev
restart: unless-stopped
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_dev
restart: unless-stopped
platform: linux/amd64
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: lago_redpanda_dev
restart: unless-stopped
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_dev:/var/lib/redpanda/data
ports:
- 9092:9092
- 19092:19092
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
container_name: lago_redpanda_console_dev
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: lago_clickhouse_dev
restart: unless-stopped
hostname: clickhouse
user: "101:101"
depends_on:
- db
- redpanda
- redpandacreatetopics
volumes:
- clickhouse_data_dev:/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
migrate:
container_name: lago-migrate_dev
image: api_dev
depends_on:
- db
command: ["./scripts/migrate.dev.sh"]
build:
context: ./api
dockerfile: $LAGO_PATH/api/Dockerfile.dev
volumes:
- $LAGO_PATH/api:/app:delegated
environment:
- DATABASE_URL=postgresql://${POSTGRES_USER:-lago}:${POSTGRES_PASSWORD:-changeme}@db:5432/${POSTGRES_DB:-lago}