From b16ce1d17a13dafb1f0e74c972a1849b4b10cb91 Mon Sep 17 00:00:00 2001 From: Navan Chauhan Date: Wed, 15 Jun 2022 21:23:34 +0530 Subject: [PATCH 1/6] install on subpath --- check_process | 4 ++-- conf/nginx.conf | 2 +- conf/systemd.service | 2 +- manifest.json | 8 +++++++- scripts/change_url | 6 ++++++ scripts/install | 2 +- 6 files changed, 18 insertions(+), 6 deletions(-) diff --git a/check_process b/check_process index 2617b17..b547924 100644 --- a/check_process +++ b/check_process @@ -1,11 +1,11 @@ ;; Test complet ; Manifest domain="domain.tld" - path="/" + path="/path" is_public=1 ; Checks pkg_linter=1 - setup_sub_dir=0 + setup_sub_dir=1 setup_root=1 setup_nourl=0 setup_private=1 diff --git a/conf/nginx.conf b/conf/nginx.conf index d601a3a..03d067a 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,4 +1,4 @@ -location / { +location __PATH__/ { proxy_pass http://127.0.0.1:__PORT__; proxy_redirect off; diff --git a/conf/systemd.service b/conf/systemd.service index eeb2d71..ae18c37 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -8,7 +8,7 @@ Type=simple User=__APP__ Group=__APP__ WorkingDirectory=__FINALPATH__/ -ExecStart=__FINALPATH__/shiori serve --port __PORT__ +ExecStart=__FINALPATH__/shiori serve --port __PORT__ --webroot __PATH__ Restart=always Environment="SHIORI_DIR=__DATADIR__" diff --git a/manifest.json b/manifest.json index b3ca4c2..67c9117 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Simple bookmark manager", "fr": "Gestionnaire de liens simple" }, - "version": "1.5.2~ynh1", + "version": "1.5.2~ynh2", "url": "https://github.com/go-shiori/shiori", "upstream": { "license": "MIT", @@ -34,6 +34,12 @@ "name": "domain", "type": "domain" }, + { + "name": "path", + "type": "path", + "example": "/example", + "default": "/example" + }, { "name": "is_public", "type": "boolean", diff --git a/scripts/change_url b/scripts/change_url index 76b4138..5fc3559 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -78,6 +78,7 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1 nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf +systemd_conf_path=/etc/systemd/system/$app.service # Change the path in the NGINX config file if [ $change_path -eq 1 ] @@ -89,6 +90,11 @@ then path_url="$new_path" # Create a dedicated NGINX config ynh_add_nginx_config + + # Make a backup of the original Systemd file if modified + ynh_backup_if_checksum_is_different --file="$systemd_conf_path" + + datadir=$(ynh_app_setting_get --app=$app --key=datadir) fi # Change the domain for NGINX diff --git a/scripts/install b/scripts/install index b2e8e1e..4400750 100755 --- a/scripts/install +++ b/scripts/install @@ -21,7 +21,7 @@ ynh_abort_if_errors #================================================= domain=$YNH_APP_ARG_DOMAIN -path_url="/" +path_url=$YNH_APP_ARG_PATH is_public=$YNH_APP_ARG_IS_PUBLIC architecture=$YNH_ARCH From fe0159dec814d0ec5c6079bed64303da0a4f6a1c Mon Sep 17 00:00:00 2001 From: Navan Chauhan Date: Wed, 15 Jun 2022 21:53:04 +0530 Subject: [PATCH 2/6] fix ynh_add_systemd_config I forgot to add `ynh_add_systemd_config` before :p --- scripts/change_url | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/change_url b/scripts/change_url index 5fc3559..a932008 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -93,8 +93,10 @@ then # Make a backup of the original Systemd file if modified ynh_backup_if_checksum_is_different --file="$systemd_conf_path" - + # Get value for systemd helper datadir=$(ynh_app_setting_get --app=$app --key=datadir) + # Create systemd service + ynh_add_systemd_config fi # Change the domain for NGINX From 4062f49dfe9e87dfe4818958634addd834ebfc1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 15 Jun 2022 18:28:13 +0200 Subject: [PATCH 3/6] Update manifest.json --- manifest.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index 67c9117..fdd82c5 100644 --- a/manifest.json +++ b/manifest.json @@ -37,8 +37,8 @@ { "name": "path", "type": "path", - "example": "/example", - "default": "/example" + "example": "/shiori", + "default": "/shiori" }, { "name": "is_public", From f049757ee706d4a55008bd6562c72beedc52dd26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 16 Jun 2022 07:58:53 +0200 Subject: [PATCH 4/6] Update nginx.conf --- conf/nginx.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/conf/nginx.conf b/conf/nginx.conf index 03d067a..0345df9 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,3 +1,4 @@ +#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; location __PATH__/ { proxy_pass http://127.0.0.1:__PORT__; From 3c1d85b878334d0067900553e6fffa5ab20a27d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 16 Jun 2022 08:01:01 +0200 Subject: [PATCH 5/6] Cleaning up --- scripts/install | 3 +-- scripts/upgrade | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index 4400750..c38439b 100755 --- a/scripts/install +++ b/scripts/install @@ -23,7 +23,6 @@ ynh_abort_if_errors domain=$YNH_APP_ARG_DOMAIN path_url=$YNH_APP_ARG_PATH is_public=$YNH_APP_ARG_IS_PUBLIC -architecture=$YNH_ARCH app=$YNH_APP_INSTANCE_NAME @@ -72,7 +71,7 @@ ynh_script_progression --message="Setting up source files..." --weight=1 ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source --dest_dir="$final_path" --source_id="$architecture" +ynh_setup_source --dest_dir="$final_path" --source_id=$YNH_ARCH chmod 750 "$final_path" chmod -R o-rwx "$final_path" diff --git a/scripts/upgrade b/scripts/upgrade index a8c2518..4953279 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -69,7 +69,7 @@ then ynh_script_progression --message="Upgrading source files..." --weight=1 # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$final_path" --source_id="$architecture" + ynh_setup_source --dest_dir="$final_path" --source_id=$YNH_ARCH fi chmod 750 "$final_path" From 8613d1b62d704a68b9cb781ce9c0aac26539e812 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 16 Jun 2022 08:15:54 +0200 Subject: [PATCH 6/6] Update DISCLAIMER.md --- doc/DISCLAIMER.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md index 11a57fd..d61804b 100644 --- a/doc/DISCLAIMER.md +++ b/doc/DISCLAIMER.md @@ -1,3 +1,5 @@ +### First log in + The default account is `shiori` with password `gopher`. It is removed once another 'owner' account is created. - username: `shiori`