From e9918816e5b8539658ad8f02a01d3f136804c2ea Mon Sep 17 00:00:00 2001 From: Michael Nguyen Date: Sat, 17 Feb 2018 22:08:51 -0800 Subject: [PATCH] Add upgrade script --- services/php/Dockerfile | 2 ++ services/php/upgrade.sh | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 services/php/upgrade.sh diff --git a/services/php/Dockerfile b/services/php/Dockerfile index a65ccee..4912021 100644 --- a/services/php/Dockerfile +++ b/services/php/Dockerfile @@ -37,6 +37,8 @@ USER root:root RUN mkdir -p /var/log/pterodactyl COPY install.sh /usr/local/bin/install RUN chmod +x /usr/local/bin/install +COPY upgrade.sh /usr/local/bin/upgrade +RUN chmod +x /usr/local/bin/upgrade COPY schedule /var/spoon/cron/crontabs/schedule COPY supervisord.conf /etc/supervisor/supervisord.conf COPY www.conf /usr/local/etc/php-fpm.d/www.conf diff --git a/services/php/upgrade.sh b/services/php/upgrade.sh new file mode 100644 index 0000000..b1f3745 --- /dev/null +++ b/services/php/upgrade.sh @@ -0,0 +1,41 @@ +#!/bin/ash + +## +# This is an install script to quickly upgrade Pterodactyl Panel. Before running, +# please BACK UP any important data! +## +if [ "$(whoami)" != "pterodactyl" ]; then + echo "Rerunning script as webserver user." + exec su -c /usr/local/bin/upgrade pterodactyl +fi + +echo "Are you sure you want to continue the upgrade script? (Y/n)" +read -n1 run + +if [ "$run" = "Y" ]; then + echo "Running upgrade script." + php artisan down + + # Change introduced in 0.7.0. + echo "Removing cached configuration." + rm -r bootstrap/cache/* + + echo "Rerunning configuration scripts." + php artisan p:environment:setup --cache=redis --session=redis --queue=redis \ + --redis-host=redis --redis-pass="" --redis-port=6379 + + echo "Removing cached views." + php artisan view:clear + + echo "Running migrations." + php artisan migrate --force + php artisan db:seed --force + + echo "Cleaning up API keys." + php artisan p:migration:clean-orphaned-keys + + echo "Upgrade complete. Please restart the container to load changes." + php artisan up +else + echo "Exiting." +fi