From e4dcb89d2ecc4beb7a04b4b2246bf6d73e60dd0e Mon Sep 17 00:00:00 2001 From: Armen Date: Fri, 11 Feb 2022 23:53:53 -0500 Subject: [PATCH] Split debug/prod docker compose files, add adminer for debugging, eliminate requirement for separate env file --- docker-compose.debug.yml | 68 ++++++++++++++++++++++++++++++++++++++++ docker-compose.yml | 27 ++++++++-------- 2 files changed, 81 insertions(+), 14 deletions(-) create mode 100644 docker-compose.debug.yml diff --git a/docker-compose.debug.yml b/docker-compose.debug.yml new file mode 100644 index 0000000..3b5b772 --- /dev/null +++ b/docker-compose.debug.yml @@ -0,0 +1,68 @@ +version: '3' + + +services: + db: + image: "postgres:14.1" + volumes: + - "./data/db:/var/lib/postgresql/data" + environment: &env + - POSTGRES_USER=contentdb + - POSTGRES_PASSWORD=password + - POSTGRES_DB=contentdb + - FLASK_DEBUG=1 + - FLASK_CONFIG=../config.cfg + adminer: + image: adminer + restart: always + environment: + - ADMINER_DEFAULT_SERVER=db + - ADMINER_DESIGN=pepa-linha + ports: + - 8081:8080 + + redis: + image: 'redis:6.2-alpine' + command: redis-server + volumes: + - './data/redis:/data' + + app: + build: . + container_name: contentdb_app_1 + command: ./utils/entrypoint.sh + environment: *env + ports: + - 5123:5123 + volumes: + - "./data/uploads:/var/cdb/uploads" + - "./app:/source/app" + - "./migrations:/source/migrations" + depends_on: + - db + - redis + + worker: + build: . + command: celery -A app.tasks.celery worker --concurrency 1 + environment: *env + volumes: + - "./data/uploads:/var/cdb/uploads" + - "./app:/home/cdb/app" + depends_on: + - redis + + beat: + build: . + command: celery -A app.tasks.celery beat + environment: *env + depends_on: + - redis + + exporter: + image: ovalmoney/celery-exporter + environment: *env + ports: + - 5125:9540 + depends_on: + - redis diff --git a/docker-compose.yml b/docker-compose.yml index 55a97a2..839ffb5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,11 +1,17 @@ version: '3' + + services: db: image: "postgres:14.1" volumes: - "./data/db:/var/lib/postgresql/data" - env_file: - - config.env + environment: &env + - POSTGRES_USER=contentdb + - POSTGRES_PASSWORD=password + - POSTGRES_DB=contentdb + - FLASK_DEBUG=0 + - FLASK_CONFIG=../config.cfg redis: image: 'redis:6.2-alpine' @@ -15,9 +21,9 @@ services: app: build: . + container_name: contentdb_app_1 command: ./utils/entrypoint.sh - env_file: - - config.env + environment: *env ports: - 5123:5123 volumes: @@ -31,10 +37,7 @@ services: worker: build: . command: celery -A app.tasks.celery worker --concurrency 1 - env_file: - - config.env - environment: - - FLASK_CONFIG=../config.cfg + environment: *env volumes: - "./data/uploads:/var/cdb/uploads" - "./app:/home/cdb/app" @@ -44,17 +47,13 @@ services: beat: build: . command: celery -A app.tasks.celery beat - env_file: - - config.env - environment: - - FLASK_CONFIG=../config.cfg + environment: *env depends_on: - redis exporter: image: ovalmoney/celery-exporter - env_file: - - config.env + environment: *env ports: - 5125:9540 depends_on: