From 7d303ae2158fbda2a039a50d5c515a385115ffd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 25 Feb 2024 12:24:40 +0100 Subject: [PATCH 1/5] Update config.json --- conf/config.json | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/conf/config.json b/conf/config.json index cfc7162..392a834 100644 --- a/conf/config.json +++ b/conf/config.json @@ -1,23 +1,10 @@ { - // IRC server settings. "server": { - // WebSocket URL or path to connect to (string). "url": "/?server=/webirc/websocket/", - // Channel(s) to auto-join (string or array of strings). "autojoin": "#yunohost", - // Controls how the password UI is presented to the user. Set to - // "mandatory" to require a password, "optional" to accept one but not - // require it, "disabled" to never ask for a password, or "external" to - // use SASL EXTERNAL. Defaults to "optional". "auth": "optional", - // Default nickname (string). "nick": "asdf", - // Don't display the login UI, immediately connect to the server - // (boolean). "autoconnect": true, - // Interval in seconds to send PING commands (number). Set to 0 to - // disable. Enabling PINGs can have an impact on client power usage and - // should only be enabled if necessary. "ping": 60 } } \ No newline at end of file From f9362bb33a87e4528fb5dfc1abcc84146c9ce76b Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 2 Mar 2024 08:52:38 +0100 Subject: [PATCH 2/5] cleaning --- manifest.toml | 3 +++ scripts/_common.sh | 2 +- scripts/backup | 8 -------- scripts/change_url | 8 ++++---- scripts/install | 5 ++--- scripts/remove | 25 ------------------------- scripts/restore | 26 ++------------------------ scripts/upgrade | 13 ++++--------- 8 files changed, 16 insertions(+), 74 deletions(-) diff --git a/manifest.toml b/manifest.toml index 52c1172..5360338 100644 --- a/manifest.toml +++ b/manifest.toml @@ -19,8 +19,11 @@ code = "https://sr.ht/~emersion/gamja/" yunohost = ">= 11.2" architectures = "all" multi_instance = true + ldap = false + sso = true + disk = "50M" ram.build = "50M" ram.runtime = "50M" diff --git a/scripts/_common.sh b/scripts/_common.sh index 9ecc68b..80c93db 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,8 +4,8 @@ # COMMON VARIABLES #================================================= -# dependencies used by the app nodejs_version=20 + go_version=1.20 #================================================= diff --git a/scripts/backup b/scripts/backup index 0ae9c52..6d2e59e 100755 --- a/scripts/backup +++ b/scripts/backup @@ -27,16 +27,8 @@ ynh_backup --src_path="$install_dir" ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# BACKUP SYSTEMD -#================================================= - ynh_backup --src_path="/etc/systemd/system/$app.service" -#================================================= -# BACKUP VARIOUS FILES -#================================================= - ynh_backup --src_path="$webircgateway_path" #================================================= diff --git a/scripts/change_url b/scripts/change_url index 2c672a1..bac16b2 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -14,14 +14,14 @@ source /usr/share/yunohost/helpers #================================================= # STOP SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Stopping a systemd service..." --time --weight=1 +ynh_script_progression --message="Stopping a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_script_progression --message="Updating NGINX web server configuration..." --time --weight=1 +ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1 ynh_change_url_nginx_config @@ -30,7 +30,7 @@ ynh_change_url_nginx_config #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --time --weight=1 +ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Using config" @@ -38,4 +38,4 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --l # END OF SCRIPT #================================================= -ynh_script_progression --message="Change of URL completed for $app" --time --last +ynh_script_progression --message="Change of URL completed for $app" --last diff --git a/scripts/install b/scripts/install index 67b0427..f96efee 100755 --- a/scripts/install +++ b/scripts/install @@ -13,7 +13,7 @@ source /usr/share/yunohost/helpers #================================================= # INSTALL DEPENDENCIES #================================================= -#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=7 +ynh_script_progression --message="Installing dependencies..." --weight=7 ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version ynh_exec_warn_less ynh_install_go --go_version=$go_version @@ -23,7 +23,6 @@ ynh_exec_warn_less ynh_install_go --go_version=$go_version #================================================= ynh_script_progression --message="Setting up source files..." --weight=5 -# Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir" chmod -R o-rwx "$install_dir" @@ -55,7 +54,7 @@ popd #================================================= ynh_script_progression --message="Adding a configuration file..." --weight=2 -ynh_add_config --template="../conf/config.json" --destination="$install_dir/config.json" +ynh_add_config --template="config.json" --destination="$install_dir/config.json" chmod 744 "$install_dir/config.json" chown $app:www-data "$install_dir/config.json" diff --git a/scripts/remove b/scripts/remove index 187ea4e..65033e5 100755 --- a/scripts/remove +++ b/scripts/remove @@ -22,37 +22,12 @@ then yunohost service remove $app fi -#================================================= -# STOP AND REMOVE SERVICE -#================================================= -ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1 - -# Remove the dedicated systemd config ynh_remove_systemd_config -#================================================= -# REMOVE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 - -# Remove the dedicated NGINX config ynh_remove_nginx_config -#================================================= -# REMOVE DEPENDENCIES -#================================================= -ynh_script_progression --message="Removing dependencies..." --weight=1 - -# Remove metapackage and its dependencies ynh_remove_nodejs -#================================================= -# SPECIFIC REMOVE -#================================================= -# REMOVE VARIOUS FILES -#================================================= -ynh_script_progression --message="Removing various files..." - ynh_secure_remove --file="$webircgateway_path" #================================================= diff --git a/scripts/restore b/scripts/restore index 7c563e0..7ebdba1 100755 --- a/scripts/restore +++ b/scripts/restore @@ -23,7 +23,7 @@ chown -R $app:www-data "$install_dir" #================================================= # REINSTALL DEPENDENCIES #================================================= -#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." --weight=7 +ynh_script_progression --message="Reinstalling dependencies..." --weight=7 ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version @@ -34,27 +34,12 @@ ynh_script_progression --message="Restoring the NGINX web server configuration.. ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# RESTORE VARIOUS FILES -#================================================= -ynh_script_progression --message="Restoring various files..." - ynh_restore_file --origin_path="$webircgateway_path" -#================================================= -# RESTORE SYSTEMD -#================================================= -ynh_script_progression --message="Restoring the systemd configuration..." --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..." --weight=1 - -yunohost service add $app --description="Simple IRC web client" +yunohost service add $app --description="Simple IRC web client" --log="/var/log/$app/$app.log" #================================================= # START SYSTEMD SERVICE @@ -63,13 +48,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Using config" -#================================================= -# GENERIC FINALIZATION -#================================================= -# RELOAD NGINX AND PHP-FPM -#================================================= -ynh_script_progression --message="Reloading NGINX web server.." --weight=1 - ynh_systemd_action --service_name=nginx --action=reload #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 4fff87f..0c640e9 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -28,14 +28,9 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= +ynh_script_progression --message="Upgrading source files..." --weight=3 -if [ "$upgrade_type" == "UPGRADE_APP" ] -then - ynh_script_progression --message="Upgrading source files..." --weight=3 - - # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$install_dir" --keep="config.json" -fi +ynh_setup_source --dest_dir="$install_dir" --keep="config.json" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" @@ -74,7 +69,7 @@ popd #================================================= ynh_script_progression --message="Updating a configuration file..." --weight=1 -ynh_add_config --template="../conf/config.json" --destination="$install_dir/config.json" +ynh_add_config --template="config.json" --destination="$install_dir/config.json" chmod 744 "$install_dir/config.json" chown $app:www-data "$install_dir/config.json" @@ -105,7 +100,7 @@ chmod -R o-rwx "$webircgateway_path" chown -R $app:www-data "$webircgateway_path" chmod +x "$webircgateway_path/webircgateway" -ynh_add_config --template="../conf/config.conf" --destination="$webircgateway_path/config.conf" +ynh_add_config --template="config.conf" --destination="$webircgateway_path/config.conf" chmod 755 "$webircgateway_path/config.conf" chown $app:www-data "$webircgateway_path/config.conf" From 0e78a69f02291e2e3fcf17e423ede8a4d649930c Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 2 Mar 2024 08:52:53 +0100 Subject: [PATCH 3/5] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index f96efee..c7a97fa 100755 --- a/scripts/install +++ b/scripts/install @@ -107,7 +107,7 @@ ynh_add_systemd_config #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 -yunohost service add $app --description="Simple IRC web client" +yunohost service add $app --description="Simple IRC web client" --log="/var/log/$app/$app.log" #================================================= # START SYSTEMD SERVICE From d722ca662966309279f78a7936a9ca2c793a091a Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 2 Mar 2024 08:53:14 +0100 Subject: [PATCH 4/5] Update upgrade --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 0c640e9..0653676 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -120,7 +120,7 @@ ynh_add_systemd_config #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 -yunohost service add $app --description="Simple IRC web client" +yunohost service add $app --description="Simple IRC web client" --log="/var/log/$app/$app.log" #================================================= # START SYSTEMD SERVICE From 2f82390efab385a9554e975903e5d2442900c2f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 2 Mar 2024 16:33:50 +0100 Subject: [PATCH 5/5] fix --- scripts/install | 4 ++-- scripts/upgrade | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/install b/scripts/install index c7a97fa..91f8b3a 100755 --- a/scripts/install +++ b/scripts/install @@ -45,8 +45,8 @@ ynh_script_progression --message="Building app... (this will take some time and pushd "$install_dir" ynh_use_nodejs - ynh_exec_warn_less npm i -g npm - ynh_exec_warn_less npm install --production + ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH $ynh_npm i -g npm + ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH $ynh_npm install --production popd #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 0653676..a9e2a59 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -60,8 +60,8 @@ ynh_script_progression --message="Building app... (this will take some time and pushd "$install_dir" ynh_use_nodejs - ynh_exec_warn_less npm i -g npm - ynh_exec_warn_less npm install --production + ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH $ynh_npm i -g npm + ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH $ynh_npm install --production popd #=================================================