82 lines
2.8 KiB
Bash
Executable file
82 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)"
|
|
email=$(ynh_user_get_info --username=$admin --key=mail)
|
|
password=$YNH_APP_ARG_PASSWORD
|
|
|
|
#=================================================
|
|
# 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 --url=https://$domain --timezone=Europe/Sofia --cache=redis --session=database --queue=redis --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:mail --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"
|