pixelfed-container/entrypoint.sh

43 lines
1.1 KiB
Bash
Raw Normal View History

2020-05-28 18:18:10 +02:00
#!/usr/bin/env bash
2020-05-29 13:28:45 +02:00
set -xeo pipefail
2020-05-28 18:18:10 +02:00
if [ ! -z $FORCE_HTTPS ]
then
sed -i 's#</VirtualHost#SetEnv HTTPS on\n</VirtualHost#' /etc/apache2/sites-enabled/000-default.conf
fi
2020-05-28 18:18:10 +02:00
cp -r storage.skel/* storage/
2020-05-30 12:46:57 +02:00
php /wait-for-db.php
2020-06-08 19:11:53 +02:00
if [[ ! -e storage/.docker.init ]]
2020-05-29 13:12:33 +02:00
then
echo "Fresh installation, initializing database..."
2020-07-05 16:18:18 +02:00
gosu www-data php artisan key:generate
gosu www-data php artisan migrate:fresh --force
gosu www-data php artisan passport:keys
2020-05-29 13:12:33 +02:00
echo done > storage/.docker.init
fi
2020-07-05 16:18:18 +02:00
gosu www-data php artisan storage:link
gosu www-data php artisan horizon:publish
2020-07-25 12:15:05 +02:00
gosu www-data php artisan cache:clear
2020-07-05 16:18:18 +02:00
gosu www-data php artisan route:cache
gosu www-data php artisan view:cache
gosu www-data php artisan config:cache
2020-05-28 18:18:10 +02:00
2020-06-08 19:11:53 +02:00
echo "++++ Check for needed migrations... ++++"
# check for migrations
2020-07-05 16:18:18 +02:00
gosu www-data php artisan migrate:status | grep No && migrations=yes || migrations=no
2020-06-08 19:11:53 +02:00
if [ $migrations = "yes" ];
then
2020-07-05 16:18:18 +02:00
gosu www-data php artisan migrate --force
2020-06-08 19:11:53 +02:00
fi
2021-01-31 13:48:40 +01:00
# create instance actor
gosu www-data php artisan instance:actor
2020-06-08 19:11:53 +02:00
echo "++++ Start apache... ++++"
2020-05-28 18:18:10 +02:00
source /etc/apache2/envvars
/usr/local/sbin/dumb-init apache2 -DFOREGROUND