pterodactyl_ynh/scripts/upgrade
Éric Gaspar 8c20b2d708 cleaning
2024-10-21 18:53:17 +02:00

78 lines
2.4 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"
#=================================================
# UPDATE A CONFIG FILE
#=================================================
ynh_script_progression "Updating $app's configuration files..."
ynh_config_add --template=".env" --destination="$install_dir/.env"
chmod 400 "$install_dir/.env"
chown "$app:$app" "$install_dir/.env"
#=================================================
# 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"