feat: add migration container and healthchecks for services
All checks were successful
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 2m11s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 2m19s
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 2m10s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 2m1s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 2m19s
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Successful in 2m41s

This commit is contained in:
2025-10-21 10:03:41 -04:00
parent 413145f479
commit 854800247e
2 changed files with 32 additions and 0 deletions

4
bin/migrate.sh Executable file
View File

@@ -0,0 +1,4 @@
eval #!/bin/sh
set -e
migrate -path /app/db/migrations -database "postgres://$DB_USERNAME:$DB_PASSWORD@$DB_HOST:$DB_PORT/$DB_DATABASE?sslmode=disable" up

View File

@@ -12,6 +12,24 @@ services:
environment:
PHP_IDE_CONFIG: serverName=localhost
migration-container:
volumes:
- ./db/migrations:/app/db/migrations
- ./bin:/app/bin
image: siteworxpro/migrate:v4.18.3
working_dir: /app
# entrypoint: "/bin/sh -c 'while true; do sleep 30; done;'"
entrypoint: /bin/sh -c '/app/bin/migrate.sh'
depends_on:
postgres:
condition: service_healthy
environment:
DB_USERNAME: ${DB_USERNAME:-siteworxpro}
DB_PASSWORD: ${DB_PASSWORD:-password}
DB_DATABASE: ${DB_DATABASE:-siteworxpro}
DB_HOST: ${DB_HOST-postgres}
DB_PORT: ${DB_PORT-5432}
dev-runtime:
ports:
- "9501:9501"
@@ -29,6 +47,11 @@ services:
redis:
image: redis:latest
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
ports:
- "6379:6379"
volumes:
@@ -36,6 +59,11 @@ services:
postgres:
image: postgres:latest
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USERNAME:-siteworxpro}"]
interval: 10s
timeout: 5s
retries: 5
environment:
POSTGRES_USER: ${DB_USERNAME:-siteworxpro}
POSTGRES_PASSWORD: ${DB_PASSWORD:-password}