pixelfed/entrypoint.sh

44 lines
1.2 KiB
Bash
Raw Normal View History

2020-05-28 16:18:10 +00:00
#!/usr/bin/env bash
2020-05-29 11:28:45 +00:00
set -xeo pipefail
2020-05-28 16:18:10 +00: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 16:18:10 +00:00
cp -r storage.skel/* storage/
2023-06-20 18:43:15 +00:00
chown -R www-data:www-data storage/ bootstrap/
2020-05-28 16:18:10 +00:00
2020-05-30 10:46:57 +00:00
php /wait-for-db.php
2020-06-08 17:11:53 +00:00
if [[ ! -e storage/.docker.init ]]
2020-05-29 11:12:33 +00:00
then
echo "Fresh installation, initializing database..."
2020-07-05 14:18:18 +00: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 11:12:33 +00:00
echo done > storage/.docker.init
fi
2020-07-05 14:18:18 +00:00
gosu www-data php artisan storage:link
2022-10-17 10:01:51 +00:00
gosu www-data php artisan config:cache
2020-07-25 10:15:05 +00:00
gosu www-data php artisan cache:clear
2020-07-05 14:18:18 +00:00
gosu www-data php artisan route:cache
gosu www-data php artisan view:cache
2020-05-28 16:18:10 +00:00
2020-06-08 17:11:53 +00:00
echo "++++ Check for needed migrations... ++++"
# check for migrations
2020-07-05 14:18:18 +00:00
gosu www-data php artisan migrate:status | grep No && migrations=yes || migrations=no
2023-01-09 19:36:09 +00:00
gosu www-data php artisan migrate:status | grep Pending && migrations=yes || migrations=no
2020-06-08 17:11:53 +00:00
if [ $migrations = "yes" ];
then
2020-07-05 14:18:18 +00:00
gosu www-data php artisan migrate --force
2020-06-08 17:11:53 +00:00
fi
2021-01-31 12:48:40 +00:00
# create instance actor
gosu www-data php artisan instance:actor
2020-06-08 17:11:53 +00:00
echo "++++ Start apache... ++++"
2020-05-28 16:18:10 +00:00
source /etc/apache2/envvars
2023-06-05 22:16:19 +00:00
dumb-init apache2 -DFOREGROUND