From 3d99deb9aa92c78cccd82121b418bf2c1d50ec26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 14 Dec 2023 10:57:47 +0100 Subject: [PATCH 1/4] fix --- conf/systemd.service | 2 +- scripts/backup | 1 - scripts/install | 7 ------- scripts/remove | 3 --- scripts/restore | 2 -- scripts/upgrade | 3 --- 6 files changed, 1 insertion(+), 17 deletions(-) diff --git a/conf/systemd.service b/conf/systemd.service index e5c8a67..2585d6f 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -9,7 +9,7 @@ Group=__APP__ WorkingDirectory=__INSTALL_DIR__ Environment="__YNH_NODE_LOAD_PATH__" Environment="NODE_ENV=production" -ExecStart=__YNH_NPM__ start --prod +ExecStart=__YNH_NPM__ __INSTALL_DIR__/app.js --port=__PORT__ # Sandboxing options to harden security # Depending on specificities of your service/app, you may need to tweak these diff --git a/scripts/backup b/scripts/backup index 9ba4b32..d8e379f 100755 --- a/scripts/backup +++ b/scripts/backup @@ -6,7 +6,6 @@ # IMPORT GENERIC 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 diff --git a/scripts/install b/scripts/install index 79c7626..5061cd6 100755 --- a/scripts/install +++ b/scripts/install @@ -20,7 +20,6 @@ lastname=$(yunohost user list --fields lastname --output-as json | jq -r .users. #================================================= ynh_script_progression --message="Installing dependencies..." --weight=10 -# Install Nodejs ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version #================================================= @@ -30,7 +29,6 @@ ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version #================================================= ynh_script_progression --message="Setting up source files..." --weight=1 -# Download, check integrity, uncompress and patch the source from manifest.toml ynh_setup_source --dest_dir="$install_dir" chmod -R o-rwx "$install_dir" @@ -41,18 +39,14 @@ chown -R $app:www-data "$install_dir" #================================================= ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 -# Create a dedicated NGINX config using the conf/nginx.conf template ynh_add_nginx_config -# Create a dedicated systemd config ynh_add_systemd_config yunohost service add $app --description="Realtime kanban board for workgroups" --log="/var/log/$app/$app.log" -# Use logrotate to manage application logfile(s) ynh_use_logrotate -# Create a dedicated Fail2Ban config ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="^(.*) Invalid (email or username:|password!) (\"(.*)\"!)? ?\(IP: \)$" #================================================= @@ -85,7 +79,6 @@ popd #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -# Start a systemd service ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" #================================================= diff --git a/scripts/remove b/scripts/remove index fb0a78d..d51ce1c 100755 --- a/scripts/remove +++ b/scripts/remove @@ -16,9 +16,6 @@ source /usr/share/yunohost/helpers #================================================= ynh_script_progression --message="Removing system configurations related to $app..." --weight=1 -# This should be a symetric version of what happens in the install script - -# 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..." --weight=1 diff --git a/scripts/restore b/scripts/restore index f159c04..a031d7a 100755 --- a/scripts/restore +++ b/scripts/restore @@ -25,7 +25,6 @@ chown -R $app:www-data "$install_dir" #================================================= ynh_script_progression --message="Reinstalling dependencies..." --weight=6 -# Install Nodejs ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version #================================================= @@ -62,7 +61,6 @@ ynh_systemd_action --action=restart --service_name=fail2ban #================================================= ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1 -# Typically you only have either $app or php-fpm but not both at the same time... ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/upgrade b/scripts/upgrade index 1b1d924..692f010 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -28,7 +28,6 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading source files..." --weight=1 - # Download, check integrity, uncompress and patch the source from manifest.toml ynh_setup_source --dest_dir="$install_dir" --keep=".env" fi @@ -48,10 +47,8 @@ ynh_add_systemd_config yunohost service add $app --description="Realtime kanban board for workgroups" --log="/var/log/$app/$app.log" -# Use logrotate to manage application logfile(s) ynh_use_logrotate --non-append -# Create a dedicated Fail2Ban config ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="^(.*) Invalid (email or username:|password!) (\"(.*)\"!)? ?\(IP: \)$" #================================================= From 82fc4bf41e03df1a8e53ffe1ac97cc00d9c1dcf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 14 Dec 2023 11:23:37 +0100 Subject: [PATCH 2/4] Update systemd.service --- conf/systemd.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/systemd.service b/conf/systemd.service index 2585d6f..8f0411f 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -9,7 +9,7 @@ Group=__APP__ WorkingDirectory=__INSTALL_DIR__ Environment="__YNH_NODE_LOAD_PATH__" Environment="NODE_ENV=production" -ExecStart=__YNH_NPM__ __INSTALL_DIR__/app.js --port=__PORT__ +ExecStart=__YNH_NODE__ __INSTALL_DIR__/app.js --port=__PORT__ # Sandboxing options to harden security # Depending on specificities of your service/app, you may need to tweak these From 01f34019d42389993eab0c571a53954e1107cae4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 14 Dec 2023 11:30:21 +0100 Subject: [PATCH 3/4] Update manifest.toml --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 2804582..851f1b0 100644 --- a/manifest.toml +++ b/manifest.toml @@ -28,7 +28,7 @@ ldap = false sso = false disk = "50M" -ram.build = "50M" +ram.build = "500M" ram.runtime = "50M" [install] From 91cbdbb781c6a7f214638e2896bb0ff158108244 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 14 Dec 2023 11:41:42 +0100 Subject: [PATCH 4/4] Update nginx.conf --- conf/nginx.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 3e8a65e..137446b 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -8,7 +8,7 @@ location __PATH__/ { proxy_set_header Connection "upgrade"; } -location /socket.io/ { +location /.io/ { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://127.0.0.1:__PORT_SOCKET__/;