pelican_ynh/scripts/install
2024-10-21 19:57:34 +02:00

80 lines
2.8 KiB
Bash
Executable file

#!/bin/bash
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# INITIALIZE AND STORE SETTINGS
#=================================================
timezone="$(cat /etc/timezone)"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression "Setting up source files..."
ynh_setup_source --dest_dir="$install_dir"
chown -R "$app:www-data" "$install_dir"
chmod -R 755 $install_dir/storage/* $install_dir/bootstrap/cache/
#=================================================
# SYSTEM CONFIGURATION
#=================================================
ynh_script_progression "Adding 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"
ynh_config_add --template=".cron" --destination="/etc/cron.d/$app"
#=================================================
# APP INITIAL CONFIGURATION
#=================================================
ynh_script_progression "Adding $app's configuration files..."
ynh_config_add --template=".env" --destination="$install_dir/.env"
chmod 600 "$install_dir/.env"
chown "$app:$app" "$install_dir/.env"
#=================================================
# 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 --no-interaction #--author=$email --url=https://$domain --timezone=America/New_York --cache=redis --session=database --queue=redis --disable-settings-ui --redis-host=127.0.0.1 --redis-pass= --redis-port=6379
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 --name-first $admin --name-last $admin --username $admin --email $email --password $password --admin 1
popd
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression "Starting $app's systemd service..."
ynh_systemctl --service="$app" --action="start"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression "Installation of $app completed"