initial
This commit is contained in:
@@ -0,0 +1,120 @@
|
||||
# DEV stack for mycoolmusicapp — one entrypoint at http://localhost:80.
|
||||
#
|
||||
# make up # build + start everything (db, redis, api, worker, webui, nginx)
|
||||
# make logs # tail logs
|
||||
# make down # stop
|
||||
#
|
||||
# Source is bind-mounted into api/worker/webui, so edits hot-reload without a
|
||||
# rebuild. PROD has NO compose yet — services there are built straight from
|
||||
# their dockerfiles/Dockerfile.prod (a separate prod compose lands later).
|
||||
#
|
||||
# Env: copy .env.example -> .env at the repo root (single combined file).
|
||||
|
||||
services:
|
||||
# -- backing services -----------------------------------------------------
|
||||
db:
|
||||
image: postgres:16-alpine
|
||||
environment:
|
||||
POSTGRES_USER: ${POSTGRES_USER:-mcma}
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-mcma}
|
||||
POSTGRES_DB: ${POSTGRES_DB:-mcma}
|
||||
ports:
|
||||
- "${POSTGRES_PORT:-5432}:5432" # exposed so host-run tests can reach it
|
||||
volumes:
|
||||
- pgdata:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-mcma}"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
restart: unless-stopped
|
||||
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
command: redis-server --save 60 1 --loglevel warning
|
||||
ports:
|
||||
- "${REDIS_PORT:-6379}:6379"
|
||||
volumes:
|
||||
- redisdata:/data
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "ping"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
restart: unless-stopped
|
||||
|
||||
# -- application services -------------------------------------------------
|
||||
api:
|
||||
build:
|
||||
context: ./mcma-backend
|
||||
dockerfile: dockerfiles/Dockerfile.dev
|
||||
env_file: .env
|
||||
environment:
|
||||
# Service-name URLs override the localhost values from .env.
|
||||
DATABASE_URL: postgresql+asyncpg://${POSTGRES_USER:-mcma}:${POSTGRES_PASSWORD:-mcma}@db:5432/${POSTGRES_DB:-mcma}
|
||||
REDIS_URL: redis://redis:6379/0
|
||||
volumes:
|
||||
- ./mcma-backend:/app # live source (hot reload)
|
||||
- /app/.venv # keep the image's venv, don't shadow it
|
||||
- media:/data/media
|
||||
- transcode_cache:/data/transcode-cache
|
||||
ports:
|
||||
- "8000:8000" # direct access for debugging / docs
|
||||
depends_on:
|
||||
db: { condition: service_healthy }
|
||||
redis: { condition: service_healthy }
|
||||
restart: unless-stopped
|
||||
|
||||
worker:
|
||||
build:
|
||||
context: ./mcma-backend
|
||||
dockerfile: dockerfiles/Dockerfile.dev
|
||||
command: arq app.workers.arq_worker.WorkerSettings
|
||||
env_file: .env
|
||||
environment:
|
||||
DATABASE_URL: postgresql+asyncpg://${POSTGRES_USER:-mcma}:${POSTGRES_PASSWORD:-mcma}@db:5432/${POSTGRES_DB:-mcma}
|
||||
REDIS_URL: redis://redis:6379/0
|
||||
volumes:
|
||||
- ./mcma-backend:/app
|
||||
- /app/.venv
|
||||
- media:/data/media
|
||||
- transcode_cache:/data/transcode-cache
|
||||
depends_on:
|
||||
db: { condition: service_healthy }
|
||||
redis: { condition: service_healthy }
|
||||
restart: unless-stopped
|
||||
|
||||
webui:
|
||||
build:
|
||||
context: ./mcma-webui
|
||||
dockerfile: dockerfiles/Dockerfile.dev
|
||||
env_file: .env
|
||||
environment:
|
||||
RSBUILD_HOST: 0.0.0.0
|
||||
RSBUILD_PORT: "3000"
|
||||
# Browser reaches HMR through nginx on :80, not the container's :3000.
|
||||
RSBUILD_HMR_CLIENT_PORT: "80"
|
||||
volumes:
|
||||
- ./mcma-webui:/app
|
||||
- /app/node_modules # keep the image's install, don't shadow it
|
||||
expose:
|
||||
- "3000"
|
||||
restart: unless-stopped
|
||||
|
||||
# -- reverse proxy: single entrypoint at localhost:80 ---------------------
|
||||
nginx:
|
||||
image: nginx:1.27-alpine
|
||||
ports:
|
||||
- "80:80"
|
||||
volumes:
|
||||
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
|
||||
depends_on:
|
||||
- api
|
||||
- webui
|
||||
restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
pgdata:
|
||||
redisdata:
|
||||
media:
|
||||
transcode_cache:
|
||||
Reference in New Issue
Block a user