initial testing commit

This commit is contained in:
knoflook 2022-09-25 12:06:42 +02:00
commit c36712ec64
Signed by: knoflook
GPG Key ID: D6A1D0E8FC4FEF1C

100
compose.yml Normal file
View File

@ -0,0 +1,100 @@
version: "3.8"
services:
web:
build: "web"
restart: unless-stopped
depends_on:
app:
condition: service_healthy
ports:
- "8080:80"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost/"]
interval: 10s
timeout: 3s
retries: 30
volumes:
- "app_data:/app/uploads"
app:
build: "app"
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
volumes:
- "shiv_data:/root/.shiv"
- "geoip_data:/var/lib/GeoIP"
- "app_data:/app/uploads"
environment:
- "SITE_URL=http://localhost:8080"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/api/"]
interval: 10s
timeout: 3s
retries: 90
env_file:
- env
- env.secrets
command: >
sh -c "
echo 'EditionIDs GeoLite2-City GeoLite2-Country' > /etc/GeoIP.conf &&
echo AccountID $${MAXMIND_ACCOUNT_ID} >> /etc/GeoIP.conf &&
echo LicenseKey $${MAXMIND_LICENSE_KEY} >> /etc/GeoIP.conf &&
echo 'Updating geoip data, first time could be slow...' &&
geoipupdate &&
python karrot-backend.pyz migrate &&
python karrot-backend.pyz server
"
worker:
build: "app"
restart: unless-stopped
depends_on:
# shiv + geoip data gets loaded on the first run of the app
# so to ensure it's available in the worker too, we need to wait
app:
condition: service_healthy
volumes:
- "shiv_data:/root/.shiv"
- "geoip_data:/var/lib/GeoIP"
env_file:
- env
command: "python karrot-backend.pyz worker"
redis:
image: "redis:6-alpine"
restart: unless-stopped
command: ["redis-server", "--appendonly", "yes"]
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 1s
timeout: 3s
retries: 30
volumes:
- "redis_data:/data"
postgres:
image: "postgres:12-alpine"
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U karrot"]
interval: 1s
timeout: 3s
retries: 30
volumes:
- "postgres_data:/var/lib/postgresql/data"
environment:
POSTGRES_PASSWORD: karrot
POSTGRES_USER: karrot
POSTGRES_DB: karrot
volumes:
shiv_data:
geoip_data:
app_data:
postgres_data:
redis_data: