190 lines
4.9 KiB
YAML
190 lines
4.9 KiB
YAML
name: disexcel
|
|
|
|
services:
|
|
|
|
backend-dev:
|
|
profiles: ["dev"]
|
|
image: "${DOCKER_REGISTRY:-local}/excel-dev:${IMAGE_TAG:-local}"
|
|
container_name: backend-dev
|
|
build:
|
|
dockerfile: ./docker/dockerfile
|
|
context: ../
|
|
target: dev
|
|
init: true #Manage processes and reap zombies
|
|
ipc: private #Inter-Process Communication (IPC) namespace for high-performance applications
|
|
environment:
|
|
- DB_HOST=psql #rewrite DB_HOST var to communicate inside the docker network
|
|
- RABBITMQ_HOST=rabbitmq
|
|
- REDIS_HOST=redis
|
|
volumes:
|
|
- type: bind
|
|
source: ../src
|
|
target: /home/excel-project/src
|
|
- type: bind
|
|
source: ../main.py
|
|
target: /home/excel-project/main.py
|
|
- type: bind
|
|
source: ../configs
|
|
target: /home/excel-project/configs
|
|
- type: bind
|
|
source: ../DB
|
|
target: /home/excel-project/DB
|
|
- type: bind
|
|
source: ../uploads
|
|
target: /home/excel-project/uploads
|
|
- type: bind
|
|
source: ../logs
|
|
target: /home/excel-project/logs
|
|
- type: bind
|
|
source: ../daemon_run.py
|
|
target: /home/excel-project/daemon_run.py
|
|
networks:
|
|
- backend
|
|
depends_on:
|
|
psql:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
rabbitmq:
|
|
condition: service_healthy
|
|
ports:
|
|
- "80:8000"
|
|
entrypoint: ["./entrypoint.sh", "--dev"]
|
|
|
|
backend-prod:
|
|
profiles: ["prod"]
|
|
image: "${DOCKER_REGISTRY:-local}/excel-prod:${IMAGE_TAG:-local}"
|
|
container_name: backend-prod
|
|
build:
|
|
dockerfile: ./docker/dockerfile
|
|
context: ../
|
|
target: prod
|
|
init: true #Manage processes and reap zombies
|
|
ipc: private #Inter-Process Communication (IPC) namespace for high-performance applications
|
|
environment:
|
|
- DB_HOST=psql
|
|
- RABBITMQ_HOST=rabbitmq
|
|
- REDIS_HOST=redis
|
|
volumes:
|
|
- type: bind
|
|
source: ../configs
|
|
target: /home/excel-project/configs
|
|
- type: bind
|
|
source: ../DB
|
|
target: /home/excel-project/DB
|
|
- type: bind
|
|
source: ../uploads
|
|
target: /home/excel-project/uploads
|
|
- type: bind
|
|
source: ../logs
|
|
target: /home/excel-project/logs
|
|
networks:
|
|
- backend
|
|
restart: unless-stopped
|
|
depends_on:
|
|
psql:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
rabbitmq:
|
|
condition: service_healthy
|
|
ports:
|
|
- "80:8000"
|
|
|
|
daemons:
|
|
profiles: ["prod", "dev"]
|
|
image: "${DOCKER_REGISTRY:-local}/excel-daemons:${IMAGE_TAG:-local}"
|
|
container_name: daemons
|
|
environment:
|
|
- RABBITMQ_HOST=rabbitmq
|
|
build:
|
|
dockerfile: ./docker/dockerfile
|
|
context: ../
|
|
target: daemon
|
|
init: true
|
|
ipc: private
|
|
volumes:
|
|
- type: bind
|
|
source: ../configs
|
|
target: /home/excel-project/configs
|
|
- type: bind
|
|
source: ../logs
|
|
target: /home/excel-project/logs
|
|
depends_on:
|
|
rabbitmq:
|
|
condition: service_healthy
|
|
networks:
|
|
- backend
|
|
restart: unless-stopped
|
|
|
|
psql:
|
|
profiles: ["prod", "dev", "local"]
|
|
image: postgres:16-alpine
|
|
container_name: psql
|
|
init: true
|
|
ipc: private
|
|
environment:
|
|
POSTGRES_USER: ${DB_USER}
|
|
POSTGRES_PASSWORD: ${DB_PASSWORD}
|
|
POSTGRES_DB: ${DB_POSTGRESS}
|
|
volumes:
|
|
- type: bind
|
|
source: ../DB
|
|
target: /var/lib/postgresql/data
|
|
networks:
|
|
- backend
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U ${DB_USER} -d ${DB_POSTGRESS}"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 5
|
|
ports:
|
|
- "${DB_PORT}:5432"
|
|
|
|
redis:
|
|
image: redis:latest
|
|
profiles: ["prod", "dev", "local"]
|
|
container_name: redis
|
|
init: true
|
|
ipc: private
|
|
ports:
|
|
- '${REDIS_PORT}:6379'
|
|
command: ["redis-server", "--requirepass", "${REDIS_PASSWORD}", "--appendonly", "yes"]
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "redis-cli -a ${REDIS_PASSWORD} ping | grep PONG"]
|
|
interval: 1s
|
|
timeout: 3s
|
|
retries: 5
|
|
restart: unless-stopped
|
|
networks:
|
|
- backend
|
|
|
|
rabbitmq:
|
|
image: rabbitmq:3-management-alpine
|
|
profiles: ["prod", "dev", "local"]
|
|
container_name: rabbitmq_broker
|
|
restart: always
|
|
init: true
|
|
ipc: private
|
|
environment:
|
|
- RABBITMQ_DEFAULT_USER=${RABBITMQ_LOGIN}
|
|
- RABBITMQ_DEFAULT_PASS=${RABBITMQ_PASSWORD}
|
|
ports:
|
|
- "${RABBITMQ_PORT}:5672"
|
|
- "${RABBITMQ_PORT_UI}:15672"
|
|
volumes:
|
|
- type: bind
|
|
source: ../RTMQ
|
|
target: /var/lib/rabbitmq
|
|
healthcheck:
|
|
test: ["CMD", "rabbitmq-diagnostics", "check_port_connectivity"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
networks:
|
|
- backend
|
|
|
|
networks:
|
|
backend:
|
|
name: "${BACKEND_NETWORK:-backend_network}" |