diff --git a/conf/app.src b/conf/app.src index 9ec2e5c..d982d64 100644 --- a/conf/app.src +++ b/conf/app.src @@ -4,3 +4,4 @@ SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=false SOURCE_FILENAME= +SOURCE_EXTRACT=true diff --git a/conf/nginx.conf b/conf/nginx.conf index 929bc94..112b9c6 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -9,7 +9,8 @@ location / { rewrite ^ https://$server_name$request_uri? permanent; } - client_max_body_size 0; + # Common parameter to increase upload size limit in conjunction with dedicated php-fpm file + client_max_body_size 50M; proxy_set_header Accept-Encoding ""; proxy_pass http://localhost:__PORT__; diff --git a/issue_template.md b/issue_template.md index 00bdbb5..a202594 100644 --- a/issue_template.md +++ b/issue_template.md @@ -1,6 +1,6 @@ --- 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. --- @@ -9,14 +9,16 @@ about: Create a report to help us debug, it would be nice to fill the template a 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 Wiki.js itself. Refer to its documentation or repository for help.* - - *If you have a doubt, post here, we will figure it out together.* + - *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 | ...* @@ -25,8 +27,8 @@ about: Create a report to help us debug, it would be nice to fill the template a - 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 wikijs @@ -38,9 +40,16 @@ about: Create a report to help us debug, it would be nice to fill the template a 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/manifest.json b/manifest.json index 52b6cb3..6ff3082 100644 --- a/manifest.json +++ b/manifest.json @@ -13,7 +13,7 @@ "name": "yalh76" }, "requirements": { - "yunohost": ">= 3.8.1" + "yunohost": ">= 4.1.3" }, "multi_instance": true, "services": [ diff --git a/pull_request_template.md b/pull_request_template.md index ccfefad..6c28fc5 100644 --- a/pull_request_template.md +++ b/pull_request_template.md @@ -13,6 +13,4 @@ ## 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/wikijs_ynh%20PR-NUM-%20(USERNAME)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/wikijs_ynh%20PR-NUM-%20(USERNAME)/) +* An automatic package_check will be launch at https://ci-apps-dev.yunohost.org/, when you add a specific comment to your Pull Request: "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!"* diff --git a/scripts/change_url b/scripts/change_url index 972eb62..cc7a858 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -33,6 +33,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #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) +port=$(ynh_app_setting_get --app=$app --key=port) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP diff --git a/scripts/install b/scripts/install index 09c35ec..4d50535 100644 --- a/scripts/install +++ b/scripts/install @@ -51,7 +51,6 @@ 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 ynh_app_setting_set --app=$app --key=ldap_user --value=$ldap_user ynh_app_setting_set --app=$app --key=ldap_password --value=$ldap_password @@ -179,13 +178,14 @@ ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --lin #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring SSOwat..." +ynh_script_progression --message="Configuring permissions..." # 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="/" + # Everyone can access the app. + # The "main" permission is automatically created before the install script. + ynh_permission_update --permission="main" --add="visitors" fi #================================================= diff --git a/scripts/remove b/scripts/remove index 3fb0543..9286422 100644 --- a/scripts/remove +++ b/scripts/remove @@ -32,7 +32,7 @@ ldap_user=$(ynh_app_setting_get --app=$app --key=ldap_user) # 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..." + ynh_script_progression --message="Removing $app service integration..." yunohost service remove $app fi diff --git a/scripts/upgrade b/scripts/upgrade index 0c012c6..85c09d5 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -19,10 +19,7 @@ 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) - db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) port=$(ynh_app_setting_get --app=$app --key=port) @@ -41,27 +38,6 @@ 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 db_name doesn't exist, create it -if [ -z "$db_name" ]; then - db_name=$(ynh_sanitize_dbid --db_name=$app) - ynh_app_setting_set --app=$app --key=db_name --value=$db_name -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 - # If ldap_user doesn't exist, retrieve it or create it if [[ -z "$ldap_user" ]]; then ldap_user="svc_${app}_ldap" @@ -84,6 +60,13 @@ ynh_psql_create_user $db_name $db_pwd ynh_psql_test_if_first_run ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --database=$db_name +# 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 #================================================= @@ -91,14 +74,9 @@ ynh_script_progression --message="Backing up the app before upgrading (may take # Backup the current version of the app ynh_backup_before_upgrade - -#Workaround to be remove in next version -ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="HTTP Server:" - ynh_clean_setup () { - # restore it if the upgrade fails + # Restore it if the upgrade fails ynh_restore_upgradebackup - ynh_clean_check_starting } # Exit if an error occurs during the execution of the script ynh_abort_if_errors @@ -124,24 +102,24 @@ then tmpdir="$(mktemp -d)" rsync -a "$config_file" "$tmpdir/." - if [ -d "$final_path/.ssh" ]; then - rsync -a "$final_path/.ssh" "$tmpdir/." - fi - if [ -d "$final_path/data" ]; then - rsync -a "$final_path/data" "$tmpdir/." - fi + if [ -d "$final_path/.ssh" ]; then + rsync -a "$final_path/.ssh" "$tmpdir/." + fi + if [ -d "$final_path/data" ]; then + rsync -a "$final_path/data" "$tmpdir/." + fi ynh_secure_remove --file="$final_path" # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$final_path" rsync -a "$tmpdir/config.yml" "$final_path/." - if [ -d "$tmpdir/.ssh" ]; then - rsync -a "$tmpdir/.ssh" "$final_path/." - fi - if [ -d "$tmpdir/data" ]; then - rsync -a "$tmpdir/data" "$final_path/." - fi + if [ -d "$tmpdir/.ssh" ]; then + rsync -a "$tmpdir/.ssh" "$final_path/." + fi + if [ -d "$tmpdir/data" ]; then + rsync -a "$tmpdir/data" "$final_path/." + fi fi #================================================= @@ -212,18 +190,6 @@ ynh_script_progression --message="Integrating service in YunoHost..." yunohost service add $app --description="$app daemon for Wiki.js" --log="/var/log/$app/$app.log" -#================================================= -# SETUP SSOWAT -#================================================= -ynh_script_progression --message="Upgrading SSOwat configuration..." - -# 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="/" -fi - #================================================= # START SYSTEMD SERVICE #=================================================