pixelfed-container/entrypoint.sh

45 lines
1.2 KiB
Bash
Raw Permalink 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/
2023-06-20 20:43:15 +02:00
chown -R www-data:www-data storage/ bootstrap/
2020-05-28 18:18:10 +02:00
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
2022-10-17 12:01:51 +02:00
gosu www-data php artisan config:cache
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
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
2023-01-09 20:36:09 +01:00
gosu www-data php artisan migrate:status | grep Pending && 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
2023-06-06 00:16:19 +02:00
dumb-init apache2 -DFOREGROUND