mirror of
https://github.com/Bubka/2FAuth.git
synced 2024-11-23 00:33:18 +01:00
48 lines
1.2 KiB
Bash
Vendored
48 lines
1.2 KiB
Bash
Vendored
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
echo "Running version ${VERSION} commit ${COMMIT} built on ${CREATED}"
|
|
|
|
# Show versions
|
|
echo "supervisord version: $(supervisord version)"
|
|
php-fpm81 -v | head -n 1
|
|
nginx -v
|
|
|
|
if [ "${DB_CONNECTION}" = "sqlite" ]; then
|
|
if [ ! -f /2fauth/database.sqlite ]; then
|
|
touch /2fauth/database.sqlite
|
|
fi
|
|
rm -f /srv/database/database.sqlite
|
|
ln -s /2fauth/database.sqlite /srv/database/database.sqlite
|
|
fi
|
|
|
|
# Inject storage in /2fauth and use it with a symlink
|
|
if [ ! -d /2fauth/storage ]; then
|
|
mv /srv/storage /2fauth/storage
|
|
else
|
|
rm -r /srv/storage
|
|
fi
|
|
ln -s /2fauth/storage /srv/storage
|
|
|
|
# Note: ${COMMIT} is set by the CI
|
|
if [ -f /2fauth/installed ]; then
|
|
INSTALLED_COMMIT="$(cat /2fauth/installed)"
|
|
if [ "${INSTALLED_COMMIT}" != "${COMMIT}" ]; then
|
|
echo "Installed commit ${INSTALLED_COMMIT} is different from program commit ${COMMIT}, we are migrating..."
|
|
php artisan optimize:clear
|
|
php artisan migrate --force
|
|
fi
|
|
else
|
|
php artisan migrate:refresh --force
|
|
php artisan passport:install
|
|
fi
|
|
|
|
echo "${COMMIT}" > /2fauth/installed
|
|
php artisan storage:link --quiet
|
|
php artisan config:cache
|
|
php artisan route:cache
|
|
php artisan view:cache
|
|
|
|
supervisord
|