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{J6FX~qqR)k&O}Tdff9V9-
zxQXw2NgF5tAwjNPYYIB%e$m&@A2G!|_0;&Snx$gVq-ad^SGI$UH}!6B7syR`djcSn
zNdlq#E(sd=rAYm@vh52UuNhV6eQIbgw|dwT^L+)wyrG{r%<)9h4BpADpHRmEHwC0u
zhi^C8q+2}-SV$K_z_gJapdfc_h6A5CkL#>0Q-V!0gS$0owgvS`OFEV>3v~AM6R!Pq{zJKaPQHQpI%lp`K>q{gM269P&Oh
zzO#*PEn-S^?>msrjM8o^WNu?WOzO>O+K%^hczF02q{W@i{qY8Wg`y?;=1D;G6Y;U?lDu=gIVqdFV|{brA%PgSb0Zs*pdj
zeA1ax8y+R&1>GZ_oOS(11nW(F;g~S}`6`&m<3-ZHXp!J3U^^lJ;_M`?M0`S`^N2TS
zl{hjQE;Kyea3l94l2r&&j&l;y*C{U(=dd+ght=owi&?i#?6c2Gd`QZxRi>LF$!4{v
zc!I6*mAEL-a~$<+%n4OZp;ym~$k?T)nOGl%b>`^zL<}M&B7D~WXr)nKnbaLEamUq#
zPzk%dJUH@h24B*5(jb1lYGr@l85aq~LIi|6UQ!@_eQxWZ$)a*s<*3}dpbBb`K&u`k
zoCT?tGH(XGqUmTsi$&wv7{+t15If^2?|0sr?!w3JuJj1pLslAzHj1_1nf#RyBSsly
z!j_XsR~xwtUt{gj=|j2O{MB1Vu3&YN$0^j3dyec5{w(V!%Q#BxYlFuMI>eKg{7T0L
zZ;O~Y!`V!EtW=b&8UW*hPMyi;Ds;bez8?d$%WVk
zUy2(yCEv=+tT=N|DAiEp{a%BvZ|!<}=S6E-o-cm~>mAEsxk$nvWQEpt=e}J-qfsjm)
UE-)&$xd9C0IsX9d#{5|Pe`qLcKmY&$
literal 0
HcmV?d00001
diff --git a/manifest.json b/manifest.json
deleted file mode 100644
index c4014d4..0000000
--- a/manifest.json
+++ /dev/null
@@ -1,79 +0,0 @@
-{
- "name": "Pterodactyl",
- "id": "pterodactyl",
- "packaging_format": 1,
- "description": {
- "en": "Pterodactyl is a gameserver management panel (Minecraft, ARK, Rust,...)",
- "fr": "Pterodactyl est un panel de gestion de serveurs de jeux (Minecraft, ARK, Rust,...)"
- },
- "version": "0.7.17",
- "url": "https://pterodactyl.io/",
- "license": "free",
- "maintainer": {
- "name": "Aeris",
- "email": "aeris@e.email"
- },
- "requirements": {
- "yunohost": ">= 3.5"
- },
- "multi_instance": true,
- "services": [
- "nginx",
- "php5-fpm",
- "mysql"
- ],
- "arguments": {
- "install": [{
- "name": "domain",
- "type": "domain",
- "ask": {
- "en": "Choose a domain name for Pterodactyl",
- "fr": "Choisissez un nom de domaine pour Pterodactyl"
- },
- "example": "example.com"
- },
-
- {
- "name": "path",
- "type": "path",
- "ask": {
- "en": "Choose a path for Pterodactyl. For now, only /pterodactyl is accepted",
- "fr": "Choisissez un chemin pour Pterodactyl. Pour l'instant seulement /pterodactyl est accepté"
- },
- "example": "/pterodactyl",
- "default": "/pterodactyl"
- },
-
- {
- "name": "admin",
- "type": "user",
- "ask": {
- "en": "Choose an admin user (should be a YunoHost registered user)",
- "fr": "Choisissez l’administrateur (should be a YunoHost registered user)"
- },
- "example": "johndoe"
- },
-
- {
- "name": "password",
- "type": "password",
- "ask": {
- "en": "Set the administrator password",
- "fr": "Définissez le mot de passe administrateur"
- },
- "example": "Choose a password"
- },
-
- {
- "name": "is_public",
- "type": "boolean",
- "ask": {
- "en": "Is it a public site ?",
- "fr": "Est-ce un site public ?"
- },
- "default": "true"
- }
-
- ]
- }
-}
diff --git a/manifest.toml b/manifest.toml
new file mode 100644
index 0000000..3eaed7e
--- /dev/null
+++ b/manifest.toml
@@ -0,0 +1,69 @@
+#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json
+
+packaging_format = 2
+
+id = "pterodactyl"
+name = "Pterodactyl"
+description.en = "Open-source game server management panel"
+description.fr = "Panneau de gestion du serveur de jeu open source"
+
+version = "1.11.7~ynh1"
+
+maintainers = ["eric_G"]
+
+[upstream]
+license = "MIT"
+website = "https://pterodactyl.io/"
+admindoc = "https://pterodactyl.io/project/introduction.html"
+code = "https://github.com/pterodactyl/panel"
+
+[integration]
+yunohost = ">= 11.2.30"
+helpers_version = "2.1"
+architectures = "all"
+multi_instance = true
+
+ldap = false
+sso = false
+
+disk = "50M"
+ram.build = "50M"
+ram.runtime = "50M"
+
+[install]
+ [install.domain]
+ type = "domain"
+
+ [install.init_main_permission]
+ type = "group"
+ default = "visitors"
+
+[resources]
+
+ [resources.sources]
+
+ [resources.sources.main]
+ in_subdir = false
+ url = "https://github.com/pterodactyl/panel/releases/download/v1.11.7/panel.tar.gz"
+ sha256 = "b41774a6c7046bdfd4303969c6700d7f46f069b5250dfad25f91bbc389c9c063"
+
+ # autoupdate.strategy = "latest_github_tag"
+
+ [resources.system_user]
+ allow_email = true
+
+ [resources.install_dir]
+ group = "www-data:r-x"
+
+ [resources.data_dir]
+
+ [resources.permissions]
+ main.url = "/"
+
+ [resources.ports]
+
+ [resources.apt]
+ packages = "tar, unzip, git, redis-server, mariadb-server, php8.3-common, php8.3-cli, php8.3-gd, php8.3-mysql, php8.3-mbstring, php8.3-bcmath, php8.3-xml, php8.3-curl, php8.3-zip"
+
+ [resources.database]
+ type = "mysql"
diff --git a/scripts/_common.sh b/scripts/_common.sh
index fbd3f3f..4ebac4e 100644
--- a/scripts/_common.sh
+++ b/scripts/_common.sh
@@ -1,131 +1,7 @@
#!/bin/bash
-# ============= FUTURE YUNOHOST HELPER =============
-# Delete a file checksum from the app settings
-#
-# $app should be defined when calling this helper
-#
-# usage: ynh_remove_file_checksum file
-# | arg: file - The file for which the checksum will be deleted
-ynh_delete_file_checksum () {
- local checksum_setting_name=checksum_${1//[\/ ]/_} # Replace all '/' and ' ' by '_'
- ynh_app_setting_delete $app $checksum_setting_name
-}
+#=================================================
+# COMMON VARIABLES AND CUSTOM HELPERS
+#=================================================
-# Create a dedicated php-fpm config
-#
-# usage: ynh_add_fpm_config
-ynh_add_fpm7.2_config () {
- # Configure PHP-FPM 7.1 by default
- ynh_secure_remove "/etc/php/7.1/fpm/pool.d/$app.conf" 2>&1
- ynh_secure_remove "/etc/php/7.1/fpm/conf.d/20-$app.ini" 2>&1
- local fpm_config_dir="/etc/php/7.2/fpm"
- local fpm_service="php7.2-fpm"
- ynh_app_setting_set $app fpm_config_dir "$fpm_config_dir"
- ynh_app_setting_set $app fpm_service "$fpm_service"
- finalphpconf="$fpm_config_dir/pool.d/$app.conf"
- ynh_backup_if_checksum_is_different "$finalphpconf"
- sudo cp ../conf/php-fpm.conf "$finalphpconf"
- ynh_replace_string "__NAMETOCHANGE__" "$app" "$finalphpconf"
- ynh_replace_string "__FINALPATH__" "$final_path" "$finalphpconf"
- ynh_replace_string "__USER__" "$app" "$finalphpconf"
- sudo chown root: "$finalphpconf"
- ynh_store_file_checksum "$finalphpconf"
-
- if [ -e "../conf/php-fpm.ini" ]
- then
- finalphpini="$fpm_config_dir/conf.d/20-$app.ini"
- ynh_backup_if_checksum_is_different "$finalphpini"
- sudo cp ../conf/php-fpm.ini "$finalphpini"
- sudo chown root: "$finalphpini"
- ynh_store_file_checksum "$finalphpini"
- fi
- sudo systemctl reload $fpm_service
-}
-
-# Remove the dedicated php-fpm config
-#
-# usage: ynh_remove_fpm7.1_config
-ynh_remove_fpm7.2_config () {
- local fpm_config_dir=$(ynh_app_setting_get $app fpm_config_dir)
- local fpm_service=$(ynh_app_setting_get $app fpm_service)
- ynh_secure_remove "$fpm_config_dir/pool.d/$app.conf"
- ynh_secure_remove "$fpm_config_dir/conf.d/20-$app.ini" 2>&1
- sudo systemctl reload $fpm_service
-}
-
-
-
-# Execute a command as another user
-# usage: exec_as USER COMMAND [ARG ...]
-exec_as() {
- local USER=$1
- shift 1
-
- if [[ $USER = $(whoami) ]]; then
- eval $@
- else
- # use sudo twice to be root and be allowed to use another user
- sudo sudo -u "$USER" $@
- fi
-}
-
-#
-# Composer helpers
-#
-
-# Execute a composer command from a given directory
-# usage: composer_exec AS_USER WORKDIR COMMAND [ARG ...]
-exec_composer() {
- local WORKDIR=$1
- shift 1
-
- COMPOSER_HOME="${WORKDIR}/.composer" \
- sudo /usr/bin/php7.2 "${WORKDIR}/composer.phar" $@ \
- -d "${WORKDIR}" --no-interaction
-}
-
-# Install and initialize Composer in the given directory
-# usage: init_composer DESTDIR [AS_USER]
-init_composer() {
- local DESTDIR=$1
- local AS_USER=${2:-admin}
-
- # install composer
- curl -sS https://getcomposer.org/installer \
- | COMPOSER_HOME="${DESTDIR}/.composer" \
- sudo /usr/bin/php7.2 -- --quiet --install-dir="$DESTDIR" \
- || ynh_die "Unable to install Composer"
-
- # update dependencies to create composer.lock
- exec_composer "$DESTDIR" install --no-dev --prefer-dist --no-scripts \
- || ynh_die "Unable to update firefly-iii core dependencies"
-}
-
-sudo_path () {
- sudo env "PATH=$PATH" $@
-}
-
-#
-# PHP7 helpers
-#
-
-ynh_install_php7 () {
-
- ynh_package_update
- ynh_package_install apt-transport-https --no-install-recommends
-
- wget -q -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
- echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php7.list
-
- ynh_package_update
- ynh_install_app_dependencies php7.2 php7.2-zip php7.2-fpm php7.2-mysql php7.2-xml php7.2-intl php7.2-mbstring php7.2-gd php7.2-curl php7.2-bcmath php7.2-opcache php7.2-ldap
- sudo update-alternatives --install /usr/bin/php php /usr/bin/php5 70
-}
-
-ynh_remove_php7 () {
- sudo rm -f /etc/apt/sources.list.d/php7.list
- sudo apt-key del 4096R/89DF5277
- sudo apt-key del 2048R/11A06851
- ynh_remove_app_dependencies php7.2 php7.2-zip php7.2-fpm php7.2-mysql php7.2-xml php7.2-intl php7.2-mbstring php7.2-gd php7.2-curl php7.2-bcmath php7.2-opcache
-}
\ No newline at end of file
+composer_version=2.5.8
diff --git a/scripts/backup b/scripts/backup
old mode 100644
new mode 100755
index af8ccd9..c66fb13
--- a/scripts/backup
+++ b/scripts/backup
@@ -1,33 +1,49 @@
#!/bin/bash
-# Exit on command errors and treat unset variables as an error
-set -eu
-
-# See comments in install script
-app=$YNH_APP_INSTANCE_NAME
-
-# Source YunoHost helpers
+source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
-# Backup sources & data
-# Note: the last argument is where to save this path, see the restore script.
-ynh_backup "/var/www/${app}" "sources"
+ynh_print_info "Declaring files to be backed up..."
-### MySQL (remove if not used) ###
-# If a MySQL database is used:
-# # Dump the database
-# dbname=$app
-# dbuser=$app
-# dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
-# mysqldump -u "$dbuser" -p"$dbpass" --no-create-db "$dbname" > ./dump.sql
-### MySQL end ###
+#=================================================
+# BACKUP THE APP MAIN DIR
+#=================================================
-# Copy NGINX configuration
-domain=$(ynh_app_setting_get "$app" domain)
-ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf" "nginx.conf"
+ynh_backup "$install_dir"
-### PHP (remove if not used) ###
-# If a dedicated php-fpm process is used:
-# # Copy PHP-FPM pool configuration
-# ynh_backup "/etc/php5/fpm/pool.d/${app}.conf" "php-fpm.conf"
-### PHP end ###
+#=================================================
+# BACKUP THE DATA DIR
+#=================================================
+
+ynh_backup "$data_dir"
+
+#=================================================
+# SYSTEM CONFIGURATION
+#=================================================
+
+ynh_backup "/etc/php/$php_version/fpm/pool.d/$app.conf"
+
+ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
+
+ynh_backup "/etc/systemd/system/$app.service"
+
+#=================================================
+# BACKUP VARIOUS FILES
+#=================================================
+
+ynh_backup "/etc/cron.d/$app"
+
+ynh_backup "/var/log/$app/"
+
+#=================================================
+# BACKUP THE MYSQL DATABASE
+#=================================================
+ynh_print_info "Backing up the MySQL database..."
+
+ynh_mysql_dump_db > db.sql
+
+#=================================================
+# END OF SCRIPT
+#=================================================
+
+ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
diff --git a/scripts/change_url b/scripts/change_url
new file mode 100644
index 0000000..25e55b5
--- /dev/null
+++ b/scripts/change_url
@@ -0,0 +1,46 @@
+#!/bin/bash
+
+## this script is only run if actual change to domain/path is detected, if you're here either $domain or $path changed
+## new location is available via $domain and $path (or $new_domain and $new_path variables if you want to be explicit)
+## old values are available via, you guessed it, $old_domain and $old_path
+
+#=================================================
+# IMPORT GENERIC HELPERS
+#=================================================
+
+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"
+
+#=================================================
+# MODIFY URL IN NGINX CONF
+#=================================================
+ynh_script_progression "Updating NGINX web server configuration..."
+
+# this will most likely adjust NGINX config correctly
+ynh_config_change_url_nginx
+
+#=================================================
+# SPECIFIC MODIFICATIONS
+#=================================================
+
+## do any changes to files that reference specific installation domain/path, i.e. regenerate configs etc
+
+#=================================================
+# START SYSTEMD SERVICE
+#=================================================
+ynh_script_progression "Starting $app's systemd service..."
+
+ynh_systemctl --service="$app" --action="start"
+
+#=================================================
+# END OF SCRIPT
+#=================================================
+
+ynh_script_progression "Change of URL completed for $app"
diff --git a/scripts/config b/scripts/config
new file mode 100644
index 0000000..9c4c1c1
--- /dev/null
+++ b/scripts/config
@@ -0,0 +1,96 @@
+#!/bin/bash
+# In simple cases, you don't need a config script.
+
+# With a simple config_panel.toml, you can write in the app settings, in the
+# upstream config file or replace complete files (logo ...) and restart services.
+
+# The config scripts allows you to go further, to handle specific cases
+# (validation of several interdependent fields, specific getter/setter for a value,
+# display dynamic informations or choices, pre-loading of config type .cube... ).
+
+#=================================================
+# IMPORT GENERIC HELPERS
+#=================================================
+
+source /usr/share/yunohost/helpers
+
+ynh_abort_if_errors
+
+#=================================================
+# RETRIEVE ARGUMENTS
+#=================================================
+
+install_dir=$(ynh_app_setting_get --key=install_dir)
+
+#=================================================
+# SPECIFIC GETTERS FOR TOML SHORT KEY
+#=================================================
+
+get__amount() {
+ # Here we can imagine to have an API call to stripe to know the amount of donation during a month
+ local amount=200
+
+ # It's possible to change some properties of the question by overriding it:
+ if [ "$amount" -gt 100 ]; then
+ cat << EOF
+style: success
+value: $amount
+ask:
+ en: A lot of donation this month: **$amount €**
+EOF
+ else
+ cat << EOF
+style: danger
+value: $amount
+ask:
+ en: Not so much donation this month: $amount €
+EOF
+ fi
+}
+
+get__prices() {
+ local prices
+ prices="$(grep "DONATION\['" "$install_dir/settings.py" | sed -r "s@^DONATION\['([^']*)'\]\['([^']*)'\] = '([^']*)'@\1/\2/\3@g" | sed -z 's/\n/,/g;s/,$/\n/')"
+ if [ "$prices" == "," ]; then
+ # Return YNH_NULL if you prefer to not return a value at all.
+ echo YNH_NULL
+ else
+ echo "$prices"
+ fi
+}
+
+#=================================================
+# SPECIFIC VALIDATORS FOR TOML SHORT KEYS
+#=================================================
+validate__publishable_key() {
+
+ # We can imagine here we test if the key is really a publishable key
+ (is_secret_key "$publishable_key") &&
+ echo 'This key seems to be a secret key'
+}
+
+#=================================================
+# SPECIFIC SETTERS FOR TOML SHORT KEYS
+#=================================================
+set__prices() {
+
+ #---------------------------------------------
+ # IMPORTANT: setters are triggered only if a change is detected
+ #---------------------------------------------
+ for price in $(echo "$prices" | sed "s/,/ /"); do
+ frequency=$(echo "$price" | cut -d/ -f1)
+ currency=$(echo "$price" | cut -d/ -f2)
+ price_id=$(echo "$price" | cut -d/ -f3)
+ sed "d/DONATION\['$frequency'\]\['$currency'\]" "$install_dir/settings.py"
+
+ echo "DONATION['$frequency']['$currency'] = '$price_id'" >> "$install_dir/settings.py"
+ done
+
+ #---------------------------------------------
+ # IMPORTANT: to be able to upgrade properly, you have to save the value in settings too
+ #---------------------------------------------
+ ynh_app_setting_set --key=prices --value="$prices"
+}
+
+#=================================================
+ynh_app_config_run "$1"
diff --git a/scripts/install b/scripts/install
old mode 100644
new mode 100755
index fd82d04..753aec4
--- a/scripts/install
+++ b/scripts/install
@@ -1,262 +1,80 @@
#!/bin/bash
-#=================================================
-# GENERIC START
-#=================================================
-# IMPORT GENERIC HELPERS
-#=================================================
-
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
-# MANAGE SCRIPT FAILURE
+# INITIALIZE AND STORE SETTINGS
#=================================================
-ynh_clean_setup () {
- ### Remove this function if there's nothing to clean before calling the remove script.
- true
-}
-# Exit if an error occurs during the execution of the script
-ynh_abort_if_errors
-
-#=================================================
-# RETRIEVE ARGUMENTS FROM THE MANIFEST
-#=================================================
-
-# Retrieve arguments
-domain=$YNH_APP_ARG_DOMAIN
-path_url=$YNH_APP_ARG_PATH
-admin=$YNH_APP_ARG_ADMIN
-is_public=$YNH_APP_ARG_IS_PUBLIC
-password=$YNH_APP_ARG_PASSWORD
-
-### If it's a multi-instance app, meaning it can be installed several times independently
-### The id of the app as stated in the manifest is available as $YNH_APP_ID
-### The instance number is available as $YNH_APP_INSTANCE_NUMBER (equals "1", "2", ...)
-### The app instance name is available as $YNH_APP_INSTANCE_NAME
-### - the first time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample
-### - the second time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample__2
-### - ynhexample__{N} for the subsequent installations, with N=3,4, ...
-### The app instance name is probably what interests you most, since this is
-### guaranteed to be unique. This is a good unique identifier to define installation path,
-### db names, ...
-app=$YNH_APP_INSTANCE_NAME
-
-#=================================================
-# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
-#=================================================
-
-### If the app uses nginx as web server (written in HTML/PHP in most cases), the final path should be "/var/www/$app".
-### If the app provides an internal web server (or uses another application server such as uwsgi), the final path should be "/opt/yunohost/$app"
-final_path=/var/www/$app
-test ! -e "$final_path" || ynh_die "This path already contains a folder"
-
-# Normalize the url path syntax
-path_url=$(ynh_normalize_url_path $path_url)
-
-# Check web path availability
-ynh_webpath_available $domain $path_url
-# Register (book) web path
-ynh_webpath_register $app $domain $path_url
-
-#=================================================
-# STORE SETTINGS FROM MANIFEST
-#=================================================
-
-ynh_app_setting_set $app domain $domain
-ynh_app_setting_set $app path $path_url
-ynh_app_setting_set $app admin $admin
-ynh_app_setting_set $app is_public $is_public
-
-#=================================================
-# FIND AND OPEN A PORT
-#=================================================
-
-### Use these lines if you have to open a port for the application
-### `ynh_find_port` will find the first available port starting from the given port.
-### If you're not using these lines:
-### - Remove the section "CLOSE A PORT" in the remove script
-
-# Find a free port
-port=$(ynh_find_port 8080)
-# Open this port
-yunohost firewall allow --no-upnp TCP $port 2>&1
-ynh_app_setting_set $app port $port
-
-#==============================================
-# INSTALL DEPS
-#==============================================
-
-## Install the PHP 7.2 repo for debian
-ynh_package_install ca-certificates apt-transport-https
-wget -q https://packages.sury.org/php/apt.gpg -O- | apt-key add -
-echo "deb https://packages.sury.org/php/ stretch main" | tee /etc/apt/sources.list.d/php.list
-
-## Get apt updates
-ynh_package_update
-ynh_package_install libargon2-1 libsodium23 libzip5 memcached php-igbinary php-memcached php-msgpack php-xdebug php7.2 php7.2-bcmath php7.2-cli php7.2-common php7.2-curl php7.2-fpm php7.2-gd php7.2-json php7.2-mbstring php7.2-mysql php7.2-opcache php7.2-readline php7.2-xml php7.2-zip
-
-
-## Start php7
-systemctl enable php7.2-fpm
-systemctl start php7.2-fpm
-
-#=================================================
-# CREATE A MYSQL DATABASE
-#=================================================
-# If your app uses a MySQL database, you can use these lines to bootstrap
-# a database, an associated user and save the password in app settings
-
-db_name=$(ynh_sanitize_dbid $app)
-ynh_app_setting_set $app db_name $db_name
-ynh_mysql_setup_db $db_name $db_name
+timezone="$(cat /etc/timezone)"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
+ynh_script_progression "Setting up source files..."
-ynh_app_setting_set $app final_path $final_path
-# Download, check integrity, uncompress and patch the source from app.src
-ynh_setup_source "$final_path"
+ynh_setup_source --dest_dir="$install_dir"
+
+chown -R "$app:www-data" "$install_dir"
+chmod -R 755 $install_dir/storage/* $install_dir/bootstrap/cache/
#=================================================
-# NGINX CONFIGURATION
+# SYSTEM CONFIGURATION
#=================================================
+ynh_script_progression "Adding system configurations related to $app..."
-# Create a dedicated nginx config
-ynh_add_nginx_config
+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"
#=================================================
-# CREATE DEDICATED USER
+# APP INITIAL CONFIGURATION
#=================================================
+ynh_script_progression "Adding $app's configuration files..."
-# Create a system user
-ynh_system_user_create $app
+ynh_config_add --template=".env" --destination="$install_dir/.env"
+
+#chmod 600 "$install_dir/.env"
+#chown "$app:$app" "$install_dir/.env"
#=================================================
-# SPECIFIC SETUP
+# INSTALL PTERODACTYL WITH COMPOSER
#=================================================
+ynh_script_progression "Installing $app with Composer..."
-# create a user
-email=$(ynh_user_get_info $admin 'mail')
-
-# setup application config
-cp -a ../conf/.env.example $final_path/.env
-cp -a ../conf/wings.service /etc/systemd/system/wings.service
+ynh_composer_install
+ynh_composer_exec install --no-dev --optimize-autoloader
#=================================================
-# MODIFY A CONFIG FILE
+# FINAL PTERODACTYL INSTALL
#=================================================
+ynh_script_progression "Install $app"
-#ynh_replace_string "random_key" "$random_key" "$final_path/.env"
-ynh_replace_string "yunouser" "$db_name" "$final_path/.env"
-ynh_replace_string "yunopass" "$db_pwd" "$final_path/.env"
-ynh_replace_string "yunobase" "$db_name" "$final_path/.env"
-ynh_replace_string "yunomail" "$email" "$final_path/.env"
-ynh_replace_string "yunodomain" "$domain" "$final_path/.env"
-
-#==============================================
-# INSTALL Composer
-#==============================================
-
-php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
-php composer-setup.php --install-dir=/usr/bin --filename=composer
-php -r "unlink('composer-setup.php');"
-
-#=================================================
-# DOWNLOAD, CHECK AND UNPACK SOURCE
-#=================================================
-
-### `ynh_setup_source` is used to install an app from a zip or tar.gz file,
-### downloaded from an upstream source, like a git repository.
-### `ynh_setup_source` use the file conf/app.src
-
-ynh_app_setting_set $app final_path $final_path
-# Download, check integrity, uncompress and patch the source from app.src
-ynh_setup_source "$final_path"
-
-#==============================================
-# Install Pterodactyl
-#==============================================
-
-pushd $final_path
-chmod -R 755 storage/* bootstrap/cache
-composer install --no-progress
-php artisan key:generate --force
-php artisan migrate --force
-php artisan db:seed --force
-php artisan p:user:make --name-first $admin --name-last $admin --username $admin --email $email --password $password --admin 1
-php artisan p:environment:setup --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 artisan migrate --seed --force
-popd
-
-#==============================================
-# Install wings
-#==============================================
-
-ynh_package_install apt-transport-https ca-certificates curl gnupg2 software-properties-common zip unzip tar make gcc g++ python curl gnupg
-curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
-add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
-ynh_package_update
-ynh_package_install docker-ce
-cp -a ../conf/daemon.json /etc/docker/daemon.json
-systemctl enable docker
-systemctl start docker
-mkdir -p /srv/daemon /srv/daemon-data
-pushd /srv/daemon
-curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
-ynh_package_install nodejs make gcc g++
-curl -L https://github.com/pterodactyl/daemon/releases/download/v0.6.11/daemon.tar.gz | tar --strip-components=1 -xzv
-npm install --only=production
-npm audit fix
-sudo npm start
+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
#=================================================
-# SETUP SYSTEMD
+# START SYSTEMD SERVICE
#=================================================
+ynh_script_progression "Starting $app's systemd service..."
-ynh_add_systemd_config
-systemctl enable $app.service
-systemctl enable wings.service
+ynh_systemctl --service="$app" --action="start"
#=================================================
-# ADVERTISE SERVICE IN ADMIN PANEL
+# END OF SCRIPT
#=================================================
-mkdir -p /var/log/pterodactyl/
-touch /var/log/$app/$app-prod.log
-yunohost service add $app --log "/var/log/$app/$app-prod.log"
-
-#==============================================
-# Cron
-#==============================================
-
-crontab -l | { cat; echo "* * * * * php /var/www/pterodactyl/artisan schedule:run" ; } | crontab -
-
-#=================================================
-# GENERIC FINALIZATION
-#=================================================
-# SECURE FILES AND DIRECTORIES
-#=================================================
-
-# Set permissions to app files
-chown -R www-data:www-data $final_path
-
-#=================================================
-# SETUP SSOWAT
-#=================================================
-
-# Make app public if necessary
-if [ $is_public -eq 1 ]
-then
- # unprotected_uris allows SSO credentials to be passed anyway.
- ynh_app_setting_set $app unprotected_uris "/"
-fi
-
-#=================================================
-# RELOAD NGINX
-#=================================================
-
-systemctl reload nginx
+ynh_script_progression "Installation of $app completed"
diff --git a/scripts/remove b/scripts/remove
old mode 100644
new mode 100755
index 8191c68..5c22862
--- a/scripts/remove
+++ b/scripts/remove
@@ -1,105 +1,28 @@
#!/bin/bash
-#=================================================
-# GENERIC START
-#=================================================
-# IMPORT GENERIC HELPERS
-#=================================================
-
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
-# LOAD SETTINGS
+# REMOVE SYSTEM CONFIGURATIONS
#=================================================
+ynh_script_progression "Removing system configurations related to $app..."
-app=$YNH_APP_INSTANCE_NAME
-
-domain=$(ynh_app_setting_get $app domain)
-port=$(ynh_app_setting_get $app port)
-final_path=$(ynh_app_setting_get $app final_path)
-
-db_name=$(ynh_app_setting_get $app db_name)
-db_user=$db_name
-
-#=================================================
-# STANDARD REMOVE
-#=================================================
-# STOP AND REMOVE SERVICE
-#=================================================
-
-# Remove the dedicated systemd config
-ynh_remove_systemd_config
-
-#=================================================
-# REMOVE SERVICE FROM ADMIN PANEL
-#=================================================
-
-# Remove a service from the admin panel, added by `yunohost service add`
-if yunohost service status | grep -q $app
-then
- echo "Remove $app service"
- yunohost service remove $app
+if ynh_hide_warnings yunohost service status "$app" >/dev/null; then
+ yunohost service remove "$app"
fi
+ynh_config_remove_systemd
+
+ynh_config_remove_nginx
+
+ynh_config_remove_phpfpm
+
+# Remove other various files specific to the app... such as:
+
+ynh_safe_rm "/etc/cron.d/$app"
#=================================================
-# REMOVE THE MYSQL DATABASE
+# END OF SCRIPT
#=================================================
-# Remove a database if it exists, along with the associated user
-ynh_mysql_remove_db $db_user $db_name
-
-#=================================================
-# REMOVE APP MAIN DIR
-#=================================================
-
-# Remove the app directory securely
-ynh_secure_remove "$final_path"
-
-#=================================================
-# REMOVE NGINX CONFIGURATION
-#=================================================
-
-# Remove the dedicated nginx config
-ynh_remove_nginx_config
-
-#=================================================
-# REMOVE PHP-FPM CONFIGURATION
-#=================================================
-
-# Remove the dedicated php-fpm config
-ynh_remove_fpm_config
-
-#=================================================
-# CLOSE A PORT
-#=================================================
-
-if yunohost firewall list | grep -q "\- $port$"
-then
- echo "Close port $port" >&2
- yunohost firewall disallow TCP $port 2>&1
-fi
-
-#=================================================
-# SPECIFIC REMOVE
-#=================================================
-# REMOVE THE CRON FILE
-#=================================================
-
-# Remove a cron file
-ynh_secure_remove "/etc/cron.d/$app"
-
-# Remove a directory securely
-ynh_secure_remove "/etc/apt/sources.list.d/php.list"
-
-# Remove the log files
-ynh_secure_remove "/var/log/$app/"
-
-#=================================================
-# GENERIC FINALIZATION
-#=================================================
-# REMOVE DEDICATED USER
-#=================================================
-
-# Delete a system user
-ynh_system_user_delete $app
+ynh_script_progression "Removal of $app completed"
diff --git a/scripts/restore b/scripts/restore
old mode 100644
new mode 100755
index 93169e9..1d56da3
--- a/scripts/restore
+++ b/scripts/restore
@@ -1,52 +1,68 @@
#!/bin/bash
-# Note: each files and directories you've saved using the ynh_backup helper
-# will be located in the current directory, regarding the last argument.
-# Exit on command errors and treat unset variables as an error
-set -eu
-
-# See comments in install script
-app=$YNH_APP_INSTANCE_NAME
-
-# Source YunoHost helpers
+source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
-# Retrieve old app settings
-domain=$(ynh_app_setting_get "$app" domain)
-path_url=$(ynh_app_setting_get "$app" path_url)
+#=================================================
+# RESTORE THE APP MAIN DIR
+#=================================================
+ynh_script_progression "Restoring the app main directory..."
-# Check domain/path availability
-sudo yunohost app checkurl "${domain}${path_url}" -a "$app" \
- || ynh_die "Path not available: ${domain}${path_url}"
+ynh_restore "$install_dir"
-# Restore sources & data
-src_path="/var/www/${app}"
-sudo cp -a ./sources "$src_path"
+chown -R "$app:www-data" "$install_dir"
-# Restore permissions to app files
-# you may need to make some file and/or directory writeable by www-data (nginx user)
-sudo chown -R root: "$src_path"
+#=================================================
+# RESTORE THE DATA DIRECTORY
+#=================================================
+ynh_script_progression "Restoring the data directory..."
-### MySQL (remove if not used) ###
-# If a MySQL database is used:
-# # Create and restore the database
-# dbname=$app
-# dbuser=$app
-# dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
-# ynh_mysql_create_db "$dbname" "$dbuser" "$dbpass"
-# ynh_mysql_connect_as "$dbuser" "$dbpass" "$dbname" < ./dump.sql
-### MySQL end ###
+ynh_restore "$data_dir"
-# Restore NGINX configuration
-sudo cp -a ./nginx.conf "/etc/nginx/conf.d/${domain}.d/${app}.conf"
+#=================================================
+# RESTORE THE MYSQL DATABASE
+#=================================================
+ynh_script_progression "Restoring the MySQL database..."
-### PHP (remove if not used) ###
-# If a dedicated php-fpm process is used:
-# # Copy PHP-FPM pool configuration and reload the service
-# sudo cp -a ./php-fpm.conf "/etc/php5/fpm/pool.d/${app}.conf"
-# sudo service php5-fpm reload
-### PHP end ###
+ynh_mysql_db_shell < ./db.sql
-# Restart webserver
-sudo service nginx reload
+#=================================================
+# RESTORE SYSTEM CONFIGURATIONS
+#=================================================
+ynh_script_progression "Restoring system configurations related to $app..."
+
+ynh_restore "/etc/php/$php_version/fpm/pool.d/$app.conf"
+
+ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
+
+ynh_restore "/etc/systemd/system/$app.service"
+systemctl enable "$app.service" --quiet
+
+yunohost service add "$app" --description="Game server management panel" --log="/var/log/$app/$app.log"
+
+#=================================================
+# RESTORE VARIOUS FILES
+#=================================================
+
+ynh_restore "/etc/cron.d/$app"
+
+ynh_restore "/var/log/$app/"
+
+#=================================================
+# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
+#=================================================
+ynh_script_progression "Reloading NGINX web server and $app's service..."
+
+### Typically you only have either $app or PHP-FPM but not both at the same time...
+ynh_systemctl --service="$app" --action="start"
+
+ynh_systemctl --service="php$php_version-fpm" --action=reload
+
+ynh_systemctl --service=nginx --action=reload
+
+#=================================================
+# END OF SCRIPT
+#=================================================
+
+ynh_script_progression "Restoration completed for $app"
diff --git a/scripts/upgrade b/scripts/upgrade
old mode 100644
new mode 100755
index cd74c66..d0754dc
--- a/scripts/upgrade
+++ b/scripts/upgrade
@@ -1,57 +1,78 @@
#!/bin/bash
-# Exit on command errors and treat unset variables as an error
-set -eu
-
-# See comments in install script
-app=$YNH_APP_INSTANCE_NAME
-final_path=/opt/yunohost/$app
-
-# Source YunoHost helpers
+source _common.sh
source /usr/share/yunohost/helpers
-# Set permissions to app files
-# you may need to make some file and/or directory writeable by www-data (nginx user)
-#sudo chown -R root: $src_path
+#=================================================
+# 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_app_setting_set $app final_path $final_path
-# Download, check integrity, uncompress and patch the source from app.src
-ynh_setup_source "$final_path"
+ynh_setup_source --dest_dir="$install_dir" --full_replace --keep=".env"
-#==============================================
-# INSTALL PLEX
-#==============================================
-
-dpkg --install $final_path/emby-server-deb*
+chown -R "$app:www-data" "$install_dir"
#=================================================
-# NGINX CONFIGURATION
+# UPDATE A CONFIG FILE
#=================================================
+ynh_script_progression "Updating $app's configuration files..."
-# Create a dedicated nginx config
-#ynh_add_nginx_config
+ynh_config_add --template=".env" --destination="$install_dir/.env"
+chmod 400 "$install_dir/.env"
+chown "$app:$app" "$install_dir/.env"
#=================================================
-# UPGRADE CONFIG
+# REAPPLY SYSTEM CONFIGURATIONS
#=================================================
-#cp -a ../conf/loolwsd.xml /etc/loolwsd
-#ynh_replace_string "__NEXTCLOUDDOMAIN__" "$nextcloud_domain" "/etc/loolwsd/loolwsd.xml"
-#ynh_replace_string "__PASSWORD__" "$password" "/etc/loolwsd/loolwsd.xml"
-#systemctl restart loolwsd
+ynh_script_progression "Upgrading system configurations related to $app..."
+ynh_config_add_phpfpm
+ynh_config_add_nginx
-# If app is public, add url to SSOWat conf as skipped_uris
-#if [[ $is_public -eq 1 ]]; then
- # See install script
-# ynh_app_setting_set "$app" unprotected_uris "/"
-#fi
+ynh_config_add_systemd
-# Reload nginx service
-systemctl restart plexmediaserver
+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"
diff --git a/tests.toml b/tests.toml
new file mode 100644
index 0000000..76f5804
--- /dev/null
+++ b/tests.toml
@@ -0,0 +1,78 @@
+#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/tests.v1.schema.json
+
+test_format = 1.0
+
+[default]
+
+ # ------------
+ # Tests to run
+ # ------------
+
+ # -------------------------------------------------------------------------------
+ # EVERYTHING PAST THIS POINT IS OPTIONAL AND MOST LIKELY UNNECESSARY FOR NEW APPS
+ #--------------------------------------------------------------------------------
+ ## Conventions in this sample:
+ ## <- An actual comment
+ # <- uncommenting this should be a valid entry in 'tests.toml'
+
+ ## NB: the tests to run are automatically deduced by the CI script according to the
+ ## content of the app's manifest. The declarations below allow to customize which
+ ## tests are ran, possibly add special test suite to test special args, or
+ ## declare which commits to test upgrade from.
+ ##
+ ## You can also decide (though this is discouraged!) to ban/ignore some tests,
+ ## The test IDs to be used in only/exclude statements are:
+ ## * install.root
+ ## * install.subdir
+ ## * install.nourl
+ ## * install.multi
+ ## * backup_restore
+ ## * upgrade
+ ## * upgrade.someCommitId
+ ## * change_url
+ ## NB: you should NOT need this except if you really have a good reason...
+
+ # exclude = ["install.private", "install.multi"]
+
+ ## For special usecases, sometimes you need to setup other things on the machine
+ ## prior to installing the app (such as installing another app)
+ ## (Remove this key entirely if not needed)
+
+ # preinstall = """
+ # sudo yunohost app install foobar
+ # sudo yunohost user list
+ # """
+
+ # -------------------------------
+ # Default args to use for install
+ # -------------------------------
+
+ ## By default, the CI will automagically fill the 'standard' args
+ ## such as domain, path, admin, is_public and password with relevant values
+ ## and also install args with a "default" provided in the manifest..
+ ## It should only make sense to declare custom args here for args with no default values
+ ## NB: you should NOT need those lines unless for custom questions with no obvious/default value
+
+ # args.language = "fr_FR"
+ # args.multisite = 0
+
+ # -------------------------------
+ # Commits to test upgrade from
+ # -------------------------------
+
+ ## 00a1a6e7 is part of commit SHA, preferrably from 'master' branch
+ ## that points to valid install of previous version
+
+ # test_upgrade_from.00a1a6e7.name = "Upgrade from 5.4"
+ # test_upgrade_from.00a1a6e7.args.foo = "bar"
+
+
+## This is an additional test suite
+# [some_additional_testsuite]
+
+ ## On additional tests suites, you can decide to run only specific tests
+
+ # only = ["install.subdir"]
+
+ # args.language = "en_GB"
+ # args.multisite = 1