diff --git a/README.md b/README.md index ea71141..96cc823 100644 --- a/README.md +++ b/README.md @@ -14,8 +14,20 @@ Pterodactyl Panel 1. App can be installed by YunoHost **admin web-interface** or by **running following command**: $ sudo yunohost app install https://github.com/YunoHost-Apps/pterodactyl_ynh - 1. Admin username is : **root**. - + + After install : + + 1. Login in panel + 2. Create Location + 3. Create Node + 4. Copy configuration node for the core.json + 5. Edit the core.json + $ sudo nano /srv/daemon/config/core.json + 6. For SSL change folder location for SSL Certificate & SSL Key + $ /etc/yunohost/certs/yourDomain.tld/crt.pem = SSL Certificate + $ /etc/yunohost/certs/yourDomain.tld/key.pem = SSL Key + 7. Start wings service + $ sudo systemctl start wings ### Upgrade this package: diff --git a/conf/.env.example b/conf/.env.example index c6a8776..62629fe 100644 --- a/conf/.env.example +++ b/conf/.env.example @@ -28,4 +28,4 @@ MAIL_FROM=no-reply@example.com QUEUE_HIGH=high QUEUE_STANDARD=standard -QUEUE_LOW=low \ No newline at end of file +QUEUE_LOW=low diff --git a/conf/app.src b/conf/app.src index 1b75a46..e08075c 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/pterodactyl/panel/releases/download/v0.7.11/panel.tar.gz -SOURCE_SUM=98f6c763ebb269ac36fa445c614ba0c17d6231515c4cf542e4a382f86706fdad97931938f7cba70bf61c953c39741a26e41c617460f163045a3a94912c800030 +SOURCE_URL=https://github.com/pterodactyl/panel/releases/download/v0.7.12/panel.tar.gz +SOURCE_SUM=26973de471dc65a81ff1770b6f2d7116f534c1bdf9c2d3ce9494b714a106e7b57b1af70769c4c23d085a88fea89850ec7d53b0a05b1c390ada67ad2a3d3900bb SOURCE_SUM_PRG=sha512sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/conf/nginx.conf b/conf/nginx.conf index 45ea24b..9d3fc7f 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,20 +1,51 @@ root /var/www/pterodactyl/public/; +index index.php; -location ^~ __PATH__ { - alias __FINALPATH__/public/; + access_log /var/log/nginx/pterodactyl.app-access.log; + error_log /var/log/nginx/pterodactyl.app-error.log error; + + # allow larger file uploads and longer script runtimes + client_max_body_size 100m; + client_body_timeout 120s; + + sendfile off; + + # See https://hstspreload.org/ before uncommenting the line below. + # add_header Strict-Transport-Security "max-age=15768000; preload;"; + add_header X-Content-Type-Options nosniff; + add_header X-XSS-Protection "1; mode=block"; + add_header X-Robots-Tag none; + add_header Content-Security-Policy "frame-ancestors 'self'"; + add_header X-Frame-Options DENY; + add_header Referrer-Policy same-origin; + #add_header X-Frame-Options "ALLOW-FROM __DOMAIN__:8080"; + #add_header Access-Control-Allow-Origin "__DOMAIN__:8080"; + +location __PATH__ { try_files $uri $uri/ /index.php?$query_string; - index index.php index.htm index.html; # Force https if ($scheme = http) { rewrite ^ https://$server_name$request_uri? permanent; } - location ~ \.php { - fastcgi_split_path_info ^(.+?\.php)(/.*)$; - fastcgi_pass unix:/var/run/php/php7.2-fpm.sock; - fastcgi_index index.php; - include fastcgi_params; - fastcgi_param REMOTE_USER $remote_user; - fastcgi_param PATH_INFO $fastcgi_path_info; - fastcgi_param SCRIPT_FILENAME $request_filename; - } + +location ~ \.php$ { + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_pass unix:/run/php/php7.2-fpm.sock; + fastcgi_index index.php; + include fastcgi_params; + fastcgi_param PHP_VALUE "upload_max_filesize = 100M \n post_max_size=100M"; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param HTTP_PROXY ""; + fastcgi_intercept_errors off; + fastcgi_buffer_size 16k; + fastcgi_buffers 4 16k; + fastcgi_connect_timeout 300; + fastcgi_send_timeout 300; + fastcgi_read_timeout 300; + include /etc/nginx/fastcgi_params; + } + + location ~ /\.ht { + deny all; + } } diff --git a/manifest.json b/manifest.json index 4b2ac0f..0f8a6a4 100644 --- a/manifest.json +++ b/manifest.json @@ -53,16 +53,7 @@ }, "example": "johndoe" }, - - { - "name": "is_public", - "type": "boolean", - "ask": { - "en": "Is it a public site ?", - "fr": "Est-ce un site public ?" - }, - "default": "true" - }, + { "name": "password", "type": "password", @@ -75,7 +66,18 @@ "fr": "Utilisez le champ aide pour ajouter une information à l'intention de l'administrateur à propos de cette question." }, "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/scripts/install b/scripts/install index d5ab675..ee89a5a 100644 --- a/scripts/install +++ b/scripts/install @@ -69,6 +69,21 @@ 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 #============================================== @@ -128,6 +143,7 @@ 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 #================================================= # MODIFY A CONFIG FILE @@ -145,7 +161,6 @@ ynh_replace_string "yunodomain" "$domain" "$final_path/.env" #============================================== php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" -php -r "if (hash_file('sha384', 'composer-setup.php') === '93b54496392c062774670ac18b134c3b3a95e5a5e5c8f1a9f115f203b75bf9a129d5daa8ba6a13e2cc8a1da0806388a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" php composer-setup.php --install-dir=/usr/bin --filename=composer php -r "unlink('composer-setup.php');" @@ -191,7 +206,7 @@ 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.8/daemon.tar.gz | tar --strip-components=1 -xzv +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 @@ -203,7 +218,7 @@ popd ynh_add_systemd_config systemctl enable $app.service -#systemctl enable --now wings +systemctl enable wings.service #================================================= # ADVERTISE SERVICE IN ADMIN PANEL