Files
server/stacks/moka/compose.yml
2026-03-31 01:19:39 -03:00

104 lines
2.4 KiB
YAML

x-app-base: &app-base
image: git.skrd.fun/skrd/moka:latest
restart: unless-stopped
env_file:
- .env
x-healthcheck-common: &healthcheck
interval: 10s
timeout: 5s
retries: 3
start_period: 20s
services:
app:
<<: *app-base
depends_on:
pgsql:
condition: service_healthy
redis:
condition: service_healthy
environment:
CONTAINER_ROLE: web
volumes:
- ${DATA_DIR}/storage:/app/storage
healthcheck:
<<: *healthcheck
test: ["CMD", "php", "-r", "exit((int) !@fsockopen('127.0.0.1', 8000));"]
queue:
<<: *app-base
depends_on:
app:
condition: service_healthy
pgsql:
condition: service_healthy
redis:
condition: service_healthy
environment:
CONTAINER_ROLE: queue
volumes:
- ${DATA_DIR}/storage:/app/storage
healthcheck:
<<: *healthcheck
test:
[
"CMD",
"php",
"-r",
"$$cmd = str_replace(\"\\0\", ' ', (string) file_get_contents('/proc/1/cmdline')); exit(str_contains($$cmd, 'artisan queue:work') ? 0 : 1);",
]
scheduler:
<<: *app-base
depends_on:
app:
condition: service_healthy
pgsql:
condition: service_healthy
redis:
condition: service_healthy
environment:
CONTAINER_ROLE: scheduler
volumes:
- ${DATA_DIR}/storage:/app/storage
healthcheck:
<<: *healthcheck
test:
[
"CMD",
"php",
"-r",
"$$cmd = str_replace(\"\\0\", ' ', (string) file_get_contents('/proc/1/cmdline')); exit(str_contains($$cmd, 'artisan schedule:work') ? 0 : 1);",
]
pgsql:
image: postgres:18
restart: unless-stopped
shm_size: 128mb
environment:
PGPASSWORD: "${DB_PASSWORD:-secret}"
POSTGRES_DB: "${DB_DATABASE}"
POSTGRES_USER: "${DB_USERNAME}"
POSTGRES_PASSWORD: "${DB_PASSWORD:-secret}"
volumes:
- ${DATA_DIR}/db:/var/lib/postgresql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
redis:
image: redis
restart: unless-stopped
volumes:
- ${DATA_DIR}/cache:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
start_period: 5s