pelican_ynh/scripts/install

81 lines
2.5 KiB
Text
Raw Normal View History

2019-01-02 05:26:13 -05:00
#!/bin/bash
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
2024-10-21 12:53:17 -04:00
# INITIALIZE AND STORE SETTINGS
2019-01-02 11:04:02 -05:00
#=================================================
2019-01-02 06:37:11 -05:00
2024-10-21 12:53:17 -04:00
timezone="$(cat /etc/timezone)"
2019-01-02 05:26:13 -05:00
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
2024-10-21 12:53:17 -04:00
ynh_script_progression "Setting up 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"
2019-01-02 05:26:13 -05:00
2024-10-21 12:53:17 -04:00
chown -R "$app:www-data" "$install_dir"
chmod -R 755 $install_dir/storage/* $install_dir/bootstrap/cache/
2019-01-02 11:04:02 -05:00
2019-01-02 06:37:11 -05:00
#=================================================
2024-10-21 12:53:17 -04:00
# SYSTEM CONFIGURATION
2019-01-02 06:37:11 -05:00
#=================================================
2024-10-21 12:53:17 -04:00
ynh_script_progression "Adding system configurations related to $app..."
2019-01-02 06:37:11 -05:00
2024-10-21 12:53:17 -04:00
ynh_config_add_phpfpm
2019-01-02 06:37:11 -05:00
2024-10-21 12:53:17 -04:00
ynh_config_add_nginx
2019-01-02 07:16:59 -05:00
2024-10-21 12:53:17 -04:00
ynh_config_add_systemd
2019-01-02 07:14:53 -05:00
2024-10-21 12:53:17 -04:00
yunohost service add "$app" --description="Game server management panel" --log="/var/log/$app/$app.log"
2019-01-02 07:43:15 -05:00
2024-10-21 12:53:17 -04:00
ynh_config_add --template=".cron" --destination="/etc/cron.d/$app"
2019-01-02 14:04:57 -05:00
2019-01-02 15:59:23 -05:00
#=================================================
2024-10-21 12:53:17 -04:00
# APP INITIAL CONFIGURATION
2019-01-02 15:59:23 -05:00
#=================================================
2024-10-21 12:53:17 -04:00
ynh_script_progression "Adding $app's configuration files..."
2019-01-02 15:59:23 -05:00
2024-10-21 12:53:17 -04:00
ynh_config_add --template=".env" --destination="$install_dir/.env"
2019-01-02 15:59:23 -05:00
2024-10-21 12:53:17 -04:00
#chmod 600 "$install_dir/.env"
#chown "$app:$app" "$install_dir/.env"
2019-01-02 15:59:23 -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
2019-01-02 05:26:13 -05:00
#=================================================
2024-10-21 12:53:17 -04:00
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 --no-interaction
php$php_version artisan p:environment:database --no-interaction
php$php_version artisan p:environment:smtp --no-interaction
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
2019-01-02 05:26:13 -05:00
#=================================================
2024-10-21 12:53:17 -04:00
ynh_script_progression "Starting $app's systemd service..."
2019-01-02 05:26:13 -05:00
2024-10-21 12:53:17 -04:00
ynh_systemctl --service="$app" --action="start"
2019-01-02 05:26:13 -05:00
#=================================================
2024-10-21 12:53:17 -04:00
# END OF SCRIPT
#=================================================
2024-10-21 12:53:17 -04:00
ynh_script_progression "Installation of $app completed"