2022-09-29 12:09:29 +01:00
|
|
|
version: "3.8"
|
2022-06-03 08:09:47 -06:00
|
|
|
|
2022-11-07 16:34:43 +01:00
|
|
|
x-labels: &oncall-labels
|
|
|
|
|
- "com.grafana.oncall.env=dev"
|
|
|
|
|
|
|
|
|
|
x-oncall-build: &oncall-build-args
|
|
|
|
|
context: ./engine
|
|
|
|
|
target: dev
|
|
|
|
|
labels: *oncall-labels
|
|
|
|
|
|
|
|
|
|
x-oncall-volumes: &oncall-volumes
|
|
|
|
|
- ./engine:/etc/app
|
|
|
|
|
- ./engine/oncall.db:/var/lib/oncall/oncall.db
|
|
|
|
|
|
|
|
|
|
x-env-files: &oncall-env-files
|
|
|
|
|
- ./dev/.env.dev
|
|
|
|
|
- ./dev/.env.${DB}.dev
|
|
|
|
|
|
|
|
|
|
x-env-vars: &oncall-env-vars
|
|
|
|
|
BROKER_TYPE: ${BROKER_TYPE}
|
|
|
|
|
|
2022-06-03 08:09:47 -06:00
|
|
|
services:
|
2022-11-07 16:34:43 +01:00
|
|
|
oncall_ui:
|
|
|
|
|
container_name: oncall_ui
|
|
|
|
|
labels: *oncall-labels
|
|
|
|
|
build:
|
|
|
|
|
context: ./grafana-plugin
|
|
|
|
|
dockerfile: Dockerfile.dev
|
|
|
|
|
labels: *oncall-labels
|
|
|
|
|
volumes:
|
|
|
|
|
- ./grafana-plugin:/etc/app
|
|
|
|
|
- /etc/app/node_modules
|
|
|
|
|
profiles:
|
|
|
|
|
- oncall_ui
|
|
|
|
|
|
|
|
|
|
oncall_engine:
|
|
|
|
|
container_name: oncall_engine
|
|
|
|
|
labels: *oncall-labels
|
|
|
|
|
build: *oncall-build-args
|
2022-06-03 08:09:47 -06:00
|
|
|
restart: always
|
2022-11-07 16:34:43 +01:00
|
|
|
command: "python manage.py runserver 0.0.0.0:8080"
|
|
|
|
|
env_file: *oncall-env-files
|
|
|
|
|
environment: *oncall-env-vars
|
|
|
|
|
volumes: *oncall-volumes
|
2022-06-03 08:09:47 -06:00
|
|
|
ports:
|
2022-11-07 16:34:43 +01:00
|
|
|
- "8080:8080"
|
|
|
|
|
depends_on:
|
|
|
|
|
oncall_db_migration:
|
|
|
|
|
condition: service_completed_successfully
|
|
|
|
|
profiles:
|
|
|
|
|
- engine
|
|
|
|
|
|
|
|
|
|
# used to invoke one-off commands, primarily from the Makefile
|
|
|
|
|
# oncall_engine couldn't (easily) be used due to it's depends_on property
|
|
|
|
|
# we could alternatively just use `docker run` however that would require
|
|
|
|
|
# duplicating the env-files, volume mounts, etc in the Makefile
|
|
|
|
|
oncall_engine_commands:
|
|
|
|
|
container_name: oncall_engine_commands
|
|
|
|
|
labels: *oncall-labels
|
|
|
|
|
build: *oncall-build-args
|
|
|
|
|
env_file: *oncall-env-files
|
|
|
|
|
environment: *oncall-env-vars
|
|
|
|
|
volumes: *oncall-volumes
|
|
|
|
|
profiles:
|
|
|
|
|
# no need to start this except from within the Makefile
|
|
|
|
|
- _engine_commands
|
|
|
|
|
|
|
|
|
|
oncall_celery:
|
|
|
|
|
container_name: oncall_celery
|
|
|
|
|
labels: *oncall-labels
|
|
|
|
|
build: *oncall-build-args
|
|
|
|
|
restart: always
|
|
|
|
|
command: "python manage.py start_celery"
|
|
|
|
|
env_file: *oncall-env-files
|
|
|
|
|
environment: *oncall-env-vars
|
|
|
|
|
volumes: *oncall-volumes
|
|
|
|
|
depends_on:
|
|
|
|
|
oncall_db_migration:
|
|
|
|
|
condition: service_completed_successfully
|
|
|
|
|
profiles:
|
|
|
|
|
- engine
|
|
|
|
|
|
|
|
|
|
oncall_db_migration:
|
|
|
|
|
container_name: oncall_db_migration
|
|
|
|
|
labels: *oncall-labels
|
|
|
|
|
build: *oncall-build-args
|
|
|
|
|
command: "python manage.py migrate --noinput"
|
|
|
|
|
env_file: *oncall-env-files
|
|
|
|
|
environment: *oncall-env-vars
|
|
|
|
|
volumes: *oncall-volumes
|
|
|
|
|
depends_on:
|
|
|
|
|
postgres:
|
|
|
|
|
condition: service_healthy
|
|
|
|
|
mysql:
|
|
|
|
|
condition: service_healthy
|
|
|
|
|
rabbitmq:
|
|
|
|
|
condition: service_healthy
|
|
|
|
|
redis:
|
|
|
|
|
condition: service_healthy
|
|
|
|
|
profiles:
|
|
|
|
|
- engine
|
2022-06-03 08:09:47 -06:00
|
|
|
|
|
|
|
|
redis:
|
2022-11-07 16:34:43 +01:00
|
|
|
container_name: redis
|
|
|
|
|
labels: *oncall-labels
|
|
|
|
|
image: redis:7.0.5
|
2022-06-03 08:09:47 -06:00
|
|
|
restart: always
|
|
|
|
|
ports:
|
2022-09-29 12:09:29 +01:00
|
|
|
- "6379:6379"
|
|
|
|
|
deploy:
|
2022-11-07 16:34:43 +01:00
|
|
|
labels: *oncall-labels
|
2022-09-29 12:09:29 +01:00
|
|
|
resources:
|
|
|
|
|
limits:
|
2022-11-07 16:34:43 +01:00
|
|
|
memory: 500m
|
|
|
|
|
cpus: "0.5"
|
|
|
|
|
healthcheck:
|
|
|
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
|
|
|
timeout: 5s
|
|
|
|
|
interval: 5s
|
|
|
|
|
retries: 10
|
|
|
|
|
volumes:
|
|
|
|
|
- redisdata_dev:/data
|
|
|
|
|
profiles:
|
|
|
|
|
- redis
|
2022-06-03 08:09:47 -06:00
|
|
|
|
2022-11-07 16:34:43 +01:00
|
|
|
rabbitmq:
|
|
|
|
|
container_name: rabbitmq
|
|
|
|
|
labels: *oncall-labels
|
2022-06-03 08:09:47 -06:00
|
|
|
image: "rabbitmq:3.7.15-management"
|
2022-11-07 16:34:43 +01:00
|
|
|
restart: always
|
2022-06-03 08:09:47 -06:00
|
|
|
environment:
|
|
|
|
|
RABBITMQ_DEFAULT_USER: "rabbitmq"
|
|
|
|
|
RABBITMQ_DEFAULT_PASS: "rabbitmq"
|
|
|
|
|
RABBITMQ_DEFAULT_VHOST: "/"
|
2022-11-07 16:34:43 +01:00
|
|
|
ports:
|
|
|
|
|
- "15672:15672"
|
|
|
|
|
- "5672:5672"
|
2022-09-29 12:09:29 +01:00
|
|
|
deploy:
|
2022-11-07 16:34:43 +01:00
|
|
|
labels: *oncall-labels
|
2022-09-29 12:09:29 +01:00
|
|
|
resources:
|
|
|
|
|
limits:
|
|
|
|
|
memory: 1000m
|
2022-11-07 16:34:43 +01:00
|
|
|
cpus: "0.5"
|
|
|
|
|
healthcheck:
|
|
|
|
|
test: rabbitmq-diagnostics -q ping
|
|
|
|
|
interval: 30s
|
|
|
|
|
timeout: 30s
|
|
|
|
|
retries: 3
|
|
|
|
|
volumes:
|
|
|
|
|
- rabbitmqdata_dev:/var/lib/rabbitmq
|
|
|
|
|
profiles:
|
|
|
|
|
- rabbitmq
|
|
|
|
|
|
|
|
|
|
mysql:
|
|
|
|
|
container_name: mysql
|
|
|
|
|
labels: *oncall-labels
|
|
|
|
|
image: mysql:5.7
|
|
|
|
|
platform: linux/x86_64
|
|
|
|
|
command: --default-authentication-plugin=mysql_native_password --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
|
|
|
|
|
restart: always
|
|
|
|
|
environment:
|
|
|
|
|
MYSQL_ROOT_PASSWORD: empty
|
|
|
|
|
MYSQL_DATABASE: oncall_local_dev
|
2022-06-03 08:09:47 -06:00
|
|
|
ports:
|
2022-11-07 16:34:43 +01:00
|
|
|
- "3306:3306"
|
|
|
|
|
deploy:
|
|
|
|
|
labels: *oncall-labels
|
|
|
|
|
resources:
|
|
|
|
|
limits:
|
|
|
|
|
memory: 500m
|
|
|
|
|
cpus: "0.5"
|
|
|
|
|
healthcheck:
|
|
|
|
|
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
|
|
|
|
|
timeout: 20s
|
|
|
|
|
retries: 10
|
|
|
|
|
volumes:
|
|
|
|
|
- mysqldata_dev:/var/lib/mysql
|
|
|
|
|
profiles:
|
|
|
|
|
- mysql
|
2022-06-03 08:09:47 -06:00
|
|
|
|
2022-11-07 16:34:43 +01:00
|
|
|
mysql_to_create_grafana_db:
|
|
|
|
|
container_name: mysql_to_create_grafana_db
|
|
|
|
|
labels: *oncall-labels
|
2022-06-13 16:39:58 -06:00
|
|
|
image: mysql:5.7
|
2022-06-03 08:09:47 -06:00
|
|
|
platform: linux/x86_64
|
2022-06-10 17:32:58 +03:00
|
|
|
command: bash -c "mysql -h mysql -uroot -pempty -e 'CREATE DATABASE IF NOT EXISTS grafana CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'"
|
2022-06-03 08:09:47 -06:00
|
|
|
depends_on:
|
|
|
|
|
mysql:
|
|
|
|
|
condition: service_healthy
|
2022-11-07 16:34:43 +01:00
|
|
|
profiles:
|
|
|
|
|
- mysql
|
|
|
|
|
|
|
|
|
|
postgres:
|
|
|
|
|
container_name: postgres
|
|
|
|
|
labels: *oncall-labels
|
|
|
|
|
image: postgres:14.4
|
|
|
|
|
restart: always
|
|
|
|
|
environment:
|
|
|
|
|
POSTGRES_DB: oncall_local_dev
|
|
|
|
|
POSTGRES_PASSWORD: empty
|
|
|
|
|
POSTGRES_INITDB_ARGS: --encoding=UTF-8
|
|
|
|
|
ports:
|
|
|
|
|
- "5432:5432"
|
|
|
|
|
deploy:
|
|
|
|
|
labels: *oncall-labels
|
|
|
|
|
resources:
|
|
|
|
|
limits:
|
|
|
|
|
memory: 500m
|
|
|
|
|
cpus: "0.5"
|
|
|
|
|
healthcheck:
|
|
|
|
|
test: ["CMD", "pg_isready", "-U", "postgres"]
|
|
|
|
|
interval: 10s
|
|
|
|
|
timeout: 5s
|
|
|
|
|
retries: 5
|
|
|
|
|
volumes:
|
|
|
|
|
- postgresdata_dev:/var/lib/postgresql/data
|
|
|
|
|
profiles:
|
|
|
|
|
- postgres
|
|
|
|
|
|
|
|
|
|
postgres_to_create_grafana_db:
|
|
|
|
|
container_name: postgres_to_create_grafana_db
|
|
|
|
|
labels: *oncall-labels
|
|
|
|
|
image: postgres:14.4
|
|
|
|
|
command: bash -c "PGPASSWORD=empty psql -U postgres -h postgres -tc \"SELECT 1 FROM pg_database WHERE datname = 'grafana'\" | grep -q 1 || PGPASSWORD=empty psql -U postgres -h postgres -c \"CREATE DATABASE grafana\""
|
|
|
|
|
depends_on:
|
|
|
|
|
postgres:
|
|
|
|
|
condition: service_healthy
|
|
|
|
|
profiles:
|
|
|
|
|
- postgres
|
2022-06-03 08:09:47 -06:00
|
|
|
|
|
|
|
|
grafana:
|
2022-11-07 16:34:43 +01:00
|
|
|
container_name: grafana
|
|
|
|
|
labels: *oncall-labels
|
|
|
|
|
image: "grafana/grafana:${GRAFANA_VERSION:-main}"
|
2022-06-03 08:09:47 -06:00
|
|
|
restart: always
|
|
|
|
|
environment:
|
|
|
|
|
GF_SECURITY_ADMIN_USER: oncall
|
|
|
|
|
GF_SECURITY_ADMIN_PASSWORD: oncall
|
|
|
|
|
GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS: grafana-oncall-app
|
2022-11-07 16:34:43 +01:00
|
|
|
env_file:
|
|
|
|
|
- ./dev/.env.${DB}.dev
|
|
|
|
|
ports:
|
|
|
|
|
- "3000:3000"
|
2022-09-29 12:09:29 +01:00
|
|
|
deploy:
|
2022-11-07 16:34:43 +01:00
|
|
|
labels: *oncall-labels
|
2022-09-29 12:09:29 +01:00
|
|
|
resources:
|
|
|
|
|
limits:
|
|
|
|
|
memory: 500m
|
2022-11-07 16:34:43 +01:00
|
|
|
cpus: "0.5"
|
|
|
|
|
extra_hosts:
|
|
|
|
|
- "host.docker.internal:host-gateway"
|
2022-06-03 08:09:47 -06:00
|
|
|
volumes:
|
2022-11-07 16:34:43 +01:00
|
|
|
- grafanadata_dev:/var/lib/grafana
|
2022-06-03 08:09:47 -06:00
|
|
|
- ./grafana-plugin:/var/lib/grafana/plugins/grafana-plugin
|
2022-11-07 16:34:43 +01:00
|
|
|
profiles:
|
|
|
|
|
- grafana
|
|
|
|
|
|
|
|
|
|
volumes:
|
|
|
|
|
redisdata_dev:
|
|
|
|
|
labels: *oncall-labels
|
|
|
|
|
grafanadata_dev:
|
|
|
|
|
labels: *oncall-labels
|
|
|
|
|
rabbitmqdata_dev:
|
|
|
|
|
labels: *oncall-labels
|
|
|
|
|
postgresdata_dev:
|
|
|
|
|
labels: *oncall-labels
|
|
|
|
|
mysqldata_dev:
|
|
|
|
|
labels: *oncall-labels
|
|
|
|
|
|
|
|
|
|
networks:
|
|
|
|
|
default:
|
|
|
|
|
name: oncall_dev
|
|
|
|
|
labels: *oncall-labels
|