More fixes
This commit is contained in:
parent
fb8772892e
commit
4be58c54bb
15 changed files with 318 additions and 190 deletions
|
@ -11,7 +11,7 @@ If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to
|
|||
## Overview
|
||||
Pterodactyl is the open-source game server management panel built with PHP7, Nodejs, and Go. Designed with security in mind, Pterodactyl runs all game servers in isolated Docker containers while exposing a beautiful and intuitive UI to administrators and users. Stop wasting time fiddling with other systems — make game servers a first class citizen on your platform.
|
||||
|
||||
**Shipped version:** 0.7.17
|
||||
**Shipped version:** 1.2.2
|
||||
|
||||
## Screenshots
|
||||
|
||||
|
@ -76,8 +76,8 @@ As Pterodactyl do not support LDAP for now [#594](https://github.com/pterodactyl
|
|||
|
||||
---
|
||||
|
||||
Developers info
|
||||
----------------
|
||||
## Developers info
|
||||
|
||||
Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/pterodactyl_ynh/tree/testing).
|
||||
|
||||
To try the testing branch, please proceed like that.
|
||||
|
|
18
README_fr.md
18
README_fr.md
|
@ -1,7 +1,7 @@
|
|||
# Pterodactyl Panel pour Yunohost
|
||||
|
||||
![](https://ci-apps.yunohost.org/ci/badges/pterodactyl.maintain.svg) ![](https://ci-apps.yunohost.org/ci/badges/pterodactyl.status.svg) [![Integration level](https://dash.yunohost.org/integration/pterodactyl.svg)](https://dash.yunohost.org/appci/app/pterodactyl)
|
||||
[![Install Pterodactyl with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=pterodactyl)
|
||||
[![Install Pterodactyl with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=pterodactyl)
|
||||
|
||||
*[Read this README in English.](./README.md)*
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
|||
Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
|
||||
|
||||
|
||||
**Version de Pterodactyl** : 0.7.17
|
||||
**Version de Pterodactyl** : 1.2.2
|
||||
|
||||
## Screenshots
|
||||
|
||||
|
@ -34,12 +34,12 @@ Après l'installation:
|
|||
3. Créez un node
|
||||
4. Copiez la configuration (core.json) pour le node créé en 3.
|
||||
5. Modifiez core.json
|
||||
```$ sudo nano /srv/daemon/config/core.json```
|
||||
`$ sudo nano /srv/daemon/config/core.json`
|
||||
6. Modifiez les chemins des certificats SSL Yunohost.
|
||||
```$ /etc/yunohost/certs/yourDomain.tld/crt.pem = SSL Certificate
|
||||
$ /etc/yunohost/certs/yourDomain.tld/key.pem = SSL Key```
|
||||
`$ /etc/yunohost/certs/yourDomain.tld/crt.pem = SSL Certificate
|
||||
$ /etc/yunohost/certs/yourDomain.tld/key.pem = SSL Key`
|
||||
7. Démarrez le service Wings
|
||||
```$ sudo systemctl start wings```
|
||||
`$ sudo systemctl start wings`
|
||||
|
||||
### Mettre à jour:
|
||||
|
||||
|
@ -57,7 +57,7 @@ Pterodactyl ne supporte pas le LDAP pour l'instant [#594](https://github.com/pte
|
|||
|
||||
#### Architectures supportées
|
||||
|
||||
* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/pterodactyl%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/pterodactyl/)
|
||||
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/pterodactyl%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/pterodactyl/)
|
||||
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/pterodactyl%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/pterodactyl/)
|
||||
|
||||
## Limitations
|
||||
|
@ -74,8 +74,8 @@ Pterodactyl ne supporte pas le LDAP pour l'instant [#594](https://github.com/pte
|
|||
|
||||
---
|
||||
|
||||
Developers info
|
||||
----------------
|
||||
## Developers info
|
||||
|
||||
Merci de faire vos PR sur la branche [testing](https://github.com/YunoHost-Apps/pterodactyl_ynh/tree/testing).
|
||||
|
||||
Pour essayer la branche testing, effectuez ces commandes :
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
# See here for more informations
|
||||
# https://github.com/YunoHost/package_check#syntax-check_process-file
|
||||
|
||||
# Move this file from check_process.default to check_process when you have filled it.
|
||||
|
||||
;; Test complet
|
||||
; Manifest
|
||||
domain="domain.tld" (DOMAIN)
|
||||
path="/pterodactyl" (PATH)
|
||||
is_public=1 (PUBLIC|public=1|private=0)
|
||||
language="fr"
|
||||
password="pass"
|
||||
admin="john" (USER)
|
||||
port="9980" (PORT)
|
||||
|
@ -26,3 +25,8 @@
|
|||
;;; Options
|
||||
Email=
|
||||
Notification=none
|
||||
;;; Upgrade options
|
||||
; commit=CommitHash
|
||||
name=Name and date of the commit.
|
||||
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666&
|
||||
|
||||
|
|
|
@ -7,20 +7,20 @@ APP_CLEAR_TASKLOG=720
|
|||
APP_DELETE_MINUTES=10
|
||||
APP_ENVIRONMENT_ONLY=true
|
||||
LOG_CHANNEL=daily
|
||||
APP_LOCALE=en
|
||||
APP_LOCALE=__LANGUAGE__
|
||||
|
||||
DB_HOST=127.0.0.1
|
||||
DB_PORT=3306
|
||||
DB_DATABASE=__DB_NAME__
|
||||
DB_USERNAME=__DB_USER__
|
||||
DB_USERNAME=__DB_NAME__
|
||||
DB_PASSWORD=__DB_PWD__
|
||||
|
||||
HASHIDS_SALT=
|
||||
HASHIDS_LENGTH=8
|
||||
|
||||
MAIL_DRIVER=smtp
|
||||
MAIL_HOST=mailtrap.io
|
||||
MAIL_PORT=2525
|
||||
MAIL_HOST=smtp.example.com
|
||||
MAIL_PORT=25
|
||||
MAIL_USERNAME=
|
||||
MAIL_PASSWORD=
|
||||
MAIL_ENCRYPTION=tls
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
SOURCE_URL=https://github.com/pterodactyl/panel/releases/download/v0.7.17/panel.tar.gz
|
||||
SOURCE_SUM=b3e37e5cf34b3fbcec73cab8947300dd55f1ba289a83501c76f198dd4e6c3750
|
||||
SOURCE_URL=https://github.com/pterodactyl/panel/releases/download/v1.2.2/panel.tar.gz
|
||||
SOURCE_SUM=e03a532623a62adf36c4b2769a90ed0a38954af1645d453bee0e470651e9aaf2
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=tar.gz
|
||||
SOURCE_IN_SUBDIR=true
|
||||
|
|
1
conf/cron
Normal file
1
conf/cron
Normal file
|
@ -0,0 +1 @@
|
|||
* * * * * php__PHPVERSION__ __FINALPATH__/artisan schedule:run >> /dev/null 2>&1
|
|
@ -1,4 +1,4 @@
|
|||
root /var/www/pterodactyl/public/;
|
||||
root __FINALPATH__/public/;
|
||||
index index.php;
|
||||
|
||||
access_log /var/log/nginx/pterodactyl.app-access.log;
|
||||
|
@ -21,7 +21,7 @@ index index.php;
|
|||
#add_header X-Frame-Options "ALLOW-FROM __DOMAIN__:8080";
|
||||
#add_header Access-Control-Allow-Origin "__DOMAIN__:8080";
|
||||
|
||||
location __PATH__ {
|
||||
location __PATH__/ {
|
||||
try_files $uri $uri/ /index.php?$query_string;
|
||||
# Force https
|
||||
if ($scheme = http) {
|
||||
|
|
|
@ -3,8 +3,8 @@ Description=Pterodactyl Wings Daemon
|
|||
After=docker.service
|
||||
|
||||
[Service]
|
||||
User=root
|
||||
#Group=some_group
|
||||
User=__APP__
|
||||
#Group__APP__
|
||||
WorkingDirectory=/srv/daemon
|
||||
LimitNOFILE=4096
|
||||
PIDFile=/var/run/wings/daemon.pid
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"en": "Gameserver management panel (Minecraft, ARK, Rust,...)",
|
||||
"fr": "Panel de gestion de serveurs de jeux (Minecraft, ARK, Rust,...)"
|
||||
},
|
||||
"version": "0.7.17~ynh1",
|
||||
"version": "1.2.2~ynh1",
|
||||
"url": "https://pterodactyl.io/",
|
||||
"license": "MIT",
|
||||
"maintainer": {
|
||||
|
@ -51,6 +51,16 @@
|
|||
},
|
||||
"example": "johndoe"
|
||||
},
|
||||
{
|
||||
"name": "language",
|
||||
"type": "string",
|
||||
"ask": {
|
||||
"en": "Choose the application language",
|
||||
"fr": "Choisissez la langue de l'application"
|
||||
},
|
||||
"choices": ["fr", "en"],
|
||||
"default": "fr"
|
||||
},
|
||||
{
|
||||
"name": "password",
|
||||
"type": "password",
|
||||
|
|
|
@ -6,9 +6,11 @@
|
|||
|
||||
YNH_PHP_VERSION=7.3
|
||||
|
||||
nodejs_version=14
|
||||
|
||||
extra_php_dependencies="php${YNH_PHP_VERSION}-igbinary php${YNH_PHP_VERSION}-memcached php${YNH_PHP_VERSION}-msgpack php${YNH_PHP_VERSION}-xdebug php${YNH_PHP_VERSION}-bcmath php7.2-cli php${YNH_PHP_VERSION}-common php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-fpm php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-opcache php${YNH_PHP_VERSION}-readline php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-zip"
|
||||
|
||||
pkg_dependencies="libargon2-1 libsodium23 libzip5 memcached"
|
||||
pkg_dependencies="libargon2-1 libsodium23 libzip5 memcached apt-transport-https ca-certificates curl gnupg2 software-properties-common zip unzip tar make gcc g++ python curl gnupg"
|
||||
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -38,11 +38,6 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
|||
#=================================================
|
||||
ynh_print_info --message="Declaring files to be backed up..."
|
||||
|
||||
### N.B. : the following 'ynh_backup' calls are only a *declaration* of what needs
|
||||
### to be backuped and not an actual copy of any file. The actual backup that
|
||||
### creates and fill the archive with the files happens in the core after this
|
||||
### script is called. Hence ynh_backups calls takes basically 0 seconds to run.
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE APP MAIN DIR
|
||||
#=================================================
|
||||
|
@ -61,43 +56,25 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
|||
|
||||
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# BACKUP FAIL2BAN CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf"
|
||||
ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC BACKUP
|
||||
#=================================================
|
||||
# BACKUP LOGROTATE
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/etc/logrotate.d/$app"
|
||||
|
||||
#=================================================
|
||||
# BACKUP SYSTEMD
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
||||
|
||||
ynh_backup --src_path="/etc/systemd/system/wings.service"
|
||||
|
||||
#=================================================
|
||||
# BACKUP VARIOUS FILES
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/etc/cron.d/$app"
|
||||
|
||||
ynh_backup --src_path="/etc/$app/"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE MYSQL DATABASE
|
||||
#=================================================
|
||||
ynh_print_info --message="Backing up the MySQL database..."
|
||||
|
||||
### (However, things like MySQL dumps *do* take some time to run, though the
|
||||
### copy of the generated dump to the archive still happens later)
|
||||
|
||||
ynh_mysql_dump_db --database="$db_name" > db.sql
|
||||
|
||||
#=================================================
|
||||
|
|
110
scripts/install
110
scripts/install
|
@ -28,6 +28,7 @@ ynh_abort_if_errors
|
|||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path_url=$YNH_APP_ARG_PATH
|
||||
admin=$YNH_APP_ARG_ADMIN
|
||||
language=$YNH_APP_ARG_LANGUAGE
|
||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
password=$YNH_APP_ARG_PASSWORD
|
||||
email=$(ynh_user_get_info --username=$admin --key=mail)
|
||||
|
@ -37,7 +38,7 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
#=================================================
|
||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Validating installation parameters..." --time --weight=1
|
||||
ynh_script_progression --message="Validating installation parameters..." --weight=1
|
||||
|
||||
final_path=/var/www/$app
|
||||
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
||||
|
@ -52,6 +53,7 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
|||
ynh_app_setting_set --app=$app --key=domain --value=$domain
|
||||
ynh_app_setting_set --app=$app --key=path --value=$path_url
|
||||
ynh_app_setting_set --app=$app --key=admin --value=$admin
|
||||
ynh_app_setting_set --app=$app --key=language --value=$language
|
||||
|
||||
#=================================================
|
||||
# FIND AND OPEN A PORT
|
||||
|
@ -67,6 +69,9 @@ ynh_app_setting_set --app=$app --key=port --value=$port
|
|||
#=================================================
|
||||
ynh_script_progression --message="Installing dependencies..." --weight=1
|
||||
|
||||
# Install Nodejs
|
||||
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
|
@ -91,7 +96,7 @@ ynh_setup_source --dest_dir="$final_path"
|
|||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring NGINX web server..." --time --weight=1
|
||||
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
@ -99,30 +104,26 @@ ynh_add_nginx_config
|
|||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring system user..." --time --weight=1
|
||||
ynh_script_progression --message="Configuring system user..." --weight=1
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create --username=$app
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
# PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring PHP-FPM..." --weight=1
|
||||
|
||||
# setup application config
|
||||
cp -a ../conf/.env $final_path/.env
|
||||
|
||||
cp -a ../conf/wings.service /etc/systemd/system/wings.service
|
||||
# Create a dedicated PHP-FPM config
|
||||
ynh_add_fpm_config
|
||||
|
||||
#=================================================
|
||||
# MODIFY A CONFIG FILE
|
||||
#=================================================
|
||||
|
||||
#ynh_replace_string "random_key" "$random_key" "$final_path/.env"
|
||||
ynh_replace_string "__DB_USER__" "$db_name" "$final_path/.env"
|
||||
ynh_replace_string "__DB_PASS__" "$db_pwd" "$final_path/.env"
|
||||
ynh_replace_string "__DB_NAME__" "$db_name" "$final_path/.env"
|
||||
#ynh_replace_string "yunomail" "$email" "$final_path/.env"
|
||||
#ynh_replace_string "yunodomain" "$domain" "$final_path/.env"
|
||||
ynh_add_config --template="../conf/.env" --destination="$final_path/.env"
|
||||
|
||||
ynh_add_config --template="../conf/wings.service" --destination="/etc/systemd/system/wings.service"
|
||||
|
||||
#==============================================
|
||||
# INSTALL Composer
|
||||
|
@ -136,26 +137,29 @@ ynh_install_composer
|
|||
|
||||
pushd $final_path
|
||||
chmod -R 755 storage/* bootstrap/cache
|
||||
composer install --no-progress
|
||||
#composer install --no-progress
|
||||
composer install --no-dev --optimize-autoloader
|
||||
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 p:environment:setup
|
||||
php artisan p:environment:database
|
||||
php artisan migrate --seed --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 Docker
|
||||
#==============================================
|
||||
|
||||
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 enable docker --quiet
|
||||
systemctl start docker
|
||||
|
||||
#==============================================
|
||||
|
@ -165,12 +169,10 @@ systemctl start docker
|
|||
mkdir -p /srv/daemon /srv/daemon-data
|
||||
pushd /srv/daemon
|
||||
|
||||
ynh_install_nodejs --nodejs_version=10
|
||||
ynh_package_install make gcc g++
|
||||
|
||||
ynh_package_install make gcc g++
|
||||
|
||||
ynh_setup_source --dest_dir=/srv/daemon --source_id=daemon.src
|
||||
npm install --only=production
|
||||
ynh_setup_source --dest_dir=/srv/daemon --source_id=daemon.src
|
||||
npm install --only=production
|
||||
|
||||
#C'est bien dit dans la doc, ne surtout pas utiliser npm audit fix -_-
|
||||
#npm audit fix
|
||||
|
@ -182,25 +184,41 @@ popd
|
|||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring a systemd service..." --weight=1
|
||||
|
||||
ynh_add_systemd_config
|
||||
systemctl enable $app.service
|
||||
systemctl enable wings.service
|
||||
|
||||
#=================================================
|
||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||
#=================================================
|
||||
|
||||
mkdir -p /var/log/pterodactyl/
|
||||
mkdir -p /var/log/$app/
|
||||
touch /var/log/$app/$app-prod.log
|
||||
yunohost service add $app --log "/var/log/$app/$app-prod.log"
|
||||
yunohost service add wings
|
||||
|
||||
#==============================================
|
||||
# Cron
|
||||
#==============================================
|
||||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config
|
||||
|
||||
crontab -l | { cat; echo "* * * * * php $final_path/artisan schedule:run" ; } | crontab -
|
||||
# Create systemd service for wings
|
||||
ynh_add_systemd_config --service=wings --template=wings.service
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||
|
||||
# Start a systemd service
|
||||
ynh_systemd_action --service_name=$app --action=start --log_path="/var/log/$app/$app.log"
|
||||
# Start a systemd service
|
||||
ynh_systemd_action --service_name=wings --action=start --log_path="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=2
|
||||
|
||||
yunohost service add $app --description="Pterodactyl Queue Worker" --log="/var/log/$app/$app-prod.log"
|
||||
yunohost service add wings --description="Pterodactyl Queue Worker"
|
||||
|
||||
#=================================================
|
||||
# SETUP A CRON
|
||||
#=================================================
|
||||
ynh_script_progression --message="Setuping a cron..."
|
||||
|
||||
ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
|
@ -209,25 +227,23 @@ crontab -l | { cat; echo "* * * * * php $final_path/artisan schedule:run" ; } |
|
|||
#=================================================
|
||||
|
||||
# Set permissions to app files
|
||||
chown -R www-data:www-data $final_path
|
||||
chown -R $app: $final_path
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring permissions..." --time --weight=1
|
||||
ynh_script_progression --message="Configuring permissions..." --weight=1
|
||||
|
||||
# Make app public if necessary
|
||||
if [ $is_public -eq 1 ]
|
||||
then
|
||||
# Everyone can access the app.
|
||||
# The "main" permission is automatically created before the install script.
|
||||
ynh_permission_update --permission="main" --add="visitors"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..." --time --weight=1
|
||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
|
@ -235,4 +251,4 @@ ynh_systemd_action --service_name=nginx --action=reload
|
|||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Installation of $app completed" --time --last
|
||||
ynh_script_progression --message="Installation of $app completed" --last
|
||||
|
|
|
@ -12,100 +12,101 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..." --time --weight=1
|
||||
|
||||
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)
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$db_name
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
|
||||
#=================================================
|
||||
# STANDARD REMOVE
|
||||
#=================================================
|
||||
# REMOVE SERVICE INTEGRATION IN YUNOHOST
|
||||
#=================================================
|
||||
|
||||
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
||||
if ynh_exec_warn_less yunohost service status $app >/dev/null
|
||||
then
|
||||
ynh_script_progression --message="Removing $app service integration..." --time --weight=1
|
||||
yunohost service remove $app
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# STOP AND REMOVE SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Stopping and removing the systemd service..." --time --weight=1
|
||||
|
||||
# Remove the dedicated systemd config
|
||||
ynh_remove_systemd_config
|
||||
ynh_remove_systemd_config --service=wings
|
||||
|
||||
#=================================================
|
||||
# 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
|
||||
fi
|
||||
if yunohost service status wings
|
||||
then
|
||||
echo "Remove wings service"
|
||||
yunohost service remove wings
|
||||
fi
|
||||
#=================================================
|
||||
# REMOVE THE MYSQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing the MySQL database..." --time --weight=1
|
||||
|
||||
# Remove a database if it exists, along with the associated user
|
||||
ynh_mysql_remove_db $db_user $db_name
|
||||
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
|
||||
|
||||
#=================================================
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing dependencies..." --time --weight=1
|
||||
|
||||
# Remove metapackage and its dependencies
|
||||
ynh_remove_app_dependencies
|
||||
|
||||
#=================================================
|
||||
# REMOVE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing app main directory..." --time --weight=1
|
||||
|
||||
# Remove the app directory securely
|
||||
ynh_secure_remove "$final_path"
|
||||
ynh_secure_remove "/srv/daemon"
|
||||
ynh_secure_remove --file="$final_path"
|
||||
|
||||
#=================================================
|
||||
# REMOVE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing NGINX web server configuration..." --time --weight=1
|
||||
|
||||
# Remove the dedicated nginx config
|
||||
# Remove the dedicated NGINX config
|
||||
ynh_remove_nginx_config
|
||||
|
||||
#=================================================
|
||||
# REMOVE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing PHP-FPM configuration..." --time --weight=1
|
||||
|
||||
# Remove the dedicated php-fpm config
|
||||
# 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 VARIOUS FILES
|
||||
#=================================================
|
||||
|
||||
# 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"
|
||||
ynh_secure_remove --file="/etc/cron.d/$app"
|
||||
|
||||
# Remove the log files
|
||||
ynh_secure_remove "/var/log/$app/"
|
||||
ynh_secure_remove --file="/var/log/$app/"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# REMOVE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing the dedicated system user..." --time --weight=1
|
||||
|
||||
# Delete a system user
|
||||
ynh_system_user_delete $app
|
||||
ynh_system_user_delete --username=$app
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Removal of $app completed" --time --last
|
||||
|
|
190
scripts/restore
190
scripts/restore
|
@ -1,52 +1,162 @@
|
|||
#!/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.
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
# 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
|
||||
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||
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)
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
# Check domain/path availability
|
||||
sudo yunohost app checkurl "${domain}${path_url}" -a "$app" \
|
||||
|| ynh_die "Path not available: ${domain}${path_url}"
|
||||
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
|
||||
|
||||
# Restore sources & data
|
||||
src_path="/var/www/${app}"
|
||||
sudo cp -a ./sources "$src_path"
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..." --time --weight=1
|
||||
|
||||
# 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"
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
### 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 ###
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$db_name
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
|
||||
# Restore NGINX configuration
|
||||
sudo cp -a ./nginx.conf "/etc/nginx/conf.d/${domain}.d/${app}.conf"
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE RESTORED
|
||||
#=================================================
|
||||
ynh_script_progression --message="Validating restoration parameters..." --time --weight=1
|
||||
|
||||
### 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_webpath_available --domain=$domain --path_url=$path_url \
|
||||
|| ynh_die --message="Path not available: ${domain}${path_url}"
|
||||
test ! -d $final_path \
|
||||
|| ynh_die --message="There is already a directory: $final_path "
|
||||
|
||||
# Restart webserver
|
||||
sudo service nginx reload
|
||||
#=================================================
|
||||
# STANDARD RESTORATION STEPS
|
||||
#=================================================
|
||||
# RESTORE THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the app main directory..." --time --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="$final_path"
|
||||
|
||||
#=================================================
|
||||
# RECREATE THE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Recreating the dedicated system user..." --time --weight=1
|
||||
|
||||
# Create the dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app
|
||||
|
||||
#=================================================
|
||||
# RESTORE USER RIGHTS
|
||||
#=================================================
|
||||
|
||||
# Restore permissions on app files
|
||||
chown -R root: $final_path
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# RESTORE FAIL2BAN CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the Fail2Ban configuration..." --time --weight=1
|
||||
|
||||
ynh_restore_file "/etc/fail2ban/jail.d/$app.conf"
|
||||
ynh_restore_file "/etc/fail2ban/filter.d/$app.conf"
|
||||
ynh_systemd_action --action=restart --service_name=fail2ban
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC RESTORATION
|
||||
#=================================================
|
||||
# REINSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reinstalling dependencies..." --time --weight=1
|
||||
|
||||
# Define and install dependencies
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE MYSQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the MySQL database..." --time --weight=1
|
||||
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
|
||||
|
||||
#=================================================
|
||||
# RESTORE SYSTEMD
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the systemd configuration..." --time --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
||||
systemctl enable $app.service --quiet
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..." --time --weight=1
|
||||
|
||||
yunohost service add $app --description="A short description of the app" --log="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --time --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# RESTORE VARIOUS FILES
|
||||
#=================================================
|
||||
|
||||
ynh_restore_file --origin_path="/etc/cron.d/$app"
|
||||
|
||||
ynh_restore_file --origin_path="/etc/$app/"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE LOGROTATE CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# RELOAD NGINX AND PHP-FPM
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --time --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Restoration completed for $app" --time --last
|
||||
|
|
|
@ -56,6 +56,13 @@ if [ -z "$final_path" ]; then
|
|||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||
fi
|
||||
|
||||
# Cleaning legacy permissions
|
||||
if ynh_legacy_permissions_exists; then
|
||||
ynh_legacy_permissions_delete_all
|
||||
|
||||
ynh_app_setting_delete --app=$app --key=is_public
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
|
@ -77,7 +84,7 @@ ynh_abort_if_errors
|
|||
#=================================================
|
||||
ynh_script_progression --message="Stopping a systemd service..." --time --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
|
||||
ynh_systemd_action --service_name=$app --action=stop --log_path="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
|
@ -105,8 +112,8 @@ ynh_add_nginx_config
|
|||
ynh_script_progression --message="Upgrading dependencies..." --time --weight=1
|
||||
|
||||
pushd $final_path
|
||||
chmod -R 755 storage/* bootstrap/cache
|
||||
composer install --no-dev --optimize-autoloader
|
||||
chmod -R 755 storage/* bootstrap/cache
|
||||
composer install --no-dev --optimize-autoloader
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
|
@ -132,10 +139,10 @@ ynh_add_fpm_config
|
|||
#=================================================
|
||||
|
||||
pushd $final_path
|
||||
php artisan view:clear
|
||||
php artisan config:clear
|
||||
php artisan migrate --force
|
||||
php artisan db:seed --force
|
||||
php artisan view:clear
|
||||
php artisan config:clear
|
||||
php artisan migrate --force
|
||||
php artisan db:seed --force
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
|
@ -153,7 +160,7 @@ ynh_add_systemd_config
|
|||
#=================================================
|
||||
|
||||
# Set permissions on app files
|
||||
chown -R root: $final_path
|
||||
chown -R $app: $final_path
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
|
|
Loading…
Reference in a new issue