diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..145651d Binary files /dev/null and b/.DS_Store differ diff --git a/issue_template.md b/.github/ISSUE_TEMPLATE.md similarity index 51% rename from issue_template.md rename to .github/ISSUE_TEMPLATE.md index 56d382c..2729a6b 100644 --- a/issue_template.md +++ b/.github/ISSUE_TEMPLATE.md @@ -1,46 +1,55 @@ --- name: Bug report -about: Create a report to help us debug, it would be nice to fill the template as much as you can to help us, help you and help us all. +about: When creating a bug report, please use the following template to provide all the relevant information and help debugging efficiently. --- **How to post a meaningful bug report** 1. *Read this whole template first.* 2. *Determine if you are on the right place:* - - *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change url...), you are on the right place!* - - *Otherwise, the issue may be due to Tyto itself. Refer to its documentation or repository for help.* - - *If you have a doubt, post here, we will figure it out together.* + - *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!* + - *Otherwise, the issue may be due to the app itself. Refer to its documentation or repository for help.* + - *When in doubt, post here and we will figure it out together.* 3. *Delete the italic comments as you write over them below, and remove this guide.* --- -**Describe the bug** +### Describe the bug + *A clear and concise description of what the bug is.* -**Versions** +### Context + - Hardware: *VPS bought online / Old laptop or computer / Raspberry Pi at home / Internet Cube with VPN / Other ARM board / ...* - YunoHost version: x.x.x - I have access to my server: *Through SSH | through the webadmin | direct access via keyboard / screen | ...* -- Are you in a special context or did you perform some particular tweaking on your YunoHost instance ?: *no / yes* +- Are you in a special context or did you perform some particular tweaking on your YunoHost instance?: *no / yes* - If yes, please explain: - Using, or trying to install package version/branch: - If upgrading, current package version: *can be found in the admin, or with `yunohost app info $app_id`* -**To Reproduce** -*Steps to reproduce the behavior.* +### Steps to reproduce + - *If you performed a command from the CLI, the command itself is enough. For example:* ```sh - sudo yunohost app install tyto + sudo yunohost app install the_app ``` - *If you used the webadmin, please perform the equivalent command from the CLI first.* - *If the error occurs in your browser, explain what you did:* 1. *Go to '...'* - 2. *Click on '....'* - 3. *Scroll down to '....'* + 2. *Click on '...'* + 3. *Scroll down to '...'* 4. *See error* -**Expected behavior** +### Expected behavior + *A clear and concise description of what you expected to happen. You can remove this section if the command above is enough to understand your intent.* -**Logs** -*After a failed command, YunoHost makes the log available to you, but also to others, thanks to `yunohost log display [log name] --share`. The actual command, with the correct log name, is displayed at the end of the failed attempt in the CLI. Execute it and copy here the share link it outputs.* +### Logs + +*When an operation fails, YunoHost provides a simple way to share the logs.* +- *In the webadmin, the error message contains a link to the relevant log page. On that page, you will be able to 'Share with Yunopaste'. If you missed it, the logs of previous operations are also available under Tools > Logs.* +- *In command line, the command to share the logs is displayed at the end of the operation and looks like `yunohost log display [log name] --share`. If you missed it, you can find the log ID of a previous operation using `yunohost log list`.* + +*After sharing the log, please copypaste directly the link provided by YunoHost (to help readability, no need to copypaste the entire content of the log here, just the link is enough...)* + *If applicable and useful, add screenshots to help explain your problem.* diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..ef70e18 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,16 @@ +## Problem + +- *Description of why you made this PR* + +## Solution + +- *And how do you fix that problem* + +## PR Status + +- [ ] Code finished and ready to be reviewed/tested +- [ ] The fix/enhancement were manually tested (if applicable) + +## Automatic tests + +Automatic tests can be triggered on https://ci-apps-dev.yunohost.org/ *after creating the PR*, by commenting "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!". (N.B. : for this to work you need to be a member of the Yunohost-Apps organization) diff --git a/68747470733a2f2f7261772e6769746875622e636f6d2f6a6833792f706963732f6d61737465722f7479746f2f6164645f7461736b2e676966.gif b/68747470733a2f2f7261772e6769746875622e636f6d2f6a6833792f706963732f6d61737465722f7479746f2f6164645f7461736b2e676966.gif deleted file mode 100644 index 4c66e26..0000000 Binary files a/68747470733a2f2f7261772e6769746875622e636f6d2f6a6833792f706963732f6d61737465722f7479746f2f6164645f7461736b2e676966.gif and /dev/null differ diff --git a/68747470733a2f2f7261772e6769746875622e636f6d2f6a6833792f706963732f6d61737465722f7479746f2f6c696e6b696e672e676966 (1).gif b/68747470733a2f2f7261772e6769746875622e636f6d2f6a6833792f706963732f6d61737465722f7479746f2f6c696e6b696e672e676966 (1).gif deleted file mode 100644 index 7c0ccd6..0000000 Binary files a/68747470733a2f2f7261772e6769746875622e636f6d2f6a6833792f706963732f6d61737465722f7479746f2f6c696e6b696e672e676966 (1).gif and /dev/null differ diff --git a/68747470733a2f2f7261772e6769746875622e636f6d2f6a6833792f706963732f6d61737465722f7479746f2f6c696e6b696e672e676966.gif b/68747470733a2f2f7261772e6769746875622e636f6d2f6a6833792f706963732f6d61737465722f7479746f2f6c696e6b696e672e676966.gif deleted file mode 100644 index 7c0ccd6..0000000 Binary files a/68747470733a2f2f7261772e6769746875622e636f6d2f6a6833792f706963732f6d61737465722f7479746f2f6c696e6b696e672e676966.gif and /dev/null differ diff --git a/68747470733a2f2f7261772e6769746875622e636f6d2f6a6833792f706963732f6d61737465722f7479746f2f6d61726b646f776e2e676966.gif b/68747470733a2f2f7261772e6769746875622e636f6d2f6a6833792f706963732f6d61737465722f7479746f2f6d61726b646f776e2e676966.gif deleted file mode 100644 index bbaea4d..0000000 Binary files a/68747470733a2f2f7261772e6769746875622e636f6d2f6a6833792f706963732f6d61737465722f7479746f2f6d61726b646f776e2e676966.gif and /dev/null differ diff --git a/68747470733a2f2f7261772e6769746875622e636f6d2f6a6833792f7479746f2f6d61737465722f7372632f696d672f7479746f2e706e67.png b/68747470733a2f2f7261772e6769746875622e636f6d2f6a6833792f7479746f2f6d61737465722f7372632f696d672f7479746f2e706e67.png deleted file mode 100644 index 99294fb..0000000 Binary files a/68747470733a2f2f7261772e6769746875622e636f6d2f6a6833792f7479746f2f6d61737465722f7372632f696d672f7479746f2e706e67.png and /dev/null differ diff --git a/README.md b/README.md index 2e87dd7..2313185 100644 --- a/README.md +++ b/README.md @@ -1,54 +1,39 @@ -# Tyto for YunoHost ![alt tag](https://github.com/YunoHost-Apps/tyto_ynh/blob/master/68747470733a2f2f7261772e6769746875622e636f6d2f6a6833792f7479746f2f6d61737465722f7372632f696d672f7479746f2e706e67.png) + + +# Tyto for YunoHost [![Integration level](https://dash.yunohost.org/integration/tyto.svg)](https://dash.yunohost.org/appci/app/tyto) ![](https://ci-apps.yunohost.org/ci/badges/tyto.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/tyto.maintain.svg) -[![Install Tyto with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=tyto) +[![Install Tyto with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=tyto) -> *This package allows you to install Tyto quickly and simply on a YunoHost server. +*[Lire ce readme en français.](./README_fr.md)* + +> *This package allows you to install Tyto quickly and simply on a YunoHost server. If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.* ## Overview -Tyto arose from the want for an electronic post-it board without the need for accounts. Something simple and intuitive that could be easily shared. -**Shipped version:** 3.0.4 +Simple, minimal electronic post-it board + +**Shipped version:** 3.0.4~ynh2 + +**Demo:** https://jh3y.github.io/tyto/ ## Screenshots -![](https://github.com/YunoHost-Apps/tyto_ynh/blob/master/68747470733a2f2f7261772e6769746875622e636f6d2f6a6833792f706963732f6d61737465722f7479746f2f6164645f7461736b2e676966.gif.) +![](./doc/screenshots/screenshot.png) -## Demo +## Documentation and resources -* [Official demo](https://jh3y.github.io/tyto) +* Official app website: https://jh3y.github.io/tyto/ +* Official user documentation: https://yunohost.org/apps +* Upstream app code repository: https://github.com/jh3y/tyto +* YunoHost documentation for this app: https://yunohost.org/app_tyto +* Report a bug: https://github.com/YunoHost-Apps/tyto_ynh/issues - -### Features -* minimal UI -* no accounts necessary -* intuitive -* extensible -* localStorage persistence -* time tracking -* sortable UI -* task linking -* Markdown support -* etc. - -## YunoHost specific features - -#### Supported architectures - -* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/tyto%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/tyto/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/tyto%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/tyto/) - -## Links - - * Report a bug: https://github.com/YunoHost-Apps/tyto_ynh/issues - * Upstream app repository: https://github.com/jh3y/tyto - * YunoHost website: https://yunohost.org/ - ---- - -Developer info ----------------- +## Developer info Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/tyto_ynh/tree/testing). @@ -58,3 +43,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/tyto_ynh/tree/testing or sudo yunohost app upgrade tyto -u https://github.com/YunoHost-Apps/tyto_ynh/tree/testing --debug ``` + +**More info regarding app packaging:** https://yunohost.org/packaging_apps \ No newline at end of file diff --git a/README_fr.md b/README_fr.md new file mode 100644 index 0000000..008876c --- /dev/null +++ b/README_fr.md @@ -0,0 +1,43 @@ +# Tyto pour YunoHost + +[![Niveau d'intégration](https://dash.yunohost.org/integration/tyto.svg)](https://dash.yunohost.org/appci/app/tyto) ![](https://ci-apps.yunohost.org/ci/badges/tyto.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/tyto.maintain.svg) +[![Installer Tyto avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=tyto) + +*[Read this readme in english.](./README.md)* +*[Lire ce readme en français.](./README_fr.md)* + +> *Ce package vous permet d'installer Tyto rapidement et simplement sur un serveur YunoHost. +Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.* + +## Vue d'ensemble + +Tableau de post-it électroniques, simple et minimaliste + +**Version incluse :** 3.0.4~ynh2 + +**Démo :** https://jh3y.github.io/tyto/ + +## Captures d'écran + +![](./doc/screenshots/screenshot.png) + +## Documentations et ressources + +* Site officiel de l'app : https://jh3y.github.io/tyto/ +* Documentation officielle utilisateur : https://yunohost.org/apps +* Dépôt de code officiel de l'app : https://github.com/jh3y/tyto +* Documentation YunoHost pour cette app : https://yunohost.org/app_tyto +* Signaler un bug : https://github.com/YunoHost-Apps/tyto_ynh/issues + +## Informations pour les développeurs + +Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/tyto_ynh/tree/testing). + +Pour essayer la branche testing, procédez comme suit. +``` +sudo yunohost app install https://github.com/YunoHost-Apps/tyto_ynh/tree/testing --debug +ou +sudo yunohost app upgrade tyto -u https://github.com/YunoHost-Apps/tyto_ynh/tree/testing --debug +``` + +**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps \ No newline at end of file diff --git a/check_process b/check_process index 0b36e02..90bfdf3 100644 --- a/check_process +++ b/check_process @@ -1,13 +1,8 @@ -# See here for more informations -# https://github.com/YunoHost/package_check#syntax-check_process-file - -# Move this file from check_process.default to check_process when you have filled it. - ;; Test complet ; Manifest - domain="domain.tld" (DOMAIN) - path="/path" (PATH) - is_public=1 (PUBLIC|public=1|private=0) + domain="domain.tld" + path="/path" + is_public=1 ; Checks pkg_linter=1 setup_sub_dir=1 @@ -18,13 +13,7 @@ upgrade=1 backup_restore=1 multi_instance=1 - # This test is no longer necessary since the version 2.7 (PR: https://github.com/YunoHost/yunohost/pull/304), you can still do it if your app could be installed with this version. - # incorrect_path=1 - port_already_use=0 change_url=1 -;;; Levels - # If the level 5 (Package linter) is forced to 1. Please add justifications here. - Level 5=auto ;;; Options Email=anmol@datamol.org Notification=change diff --git a/conf/nginx.conf b/conf/nginx.conf index d49da22..052c370 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -9,13 +9,6 @@ location __PATH__/ { rewrite ^ https://$server_name$request_uri? permanent; } - index index.php index.html; - - # Common parameter to increase upload size limit in conjuction with dedicated php-fpm file - #client_max_body_size 50M; - - try_files $uri $uri/ index.php index.html; - # Include SSOWAT user panel. include conf.d/yunohost_panel.conf.inc; } diff --git a/doc/.DS_Store b/doc/.DS_Store new file mode 100644 index 0000000..b5e9f00 Binary files /dev/null and b/doc/.DS_Store differ diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md new file mode 100644 index 0000000..e69de29 diff --git a/68747470733a2f2f7261772e6769746875622e636f6d2f6a6833792f706963732f6d61737465722f7479746f2f6170705f74687265655f636f6c732e706e67.png b/doc/screenshots/screenshot.png similarity index 100% rename from 68747470733a2f2f7261772e6769746875622e636f6d2f6a6833792f706963732f6d61737465722f7479746f2f6170705f74687265655f636f6c732e706e67.png rename to doc/screenshots/screenshot.png diff --git a/manifest.json b/manifest.json index c0379be..db45cd1 100644 --- a/manifest.json +++ b/manifest.json @@ -3,11 +3,18 @@ "id": "tyto", "packaging_format": 1, "description": { - "en": "A simple, minimal electronic post-it board", - "fr": "Un tableau de post-it électroniques, simple et minimaliste" + "en": "Simple, minimal electronic post-it board", + "fr": "Tableau de post-it électroniques, simple et minimaliste" }, - "version": "3.0.4~ynh1", + "version": "3.0.4~ynh2", "url": "https://github.com/jh3y/tyto", + "upstream": { + "license": "MIT", + "website": "https://jh3y.github.io/tyto/", + "demo": "https://jh3y.github.io/tyto/", + "userdoc": "https://yunohost.org/apps", + "code": "https://github.com/jh3y/tyto" + }, "license": "MIT", "maintainer": { "name": "Anmol Sharma", @@ -15,7 +22,7 @@ "url": "https://datamol.org" }, "requirements": { - "yunohost": ">= 3.5" + "yunohost": ">= 4.2.4" }, "multi_instance": true, "services": [ @@ -26,25 +33,20 @@ { "name": "domain", "type": "domain", - "ask": { - "en": "Choose a domain name for Tyto" - }, "example": "example.com" }, { "name": "path", "type": "path", - "ask": { - "en": "Choose a path for Tyto" - }, "example": "/tyto", "default": "/tyto" }, { "name": "is_public", "type": "boolean", - "ask": { - "en": "Is it a public application?" + "help": { + "en": "If enabled, Tyto will be accessible by people who do not have an account. This can be changed later via the webadmin.", + "fr": "Si cette case est cochée, Tyto sera accessible aux personnes n’ayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin." }, "default": true } diff --git a/pull_request_template.md b/pull_request_template.md deleted file mode 100644 index 4139384..0000000 --- a/pull_request_template.md +++ /dev/null @@ -1,18 +0,0 @@ -## Problem -- *Description of why you made this PR* - -## Solution -- *And how do you fix that problem* - -## PR Status -- [ ] Code finished. -- [ ] Tested with Package_check. -- [ ] Fix or enhancement tested. -- [ ] Upgrade from last version tested. -- [ ] Can be reviewed and tested. - -## Package_check results ---- -*If you have access to [App Continuous Integration for packagers](https://yunohost.org/#/packaging_apps_ci) you can provide a link to the package_check results like below, replacing '-NUM-' in this link by the PR number and USERNAME by your username on the ci-apps-dev. Or you provide a screenshot or a pastebin of the results* - -[![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/tyto_ynh%20PR-NUM-%20(USERNAME)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/tyto_ynh%20PR-NUM-%20(USERNAME)/) diff --git a/scripts/_common.sh b/scripts/_common.sh index ecd263f..944a65e 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,9 +4,6 @@ # COMMON VARIABLES #================================================= -# dependencies used by the app -pkg_dependencies="" - #================================================= # PERSONAL HELPERS #================================================= diff --git a/scripts/backup b/scripts/backup index c3096ff..87e89d3 100755 --- a/scripts/backup +++ b/scripts/backup @@ -44,7 +44,6 @@ ynh_backup --src_path="$final_path" ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/change_url b/scripts/change_url index fdf22bd..b7addbc 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -29,15 +29,10 @@ ynh_script_progression --message="Loading installation settings..." # Needed for helper "ynh_add_nginx_config" final_path=$(ynh_app_setting_get --app=$app --key=final_path) -# Add settings here as needed by your application -#db_name=$(ynh_app_setting_get --app=$app --key=db_name) -#db_user=$db_name -#db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) - #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before changing its url (may take a while)..." +ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." # Backup the current version of the app ynh_backup_before_upgrade @@ -72,7 +67,7 @@ fi #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_script_progression --message="Updating nginx web server configuration..." +ynh_script_progression --message="Updating NGINX web server configuration..." nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf @@ -101,7 +96,7 @@ fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading NGINX web server..." ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/install b/scripts/install index 2461006..6096664 100755 --- a/scripts/install +++ b/scripts/install @@ -44,10 +44,15 @@ ynh_script_progression --message="Storing installation settings..." ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url -ynh_app_setting_set --app=$app --key=is_public --value=$is_public #================================================= -# STANDARD MODIFICATIONS +# 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 #================================================= @@ -57,52 +62,33 @@ 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" +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" + #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Configuring nginx web server..." +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 - -#================================================= -# GENERIC FINALIZATION -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= -ynh_script_progression --message="Securing files and directories..." - -# Set permissions to app files -chown -R $app: $final_path - #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring SSOwat..." +ynh_script_progression --message="Configuring permissions..." -if [ $is_public -eq 0 ] -then # Remove the public access - ynh_app_setting_delete $app skipped_uris -fi # Make app public if necessary if [ $is_public -eq 1 ] then - # unprotected_uris allows SSO credentials to be passed anyway. - ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" + ynh_permission_update --permission="main" --add="visitors" fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading NGINX web server..." ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/remove b/scripts/remove index 7c04ac9..781098a 100755 --- a/scripts/remove +++ b/scripts/remove @@ -32,7 +32,7 @@ ynh_secure_remove --file="$final_path" #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Removing nginx web server configuration..." +ynh_script_progression --message="Removing NGINX web server configuration..." # Remove the dedicated nginx config ynh_remove_nginx_config diff --git a/scripts/restore b/scripts/restore index 7d286a9..d8274a7 100755 --- a/scripts/restore +++ b/scripts/restore @@ -43,10 +43,18 @@ test ! -d $final_path \ #================================================= # RESTORE THE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Restoring the nginx configuration..." +ynh_script_progression --message="Restoring the NGINX configuration..." ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" +#================================================= +# RECREATE THE DEDICATED USER +#================================================= +ynh_script_progression --message="Recreating the dedicated system user..." + +# Create the dedicated user (if not existing) +ynh_system_user_create --username=$app --home_dir="$final_path" + #================================================= # RESTORE THE APP MAIN DIR #================================================= @@ -54,28 +62,16 @@ ynh_script_progression --message="Restoring the app main directory..." ynh_restore_file --origin_path="$final_path" -#================================================= -# RECREATE THE DEDICATED USER -#================================================= -ynh_script_progression --message="Recreating the dedicated system user..." - -# Create the dedicated user (if not existing) -ynh_system_user_create --username=$app - -#================================================= -# RESTORE USER RIGHTS -#================================================= -ynh_script_progression --message="Restoring user rights..." - -# Restore permissions on app files -chown -R root: $final_path +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" #================================================= # GENERIC FINALIZATION #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading NGINX web server..." ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/upgrade b/scripts/upgrade index 9f98635..fd4a9de 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -18,7 +18,6 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) -is_public=$(ynh_app_setting_get --app=$app --key=is_public) final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= @@ -33,21 +32,19 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= ynh_script_progression --message="Ensuring downward compatibility..." -# Fix is_public as a boolean value -if [ "$is_public" = "Yes" ]; then - ynh_app_setting_set --app=$app --key=is_public --value=1 - is_public=1 -elif [ "$is_public" = "No" ]; then - ynh_app_setting_set --app=$app --key=is_public --value=0 - is_public=0 -fi - # If final_path doesn't exist, create it if [ -z "$final_path" ]; then final_path=/var/www/$app ynh_app_setting_set --app=$app --key=final_path --value=$final_path fi +# Cleaning legacy permissions +if ynh_legacy_permissions_exists; then + ynh_legacy_permissions_delete_all + + ynh_app_setting_delete --app=$app --key=is_public +fi + #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -63,11 +60,12 @@ ynh_clean_setup () { ynh_abort_if_errors #================================================= -# CHECK THE PATH +# CREATE DEDICATED USER #================================================= +ynh_script_progression --message="Making sure dedicated system user exists..." -# Normalize the URL path syntax -path_url=$(ynh_normalize_url_path --path_url=$path_url) +# Create a dedicated user (if not existing) +ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # STANDARD UPGRADE STEPS @@ -83,52 +81,22 @@ then ynh_setup_source --dest_dir="$final_path" fi +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" + #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading nginx web server configuration..." +ynh_script_progression --message="Upgrading NGINX web server configuration..." # Create a dedicated nginx config ynh_add_nginx_config -#================================================= -# 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 - -#================================================= -# GENERIC FINALIZATION -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= -ynh_script_progression --message="Securing files and directories..." - -# Set right permissions for curl installation -chown -R $app: $final_path - -#================================================= -# SETUP SSOWAT -#================================================= -ynh_script_progression --message="Upgrading SSOwat configuration..." - -if [ $is_public -eq 0 ] -then # Remove the public access - ynh_app_setting_delete $app skipped_uris -fi -# Make app public if necessary -if [ $is_public -eq 1 ] -then - # unprotected_uris allows SSO credentials to be passed anyway - ynh_app_setting_set $app unprotected_uris "/" -fi - #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading NGINX web server..." ynh_systemd_action --service_name=nginx --action=reload