pelican_ynh/scripts/upgrade
2024-10-28 16:39:33 -04:00

68 lines
2.1 KiB
Bash
Executable file

#!/bin/bash
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression "Stopping $app's systemd service..."
ynh_systemctl --service="$app" --action="stop"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression "Upgrading source files..."
ynh_setup_source --dest_dir="$install_dir" --full_replace --keep=".env"
chown -R "$app:www-data" "$install_dir"
#=================================================
# REAPPLY SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression "Upgrading system configurations related to $app..."
ynh_config_add_phpfpm
ynh_config_add_nginx
ynh_config_add_systemd
yunohost service add "$app" --description="Game server management panel" --log="/var/log/$app/$app.log"
#=================================================
# INSTALL PTERODACTYL WITH COMPOSER
#=================================================
ynh_script_progression "Installing $app with Composer..."
ynh_composer_install
ynh_composer_exec install --no-dev --optimize-autoloader
#=================================================
# FINAL PTERODACTYL INSTALL
#=================================================
ynh_script_progression "Install $app"
pushd $install_dir
#php$php_version artisan key:generate --force
#php$php_version artisan p:environment:setup
#php$php_version artisan p:environment:database
#php$php_version artisan p:environment:smtp
php$php_version artisan migrate --seed --force
#php$php_version artisan p:user:make
popd
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression "Starting $app's systemd service..."
ynh_systemctl --service="$app" --action="start"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression "Upgrade of $app completed"