sbt-idp/docker-compose-dev.yml

257 lines
7.1 KiB
YAML
Raw Normal View History

2023-12-21 05:55:14 +00:00
# TODO: use docker-compose extend: for compact purpose
version: '3.0'
networks:
ctel-sbt:
driver: bridge
services:
cope2n-fi-sbt:
build:
context: cope2n-ai-fi
shm_size: 10gb
dockerfile: Dockerfile
shm_size: 10gb
restart: always
networks:
- ctel-sbt
privileged: true
2024-02-07 05:39:24 +00:00
image: sidp/cope2n-ai-fi-sbt:latest
2023-12-21 05:55:14 +00:00
environment:
- PYTHONPATH=${PYTHONPATH}:/workspace/cope2n-ai-fi # For import module
2023-12-21 05:55:14 +00:00
- CELERY_BROKER=amqp://${RABBITMQ_DEFAULT_USER}:${RABBITMQ_DEFAULT_PASS}@rabbitmq-sbt:5672
- CUDA_VISIBLE_DEVICES=0
volumes:
- ./cope2n-ai-fi:/workspace/cope2n-ai-fi # for dev container only
2023-12-21 05:55:14 +00:00
working_dir: /workspace/cope2n-ai-fi
# deploy:
# resources:
# reservations:
# devices:
# - driver: nvidia
# count: 1
# capabilities: [gpu]
# command: bash -c "tail -f > /dev/null"
command: bash run.sh
deploy:
mode: replicated
2023-12-22 03:54:04 +00:00
replicas: 1
2023-12-21 05:55:14 +00:00
# Back-end services
be-ctel-sbt:
build:
context: cope2n-api
dockerfile: Dockerfile
2024-02-07 05:39:24 +00:00
image: sidp/cope2n-be-fi-sbt:latest
2023-12-21 05:55:14 +00:00
environment:
- MEDIA_ROOT=${MEDIA_ROOT}
- DB_ENGINE=${DB_ENGINE}
- DB_SCHEMA=${DB_SCHEMA}
- DB_USER=${DB_USER}
- DB_PASSWORD=${DB_PASSWORD}
- DB_HOST=${DB_HOST}
- DB_PORT=${DB_PUBLIC_PORT}
- DEBUG=${DEBUG}
- CORS_ALLOWED_ORIGINS=${CORS_ALLOWED_ORIGINS}
- BASE_PORT=${BASE_PORT}
- CTEL_KEY=${CTEL_KEY}
- SECRET_KEY=${SECRET_KEY}
- DB_INTERNAL_KEY=${DB_INTERNAL_KEY}
- ALLOWED_HOSTS=${ALLOWED_HOSTS}
- BROKER_URL=amqp://${RABBITMQ_DEFAULT_USER}:${RABBITMQ_DEFAULT_PASS}@rabbitmq-sbt:5672
- BASE_URL=http://be-ctel-sbt:${BASE_PORT}
- BASE_UI_URL=http://fe:${VITE_PORT}
- AUTH_TOKEN_LIFE_TIME=${AUTH_TOKEN_LIFE_TIME}
- IMAGE_TOKEN_LIFE_TIME=${IMAGE_TOKEN_LIFE_TIME}
- INTERNAL_SDS_KEY=${INTERNAL_SDS_KEY}
- ADMIN_USER_NAME=${ADMIN_USER_NAME}
- ADMIN_PASSWORD=${ADMIN_PASSWORD}
- STANDARD_USER_NAME=${STANDARD_USER_NAME}
- STANDARD_PASSWORD=${STANDARD_PASSWORD}
2024-02-01 07:32:20 +00:00
- S3_ENDPOINT=${S3_ENDPOINT}
2023-12-21 05:55:14 +00:00
- S3_ACCESS_KEY=${S3_ACCESS_KEY}
- S3_SECRET_KEY=${S3_SECRET_KEY}
- S3_BUCKET_NAME=${S3_BUCKET_NAME}
restart: always
2024-03-04 08:38:38 +00:00
healthcheck:
test: ["CMD-SHELL", "curl --fail http://localhost:9000/api/ctel/healthcheck || exit 1"]
interval: 10s
timeout: 5s
retries: 50
2023-12-22 03:54:04 +00:00
ports:
2024-02-29 06:12:50 +00:00
- 9000:9000
2023-12-21 05:55:14 +00:00
networks:
- ctel-sbt
volumes:
2024-02-26 05:39:22 +00:00
- BE_media:${MEDIA_ROOT}
2023-12-22 03:54:04 +00:00
- BE_static:/app/static
2023-12-25 03:32:09 +00:00
- ./cope2n-api:/app
2023-12-21 05:55:14 +00:00
working_dir: /app
depends_on:
db-sbt:
condition: service_started
command: sh -c "chmod -R 777 /app; sleep 5; python manage.py collectstatic --no-input &&
python manage.py makemigrations &&
python manage.py migrate &&
python manage.py compilemessages &&
gunicorn fwd.asgi:application -k uvicorn.workers.UvicornWorker --timeout 300 -b 0.0.0.0:9000" # pre-makemigrations on prod
# command: bash -c "tail -f > /dev/null"
2023-12-25 07:14:05 +00:00
2023-12-21 05:55:14 +00:00
minio:
image: minio/minio
environment:
- MINIO_ROOT_USER=${S3_ACCESS_KEY}
- MINIO_ROOT_PASSWORD=${S3_SECRET_KEY}
- MINIO_ACCESS_KEY=${S3_ACCESS_KEY}
- MINIO_SECRET_KEY=${S3_SECRET_KEY}
volumes:
- ./data/minio_data:/data
2024-01-09 12:41:17 +00:00
ports:
2024-02-29 06:12:50 +00:00
- 9884:9884
- 9885:9885
2023-12-21 05:55:14 +00:00
networks:
- ctel-sbt
restart: always
command: server --address :9884 --console-address :9885 /data
profiles: ["local"]
createbuckets:
image: minio/mc
depends_on:
- minio
entrypoint: >
/bin/sh -c "
/usr/bin/mc alias set myminio http://minio:9884 ${S3_ACCESS_KEY} ${S3_SECRET_KEY};
/usr/bin/mc mb myminio/${S3_BUCKET_NAME};
/usr/bin/mc policy set public myminio/${S3_BUCKET_NAME};
exit 0;
"
networks:
- ctel-sbt
profiles: ["local"]
result-cache:
image: redis:6.2-alpine
restart: always
command: redis-server --save 20 1 --loglevel warning
networks:
- ctel-sbt
be-celery-sbt:
build:
context: cope2n-api
dockerfile: Dockerfile
2024-02-07 05:39:24 +00:00
image: sidp/cope2n-be-fi-sbt:latest
2023-12-21 05:55:14 +00:00
environment:
- MEDIA_ROOT=${MEDIA_ROOT}
- PYTHONPATH=${PYTHONPATH}:/app # For import module
- PYTHONUNBUFFERED=1 # For show print log
- DB_ENGINE=${DB_ENGINE}
- DB_SCHEMA=${DB_SCHEMA}
- DB_USER=${DB_USER}
- DB_PASSWORD=${DB_PASSWORD}
- DB_HOST=${DB_HOST}
- DB_PORT=${DB_PUBLIC_PORT}
- BROKER_URL=amqp://${RABBITMQ_DEFAULT_USER}:${RABBITMQ_DEFAULT_PASS}@rabbitmq-sbt:5672
- BASE_UI_URL=http://fe:${VITE_PORT}
- DEBUG=${DEBUG}
- DB_INTERNAL_KEY=${DB_INTERNAL_KEY}
- IMAGE_TOKEN_LIFE_TIME=${IMAGE_TOKEN_LIFE_TIME}
- CTEL_KEY=${CTEL_KEY}
- SECRET_KEY=${SECRET_KEY}
- ALLOWED_HOSTS=${ALLOWED_HOSTS}
- S3_ENDPOINT=${S3_ENDPOINT}
- S3_ACCESS_KEY=${S3_ACCESS_KEY}
- S3_SECRET_KEY=${S3_SECRET_KEY}
- S3_BUCKET_NAME=${S3_BUCKET_NAME}
- BASE_URL=http://be-ctel-sbt:${BASE_PORT}
- REDIS_HOST=result-cache
- REDIS_PORT=6379
restart: always
networks:
- ctel-sbt
depends_on:
db-sbt:
condition: service_started
rabbitmq-sbt:
condition: service_started
volumes:
2024-02-26 05:39:22 +00:00
- BE_media:${MEDIA_ROOT}
2023-12-25 03:32:09 +00:00
- ./cope2n-api:/app
2023-12-21 05:55:14 +00:00
working_dir: /app
2024-02-26 05:39:22 +00:00
command: sh -c "celery -A fwd_api.celery_worker.worker worker -l INFO -c 5"
# command: bash -c "tail -f > /dev/null"
2023-12-21 05:55:14 +00:00
# Back-end persistent
db-sbt:
restart: always
mem_reservation: 500m
2023-12-26 07:10:59 +00:00
image: postgres:15.4-alpine
2023-12-21 05:55:14 +00:00
volumes:
- ./data/postgres_data:/var/lib/postgresql/data
networks:
- ctel-sbt
environment:
- POSTGRES_USER=${DB_USER}
- POSTGRES_PASSWORD=${DB_PASSWORD}
- POSTGRES_DB=${DB_SCHEMA}
2024-01-31 03:00:18 +00:00
ports:
2024-02-29 06:12:50 +00:00
- 5432:5432
2023-12-21 05:55:14 +00:00
rabbitmq-sbt:
mem_reservation: 600m
restart: always
image: rabbitmq:3.10-alpine
working_dir: /workspace/cope2n-api
networks:
- ctel-sbt
environment:
- RABBITMQ_DEFAULT_USER=${RABBITMQ_DEFAULT_USER}
- RABBITMQ_DEFAULT_PASS=${RABBITMQ_DEFAULT_PASS}
# Front-end services
fe-sbt:
restart: always
build:
context: cope2n-fe
shm_size: 10gb
dockerfile: Dockerfile
2024-02-07 05:39:24 +00:00
image: sidp/cope2n-fe-fi-sbt:latest
2023-12-21 05:55:14 +00:00
shm_size: 10gb
privileged: true
ports:
2024-02-29 06:12:50 +00:00
- 9881:80
2023-12-21 05:55:14 +00:00
depends_on:
be-ctel-sbt:
condition: service_started
be-celery-sbt:
condition: service_started
environment:
- VITE_PROXY=http://be-ctel-sbt:${BASE_PORT}
- VITE_API_BASE_URL=http://fe-sbt:80
volumes:
2023-12-22 03:54:04 +00:00
- BE_static:/backend-static
2023-12-21 05:55:14 +00:00
networks:
- ctel-sbt
2024-03-04 08:38:38 +00:00
dashboard_refresh:
build:
context: api-cronjob
dockerfile: Dockerfile
image: sidp/api-caller-sbt:latest
environment:
- PROXY=http://be-ctel-sbt:9000
- ADMIN_USER_NAME=${ADMIN_USER_NAME}
- ADMIN_PASSWORD=${ADMIN_PASSWORD}
depends_on:
be-ctel-sbt:
condition: service_healthy
restart: always
networks:
- ctel-sbt
2023-12-21 05:55:14 +00:00
volumes:
db_data:
2024-01-05 07:18:16 +00:00
BE_static:
BE_media: