Docker-Swarm-Loadbalancer/laravel/migrate.runit
Matthew Baggett 6db6395f66
Trunk linter ()
* linting is fun

* mis-detection of missing healthcheck staements.

* typo

* disable tagging vanity tags on non-main branch

* Unbugger node build?

* Add gitleaks detector, remove an expired secret.

* More linting-derived cleanup

* Fiddle with trivy

* Fiddle with trivy

* add a readme

* Fix build bug with php flavours

* Marshall should build other flavours of ubuntu.

* Fiddle with act cache location.

* Add concurrency checks

* Composer version gubbins for 7.0/7.1

* ubuntu is just a label, and injected over the top of.

* Composer version gubbins for 7.0/7.1

* Run when workflow is altered too please.

* Hopefully fix composer stage.

* setup tooling meta-tooling.

* Add trunk

* Disable mirror mode, its being problematic, and increase retries to 5.

* Revisit how ghcr login works.

* Add trunk checks.

* All hail the linter

* Heavilly revise workflow

* Fettling

* Fettling

* Fettling

* Fettling

* Fettling

* Cleanup

* Cleanup

* Fettling.. Why does mitm build but not redis?

* Fettling.. Why does mitm build but not redis?

* Debuggin

* Fettling.

* Fix build?

* Permissions are a pain

* Switch around some should_push logic because envs aren't available that early.

* Permissionssssss

* Trivy, bane of my life

* Fix merge?

* Fix labels

* Help node along, among other things

* Redis 6.1 & 7.1 aren't a thing any more.

* Ffff USER nonsense

* latest-openssl doesn't exist.

* fixup mysqlproxy.

* Fix labels

* uurrgh

* uurrgh

* Didn't need to add the mitmproxy user, it exists

* Missing ghcr login

* Missing backtick

* Fix build?

* Add validate build step to bouncer.

* Fix bouncer build

* Disable laravel build

* Missing env

* Fix swarm mon build

* Scout just doesn't seem to work.
2024-02-07 16:21:14 +01:00

43 lines
1.2 KiB
Bash

#!/usr/bin/env bash
rm -f /var/lock/laravel_migration_underway \
/var/lock/laravel_migration_complete
if [[ ${MIGRATE_ENABLE,,} == "on" ]]; then
# Give a moment for services to wake up
echo "[MIGRATION] Waiting until Laravel Ready."
sleep 3
until [[ -f /var/lock/laravel_ready ]]; do
sleep 1
done
echo "[MIGRATION] Laravel is ready, running migrations..."
cd /app || exit
# Run migration
touch /var/lock/laravel_migration_underway
if [[ ${MIGRATE_CLEAN,,} == "on" ]]; then
php /app/artisan migrate:fresh --force
php /app/artisan migrate --force # First run will fail due to permissions. We can ignore, but need to migrate again to finish.
else
# If we run this on first commit, it is the same as migrate:fresh, first run may fail and we need to try one more time.
php /app/artisan migrate --force || php /app/artisan migrate --force
fi
if [[ ${SEEDERS,,} == "on" ]]; then
php /app/artisan db:seed -q
fi
rm /var/lock/laravel_migration_underway
touch /var/lock/laravel_migration_complete
echo "[MIGRATION] Migration complete!"
else
echo "[MIGRATION] Not enabled. Set MIGRATE_ENABLE = on to enable."
fi
# Sleep forever (and sleep again in case the sleep process is killed)
while true; do
sleep infinity
done