From f0e9373aa2403bf04f84c67646ac5d34376b7959 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 3 Apr 2021 22:40:01 +0200 Subject: [PATCH 01/10] Apply last example_ynh --- README.md | 10 +++++----- manifest.json | 11 +++-------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 5741dc9..4070227 100644 --- a/README.md +++ b/README.md @@ -23,8 +23,8 @@ YunoRunner is our own CI runner for YunoHost Apps #### Supported architectures -* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/yunorunner%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/yunorunner/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/yunorunner%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/yunorunner/) +* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/yunorunner.svg)](https://ci-apps.yunohost.org/ci/apps/yunorunner/) +* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/yunorunner.svg)](https://ci-apps-arm.yunohost.org/ci/apps/yunorunner/) ## Limitations @@ -42,11 +42,11 @@ YunoRunner is our own CI runner for YunoHost Apps ## Developer info -Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/yunorunner_ynh/tree/testing). +Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/yunorunner_ynh_core/tree/testing). To try the testing branch, please proceed like that. ``` -sudo yunohost app install https://github.com/YunoHost-Apps/yunorunner_ynh/tree/testing --debug +sudo yunohost app install https://github.com/YunoHost-Apps/yunorunner_ynh_core/tree/testing --debug or -sudo yunohost app upgrade yunorunner -u https://github.com/YunoHost-Apps/yunorunner_ynh/tree/testing --debug +sudo yunohost app upgrade yunorunner -u https://github.com/YunoHost-Apps/yunorunner_ynh_core/tree/testing --debug ``` diff --git a/manifest.json b/manifest.json index 958067d..3530445 100644 --- a/manifest.json +++ b/manifest.json @@ -10,6 +10,9 @@ "url": "https://github.com/YunoHost/yunorunner", "license": "GPL-3.0-or-later", "maintainer": { + "name": "" + }, + "previous_maintainer": { "name": "Maniack Crudelis", "email": "maniackc_dev@crudelis.fr" }, @@ -25,19 +28,11 @@ { "name": "domain", "type": "domain", - "ask": { - "en": "Choose a domain name for YunoRunner", - "fr": "Choisissez un nom de domaine pour YunoRunner" - }, "example": "example.com" }, { "name": "path", "type": "path", - "ask": { - "en": "Choose a path for YunoRunner", - "fr": "Choisissez un chemin pour YunoRunner" - }, "example": "/yunorunner", "default": "/yunorunner" } From ecc8749d1b5806c39ecae65a2743e8927a892a44 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 9 Apr 2021 23:06:33 +0200 Subject: [PATCH 02/10] Update change_url --- scripts/change_url | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/change_url b/scripts/change_url index 0b2af13..ba60148 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -32,7 +32,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) port=$(ynh_app_setting_get --app=$app --key=port) #================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP #================================================= ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." From a8e69e2666c8d27f77051a2810bb41937b82acdd Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 9 Apr 2021 23:06:37 +0200 Subject: [PATCH 03/10] Update upgrade --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 20fb21f..a012a5f 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -68,7 +68,7 @@ then fi #================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP #================================================= ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." From 5f12be01d77e6c8ba22790f1c29aa96b2c3da19f Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 9 Apr 2021 23:34:14 +0200 Subject: [PATCH 04/10] Update restore --- scripts/restore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/restore b/scripts/restore index f2ba14e..ed1970a 100644 --- a/scripts/restore +++ b/scripts/restore @@ -23,7 +23,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading settings..." +ynh_script_progression --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME From 78f64f99cfdfa76ba69594bf9ce60f96c268ef23 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 10 Apr 2021 17:09:37 +0200 Subject: [PATCH 05/10] Update upgrade --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index a012a5f..20fb21f 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -68,7 +68,7 @@ then fi #================================================= -# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP +# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." From 93c6cc1714992fbebc3dd8d0fc7e313f29514fbd Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 10 Apr 2021 17:37:08 +0200 Subject: [PATCH 06/10] Update check_process --- check_process | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/check_process b/check_process index f7cb389..f2f35f1 100644 --- a/check_process +++ b/check_process @@ -16,6 +16,8 @@ # upgrade=1 from_commit=04cb5f0ec18def9d50fa861c16d491275843b9e7 # 041120 # upgrade=1 from_commit=7b3acfc9b28b6ed33a1590ae16261d7dd3b5b06a + # 2021-03-05~ynh1 + upgrade=1 from_commit=f0e9373aa2403bf04f84c67646ac5d34376b7959 backup_restore=1 multi_instance=1 incorrect_path=1 @@ -30,3 +32,5 @@ Notification=down manifest_arg=domain=DOMAIN&path=PATH& ; commit=7b3acfc9b28b6ed33a1590ae16261d7dd3b5b06a name=041120 + ; commit=f0e9373aa2403bf04f84c67646ac5d34376b7959 + name=2021-03-05~ynh1 From 089e8117037cb4eec138ba8e2c77d58744997383 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 10 Apr 2021 17:46:40 +0200 Subject: [PATCH 07/10] Apply example_ynh --- scripts/install | 35 +++++++++++++++++------------------ scripts/remove | 2 +- scripts/restore | 18 +++++++----------- scripts/upgrade | 36 ++++++++++++++++++------------------ 4 files changed, 43 insertions(+), 48 deletions(-) diff --git a/scripts/install b/scripts/install index 33abf31..b8e13ae 100644 --- a/scripts/install +++ b/scripts/install @@ -65,6 +65,14 @@ ynh_script_progression --message="Installing dependencies..." ynh_install_app_dependencies $pkg_dependencies +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Configuring system user..." + +# Create a system user +ynh_system_user_create --username=$app --home_dir="$final_path" + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -79,6 +87,10 @@ pushd "$final_path" git reset --quiet --hard FETCH_HEAD popd +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R root:$app "$final_path" + #================================================= # NGINX CONFIGURATION #================================================= @@ -87,14 +99,6 @@ ynh_script_progression --message="Configuring NGINX web server..." # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Configuring system user..." - -# Create a system user -ynh_system_user_create --username=$app - #================================================= # SPECIFIC SETUP #================================================= @@ -120,22 +124,17 @@ ynh_script_progression --message="Configuring a systemd service..." ynh_add_systemd_config #================================================= -# CONFIGURE YUNORUNNER +# ADD A CONFIGURATION #================================================= -ynh_script_progression --message="Configuring YunoRunner..." +ynh_script_progression --message="Adding a config file..." ynh_add_config --template="yunorunner.config.py" --destination="$final_path/config.py" +chmod 400 "$final_path/config.py" +chown $app:$app "$final_path/config.py" + #================================================= # GENERIC FINALIZATION -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= -ynh_script_progression --message="Securing files and directories..." - -# Set permissions to app files -chown -R $app:root $final_path - #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= diff --git a/scripts/remove b/scripts/remove index 7b05647..524c878 100755 --- a/scripts/remove +++ b/scripts/remove @@ -76,7 +76,7 @@ then fi #================================================= -# GENERIC FINALISATION +# GENERIC FINALIZATION #================================================= # REMOVE DEDICATED USER #================================================= diff --git a/scripts/restore b/scripts/restore index ed1970a..d1ad259 100644 --- a/scripts/restore +++ b/scripts/restore @@ -56,13 +56,6 @@ ynh_script_progression --message="Restoring the NGINX web server configuration.. ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# RESTORE THE APP MAIN DIR -#================================================= -ynh_script_progression --message="Restoring the app main directory..." - -ynh_restore_file --origin_path="$final_path" - #================================================= # RECREATE THE DEDICATED USER #================================================= @@ -72,12 +65,15 @@ ynh_script_progression --message="Recreating the dedicated system user..." ynh_system_user_create --username=$app #================================================= -# RESTORE USER RIGHTS +# RESTORE THE APP MAIN DIR #================================================= -ynh_script_progression --message="Restoring user rights..." +ynh_script_progression --message="Restoring the app main directory..." -# Restore permissions on app files -chown -R $app:root $final_path +ynh_restore_file --origin_path="$final_path" + +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R root:$app "$final_path" #================================================= # SPECIFIC RESTORATION diff --git a/scripts/upgrade b/scripts/upgrade index 20fb21f..3fec468 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -96,6 +96,14 @@ ynh_script_progression --message="Stopping a systemd service..." ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" --line_match="Stopped YunoRunner CI" +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Making sure dedicated system user exists..." + +# Create a dedicated user (if not existing) +ynh_system_user_create --username=$app --home_dir="$final_path" + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -111,6 +119,10 @@ then popd fi +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R root:$app "$final_path" + #================================================= # NGINX CONFIGURATION #================================================= @@ -126,14 +138,6 @@ ynh_script_progression --message="Upgrading dependencies..." ynh_install_app_dependencies $pkg_dependencies -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." - -# Create a dedicated user (if not existing) -ynh_system_user_create --username=$app - #================================================= # SPECIFIC UPGRADE #================================================= @@ -155,25 +159,21 @@ popd #================================================= ynh_script_progression --message="Upgrading systemd configuration..." +# Create a dedicated systemd config ynh_add_systemd_config #================================================= -# CONFIGURE YUNORUNNER +# UPDATE A CONFIG FILE #================================================= -ynh_script_progression --message="Configuring YunoRunner..." +ynh_script_progression --message="Updating a config file..." ynh_add_config --template="yunorunner.config.py" --destination="$final_path/config.py" +chmod 400 "$final_path/config.py" +chown $app:$app "$final_path/config.py" + #================================================= # GENERIC FINALIZATION -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= -ynh_script_progression --message="Securing files and directories..." - -# Set permissions on app files -chown -R $app:root $final_path - #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= From 96a200c7a6b29fe07e18771e6736b90987f34d6c Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 11 Apr 2021 22:11:16 +0200 Subject: [PATCH 08/10] Fix rights --- scripts/install | 18 +++++++++--------- scripts/restore | 2 +- scripts/upgrade | 18 +++++++++--------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/scripts/install b/scripts/install index b8e13ae..4cb2ff6 100644 --- a/scripts/install +++ b/scripts/install @@ -89,7 +89,7 @@ popd chmod 750 "$final_path" chmod -R o-rwx "$final_path" -chown -R root:$app "$final_path" +chown -R $app:$app "$final_path" #================================================= # NGINX CONFIGURATION @@ -115,14 +115,6 @@ pushd $final_path venv/bin/pip install 'websockets>=6.0,<7.0' popd -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_script_progression --message="Configuring a systemd service..." - -# Create a dedicated systemd config -ynh_add_systemd_config - #================================================= # ADD A CONFIGURATION #================================================= @@ -133,6 +125,14 @@ ynh_add_config --template="yunorunner.config.py" --destination="$final_path/conf chmod 400 "$final_path/config.py" chown $app:$app "$final_path/config.py" +#================================================= +# SETUP SYSTEMD +#================================================= +ynh_script_progression --message="Configuring a systemd service..." + +# Create a dedicated systemd config +ynh_add_systemd_config + #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/restore b/scripts/restore index d1ad259..dc2d712 100644 --- a/scripts/restore +++ b/scripts/restore @@ -73,7 +73,7 @@ ynh_restore_file --origin_path="$final_path" chmod 750 "$final_path" chmod -R o-rwx "$final_path" -chown -R root:$app "$final_path" +chown -R $app:$app "$final_path" #================================================= # SPECIFIC RESTORATION diff --git a/scripts/upgrade b/scripts/upgrade index 3fec468..dde97b1 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -121,7 +121,7 @@ fi chmod 750 "$final_path" chmod -R o-rwx "$final_path" -chown -R root:$app "$final_path" +chown -R $app:$app "$final_path" #================================================= # NGINX CONFIGURATION @@ -154,14 +154,6 @@ pushd $final_path venv/bin/pip install 'websockets>=6.0,<7.0' popd -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_script_progression --message="Upgrading systemd configuration..." - -# Create a dedicated systemd config -ynh_add_systemd_config - #================================================= # UPDATE A CONFIG FILE #================================================= @@ -172,6 +164,14 @@ ynh_add_config --template="yunorunner.config.py" --destination="$final_path/conf chmod 400 "$final_path/config.py" chown $app:$app "$final_path/config.py" +#================================================= +# SETUP SYSTEMD +#================================================= +ynh_script_progression --message="Upgrading systemd configuration..." + +# Create a dedicated systemd config +ynh_add_systemd_config + #================================================= # GENERIC FINALIZATION #================================================= From b0145eec6dbddb39df0620d2784274919f724355 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 15 Apr 2021 20:30:26 +0200 Subject: [PATCH 09/10] Fix chmod --- scripts/install | 2 +- scripts/restore | 2 +- scripts/upgrade | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index 4cb2ff6..7d8eff0 100644 --- a/scripts/install +++ b/scripts/install @@ -87,7 +87,7 @@ pushd "$final_path" git reset --quiet --hard FETCH_HEAD popd -chmod 750 "$final_path" +chmod -R 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:$app "$final_path" diff --git a/scripts/restore b/scripts/restore index dc2d712..e64b8e0 100644 --- a/scripts/restore +++ b/scripts/restore @@ -71,7 +71,7 @@ ynh_script_progression --message="Restoring the app main directory..." ynh_restore_file --origin_path="$final_path" -chmod 750 "$final_path" +chmod -R 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:$app "$final_path" diff --git a/scripts/upgrade b/scripts/upgrade index dde97b1..686e0de 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -119,7 +119,7 @@ then popd fi -chmod 750 "$final_path" +chmod -R 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:$app "$final_path" From 4bf3d2651d46598f6888c4673a763955bbed4d3b Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 17 Apr 2021 18:32:58 +0200 Subject: [PATCH 10/10] Fix recursive chmod --- scripts/install | 2 +- scripts/restore | 2 +- scripts/upgrade | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index 7d8eff0..4cb2ff6 100644 --- a/scripts/install +++ b/scripts/install @@ -87,7 +87,7 @@ pushd "$final_path" git reset --quiet --hard FETCH_HEAD popd -chmod -R 750 "$final_path" +chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:$app "$final_path" diff --git a/scripts/restore b/scripts/restore index e64b8e0..dc2d712 100644 --- a/scripts/restore +++ b/scripts/restore @@ -71,7 +71,7 @@ ynh_script_progression --message="Restoring the app main directory..." ynh_restore_file --origin_path="$final_path" -chmod -R 750 "$final_path" +chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:$app "$final_path" diff --git a/scripts/upgrade b/scripts/upgrade index 686e0de..dde97b1 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -119,7 +119,7 @@ then popd fi -chmod -R 750 "$final_path" +chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:$app "$final_path"