console/integration-tests/docker-compose.yml
Laurin Quast 7656b7957d
feat: clean app env (#422)
* feat: document environment variables

* more env documentation

* wip

* add noop for backend env

* typo

* feat: embed environment validation/parsing in built app

* fix the sentry integration 😌

* feat: use env

* feat: decode the usage service environment

* feat: decode the webhooks service environment

* feat: disallow process.env

* feat: decode the tokens service environment

* feat: decode the stripe-billing service environment

* feat: decode server service environment

* feat: decode schema service environment

* feat: decode rate-limit service environment

* feat: decode usage-estimator service environment

* feat: decode emails service environment

* adjust env

* remove commented out code

* adjust env variable name

* use separate env variables

* env fixes

* more environmental stuff :)

* ...

* replace POSTGRES_CONNECTION_STRING with specific environment variables

* handle optional clickhouse (for now :)

* add missing POSTGRES_DB environment variable

* make ENVIRONMENT optional

* the other matters lol

* feat: support delivering mails via SMTP (#412)

* feat: optional CDN (#410)

* feat: optional CDN

* enable CDN in deployment

* enable the CDN in integration tests

* add sendmail provider

* remove unused env variables from the deployment

* only show login alert when legacy auth0 migration is enabled

* feat: make TOKENS_ENDPOINT mandatory and RATE_LIMIT_ENDPOINT optional for usage service

* feat: upgrade supertokens and enable server side email confirmation (#423)

* feat: upgrade supertokens and enable server side email confirmation

* feat: opt into required email verification

* docs: self hosting (#428)

* docs: self-hosting quick start

* Update packages/web/docs/pages/self-hosting/get-started.mdx

Co-authored-by: Kamil Kisiela <kamil.kisiela@gmail.com>

Co-authored-by: Kamil Kisiela <kamil.kisiela@gmail.com>

Co-authored-by: Kamil Kisiela <kamil.kisiela@gmail.com>

* feat: optional GitHub and Slack environment variables (#440)

* feat: optional github integration environment variables

* feat: optional slack integration (#441)

* use latest stable supertokens

Co-authored-by: Kamil Kisiela <kamil.kisiela@gmail.com>
2022-10-04 14:30:21 +02:00

459 lines
12 KiB
YAML

version: '3.8'
services:
db:
image: postgres:13.4-alpine
ports:
- 5432:5432
environment:
POSTGRES_DB: registry
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
PGDATA: /var/lib/postgresql/data
healthcheck:
test: ['CMD-SHELL', 'pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}']
interval: 5s
timeout: 5s
retries: 6
networks:
- 'stack'
clickhouse:
image: clickhouse/clickhouse-server:22.6.1-alpine
volumes:
- ../packages/services/storage/configs/clickhouse:/etc/clickhouse-server/conf.d
healthcheck:
test: ['CMD', 'wget', '--spider', '-q', 'localhost:8123/ping']
interval: 5s
timeout: 5s
retries: 6
start_period: 10s
environment:
CLICKHOUSE_USER: test
CLICKHOUSE_PASSWORD: test
ports:
- 8123:8123
networks:
- 'stack'
zookeeper:
image: confluentinc/cp-zookeeper:7.1.1-1-ubi8.amd64
hostname: zookeeper
networks:
- 'stack'
ports:
- 2181:2181
ulimits:
nofile:
soft: 20000
hard: 40000
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
broker:
image: confluentinc/cp-kafka:7.1.1-1-ubi8.amd64
hostname: borker
depends_on:
zookeeper:
condition: service_started
networks:
- 'stack'
ports:
- 29092:29092
- 9092:9092
ulimits:
nofile:
soft: 20000
hard: 40000
healthcheck:
test: ['CMD', 'cub', 'kafka-ready', '1', '5', '-b', '127.0.0.1:9092', '-c', '/etc/kafka/kafka.properties']
interval: 15s
timeout: 10s
retries: 6
start_period: 15s
environment:
KAFKA_BROKER_ID: 1
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_AUTO_CREATE_TOPICS_ENABLE: 'true'
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://broker:29092,PLAINTEXT_HOST://localhost:9092
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
redis:
image: bitnami/redis:6.2
networks:
- 'stack'
healthcheck:
test: ['CMD', 'redis-cli', 'ping']
interval: 5s
timeout: 10s
retries: 6
start_period: 5s
ports:
- 6379:6379
environment:
- REDIS_PASSWORD=test
- REDIS_DISABLE_COMMANDS=FLUSHDB,FLUSHALL
supertokens:
image: registry.supertokens.io/supertokens/supertokens-postgresql:4.1
depends_on:
db:
condition: service_healthy
networks:
- 'stack'
ports:
- '3567:3567'
environment:
POSTGRESQL_USER: postgres
POSTGRESQL_PASSWORD: postgres
POSTGRESQL_DATABASE_NAME: registry
POSTGRESQL_TABLE_NAMES_PREFIX: 'supertokens'
POSTGRESQL_HOST: db
POSTGRESQL_PORT: 5432
API_KEYS: bubatzbieber6942096420
local_cdn:
image: node:16.13.2-alpine3.14
entrypoint:
- '/bin/sh'
- '/run-local-cdn.sh'
networks:
- 'stack'
healthcheck:
test: ['CMD', 'wget', '--spider', '-q', 'localhost:3004/_readiness']
interval: 5s
timeout: 5s
retries: 6
start_period: 5s
ports:
- 3004:3004
volumes:
- '../packages/services/cdn-worker/dist/dev.js:/cdn.js'
- './run-local-cdn.sh:/run-local-cdn.sh'
environment:
NODE_ENV: production
PORT: 3004
CDN_AUTH_PRIVATE_KEY: 1e1064ef9cda8bf38936b77317e90dc3
external_composition:
image: node:16.13.2-alpine3.14
entrypoint:
- '/bin/sh'
- '/run-external-composition.sh'
networks:
- 'stack'
healthcheck:
test: ['CMD', 'wget', '--spider', '-q', 'localhost:3012/_readiness']
interval: 5s
timeout: 5s
retries: 6
start_period: 5s
ports:
- 3012:3012
volumes:
- '../packages/libraries/external-composition/dist/example.mjs:/example.mjs'
- './run-external-composition.sh:/run-external-composition.sh'
environment:
NODE_ENV: production
PORT: 3012
SECRET: secretsecret
storage:
image: '${DOCKER_REGISTRY}storage${DOCKER_TAG}'
networks:
- 'stack'
depends_on:
clickhouse:
condition: service_healthy
db:
condition: service_healthy
environment:
MIGRATOR: 'up'
CLICKHOUSE_MIGRATOR: 'up'
POSTGRES_HOST: db
POSTGRES_PORT: 5432
POSTGRES_DB: registry
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
CLICKHOUSE_PROTOCOL: 'http'
CLICKHOUSE_HOST: 'clickhouse'
CLICKHOUSE_PORT: '8123'
CLICKHOUSE_USERNAME: 'test'
CLICKHOUSE_PASSWORD: 'test'
# Tell dockest, we want to wait for the exit code of the migrator to be 0
labels:
dockest.readiness: 'exit_code'
server:
image: '${DOCKER_REGISTRY}server${DOCKER_TAG}'
networks:
- 'stack'
depends_on:
redis:
condition: service_healthy
clickhouse:
condition: service_healthy
storage:
condition: service_completed_successfully
tokens:
condition: service_healthy
webhooks:
condition: service_healthy
emails:
condition: service_healthy
schema:
condition: service_healthy
usage-estimator:
condition: service_healthy
rate-limit:
condition: service_healthy
stripe-billing:
condition: service_healthy
local_cdn:
condition: service_healthy
ports:
- 3001:3001
environment:
NODE_ENV: production
POSTGRES_HOST: db
POSTGRES_PORT: 5432
POSTGRES_DB: registry
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ROARR_LOG: 'true'
CLICKHOUSE_PROTOCOL: 'http'
CLICKHOUSE_HOST: clickhouse
CLICKHOUSE_PORT: 8123
CLICKHOUSE_USERNAME: test
CLICKHOUSE_PASSWORD: test
REDIS_HOST: redis
REDIS_PORT: 6379
REDIS_PASSWORD: test
TOKENS_ENDPOINT: http://tokens:3003
WEBHOOKS_ENDPOINT: http://webhooks:3005
SCHEMA_ENDPOINT: http://schema:3002
USAGE_ESTIMATOR_ENDPOINT: http://usage-estimator:3008
RATE_LIMIT_ENDPOINT: http://rate-limit:3009
BILLING_ENDPOINT: http://stripe-billing:3010
EMAILS_ENDPOINT: http://emails:3011
CDN: '1'
CDN_CF_BASE_PATH: http://local_cdn:3004
CDN_CF_ACCOUNT_ID: 103df45224310d669213971ce28b5b70
CDN_CF_AUTH_TOKEN: 85e20c26c03759603c0f45884824a1c3
CDN_CF_NAMESPACE_ID: 33b1e3bbb4a4707d05ea0307cbb55c79
CDN_AUTH_PRIVATE_KEY: 1e1064ef9cda8bf38936b77317e90dc3
CDN_BASE_URL: http://localhost:3004
GITHUB_APP_ID: 123123
GITHUB_APP_PRIVATE_KEY: 5f938d51a065476c4dc1b04aeba13afb
ENCRYPTION_SECRET: 8ebe95cf24c1fbe306e9fa32c8c33148
FEEDBACK_SLACK_TOKEN: ''
FEEDBACK_SLACK_CHANNEL: '#hive'
WEB_APP_URL: https://app.graphql-hive.com
PORT: 3001
FF_CLICKHOUSE_V2_TABLES: ${FF_CLICKHOUSE_V2_TABLES}
SUPERTOKENS_CONNECTION_URI: http://supertokens:3567
SUPERTOKENS_API_KEY: bubatzbieber6942096420
schema:
image: '${DOCKER_REGISTRY}schema${DOCKER_TAG}'
networks:
- 'stack'
depends_on:
redis:
condition: service_healthy
ports:
- 3002:3002
environment:
NODE_ENV: production
PORT: 3002
REDIS_HOST: redis
REDIS_PORT: 6379
REDIS_PASSWORD: test
ENCRYPTION_SECRET: 8ebe95cf24c1fbe306e9fa32c8c33148
tokens:
image: '${DOCKER_REGISTRY}tokens${DOCKER_TAG}'
networks:
- 'stack'
depends_on:
storage:
condition: service_completed_successfully
ports:
- 3003:3003
environment:
NODE_ENV: production
POSTGRES_HOST: db
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_PORT: 5432
POSTGRES_DB: registry
ROARR_LOG: 'true'
PORT: 3003
webhooks:
image: '${DOCKER_REGISTRY}webhooks${DOCKER_TAG}'
networks:
- 'stack'
depends_on:
redis:
condition: service_healthy
ports:
- 3005:3005
environment:
NODE_ENV: production
BULLMQ_COMMANDS_FROM_ROOT: 'true'
PORT: 3005
REDIS_HOST: redis
REDIS_PORT: 6379
REDIS_PASSWORD: test
emails:
image: '${DOCKER_REGISTRY}emails${DOCKER_TAG}'
networks:
- 'stack'
depends_on:
redis:
condition: service_healthy
ports:
- 3011:3011
environment:
NODE_ENV: production
BULLMQ_COMMANDS_FROM_ROOT: 'true'
PORT: 3011
REDIS_HOST: redis
REDIS_PORT: 6379
REDIS_PASSWORD: test
EMAIL_PROVIDER: mock
EMAIL_FROM: mock@graphql-hive.com
usage:
image: '${DOCKER_REGISTRY}usage${DOCKER_TAG}'
networks:
- 'stack'
ports:
- '3006:3006'
depends_on:
broker:
condition: service_healthy
rate-limit:
condition: service_healthy
tokens:
condition: service_healthy
environment:
NODE_ENV: production
TOKENS_ENDPOINT: http://tokens:3003
RATE_LIMIT_ENDPOINT: http://rate-limit:3009
KAFKA_CONNECTION_MODE: 'docker'
KAFKA_TOPIC: 'usage_reports_v2'
KAFKA_BROKER: broker:29092
KAFKA_BUFFER_SIZE: 350
KAFKA_BUFFER_INTERVAL: 1000
KAFKA_BUFFER_DYNAMIC: '1'
PORT: 3006
usage-ingestor:
image: '${DOCKER_REGISTRY}usage-ingestor${DOCKER_TAG}'
networks:
- 'stack'
depends_on:
broker:
condition: service_healthy
clickhouse:
condition: service_healthy
ports:
- 3007:3007
environment:
NODE_ENV: production
KAFKA_CONNECTION_MODE: 'docker'
KAFKA_BROKER: broker:29092
KAFKA_CONCURRENCY: '1'
KAFKA_CONSUMER_GROUP: 'usage-ingestor-v2'
KAFKA_TOPIC: 'usage_reports_v2'
CLICKHOUSE_PROTOCOL: 'http'
CLICKHOUSE_HOST: clickhouse
CLICKHOUSE_PORT: 8123
CLICKHOUSE_USERNAME: test
CLICKHOUSE_PASSWORD: test
PORT: 3007
usage-estimator:
image: '${DOCKER_REGISTRY}usage-estimator${DOCKER_TAG}'
networks:
- 'stack'
ports:
- 3008:3008
depends_on:
clickhouse:
condition: service_healthy
storage:
condition: service_completed_successfully
environment:
NODE_ENV: production
ROARR_LOG: 'true'
CLICKHOUSE_PROTOCOL: 'http'
CLICKHOUSE_HOST: 'clickhouse'
CLICKHOUSE_PORT: '8123'
CLICKHOUSE_USERNAME: 'test'
CLICKHOUSE_PASSWORD: 'test'
PORT: 3008
FF_CLICKHOUSE_V2_TABLES: ${FF_CLICKHOUSE_V2_TABLES}
rate-limit:
image: '${DOCKER_REGISTRY}rate-limit${DOCKER_TAG}'
networks:
- 'stack'
ports:
- 3009:3009
depends_on:
clickhouse:
condition: service_healthy
storage:
condition: service_completed_successfully
usage-estimator:
condition: service_healthy
emails:
condition: service_healthy
environment:
NODE_ENV: production
LIMIT_CACHE_UPDATE_INTERVAL_MS: 2000
POSTGRES_HOST: db
POSTGRES_PORT: 5432
POSTGRES_DB: registry
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
USAGE_ESTIMATOR_ENDPOINT: http://usage-estimator:3008
EMAILS_ENDPOINT: http://emails:3011
ROARR_LOG: 'true'
PORT: 3009
stripe-billing:
image: '${DOCKER_REGISTRY}stripe-billing${DOCKER_TAG}'
networks:
- 'stack'
ports:
- 3010:3010
depends_on:
clickhouse:
condition: service_healthy
storage:
condition: service_completed_successfully
usage-estimator:
condition: service_healthy
environment:
NODE_ENV: production
STRIPE_SECRET_KEY: ${STRIPE_SECRET_KEY}
POSTGRES_HOST: db
POSTGRES_PORT: 5432
POSTGRES_DB: registry
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ROARR_LOG: 'true'
USAGE_ESTIMATOR_ENDPOINT: http://usage-estimator:3008
PORT: 3010
networks:
stack: {}