diff --git a/README.md b/README.md index 3a809e0..2a37ec4 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ # Mobilizon for YunoHost -[![Integration level](https://dash.yunohost.org/integration/mobilizon.svg)](https://dash.yunohost.org/appci/app/mobilizon) ![](https://ci-apps.yunohost.org/ci/badges/mobilizon.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/mobilizon.maintain.svg) -[![Install Mobilizon with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=mobilizon) +[![Integration level](https://dash.yunohost.org/integration/REPLACEBYYOURAPP.svg)](https://dash.yunohost.org/appci/app/REPLACEBYYOURAPP) ![](https://ci-apps.yunohost.org/ci/badges/REPLACEBYYOURAPP.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/REPLACEBYYOURAPP.maintain.svg) +[![Install REPLACEBYYOURAPP with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=REPLACEBYYOURAPP) -> *This package allows you to install Mobilizon quickly and simply on a YunoHost server. +> *This package allows you to install REPLACEBYYOURAPP 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 @@ -46,8 +46,8 @@ LDAP is supported but HTTP auth is not supported? #### Supported architectures -* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/mobilizon%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/mobilizon/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/mobilizon%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/mobilizon/) +* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/REPLACEBYYOURAPP%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/REPLACEBYYOURAPP/) +* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/REPLACEBYYOURAPP%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/REPLACEBYYOURAPP/) ## Links @@ -58,14 +58,13 @@ LDAP is supported but HTTP auth is not supported? --- -Developer info ----------------- +## Developer info -Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/mobilizon_ynh/tree/testing). +Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/REPLACEBYYOURAPP_ynh/tree/testing). To try the testing branch, please proceed like that. ``` -sudo yunohost app install https://github.com/YunoHost-Apps/mobilizon_ynh/tree/testing --debug +sudo yunohost app install https://github.com/YunoHost-Apps/REPLACEBYYOURAPP_ynh/tree/testing --debug or -sudo yunohost app upgrade mobilizon -u https://github.com/YunoHost-Apps/mobilizon_ynh/tree/testing --debug +sudo yunohost app upgrade REPLACEBYYOURAPP -u https://github.com/YunoHost-Apps/REPLACEBYYOURAPP_ynh/tree/testing --debug ``` diff --git a/check_process b/check_process index 8afbb14..f9f05d7 100644 --- a/check_process +++ b/check_process @@ -24,13 +24,8 @@ # upgrade=1 from_commit=8413ab8bd3aca3e2f6c431153dd9dfab37860956 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=0 -;;; Levels - # If the level 5 (Package linter) is forced to 1. Please add justifications here. - Level 5=auto ;;; Options Email=yalh@yahoo.com Notification=all diff --git a/conf/app.src b/conf/app.src index f3b2dac..33fa7a2 100644 --- a/conf/app.src +++ b/conf/app.src @@ -4,3 +4,4 @@ SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true SOURCE_FILENAME=mobilizon-1.0.6.tar.gz +SOURCE_EXTRACT=true diff --git a/conf/nginx.conf b/conf/nginx.conf index e21dafd..e0eeb1e 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,11 +1,11 @@ -location / { +location __PATH__/ { # Force usage of https if ($scheme = http) { rewrite ^ https://$server_name$request_uri? permanent; } - # the nginx default is 1m, not enough for large media uploads - client_max_body_size 16m; + # Common parameter to increase upload size limit in conjunction with dedicated php-fpm file + client_max_body_size 50M; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; diff --git a/issue_template.md b/issue_template.md index 4713927..4a290c4 100644 --- a/issue_template.md +++ b/issue_template.md @@ -6,11 +6,11 @@ about: When creating a bug report, please use the following template to provide **How to post a meaningful bug report** 1. *Read this whole template first.* -2. *Make sure 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 the app itself. Refer to its documentation or repository for help.* - - *In doubt, ask here and we will figure it out together.* -3. *Delete these italic comments as you write over them below, and remove this guide.* +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 REPLACEBYYOURAPP 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 @@ -22,7 +22,7 @@ about: When creating a bug report, please use the following template to provide - 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`* @@ -31,13 +31,13 @@ about: When creating a bug report, please use the following template to provide - *If you performed a command from the CLI, the command itself is enough. For example:* ```sh - sudo yunohost app install mobilizon + sudo yunohost app install REPLACEBYYOURAPP ``` - *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 diff --git a/manifest.json b/manifest.json index 8484964..6292a8e 100644 --- a/manifest.json +++ b/manifest.json @@ -13,7 +13,7 @@ "name": "yalh76" }, "requirements": { - "yunohost": ">= 4.0" + "yunohost": ">= 4.1.3" }, "multi_instance": true, "services": [ diff --git a/pull_request_template.md b/pull_request_template.md index 6e38f27..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/mobilizon_ynh%20PR-NUM-%20(USERNAME)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/mobilizon_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/install b/scripts/install index 5458eda..4105def 100644 --- a/scripts/install +++ b/scripts/install @@ -53,7 +53,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=admin --value=$admin -ynh_app_setting_set --app=$app --key=is_public --value=$is_public ynh_app_setting_set --app=$app --key=language --value=$language ynh_app_setting_set --app=$app --key=admin_email --value=$admin_email ynh_app_setting_set --app=$app --key=ynh_user_password --value=$ynh_user_password @@ -223,13 +222,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/restore b/scripts/restore index 5cccea7..27f2602 100644 --- a/scripts/restore +++ b/scripts/restore @@ -138,7 +138,7 @@ ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --lin #================================================= # RELOAD NGINX AND PHP-FPM #================================================= -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 bda742f..2e3ad57 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -20,7 +20,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) admin=$(ynh_app_setting_get --app=$app --key=admin) -is_public=$(ynh_app_setting_get --app=$app --key=is_public) final_path=$(ynh_app_setting_get --app=$app --key=final_path) language=$(ynh_app_setting_get --app=$app --key=language) db_name=$(ynh_app_setting_get --app=$app --key=db_name) @@ -46,25 +45,9 @@ previous_version="${version}" #================================================= 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 +if ! ynh_permission_exists --permission="admin"; then + # Create the required permissions + ynh_permission_create --permission="admin" --url="/admin" --allowed=$admin fi ynh_secure_remove --file="$final_path/$app/priv/data/GeoLite2-City.mmdb" @@ -100,18 +83,18 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line #================================================= if ynh_version_gt "1.0.0~ynh1" "${previous_version}" ; then - ynh_script_progression --message="Upgrade configuration to 1.0.0..." + ynh_script_progression --message="Upgrade configuration to 1.0.0..." - ynh_user_password=$(ynh_string_random --length=30) - ynh_app_setting_set --app=$app --key=ynh_user_password --value=$ynh_user_password + ynh_user_password=$(ynh_string_random --length=30) + ynh_app_setting_set --app=$app --key=ynh_user_password --value=$ynh_user_password - yunohost user create ${app}_notifs --firstname "Mobilizon" --lastname "Notifications" --mail ${app}_notifs@$domain --password "$ynh_user_password" -q 0 - yunohost user update ${app}_notifs --add-mailalias $app@$domain --add-mailforward $admin_email + yunohost user create ${app}_notifs --firstname "Mobilizon" --lastname "Notifications" --mail ${app}_notifs@$domain --password "$ynh_user_password" -q 0 + yunohost user update ${app}_notifs --add-mailalias $app@$domain --add-mailforward $admin_email # Manage previous .env file ynh_backup_if_checksum_is_different --file="$final_path/$app/.env" - ynh_delete_file_checksum --file="$final_path/$app/.env" - ynh_secure_remove --file="$final_path/$app/.env" + ynh_delete_file_checksum --file="$final_path/$app/.env" + ynh_secure_remove --file="$final_path/$app/.env" # Configure Mobilizon config="$final_path/$app/config/prod.secret.exs" @@ -129,8 +112,8 @@ if ynh_version_gt "1.0.0~ynh1" "${previous_version}" ; then cat "../conf/ldap.exs" >> "$config" cat "../conf/mail.exs" >> "$config" - ynh_replace_string --match_string="__YNH_USER__" --replace_string="${app}_notifs" --target_file="$config" - ynh_replace_string --match_string="__YNH_USER_PASSWORD__" --replace_string="${ynh_user_password}" --target_file="$config" + ynh_replace_string --match_string="__YNH_USER__" --replace_string="${app}_notifs" --target_file="$config" + ynh_replace_string --match_string="__YNH_USER_PASSWORD__" --replace_string="${ynh_user_password}" --target_file="$config" # Recalculate and store the checksum of the file for the next upgrade. ynh_store_file_checksum --file="$config" @@ -148,7 +131,7 @@ then tmpdir="$(mktemp -d)" # Backup the config file in the temp dir - cp -a "$final_path/$app/config/prod.secret.exs" "$tmpdir/prod.secret.exs" + cp -a "$final_path/$app/config/prod.secret.exs" "$tmpdir/prod.secret.exs" # Remove the app directory securely ynh_secure_remove --file="$final_path/$app" @@ -157,7 +140,7 @@ then ynh_setup_source --dest_dir="$final_path/$app" #Copy the admin saved settings from tmp directory to final path - cp -a "$tmpdir/prod.secret.exs" "$final_path/$app/config/prod.secret.exs" + cp -a "$tmpdir/prod.secret.exs" "$final_path/$app/config/prod.secret.exs" # Remove the tmp directory securely ynh_secure_remove --file="$tmpdir" @@ -215,20 +198,20 @@ chmod o-rwx $config chown -R "$app":"$app" "$final_path" pushd $final_path/$app/js - ynh_use_nodejs - ynh_script_progression --message="Installing NodeJS dependencies (this is going to take a while...)" - sudo -u $app env PATH=$PATH yarn install - ynh_script_progression --message="Building NodeJS application (this is going to take a while...)" - sudo -u $app env PATH=$PATH NODE_BUILD_MEMORY=1024 yarn run build + ynh_use_nodejs + ynh_script_progression --message="Installing NodeJS dependencies (this is going to take a while...)" + sudo -u $app env PATH=$PATH yarn install + ynh_script_progression --message="Building NodeJS application (this is going to take a while...)" + sudo -u $app env PATH=$PATH NODE_BUILD_MEMORY=1024 yarn run build popd ynh_script_progression --message="Building Elixir application (this is going to take a while...)" pushd $final_path/$app - sudo -u "$app" MIX_ENV=prod mix local.hex --force - sudo -u "$app" MIX_ENV=prod mix local.rebar --force - sudo -u "$app" MIX_ENV=prod mix deps.get - sudo -u "$app" MIX_ENV=prod mix compile - sudo -u "$app" MIX_ENV=prod mix ecto.migrate + sudo -u "$app" MIX_ENV=prod mix local.hex --force + sudo -u "$app" MIX_ENV=prod mix local.rebar --force + sudo -u "$app" MIX_ENV=prod mix deps.get + sudo -u "$app" MIX_ENV=prod mix compile + sudo -u "$app" MIX_ENV=prod mix ecto.migrate popd #================================================= @@ -236,10 +219,10 @@ popd #================================================= if ynh_version_gt "1.0.3~ynh1" "${previous_version}" ; then - ynh_script_progression --message="Mobilizon v1.0.3: Refresh remote profiles to save avatars locally" - pushd $final_path/$app - sudo -u "$app" MIX_ENV=prod mix mobilizon.actors.refresh --all - popd + ynh_script_progression --message="Mobilizon v1.0.3: Refresh remote profiles to save avatars locally" + pushd $final_path/$app + sudo -u "$app" MIX_ENV=prod mix mobilizon.actors.refresh --all + popd fi #================================================= @@ -282,18 +265,6 @@ ynh_script_progression --message="Starting a systemd service..." ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Access Mobilizon.Web.Endpoint at" -#================================================= -# 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 - #================================================= # RELOAD NGINX #=================================================