You've already forked Php-Template
feat: add migration container and healthchecks for services (#8)
All checks were successful
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 1m32s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 1m31s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 1m41s
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Successful in 1m50s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 1m40s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 1m37s
🏗️✨ Build Workflow / 🖥️ 🔨 Build (push) Successful in 12m3s
🏗️✨ Build Workflow / 🖥️ 🔨 Build Migrations (push) Successful in 1m36s
All checks were successful
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 1m32s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 1m31s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 1m41s
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Successful in 1m50s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 1m40s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 1m37s
🏗️✨ Build Workflow / 🖥️ 🔨 Build (push) Successful in 12m3s
🏗️✨ Build Workflow / 🖥️ 🔨 Build Migrations (push) Successful in 1m36s
Reviewed-on: #8 Co-authored-by: Ron Rise <ron@siteworxpro.com> Co-committed-by: Ron Rise <ron@siteworxpro.com>
This commit was merged in pull request #8.
This commit is contained in:
4
bin/migrate.sh
Executable file
4
bin/migrate.sh
Executable 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
|
||||||
@@ -12,6 +12,24 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
PHP_IDE_CONFIG: serverName=localhost
|
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:
|
dev-runtime:
|
||||||
ports:
|
ports:
|
||||||
- "9501:9501"
|
- "9501:9501"
|
||||||
@@ -29,6 +47,11 @@ services:
|
|||||||
|
|
||||||
redis:
|
redis:
|
||||||
image: redis:latest
|
image: redis:latest
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "redis-cli", "ping"]
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
ports:
|
ports:
|
||||||
- "6379:6379"
|
- "6379:6379"
|
||||||
volumes:
|
volumes:
|
||||||
@@ -36,6 +59,11 @@ services:
|
|||||||
|
|
||||||
postgres:
|
postgres:
|
||||||
image: postgres:latest
|
image: postgres:latest
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "pg_isready -U ${DB_USERNAME:-siteworxpro}"]
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
environment:
|
environment:
|
||||||
POSTGRES_USER: ${DB_USERNAME:-siteworxpro}
|
POSTGRES_USER: ${DB_USERNAME:-siteworxpro}
|
||||||
POSTGRES_PASSWORD: ${DB_PASSWORD:-password}
|
POSTGRES_PASSWORD: ${DB_PASSWORD:-password}
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
FROM siteworxpro/migrate:v4.18.3
|
FROM siteworxpro/migrate:v4.18.3
|
||||||
|
|
||||||
ADD db/migrations /app/db/migrations
|
ADD db/migrations /app/db/migrations
|
||||||
|
ADD bin/migrate.sh /app/bin/migrate.sh
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
ENTRYPOINT ["/app/bin/migrate.sh"]
|
||||||
|
|||||||
Reference in New Issue
Block a user