From 2772f4fd23245318f33d7d19895905a55185b044 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Wed, 15 Jun 2022 02:10:40 +0200 Subject: [PATCH] Apply last example_ynh --- check_process | 3 +- conf/nginx.conf | 86 ++++++++++++++++++++++++------------------------- manifest.json | 24 +++++++------- scripts/install | 4 +-- scripts/restore | 14 ++++---- scripts/upgrade | 8 +++++ 6 files changed, 74 insertions(+), 65 deletions(-) diff --git a/check_process b/check_process index c66d406..9857c39 100644 --- a/check_process +++ b/check_process @@ -4,9 +4,10 @@ domain="domain.tld" version="14" oca=0 - admin_password="testpassw0rD" lang="en_US" tz="Etc/GMT" + admin="john" + admin_password="testpassw0rD" ; Checks pkg_linter=1 setup_sub_dir=0 diff --git a/conf/nginx.conf b/conf/nginx.conf index 7a361c9..6ffff73 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,51 +1,51 @@ location / { - if ($scheme = http) { - rewrite ^ https://$server_name$request_uri? permanent; - } - try_files $uri @__APP__; + try_files $uri @__APP__; } -location @__APP__ { - proxy_pass http://127.0.0.1:__PORT__; - - client_max_body_size 50M; - client_body_timeout 60m; - fastcgi_read_timeout 60m; - proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504; - proxy_buffers 16 64k; - proxy_buffer_size 128k; - proxy_redirect off; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Host $host; - proxy_read_timeout 720s; - proxy_connect_timeout 720s; - proxy_send_timeout 720s; +location @__APP__ { + proxy_pass http://127.0.0.1:__PORT__; + + client_max_body_size 50M; + client_body_timeout 60m; + fastcgi_read_timeout 60m; + + proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504; + proxy_buffers 16 64k; + proxy_buffer_size 128k; + proxy_redirect off; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Host $host; + proxy_read_timeout 720s; + proxy_connect_timeout 720s; + proxy_send_timeout 720s; } + location /longpolling { - proxy_pass http://127.0.0.1:__PORT_CHAT__; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Host $host; - proxy_read_timeout 720s; - proxy_connect_timeout 720s; - proxy_send_timeout 720s; + proxy_pass http://127.0.0.1:__PORT_CHAT__; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Host $host; + proxy_read_timeout 720s; + proxy_connect_timeout 720s; + proxy_send_timeout 720s; } + location ~* /web/static/ { - proxy_cache_valid 200 90m; - proxy_buffering on; - expires 864000; - proxy_pass http://127.0.0.1:__PORT__; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Host $host; - proxy_read_timeout 720s; - proxy_connect_timeout 720s; - proxy_send_timeout 720s; + proxy_cache_valid 200 90m; + proxy_buffering on; + expires 864000; + proxy_pass http://127.0.0.1:__PORT__; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Host $host; + proxy_read_timeout 720s; + proxy_connect_timeout 720s; + proxy_send_timeout 720s; } diff --git a/manifest.json b/manifest.json index 38d53c0..ffb0119 100644 --- a/manifest.json +++ b/manifest.json @@ -37,10 +37,6 @@ "name": "domain", "type": "domain" }, - { - "name": "admin", - "type": "user" - }, { "name": "version", "type": "string", @@ -60,14 +56,6 @@ "fr": "Désirez vous installer OCA à la place des sources de LibreERP (pas encore implémenté)" } }, - { - "name": "admin_password", - "type": "password", - "ask": { - "en": "Choose a strong master admin password", - "fr": "Choisissez un mot de passe maître fort pour l'administration" - } - }, { "name": "lang", "type": "string", @@ -86,6 +74,18 @@ "fr": "Choisissez un fuseau horaire" }, "default": "Etc/UTC" + }, + { + "name": "admin", + "type": "user" + }, + { + "name": "admin_password", + "type": "password", + "ask": { + "en": "Choose a strong master admin password", + "fr": "Choisissez un mot de passe maître fort pour l'administration" + } } ] } diff --git a/scripts/install b/scripts/install index e37aba6..6092822 100644 --- a/scripts/install +++ b/scripts/install @@ -25,12 +25,12 @@ ynh_abort_if_errors domain=$YNH_APP_ARG_DOMAIN path_url="/" -admin=$YNH_APP_ARG_ADMIN export app_version=$YNH_APP_ARG_VERSION oca=$YNH_APP_ARG_OCA -admin_password=$YNH_APP_ARG_ADMIN_PASSWORD lang=$YNH_APP_ARG_LANG tz=$YNH_APP_ARG_TZ +admin=$YNH_APP_ARG_ADMIN +admin_password=$YNH_APP_ARG_ADMIN_PASSWORD export app=$YNH_APP_INSTANCE_NAME diff --git a/scripts/restore b/scripts/restore index 2effee2..e76377d 100644 --- a/scripts/restore +++ b/scripts/restore @@ -57,13 +57,6 @@ test ! -d $final_path \ #================================================= # STANDARD RESTORATION STEPS -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the NGINX web server configuration..." - -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" - #================================================= # RECREATE THE DEDICATED USER #================================================= @@ -95,6 +88,13 @@ ynh_script_progression --message="Reinstalling dependencies..." # Define and install dependencies ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies +#================================================= +# RESTORE THE NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Restoring the NGINX web server configuration..." + +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" + #================================================= # ADD SWAP #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index bd9ae58..f7c3c0b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -100,6 +100,14 @@ ynh_script_progression --message="Upgrading dependencies..." ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies +#================================================= +# NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Upgrading NGINX web server configuration..." + +# Create a dedicated NGINX config +ynh_add_nginx_config + #================================================= # SPECIFIC UPGRADE #=================================================