2019-08-16 11:38:26 -05:00
|
|
|
#!/usr/bin/env sh
|
|
|
|
set -e
|
|
|
|
|
|
|
|
cd /etc/shlink
|
|
|
|
|
|
|
|
echo "Creating fresh database if needed..."
|
|
|
|
php bin/cli db:create -n -q
|
|
|
|
|
|
|
|
echo "Updating database..."
|
|
|
|
php bin/cli db:migrate -n -q
|
|
|
|
|
|
|
|
echo "Generating proxies..."
|
|
|
|
php vendor/doctrine/orm/bin/doctrine.php orm:generate-proxies -n -q
|
|
|
|
|
2020-04-06 13:52:33 -05:00
|
|
|
echo "Clearing entities cache..."
|
|
|
|
php vendor/doctrine/orm/bin/doctrine.php orm:clear-cache:metadata -n -q
|
|
|
|
|
2021-04-08 07:32:19 -05:00
|
|
|
# Try to download GeoLite2 db file only if the license key env var was defined
|
|
|
|
if [ ! -z "${GEOLITE_LICENSE_KEY}" ]; then
|
|
|
|
echo "Downloading GeoLite2 db file..."
|
|
|
|
php bin/cli visit:download-db -n -q
|
|
|
|
fi
|
|
|
|
|
2021-05-26 08:45:24 -05:00
|
|
|
# Periodicaly run visit:locate every hour
|
|
|
|
# https://shlink.io/documentation/long-running-tasks/#locate-visits
|
|
|
|
# set env var "ENABLE_PERIODIC_VISIT_LOCATE=1" to enable
|
|
|
|
if [ $ENABLE_PERIODIC_VISIT_LOCATE ]; then
|
|
|
|
echo "Starting periodic visite locate..."
|
|
|
|
echo "0 * * * * php bin/cli visit:locate -q" > /etc/crontabs/root
|
|
|
|
/usr/sbin/crond &
|
|
|
|
fi
|
|
|
|
|
2019-08-16 11:38:26 -05:00
|
|
|
# When restarting the container, swoole might think it is already in execution
|
|
|
|
# This forces the app to be started every second until the exit code is 0
|
2021-01-14 13:19:38 -06:00
|
|
|
until php vendor/bin/laminas mezzio:swoole:start; do sleep 1 ; done
|