2022-09-29 12:09:29 +01:00
version : "3.8"
x-environment :
&oncall-environment
BASE_URL : $DOMAIN
SECRET_KEY : $SECRET_KEY
RABBITMQ_USERNAME : "rabbitmq"
RABBITMQ_PASSWORD : $RABBITMQ_PASSWORD
RABBITMQ_HOST : "rabbitmq"
RABBITMQ_PORT : "5672"
RABBITMQ_DEFAULT_VHOST : "/"
MYSQL_PASSWORD : $MYSQL_PASSWORD
MYSQL_DB_NAME : oncall_hobby
MYSQL_USER : ${MYSQL_USER:-root}
MYSQL_HOST : ${MYSQL_HOST:-mysql}
MYSQL_PORT : 3306
REDIS_URI : redis://redis:6379/0
DJANGO_SETTINGS_MODULE : settings.hobby
CELERY_WORKER_QUEUE : "default,critical,long,slack,telegram,webhook,retry,celery"
CELERY_WORKER_CONCURRENCY : "1"
CELERY_WORKER_MAX_TASKS_PER_CHILD : "100"
CELERY_WORKER_SHUTDOWN_INTERVAL : "65m"
CELERY_WORKER_BEAT_ENABLED : "True"
2022-06-09 11:17:14 +03:00
services :
engine :
2022-06-14 09:54:41 -06:00
image : grafana/oncall
2022-06-17 14:08:09 +03:00
restart : always
2022-06-09 15:49:14 +03:00
ports :
2022-09-29 12:09:29 +01:00
- "8080:8080"
2022-06-09 11:17:14 +03:00
command : >
sh -c "uwsgi --ini uwsgi.ini"
2022-09-29 12:09:29 +01:00
environment : *oncall-environment
2022-06-09 11:17:14 +03:00
depends_on :
mysql :
condition : service_healthy
oncall_db_migration :
condition : service_completed_successfully
rabbitmq :
2022-07-18 11:11:54 +03:00
condition : service_healthy
2022-06-09 11:17:14 +03:00
redis :
condition : service_started
celery :
2022-06-14 09:54:41 -06:00
image : grafana/oncall
2022-06-17 14:08:09 +03:00
restart : always
2022-06-09 11:17:14 +03:00
command : sh -c "./celery_with_exporter.sh"
2022-09-29 12:09:29 +01:00
environment : *oncall-environment
2022-06-09 11:17:14 +03:00
depends_on :
mysql :
condition : service_healthy
oncall_db_migration :
condition : service_completed_successfully
rabbitmq :
2022-07-18 11:11:54 +03:00
condition : service_healthy
2022-06-09 11:17:14 +03:00
redis :
condition : service_started
oncall_db_migration :
2022-06-14 09:54:41 -06:00
image : grafana/oncall
2022-06-09 11:17:14 +03:00
command : python manage.py migrate --noinput
2022-09-29 12:09:29 +01:00
environment : *oncall-environment
2022-06-09 11:17:14 +03:00
depends_on :
mysql :
condition : service_healthy
2022-06-14 09:14:45 -06:00
rabbitmq :
2022-07-18 11:11:54 +03:00
condition : service_healthy
2022-06-09 11:17:14 +03:00
mysql :
image : mysql:5.7
platform : linux/x86_64
2022-06-14 09:14:45 -06:00
command : --default-authentication-plugin=mysql_native_password --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
2022-06-09 11:17:14 +03:00
restart : always
2022-06-20 09:29:37 -06:00
expose :
- 3306
2022-06-09 11:17:14 +03:00
volumes :
- dbdata:/var/lib/mysql
environment :
MYSQL_ROOT_PASSWORD : $MYSQL_PASSWORD
MYSQL_DATABASE : oncall_hobby
2022-09-29 12:09:29 +01:00
deploy :
resources :
limits :
memory : 500m
cpus : '0.5'
2022-06-09 11:17:14 +03:00
healthcheck :
test : "mysql -uroot -p$MYSQL_PASSWORD oncall_hobby -e 'select 1'"
timeout : 20s
retries : 10
redis :
image : redis
restart : always
2022-06-20 09:29:37 -06:00
expose :
- 6379
2022-09-29 12:09:29 +01:00
deploy :
resources :
limits :
memory : 100m
cpus : '0.1'
2022-06-09 11:17:14 +03:00
rabbitmq :
image : "rabbitmq:3.7.15-management"
2022-06-17 14:08:09 +03:00
restart : always
2022-06-09 11:17:14 +03:00
hostname : rabbitmq
volumes :
- rabbitmqdata:/var/lib/rabbitmq
environment :
RABBITMQ_DEFAULT_USER : "rabbitmq"
RABBITMQ_DEFAULT_PASS : $RABBITMQ_PASSWORD
RABBITMQ_DEFAULT_VHOST : "/"
2022-09-29 12:09:29 +01:00
deploy :
resources :
limits :
memory : 1000m
cpus : '0.5'
2022-07-18 11:11:54 +03:00
healthcheck :
test : rabbitmq-diagnostics -q ping
interval : 30s
timeout : 30s
retries : 3
2022-06-09 11:17:14 +03:00
mysql_to_create_grafana_db :
image : mysql:5.7
platform : linux/x86_64
command : bash -c "mysql -h ${MYSQL_HOST:-mysql} -uroot -p${MYSQL_PASSWORD:?err} -e 'CREATE DATABASE IF NOT EXISTS grafana CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'"
depends_on :
mysql :
condition : service_healthy
profiles :
- with_grafana
grafana :
2022-06-10 22:58:46 +03:00
image : "grafana/grafana:9.0.0-beta3"
2022-06-17 14:08:09 +03:00
restart : always
2022-06-09 15:49:14 +03:00
ports :
2022-09-29 12:09:29 +01:00
- "3000:3000"
2022-06-09 11:17:14 +03:00
environment :
GF_DATABASE_TYPE : mysql
GF_DATABASE_HOST : ${MYSQL_HOST:-mysql}
GF_DATABASE_USER : ${MYSQL_USER:-root}
GF_DATABASE_PASSWORD : ${MYSQL_PASSWORD:?err}
GF_SECURITY_ADMIN_USER : ${GRAFANA_USER:-admin}
2022-09-29 13:06:33 +01:00
GF_SECURITY_ADMIN_PASSWORD : ${GRAFANA_PASSWORD:-admin}
2022-06-09 11:17:14 +03:00
GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS : grafana-oncall-app
GF_INSTALL_PLUGINS : grafana-oncall-app
2022-09-29 12:09:29 +01:00
deploy :
resources :
limits :
memory : 500m
cpus : '0.5'
2022-06-09 11:17:14 +03:00
depends_on :
mysql_to_create_grafana_db :
condition : service_completed_successfully
mysql :
condition : service_healthy
profiles :
- with_grafana
volumes :
dbdata :
rabbitmqdata :