pelican_ynh/scripts/upgrade

79 lines
2.4 KiB
Text
Raw Normal View History

2019-01-02 05:26:13 -05:00
#!/bin/bash
2024-10-21 12:53:17 -04:00
source _common.sh
2019-01-02 05:26:13 -05:00
source /usr/share/yunohost/helpers
2024-10-21 12:53:17 -04:00
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression "Stopping $app's systemd service..."
ynh_systemctl --service="$app" --action="stop"
2019-01-02 05:26:13 -05:00
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
2024-10-21 12:53:17 -04:00
ynh_script_progression "Upgrading source files..."
2019-01-02 05:26:13 -05:00
2024-10-21 12:53:17 -04:00
ynh_setup_source --dest_dir="$install_dir" --full_replace --keep=".env"
2019-01-02 05:26:13 -05:00
2024-10-21 12:53:17 -04:00
chown -R "$app:www-data" "$install_dir"
2019-01-02 05:26:13 -05:00
2024-10-21 12:53:17 -04:00
#=================================================
# 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"
2019-01-02 05:26:13 -05:00
#=================================================
2024-10-21 12:53:17 -04:00
# REAPPLY SYSTEM CONFIGURATIONS
2019-01-02 05:26:13 -05:00
#=================================================
2024-10-21 12:53:17 -04:00
ynh_script_progression "Upgrading system configurations related to $app..."
ynh_config_add_phpfpm
2019-01-02 05:26:13 -05:00
2024-10-21 12:53:17 -04:00
ynh_config_add_nginx
2019-01-02 05:26:13 -05:00
2024-10-21 12:53:17 -04:00
ynh_config_add_systemd
yunohost service add "$app" --description="Game server management panel" --log="/var/log/$app/$app.log"
2019-01-02 05:26:13 -05:00
#=================================================
2024-10-21 12:53:17 -04:00
# INSTALL PTERODACTYL WITH COMPOSER
2019-01-02 05:26:13 -05:00
#=================================================
2024-10-21 12:53:17 -04:00
ynh_script_progression "Installing $app with Composer..."
2019-01-02 05:26:13 -05:00
2024-10-21 12:53:17 -04:00
ynh_composer_install
ynh_composer_exec install --no-dev --optimize-autoloader
2019-01-02 05:26:13 -05:00
2024-10-21 12:53:17 -04:00
#=================================================
# FINAL PTERODACTYL INSTALL
#=================================================
ynh_script_progression "Install $app"
2019-01-02 05:26:13 -05:00
2024-10-21 12:53:17 -04:00
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
2019-01-02 05:26:13 -05:00
2024-10-21 12:53:17 -04:00
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression "Starting $app's systemd service..."
ynh_systemctl --service="$app" --action="start"
#=================================================
# END OF SCRIPT
#=================================================
2019-01-02 05:26:13 -05:00
2024-10-21 12:53:17 -04:00
ynh_script_progression "Upgrade of $app completed"