From c943a9a9b67b12cffc59a1f83cb1a8424bad8f86 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 4 Jun 2020 00:53:37 +0200 Subject: [PATCH 01/48] cleanup --- scripts/backup | 2 +- scripts/install | 1 - scripts/remove | 2 +- scripts/restore | 1 - scripts/upgrade | 1 - scripts/ynh_add_extra_apt_repos__3 | 294 ----------------------------- 6 files changed, 2 insertions(+), 299 deletions(-) delete mode 100644 scripts/ynh_add_extra_apt_repos__3 diff --git a/scripts/backup b/scripts/backup index b42b5fe..0e29669 100644 --- a/scripts/backup +++ b/scripts/backup @@ -60,7 +60,7 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= ynh_print_info --message="Backing up the PostgreSQL database..." -ynh_psql_dump_db --database=$db_name > db.sql +ynh_psql_dump_db --database="$db_name" > db.sql #================================================= # SPECIFIC BACKUP diff --git a/scripts/install b/scripts/install index d05a4a4..6266fa4 100644 --- a/scripts/install +++ b/scripts/install @@ -7,7 +7,6 @@ #================================================= source _common.sh -source ynh_add_extra_apt_repos__3 source /usr/share/yunohost/helpers #================================================= diff --git a/scripts/remove b/scripts/remove index f9aa296..8e1e1c7 100644 --- a/scripts/remove +++ b/scripts/remove @@ -50,7 +50,7 @@ ynh_remove_systemd_config ynh_print_info --message="Removing the PostgreSQL database..." # Remove a database if it exists, along with the associated user -ynh_psql_remove_db --db_user=$db_user --db_name=$db_name +ynh_psql_remove_db --db_user="$db_user" --db_name="$db_name" #================================================= # REMOVE DEPENDENCIES diff --git a/scripts/restore b/scripts/restore index 97b3220..fd06ef1 100644 --- a/scripts/restore +++ b/scripts/restore @@ -8,7 +8,6 @@ #Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh -source ../settings/scripts/ynh_add_extra_apt_repos__3 source /usr/share/yunohost/helpers #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 92df5c9..bf4b7e2 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -7,7 +7,6 @@ #================================================= source _common.sh -source ynh_add_extra_apt_repos__3 source /usr/share/yunohost/helpers #================================================= diff --git a/scripts/ynh_add_extra_apt_repos__3 b/scripts/ynh_add_extra_apt_repos__3 deleted file mode 100644 index 1b05ce9..0000000 --- a/scripts/ynh_add_extra_apt_repos__3 +++ /dev/null @@ -1,294 +0,0 @@ -#!/bin/bash - -# Pin a repository. -# -# usage: ynh_pin_repo --package=packages --pin=pin_filter [--priority=priority_value] [--name=name] [--append] -# | arg: -p, --package - Packages concerned by the pin. Or all, *. -# | arg: -i, --pin - Filter for the pin. -# | arg: -p, --priority - Priority for the pin -# | arg: -n, --name - Name for the files for this repo, $app as default value. -# | arg: -a, --append - Do not overwrite existing files. -# -# See https://manpages.debian.org/stretch/apt/apt_preferences.5.en.html for information about pinning. -# -ynh_pin_repo () { - # Declare an array to define the options of this helper. - local legacy_args=pirna - declare -Ar args_array=( [p]=package= [i]=pin= [r]=priority= [n]=name= [a]=append ) - local package - local pin - local priority - local name - local append - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - package="${package:-*}" - priority=${priority:-50} - name="${name:-$app}" - append=${append:-0} - - if [ $append -eq 1 ] - then - append="tee -a" - else - append="tee" - fi - - mkdir -p "/etc/apt/preferences.d" - echo "Package: $package -Pin: $pin -Pin-Priority: $priority" \ - | $append "/etc/apt/preferences.d/$name" -} - -# Add a repository. -# -# usage: ynh_add_repo --uri=uri --suite=suite --component=component [--name=name] [--append] -# | arg: -u, --uri - Uri of the repository. -# | arg: -s, --suite - Suite of the repository. -# | arg: -c, --component - Component of the repository. -# | arg: -n, --name - Name for the files for this repo, $app as default value. -# | arg: -a, --append - Do not overwrite existing files. -# -# Example for a repo like deb http://forge.yunohost.org/debian/ stretch stable -# uri suite component -# ynh_add_repo --uri=http://forge.yunohost.org/debian/ --suite=stretch --component=stable -# -ynh_add_repo () { - # Declare an array to define the options of this helper. - local legacy_args=uscna - declare -Ar args_array=( [u]=uri= [s]=suite= [c]=component= [n]=name= [a]=append ) - local uri - local suite - local component - local name - local append - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - name="${name:-$app}" - append=${append:-0} - - if [ $append -eq 1 ] - then - append="tee -a" - else - append="tee" - fi - - mkdir -p "/etc/apt/sources.list.d" - # Add the new repo in sources.list.d - echo "deb $uri $suite $component" \ - | $append "/etc/apt/sources.list.d/$name.list" -} - -# Add an extra repository correctly, pin it and get the key. -# -# usage: ynh_install_extra_repo --repo="repo" [--key=key_url] [--priority=priority_value] [--name=name] [--append] -# | arg: -r, --repo - Complete url of the extra repository. -# | arg: -k, --key - url to get the public key. -# | arg: -p, --priority - Priority for the pin -# | arg: -n, --name - Name for the files for this repo, $app as default value. -# | arg: -a, --append - Do not overwrite existing files. -ynh_install_extra_repo () { - # Declare an array to define the options of this helper. - local legacy_args=rkpna - declare -Ar args_array=( [r]=repo= [k]=key= [p]=priority= [n]=name= [a]=append ) - local repo - local key - local priority - local name - local append - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - name="${name:-$app}" - append=${append:-0} - key=${key:-0} - priority=${priority:-} - - if [ $append -eq 1 ] - then - append="--append" - wget_append="tee -a" - else - append="" - wget_append="tee" - fi - - # Split the repository into uri, suite and components. - # Remove "deb " at the beginning of the repo. - repo="${repo#deb }" - - # Get the uri - local uri="$(echo "$repo" | awk '{ print $1 }')" - - # Get the suite - local suite="$(echo "$repo" | awk '{ print $2 }')" - - # Get the components - local component="${repo##$uri $suite }" - - # Add the repository into sources.list.d - ynh_add_repo --uri="$uri" --suite="$suite" --component="$component" --name="$name" $append - - # Pin the new repo with the default priority, so it won't be used for upgrades. - # Build $pin from the uri without http and any sub path - local pin="${uri#*://}" - pin="${pin%%/*}" - # Set a priority only if asked - if [ -n "$priority" ] - then - priority="--priority=$priority" - fi - ynh_pin_repo --package="*" --pin="origin \"$pin\"" $priority --name="$name" $append - - # Get the public key for the repo - if [ -n "$key" ] - then - mkdir -p "/etc/apt/trusted.gpg.d" - wget -q "$key" -O - | gpg --dearmor | $wget_append /etc/apt/trusted.gpg.d/$name.gpg > /dev/null - fi - - # Update the list of package with the new repo - ynh_package_update -} - -# Remove an extra repository and the assiociated configuration. -# -# usage: ynh_remove_extra_repo [--name=name] -# | arg: -n, --name - Name for the files for this repo, $app as default value. -ynh_remove_extra_repo () { - # Declare an array to define the options of this helper. - local legacy_args=n - declare -Ar args_array=( [n]=name= ) - local name - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - name="${name:-$app}" - - ynh_secure_remove --file="/etc/apt/sources.list.d/$name.list" - ynh_secure_remove --file="/etc/apt/preferences.d/$name" - ynh_secure_remove --file="/etc/apt/trusted.gpg.d/$name.gpg" - ynh_secure_remove --file="/etc/apt/trusted.gpg.d/$name.asc" - - # Update the list of package to exclude the old repo - ynh_package_update -} - -# Install packages from an extra repository properly. -# -# usage: ynh_install_extra_app_dependencies --repo="repo" --package="dep1 dep2" [--key=key_url] [--name=name] -# | arg: -r, --repo - Complete url of the extra repository. -# | arg: -p, --package - The packages to install from this extra repository -# | arg: -k, --key - url to get the public key. -# | arg: -n, --name - Name for the files for this repo, $app as default value. -ynh_install_extra_app_dependencies () { - # Declare an array to define the options of this helper. - local legacy_args=rpkn - declare -Ar args_array=( [r]=repo= [p]=package= [k]=key= [n]=name= ) - local repo - local package - local key - local name - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - name="${name:-$app}" - key=${key:-0} - - # Set a key only if asked - if [ -n "$key" ] - then - key="--key=$key" - fi - # Add an extra repository for those packages - ynh_install_extra_repo --repo="$repo" $key --priority=995 --name=$name - - # Install requested dependencies from this extra repository. - ynh_add_app_dependencies --package="$package" - - # Remove this extra repository after packages are installed - ynh_remove_extra_repo --name=$app -} - -#================================================= - -# patched version of ynh_install_app_dependencies to be used with ynh_add_app_dependencies - -# Define and install dependencies with a equivs control file -# This helper can/should only be called once per app -# -# usage: ynh_install_app_dependencies dep [dep [...]] -# | arg: dep - the package name to install in dependence -# You can give a choice between some package with this syntax : "dep1|dep2" -# Example : ynh_install_app_dependencies dep1 dep2 "dep3|dep4|dep5" -# This mean in the dependence tree : dep1 & dep2 & (dep3 | dep4 | dep5) -# -# Requires YunoHost version 2.6.4 or higher. -ynh_install_app_dependencies () { - local dependencies=$@ - dependencies="$(echo "$dependencies" | sed 's/\([^\<=\>]\)\ \([^(]\)/\1, \2/g')" - dependencies=${dependencies//|/ | } - local manifest_path="../manifest.json" - if [ ! -e "$manifest_path" ]; then - manifest_path="../settings/manifest.json" # Into the restore script, the manifest is not at the same place - fi - - local version=$(grep '\"version\": ' "$manifest_path" | cut -d '"' -f 4) # Retrieve the version number in the manifest file. - if [ ${#version} -eq 0 ]; then - version="1.0" - fi - local dep_app=${app//_/-} # Replace all '_' by '-' - - # Handle specific versions - if [[ "$dependencies" =~ [\<=\>] ]] - then - # Replace version specifications by relationships syntax - # https://www.debian.org/doc/debian-policy/ch-relationships.html - # Sed clarification - # [^(\<=\>] ignore if it begins by ( or < = >. To not apply twice. - # [\<=\>] matches < = or > - # \+ matches one or more occurence of the previous characters, for >= or >>. - # [^,]\+ matches all characters except ',' - # Ex: package>=1.0 will be replaced by package (>= 1.0) - dependencies="$(echo "$dependencies" | sed 's/\([^(\<=\>]\)\([\<=\>]\+\)\([^,]\+\)/\1 (\2 \3)/g')" - fi - - cat > /tmp/${dep_app}-ynh-deps.control << EOF # Make a control file for equivs-build -Section: misc -Priority: optional -Package: ${dep_app}-ynh-deps -Version: ${version} -Depends: ${dependencies} -Architecture: all -Description: Fake package for $app (YunoHost app) dependencies - This meta-package is only responsible of installing its dependencies. -EOF - ynh_package_install_from_equivs /tmp/${dep_app}-ynh-deps.control \ - || ynh_die --message="Unable to install dependencies" # Install the fake package and its dependencies - rm /tmp/${dep_app}-ynh-deps.control - ynh_app_setting_set --app=$app --key=apt_dependencies --value="$dependencies" -} - -ynh_add_app_dependencies () { - # Declare an array to define the options of this helper. - local legacy_args=pr - declare -Ar args_array=( [p]=package= [r]=replace) - local package - local replace - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - replace=${replace:-0} - - local current_dependencies="" - if [ $replace -eq 0 ] - then - local dep_app=${app//_/-} # Replace all '_' by '-' - if ynh_package_is_installed --package="${dep_app}-ynh-deps" - then - current_dependencies="$(dpkg-query --show --showformat='${Depends}' ${dep_app}-ynh-deps) " - fi - - current_dependencies=${current_dependencies// | /|} - fi - - ynh_install_app_dependencies "${current_dependencies}${package}" -} From 361b49c0478635bdfdf82bf174f3010e26151d4b Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 3 Aug 2020 23:19:04 +0200 Subject: [PATCH 02/48] Upgrade to 1.0.0-beta.3 --- README.md | 14 +++---- check_process | 9 +++++ conf/.env | 22 ----------- conf/app.src | 6 +-- conf/nginx.conf | 16 +++++++- conf/prod.exs | 88 -------------------------------------------- conf/systemd.service | 13 +++---- issue_template.md | 46 +++++++++++++++++++++++ manifest.json | 6 +-- scripts/_common.sh | 4 +- scripts/backup | 35 +++++------------- scripts/change_url | 27 +++++++------- scripts/install | 84 +++++++++++++----------------------------- scripts/remove | 29 ++++++--------- scripts/restore | 29 +++++++-------- scripts/upgrade | 79 +++++++++++++++------------------------ 16 files changed, 197 insertions(+), 310 deletions(-) delete mode 100644 conf/.env delete mode 100644 conf/prod.exs create mode 100644 issue_template.md diff --git a/README.md b/README.md index 9716005..549344b 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ # Mobilizon for YunoHost -[![Integration level](https://dash.yunohost.org/integration/mobilizon.svg)](https://dash.yunohost.org/appci/app/mobilizon) +[![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.png)](https://install-app.yunohost.org/?app=mobilizon) -> *This package allow you to install Mobilizon quickly and simply on a YunoHost server. -If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.* +> *This package allows you to install Mobilizon 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 MobiliZon is your federated organization and mobilization platform. Supported by [Framasoft](https://framasoft.org/en/) @@ -13,7 +13,7 @@ MobiliZon aims to solve existing platform's problems to organize events in a dec Mobilizon is a tool designed to create platforms for managing communities and events. Its purpose is to help as many people as possible to free themselves from Facebook groups and events, from Meetup, etc. -**Shipped version:** 0.1.0-2019-12-28 +**Shipped version:** 1.0.0-beta.3 ## Important points to read before installing @@ -46,7 +46,7 @@ exit #### Supported architectures -* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/mobilizon%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/mobilizon/) +* 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/) ## Links @@ -58,10 +58,10 @@ exit --- -Developers info +Developer info ---------------- -Please do 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/mobilizon_ynh/tree/testing). To try the testing branch, please proceed like that. ``` diff --git a/check_process b/check_process index 1f9a30a..f1906fd 100644 --- a/check_process +++ b/check_process @@ -14,7 +14,10 @@ setup_private=1 setup_public=1 upgrade=1 + # 0.1.0-2019-05-15~ynh1 upgrade=1 from_commit=185cc16e516076e340cca149e8e9140a8762e22e + # 0.1.0-2019-12-28~ynh1 + upgrade=1 from_commit=6b77f268d4e7e2cd525e11e11f3ed5a5162d0bd2 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. @@ -27,3 +30,9 @@ ;;; Options Email=yalh@yahoo.com Notification=all +;;; Upgrade options + ; commit=185cc16e516076e340cca149e8e9140a8762e22e + name=0.1.0-2019-05-15~ynh1 + ; commit=6b77f268d4e7e2cd525e11e11f3ed5a5162d0bd2 + name=0.1.0-2019-12-28~ynh1 + diff --git a/conf/.env b/conf/.env deleted file mode 100644 index 3c79767..0000000 --- a/conf/.env +++ /dev/null @@ -1,22 +0,0 @@ -# Settings -MOBILIZON_INSTANCE_NAME="__NAME__" -MOBILIZON_INSTANCE_HOST="__DOMAIN__" -MOBILIZON_INSTANCE_PORT=__PORT__ -MOBILIZON_INSTANCE_EMAIL="__ADMIN_EMAIL__" -MOBILIZON_INSTANCE_REGISTRATIONS_OPEN=true - -# API -GRAPHQL_API_ENDPOINT="https://__DOMAIN__" -GRAPHQL_API_FULL_PATH="" - -# APP -MIX_ENV=prod -MOBILIZON_LOGLEVEL="error" -MOBILIZON_SECRET="__SECRET__" - -# Database -MOBILIZON_DATABASE_USERNAME="__DB_USER__" -MOBILIZON_DATABASE_PASSWORD="__DB_PWD__" -MOBILIZON_DATABASE_DBNAME="__DB_NAME__" -MOBILIZON_DATABASE_HOST="localhost" -MOBILIZON_DATABASE_PORT=5432 diff --git a/conf/app.src b/conf/app.src index 2cad1bc..e45c24e 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,6 +1,6 @@ -SOURCE_URL=https://framagit.org/framasoft/mobilizon/-/archive/62ad69c53c1c0789e879ad04787121a27883639e/mobilizon-62ad69c53c1c0789e879ad04787121a27883639e.tar.gz -SOURCE_SUM=d9db8d987134cae240fbdc4b3fb207328eee168242b809ec3dc66d7bfd17660e +SOURCE_URL=https://framagit.org/framasoft/mobilizon/-/archive/1.0.0-beta.3/mobilizon-1.0.0-beta.3.tar.gz +SOURCE_SUM=5bf0f328f19fd182b0a02088bd9d53cd9e9042dde165328d42c9b12149b97c2d SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true -SOURCE_FILENAME=0.1.0-2019-12-28.tar.gz \ No newline at end of file +SOURCE_FILENAME=mobilizon-1.0.0-beta.3.tar.gz \ No newline at end of file diff --git a/conf/nginx.conf b/conf/nginx.conf index 7a4b36a..eb3c411 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -4,16 +4,30 @@ location / { rewrite ^ https://$server_name$request_uri? permanent; } - # Standard nginx configuration + gzip off; proxy_http_version 1.1; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + + # For Websocket support proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $http_host; + proxy_redirect off; + proxy_pass http://localhost:__PORT__; client_max_body_size 16m; + location ~* \.(css|js)$ { + root /home/mobilizon/live/priv/static; + etag off; + expires 1y; + access_log off; + add_header Cache-Control public; + } + # Include SSOWAT user panel. include conf.d/yunohost_panel.conf.inc; } diff --git a/conf/prod.exs b/conf/prod.exs deleted file mode 100644 index 59a2308..0000000 --- a/conf/prod.exs +++ /dev/null @@ -1,88 +0,0 @@ -import Config - -config :mobilizon, MobilizonWeb.Endpoint, - load_from_system_env: true, - url: [ - host: "__DOMAIN__", - port: 443, - scheme: "https" - ], - http: [ - ip: {127, 0, 0, 1}, - port: __PORT__ - ], - secret_key_base: - "__SECRET__", - cache_static_manifest: "priv/static/manifest.json" - -# Configure your database -config :mobilizon, Mobilizon.Storage.Repo, - types: Mobilizon.Storage.PostgresTypes, - username: "__DB_USER__", - password: "__DB_PWD__", - database: "__DB_NAME__", - hostname: "localhost", - port: "5432", - pool_size: 15 - -config :mobilizon, MobilizonWeb.Email.Mailer, - adapter: Bamboo.SMTPAdapter, - server: "localhost", - hostname: "localhost", - port: 25, - # or {:system, "SMTP_USERNAME"} - username: nil, - # or {:system, "SMTP_PASSWORD"} - password: nil, - # can be `:always` or `:never` - tls: :if_available, - # or {":system", ALLOWED_TLS_VERSIONS"} w/ comma seprated values (e.g. "tlsv1.1,tlsv1.2") - allowed_tls_versions: [:tlsv1, :"tlsv1.1", :"tlsv1.2"], - # can be `true` - ssl: false, - retries: 1, - # can be `true` - no_mx_lookups: false - -# Do not print debug messages in production -#config :logger, level: System.get_env("MOBILIZON_LOGLEVEL") |> String.to_atom() || :info - -config :mobilizon, Mobilizon.Service.Geospatial, service: Mobilizon.Service.Geospatial.Nominatim - -# ## SSL Support -# -# To get SSL working, you will need to add the `https` key -# to the previous section and set your `:url` port to 443: -# -# config :mobilizon, MobilizonWeb.Endpoint, -# ... -# url: [host: "example.com", port: 443], -# https: [:inet6, -# port: 443, -# keyfile: System.get_env("SOME_APP_SSL_KEY_PATH"), -# certfile: System.get_env("SOME_APP_SSL_CERT_PATH")] -# -# Where those two env variables return an absolute path to -# the key and cert in disk or a relative path inside priv, -# for example "priv/ssl/server.key". -# -# We also recommend setting `force_ssl`, ensuring no data is -# ever sent via http, always redirecting to https: -# -# config :mobilizon, MobilizonWeb.Endpoint, -# force_ssl: [hsts: true] -# -# Check `Plug.SSL` for all available options in `force_ssl`. - -# ## Using releases -# -# If you are doing OTP releases, you need to instruct Phoenix -# to start the server for all endpoints: -# -# config :phoenix, :serve_endpoints, true -# -# Alternatively, you can configure exactly which server to -# start per endpoint: -# -# config :mobilizon, MobilizonWeb.Endpoint, server: true -# diff --git a/conf/systemd.service b/conf/systemd.service index ea95f14..b93a07e 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -3,17 +3,15 @@ Description=__APP__ Mobilizon Service After=network.target postgresql.service [Service] +User=__APP__ +WorkingDirectory=__FINALPATH__/__APP__/ +ExecStart=/usr/bin/env mix phx.server ExecReload=/bin/kill $MAINPID KillMode=process Restart=on-failure -User=__APP__ -Group=__APP__ +Environment=MIX_ENV=prod -Environment="MIX_ENV=prod" -EnvironmentFile=__FINALPATH__/__APP__/.env - -WorkingDirectory=__FINALPATH__/__APP__/ -ExecStart=/usr/bin/mix phx.server +SyslogIdentifier=mobilizon ; Some security directives. ; Use private /tmp and /var/tmp folders inside a new file system namespace, which are discarded after the process stops. @@ -25,5 +23,6 @@ PrivateDevices=false ; Ensures that the service process and all its children can never gain new privileges through execve(). NoNewPrivileges=true + [Install] WantedBy=multi-user.target diff --git a/issue_template.md b/issue_template.md new file mode 100644 index 0000000..e7ad54a --- /dev/null +++ b/issue_template.md @@ -0,0 +1,46 @@ +--- +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. + +--- + +**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 Mobilizon itself. Refer to its documentation or repository for help.* + - *If you have a doubt, post here, we will figure it out together.* +3. *Delete the italic comments as you write over them below, and remove this guide.* +--- + +**Describe the bug** +*A clear and concise description of what the bug is.* + +**Versions** +- 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* + - 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.* +- *If you performed a command from the CLI, the command itself is enough. For example:* + ```sh + sudo yunohost app install mobilizon + ``` +- *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 '....'* + 4. *See error* + +**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.* +*If applicable and useful, add screenshots to help explain your problem.* diff --git a/manifest.json b/manifest.json index 551b574..41298ad 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "A decentralized and federated platform to organize events", "fr": "Une plateforme décentralisée et fédérée pour organiser des événements" }, - "version": "0.1.0-2019-12-28~ynh1", + "version": "1.0.0-beta.3~ynh1", "url": "https://joinmobilizon.org/", "license": "AGPL-3.0-or-later", "maintainer": { @@ -74,8 +74,8 @@ "en": "Choose the instance name", "fr": "Choisissez le nom de l'instance" }, - "example": "My Mobilizon", - "default": "My Mobilizon" + "example": "Mobilizon", + "default": "Mobilizon" } ] } diff --git a/scripts/_common.sh b/scripts/_common.sh index dccf378..e5f878e 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,9 +5,11 @@ #================================================= # dependencies used by the app -pkg_dependencies="build-essential inotify-tools postgresql postgresql-client postgresql-contrib git curl gnupg openssl postgis make gcc libc-dev argon2 imagemagick" +pkg_dependencies="build-essential inotify-tools postgresql postgresql-client postgresql-contrib git curl gnupg openssl postgis make gcc libc-dev argon2 imagemagick webp gifsicle jpegoptim optipng pngquant" extra_pkg_dependencies="elixir esl-erlang" +NODEJS_VERSION=12 + #================================================= # PERSONAL HELPERS #================================================= diff --git a/scripts/backup b/scripts/backup index 0e29669..9fcc981 100644 --- a/scripts/backup +++ b/scripts/backup @@ -13,7 +13,6 @@ source /usr/share/yunohost/helpers #================================================= # MANAGE SCRIPT FAILURE #================================================= -ynh_print_info --message="Managing script failure..." ynh_clean_setup () { ynh_clean_check_starting @@ -33,28 +32,30 @@ domain=$(ynh_app_setting_get --app=$app --key=domain) db_name=$(ynh_app_setting_get --app=$app --key=db_name) #================================================= -# STANDARD BACKUP STEPS +# DECLARE DATA AND CONF FILES TO BACKUP #================================================= -# STOP SYSTEMD SERVICE -#================================================= -ynh_print_info --message="Stopping a systemd service..." - -ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd +ynh_print_info --message="Declaring files to be backed up..." #================================================= # BACKUP THE APP MAIN DIR #================================================= -ynh_print_info --message="Backing up the main app directory..." ynh_backup --src_path="$final_path" #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= -ynh_print_info --message="Backing up nginx web server configuration..." ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" +#================================================= +# SPECIFIC BACKUP +#================================================= +# BACKUP SYSTEMD +#================================================= + +ynh_backup --src_path="/etc/systemd/system/$app.service" + #================================================= # BACKUP THE POSTGRESQL DATABASE #================================================= @@ -62,22 +63,6 @@ ynh_print_info --message="Backing up the PostgreSQL database..." ynh_psql_dump_db --database="$db_name" > db.sql -#================================================= -# SPECIFIC BACKUP -#================================================= -# BACKUP SYSTEMD -#================================================= -ynh_print_info --message="Backing up systemd configuration..." - -ynh_backup --src_path="/etc/systemd/system/$app.service" - -#================================================= -# START SYSTEMD SERVICE -#================================================= -ynh_print_info --message="Starting a systemd service..." - -ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Access MobilizonWeb.Endpoint at" - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/change_url b/scripts/change_url index 7453e00..07d9ec9 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -24,7 +24,7 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # LOAD SETTINGS #================================================= -ynh_print_info --message="Loading installation settings..." +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) @@ -37,7 +37,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_print_info --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,14 +72,14 @@ fi #================================================= # STOP SYSTEMD SERVICE #================================================= -ynh_print_info --message="Stopping a systemd service..." +ynh_script_progression --message="Stopping a systemd service..." ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped" #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_print_info --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 @@ -110,33 +110,34 @@ fi #================================================= # MODIFY A CONFIG FILE #================================================= -ynh_print_info --message="Modifying a config file..." +ynh_script_progression --message="Modifying a config file..." -ynh_replace_string --match_string="$old_domain" --replace_string="$new_domain" --target_file="$final_path/$app/.env" -ynh_replace_string --match_string="$old_domain" --replace_string="$new_domain" --target_file="$final_path/$app/config/prod.secret.exs" +config="$final_path/$app/config/prod.secret.exs" +ynh_replace_string --match_string="$old_domain" --replace_string="$new_domain" --target_file="$config" #================================================= # STORE THE CONFIG FILE CHECKSUM #================================================= -ynh_print_info --message="Storing the config file checksum..." +ynh_script_progression --message="Storing the config file checksum..." -ynh_backup_if_checksum_is_different --file="$final_path/$app/.env" +ynh_backup_if_checksum_is_different --file="$config" # Recalculate and store the checksum of the file for the next upgrade. -ynh_store_file_checksum --file="$final_path/$app/.env" +ynh_store_file_checksum --file="$config" #================================================= # GENERIC FINALISATION #================================================= # START SYSTEMD SERVICE #================================================= -ynh_print_info --message="Starting a systemd service..." +ynh_script_progression --message="Starting a systemd service..." +# Start a systemd service ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Access MobilizonWeb.Endpoint at" #================================================= # RELOAD NGINX #================================================= -ynh_print_info --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading nginx web server..." ynh_systemd_action --service_name=nginx --action=reload @@ -144,4 +145,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_print_info --message="Change of URL completed for $app" +ynh_script_progression --message="Change of URL completed for $app" diff --git a/scripts/install b/scripts/install index 6266fa4..aeedc93 100644 --- a/scripts/install +++ b/scripts/install @@ -12,10 +12,10 @@ source /usr/share/yunohost/helpers #================================================= # MANAGE SCRIPT FAILURE #================================================= -ynh_print_info --message="Managing script failure..." ynh_clean_setup () { - ynh_clean_check_starting + read -p "key" + ynh_clean_check_starting } # Exit if an error occurs during the execution of the script ynh_abort_if_errors @@ -23,7 +23,6 @@ ynh_abort_if_errors #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= -ynh_print_info --message="Retrieving arguments from the manifest..." domain=$YNH_APP_ARG_DOMAIN path_url="/" @@ -33,7 +32,6 @@ language=$YNH_APP_ARG_LANGUAGE password=$YNH_APP_ARG_PASSWORD name=$YNH_APP_ARG_NAME -secret=$(ynh_string_random 30) admin_email=$(ynh_user_get_info $admin 'mail') app=$YNH_APP_INSTANCE_NAME @@ -41,7 +39,7 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= -ynh_print_info --message="Validating installation parameters..." +ynh_script_progression --message="Validating installation parameters..." final_path=/var/www/$app test ! -e "$final_path" || ynh_die --message="This path already contains a folder" @@ -52,7 +50,7 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -ynh_print_info --message="Storing installation settings..." +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 @@ -60,7 +58,6 @@ 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=name --value=$name -ynh_app_setting_set --app=$app --key=secret --value=$secret ynh_app_setting_set --app=$app --key=admin_email --value=$admin_email #================================================= @@ -68,7 +65,7 @@ ynh_app_setting_set --app=$app --key=admin_email --value=$admin_email #================================================= # FIND AND OPEN A PORT #================================================= -ynh_print_info --message="Configuring firewall..." +ynh_script_progression --message="Configuring firewall..." # Find an available port port=$(ynh_find_port --port=8095) @@ -77,18 +74,18 @@ ynh_app_setting_set --app=$app --key=port --value=$port #================================================= # INSTALL DEPENDENCIES #================================================= -ynh_print_info --message="Installing dependencies..." +ynh_script_progression --message="Installing dependencies..." ynh_install_app_dependencies $pkg_dependencies -ynh_install_nodejs --nodejs_version="10" +ynh_install_nodejs --nodejs_version=$NODEJS_VERSION ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key='https://dl.yarnpkg.com/debian/pubkey.gpg' #================================================= # INSTALL EXTRA DEPENDENCIES #================================================= -ynh_print_info --message="Installing extra dependencies ..." +ynh_script_progression --message="Installing extra dependencies ..." lsb_name="$(lsb_release --codename --short)" ynh_install_extra_app_dependencies --repo="deb http://packages.erlang-solutions.com/debian $lsb_name contrib" --package="$extra_pkg_dependencies" --key='https://packages.erlang-solutions.com/debian/erlang_solutions.asc' @@ -96,7 +93,7 @@ ynh_install_extra_app_dependencies --repo="deb http://packages.erlang-solutions. #================================================= # CREATE A POSTGRESQL DATABASE #================================================= -ynh_print_info --message="Creating a PostgreSQL database..." +ynh_script_progression --message="Creating a PostgreSQL database..." db_name=$(ynh_sanitize_dbid --db_name=$app) db_user=$db_name @@ -113,7 +110,7 @@ ynh_psql_execute_as_root --sql="ALTER USER $db_user PASSWORD '$db_pwd';" --datab #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_print_info --message="Setting up source files..." +ynh_script_progression --message="Setting up source files..." ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress and patch the source from app.src @@ -122,7 +119,7 @@ ynh_setup_source --dest_dir="$final_path/$app" #================================================= # NGINX CONFIGURATION #================================================= -ynh_print_info --message="Configuring nginx web server..." +ynh_script_progression --message="Configuring nginx web server..." # Create a dedicated nginx config ynh_add_nginx_config @@ -130,50 +127,23 @@ ynh_add_nginx_config #================================================= # CREATE DEDICATED USER #================================================= -ynh_print_info --message="Configuring system user..." +ynh_script_progression --message="Configuring system user..." # Create a system user ynh_system_user_create --username=$app --home_dir=$final_path #================================================= # SPECIFIC SETUP -#================================================= -# MODIFY A CONFIG FILE -#================================================= -ynh_print_info --message="Modifying a config file..." - -config="$final_path/$app/.env" -cp ../conf/.env "$config" - -ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$config" -ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$config" -ynh_replace_string --match_string="__SECRET__" --replace_string="$secret" --target_file="$config" -ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$config" -ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_user" --target_file="$config" -ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$config" -ynh_replace_string --match_string="__NAME__" --replace_string="$name" --target_file="$config" -ynh_replace_string --match_string="__ADMIN_EMAIL__" --replace_string="$admin_email" --target_file="$config" - #================================================= # MAKE SETUP #================================================= -ynh_print_info --message="Making setup..." - -# Temporarly bypass error : WARNING ** (ArgumentError) argument error and System.get_env doesn't load environment variables - -ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="../conf/prod.exs" -ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="../conf/prod.exs" -ynh_replace_string --match_string="__SECRET__" --replace_string="$secret" --target_file="../conf/prod.exs" -ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="../conf/prod.exs" -ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_user" --target_file="../conf/prod.exs" -ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="../conf/prod.exs" -ynh_replace_string --match_string="__NAME__" --replace_string="$name" --target_file="../conf/prod.exs" -ynh_replace_string --match_string="__ADMIN_EMAIL__" --replace_string="$admin_email" --target_file="../conf/prod.exs" -cp ../conf/prod.exs "$final_path/$app/config/prod.exs" +ynh_script_progression --message="Making setup..." # Give permission to the final_path chown -R "$app":"$app" "$final_path" +config="$final_path/$app/config/prod.secret.exs" + pushd $final_path/$app/js ynh_use_nodejs sudo -u $app env PATH=$PATH yarn install @@ -181,20 +151,18 @@ pushd $final_path/$app/js popd pushd $final_path/$app - ynh_replace_string --match_string="config :logger" --replace_string="#config :logger" --target_file="$final_path/$app/config/prod.exs" - source .env 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 ecto.migrate - sudo -u "$app" MIX_ENV=prod mix phx.digest - ynh_replace_string --match_string="#config :logger" --replace_string="config :logger" --target_file="$final_path/$app/config/prod.exs" + sudo -u "$app" MIX_ENV=prod mix compile + sudo -u "$app" MIX_ENV=prod mix mobilizon.instance gen --force --output $config --output-psql /tmp/setup_db.psql --domain $domain --instance-name $name --admin-email $admin_email --dbhost localhost --dbname $db_name --dbuser $db_user --dbpass $db_pwd --listen-port $port + sudo -u "$app" MIX_ENV=prod mix mobilizon.users.new "$admin_email" --admin --password "$password" popd #================================================= # SETUP SYSTEMD #================================================= -ynh_print_info --message="Configuring a systemd service..." +ynh_script_progression --message="Configuring a systemd service..." # Create a dedicated systemd config ynh_add_systemd_config @@ -202,7 +170,7 @@ ynh_add_systemd_config #================================================= # STORE THE CONFIG FILE CHECKSUM #================================================= -ynh_print_info --message="Storing the config file checksum..." +ynh_script_progression --message="Storing the config file checksum..." # Calculate and store the config file checksum into the app settings ynh_store_file_checksum --file="$config" @@ -212,7 +180,7 @@ ynh_store_file_checksum --file="$config" #================================================= # SECURE FILES AND DIRECTORIES #================================================= -ynh_print_info --message="Securing files and directories..." +ynh_script_progression --message="Securing files and directories..." # Set permissions to app files chown -R "$app":"$app" "$final_path" @@ -220,14 +188,14 @@ chown -R "$app":"$app" "$final_path" #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= -ynh_print_info --message="Integrating service in YunoHost..." +ynh_script_progression --message="Integrating service in YunoHost..." yunohost service add $app --description "$app daemon for Mobilizon" #================================================= # START SYSTEMD SERVICE #================================================= -ynh_print_info --message="Starting a systemd service..." +ynh_script_progression --message="Starting a systemd service..." # Start a systemd service ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Access MobilizonWeb.Endpoint at" @@ -235,7 +203,7 @@ ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --lin #================================================= # SETUP SSOWAT #================================================= -ynh_print_info --message="Configuring SSOwat..." +ynh_script_progression --message="Configuring SSOwat..." # Make app public if necessary if [ $is_public -eq 1 ] @@ -247,7 +215,7 @@ fi #================================================= # RELOAD NGINX #================================================= -ynh_print_info --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading nginx web server..." ynh_systemd_action --service_name=nginx --action=reload @@ -255,4 +223,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_print_info --message="Installation of $app completed" +ynh_script_progression --message="Installation of $app completed" diff --git a/scripts/remove b/scripts/remove index 8e1e1c7..97cc9be 100644 --- a/scripts/remove +++ b/scripts/remove @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_print_info --message="Loading installation settings..." +ynh_script_progression --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME @@ -27,19 +27,18 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # REMOVE SERVICE INTEGRATION IN YUNOHOST #================================================= -ynh_print_info --message="Removing service integration in YunoHost..." # 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_print_info --message="Removing $app service..." + ynh_script_progression --message="Removing $app service..." yunohost service remove $app fi #================================================= # STOP AND REMOVE SERVICE #================================================= -ynh_print_info --message="Stopping and removing the systemd service..." +ynh_script_progression --message="Stopping and removing the systemd service..." # Remove the dedicated systemd config ynh_remove_systemd_config @@ -47,7 +46,7 @@ ynh_remove_systemd_config #================================================= # REMOVE THE POSTGRESQL DATABASE #================================================= -ynh_print_info --message="Removing the PostgreSQL database..." +ynh_script_progression --message="Removing the PostgreSQL database..." # Remove a database if it exists, along with the associated user ynh_psql_remove_db --db_user="$db_user" --db_name="$db_name" @@ -55,7 +54,7 @@ ynh_psql_remove_db --db_user="$db_user" --db_name="$db_name" #================================================= # REMOVE DEPENDENCIES #================================================= -ynh_print_info --message="Removing dependencies..." +ynh_script_progression --message="Removing dependencies..." # Remove metapackage and its dependencies ynh_remove_app_dependencies @@ -65,7 +64,7 @@ ynh_remove_nodejs #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_print_info --message="Removing app main directory..." +ynh_script_progression --message="Removing app main directory..." # Remove the app directory securely ynh_secure_remove --file="$final_path" @@ -73,7 +72,7 @@ ynh_secure_remove --file="$final_path" #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_print_info --message="Removing nginx web server configuration..." +ynh_script_progression --message="Removing nginx web server configuration..." # Remove the dedicated nginx config ynh_remove_nginx_config @@ -81,33 +80,29 @@ ynh_remove_nginx_config #================================================= # CLOSE A PORT #================================================= -ynh_print_info --message="Closing a port..." if yunohost firewall list | grep -q "\- $port$" then - ynh_print_info --message="Closing port $port..." + ynh_script_progression --message="Closing port $port..." ynh_exec_warn_less yunohost firewall disallow TCP $port fi #================================================= # SPECIFIC REMOVE #================================================= -# REMOVE THE LOG FILE +# REMOVE VARIOUS FILES #================================================= -ynh_print_info --message="Removing the log files..." +ynh_script_progression --message="Removing various files..." # Remove the log files ynh_secure_remove --file="/var/log/$app" -# Remove the GeoIP folder -ynh_secure_remove --file="/usr/share/GeoIP" - #================================================= # GENERIC FINALIZATION #================================================= # REMOVE DEDICATED USER #================================================= -ynh_print_info --message="Removing the dedicated system user..." +ynh_script_progression --message="Removing the dedicated system user..." # Delete a system user ynh_system_user_delete --username=$app @@ -116,4 +111,4 @@ ynh_system_user_delete --username=$app # END OF SCRIPT #================================================= -ynh_print_info --message="Removal of $app completed" +ynh_script_progression --message="Removal of $app completed" diff --git a/scripts/restore b/scripts/restore index fd06ef1..ef65315 100644 --- a/scripts/restore +++ b/scripts/restore @@ -13,7 +13,6 @@ source /usr/share/yunohost/helpers #================================================= # MANAGE SCRIPT FAILURE #================================================= -ynh_print_info --message="Managing script failure..." ynh_clean_setup () { ynh_clean_check_starting @@ -24,7 +23,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_print_info --message="Loading settings..." +ynh_script_progression --message="Loading settings..." app=$YNH_APP_INSTANCE_NAME @@ -39,7 +38,7 @@ port=$(ynh_app_setting_get --app=$app --key=port) #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= -ynh_print_info --message="Validating restoration parameters..." +ynh_script_progression --message="Validating restoration parameters..." ynh_webpath_available --domain=$domain --path_url=$path_url \ || ynh_die --message="Path not available: ${domain}${path_url}" @@ -51,21 +50,21 @@ test ! -d $final_path \ #================================================= # RESTORE THE NGINX CONFIGURATION #================================================= -ynh_print_info --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" #================================================= # RESTORE THE APP MAIN DIR #================================================= -ynh_print_info --message="Restoring the app main directory..." +ynh_script_progression --message="Restoring the app main directory..." ynh_restore_file --origin_path="$final_path" #================================================= # RECREATE THE DEDICATED USER #================================================= -ynh_print_info --message="Recreating the dedicated system 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 @@ -73,7 +72,7 @@ ynh_system_user_create --username=$app --home_dir=$final_path #================================================= # RESTORE USER RIGHTS #================================================= -ynh_print_info --message="Restoring user rights..." +ynh_script_progression --message="Restoring user rights..." # Restore permissions on app files chown -R "$app":"$app" "$final_path" @@ -83,12 +82,12 @@ chown -R "$app":"$app" "$final_path" #================================================= # REINSTALL DEPENDENCIES #================================================= -ynh_print_info --message="Reinstalling dependencies..." +ynh_script_progression --message="Reinstalling dependencies..." # Define and install dependencies ynh_install_app_dependencies $pkg_dependencies -ynh_install_nodejs --nodejs_version="10" +ynh_install_nodejs --nodejs_version=$NODEJS_VERSION ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key='https://dl.yarnpkg.com/debian/pubkey.gpg' @@ -98,7 +97,7 @@ ynh_install_extra_app_dependencies --repo="deb http://packages.erlang-solutions. #================================================= # RESTORE THE POSTGRESQL DATABASE #================================================= -ynh_print_info --message="Restoring the PostgreSQL database..." +ynh_script_progression --message="Restoring the PostgreSQL database..." ynh_psql_test_if_first_run ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd @@ -110,7 +109,7 @@ ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name #================================================= # RESTORE SYSTEMD #================================================= -ynh_print_info --message="Restoring the systemd configuration..." +ynh_script_progression --message="Restoring the systemd configuration..." ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service @@ -118,14 +117,14 @@ systemctl enable $app.service #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= -ynh_print_info --message="Integrating service in YunoHost..." +ynh_script_progression --message="Integrating service in YunoHost..." yunohost service add $app --description "$app daemon for Mobilizon" #================================================= # START SYSTEMD SERVICE #================================================= -ynh_print_info --message="Starting a systemd service..." +ynh_script_progression --message="Starting a systemd service..." ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Access MobilizonWeb.Endpoint at" @@ -134,7 +133,7 @@ ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --lin #================================================= # RELOAD NGINX AND PHP-FPM #================================================= -ynh_print_info --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading nginx web server..." ynh_systemd_action --service_name=nginx --action=reload @@ -142,4 +141,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_print_info --message="Restoration completed for $app" +ynh_script_progression --message="Restoration completed for $app" diff --git a/scripts/upgrade b/scripts/upgrade index bf4b7e2..2dfc974 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_print_info --message="Loading installation settings..." +ynh_script_progression --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME @@ -33,14 +33,14 @@ admin_email=$(ynh_app_setting_get --app=$app --key=admin_email) #================================================= # CHECK VERSION #================================================= -ynh_print_info --message="Checking version..." +ynh_script_progression --message="Checking version..." upgrade_type=$(ynh_check_app_version_changed) #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= -ynh_print_info --message="Ensuring downward compatibility..." +ynh_script_progression --message="Ensuring downward compatibility..." # Fix is_public as a boolean value if [ "$is_public" = "Yes" ]; then @@ -70,7 +70,7 @@ ynh_secure_remove --file="/usr/share/GeoIP" #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_print_info --message="Backing up the app before upgrading (may take a while)..." +ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." # Backup the current version of the app ynh_backup_before_upgrade @@ -87,7 +87,7 @@ ynh_abort_if_errors #================================================= # STOP SYSTEMD SERVICE #================================================= -ynh_print_info --message="Stopping a systemd service..." +ynh_script_progression --message="Stopping a systemd service..." ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped" @@ -97,14 +97,16 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line if [ "$upgrade_type" == "UPGRADE_APP" ] then - ynh_print_info --message="Upgrading source files..." + ynh_script_progression --message="Upgrading source files..." # Create a temporary directory tmpdir="$(mktemp -d)" # Backup the config file in the temp dir - cp -a "$final_path/$app/.env" "$tmpdir/.env" - cp -a "$final_path/$app/config/prod.exs" "$tmpdir/prod.exs" + if [ -s "$final_path/$app/config/prod.exs" ] + then + cp -a "$final_path/$app/config/prod.exs" "$tmpdir/prod.secret.exs" + fi # Remove the app directory securely ynh_secure_remove --file="$final_path/$app" @@ -113,8 +115,10 @@ then ynh_setup_source --dest_dir="$final_path/$app" #Copy the admin saved settings from tmp directory to final path - cp -a "$tmpdir/.env" "$final_path/$app/.env" - cp -a "$tmpdir/prod.exs" "$final_path/$app/config/prod.exs" + if [ -s "$tmpdir/prod.exs" ] + then + cp -a "$tmpdir/prod.exs" "$final_path/$app/config/prod.secret.exs" + fi # Remove the tmp directory securely ynh_secure_remove --file="$tmpdir" @@ -123,7 +127,7 @@ fi #================================================= # NGINX CONFIGURATION #================================================= -ynh_print_info --message="Upgrading nginx web server configuration..." +ynh_script_progression --message="Upgrading nginx web server configuration..." # Create a dedicated nginx config ynh_add_nginx_config @@ -131,11 +135,11 @@ ynh_add_nginx_config #================================================= # UPGRADE DEPENDENCIES #================================================= -ynh_print_info --message="Upgrading dependencies..." +ynh_script_progression --message="Upgrading dependencies..." ynh_install_app_dependencies $pkg_dependencies -ynh_install_nodejs --nodejs_version="10" +ynh_install_nodejs --nodejs_version=$NODEJS_VERSION lsb_name="$(lsb_release --codename --short)" ynh_install_extra_app_dependencies --repo="deb http://packages.erlang-solutions.com/debian $lsb_name contrib" --package="$extra_pkg_dependencies" --key='https://packages.erlang-solutions.com/debian/erlang_solutions.asc' @@ -143,7 +147,7 @@ ynh_install_extra_app_dependencies --repo="deb http://packages.erlang-solutions. #================================================= # CREATE DEDICATED USER #================================================= -ynh_print_info --message="Making sure dedicated system user exists..." +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 @@ -153,37 +157,15 @@ ynh_system_user_create --username=$app --home_dir=$final_path #================================================= # MODIFY A CONFIG FILE #================================================= -ynh_print_info --message="Modifying a config file..." +ynh_script_progression --message="Modifying a config file..." -config="$final_path/$app/.env" +config="$final_path/$app/config/prod.secret.exs" ynh_backup_if_checksum_is_different --file="$config" -cp ../conf/.env "$config" - -ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$config" -ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$config" -ynh_replace_string --match_string="__SECRET__" --replace_string="$secret" --target_file="$config" -ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$config" -ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_user" --target_file="$config" -ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$config" -ynh_replace_string --match_string="__NAME__" --replace_string="$name" --target_file="$config" -ynh_replace_string --match_string="__ADMIN_EMAIL__" --replace_string="$admin_email" --target_file="$config" #================================================= # MAKE SETUP #================================================= -ynh_print_info --message="Making setup..." - -# Temporarly bypass error : WARNING ** (ArgumentError) argument error and System.get_env doesn't load environment variables - -ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="../conf/prod.exs" -ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="../conf/prod.exs" -ynh_replace_string --match_string="__SECRET__" --replace_string="$secret" --target_file="../conf/prod.exs" -ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="../conf/prod.exs" -ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_user" --target_file="../conf/prod.exs" -ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="../conf/prod.exs" -ynh_replace_string --match_string="__NAME__" --replace_string="$name" --target_file="../conf/prod.exs" -ynh_replace_string --match_string="__ADMIN_EMAIL__" --replace_string="$admin_email" --target_file="../conf/prod.exs" -cp ../conf/prod.exs "$final_path/$app/config/prod.exs" +ynh_script_progression --message="Making setup..." # Give permission to the final_path chown -R "$app":"$app" "$final_path" @@ -195,27 +177,24 @@ pushd $final_path/$app/js popd pushd $final_path/$app - ynh_replace_string --match_string="config :logger" --replace_string="#config :logger" --target_file="$final_path/$app/config/prod.exs" - source .env 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 phx.digest - ynh_replace_string --match_string="#config :logger" --replace_string="config :logger" --target_file="$final_path/$app/config/prod.exs" popd #================================================= # STORE THE CONFIG FILE CHECKSUM #================================================= -ynh_print_info --message="Storing the config file checksum..." +ynh_script_progression --message="Storing the config file checksum..." # Recalculate and store the checksum of the file for the next upgrade. ynh_store_file_checksum --file="$config" #================================================= # SETUP SYSTEMD #================================================= -ynh_print_info --message="Upgrading systemd configuration..." +ynh_script_progression --message="Upgrading systemd configuration..." # Create a dedicated systemd config ynh_add_systemd_config @@ -225,7 +204,7 @@ ynh_add_systemd_config #================================================= # SECURE FILES AND DIRECTORIES #================================================= -ynh_print_info --message="Securing files and directories..." +ynh_script_progression --message="Securing files and directories..." # Set permissions on app files chown -R "$app":"$app" "$final_path" @@ -233,7 +212,7 @@ chown -R "$app":"$app" "$final_path" #================================================= # SETUP SSOWAT #================================================= -ynh_print_info --message="Upgrading SSOwat configuration..." +ynh_script_progression --message="Upgrading SSOwat configuration..." # Make app public if necessary if [ $is_public -eq 1 ] @@ -245,14 +224,14 @@ fi #================================================= # START SYSTEMD SERVICE #================================================= -ynh_print_info --message="Starting a systemd service..." +ynh_script_progression --message="Starting a systemd service..." ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Access MobilizonWeb.Endpoint at" #================================================= # RELOAD NGINX #================================================= -ynh_print_info --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading nginx web server..." ynh_systemd_action --service_name=nginx --action=reload @@ -260,4 +239,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_print_info --message="Upgrade of $app completed" +ynh_script_progression --message="Upgrade of $app completed" From 529b1771561703d87d908b398c0751044d798f4d Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 10 Aug 2020 21:57:25 +0200 Subject: [PATCH 03/48] Cleanup --- conf/app.src | 4 ++-- scripts/install | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/conf/app.src b/conf/app.src index e45c24e..c2eaf29 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://framagit.org/framasoft/mobilizon/-/archive/1.0.0-beta.3/mobilizon-1.0.0-beta.3.tar.gz -SOURCE_SUM=5bf0f328f19fd182b0a02088bd9d53cd9e9042dde165328d42c9b12149b97c2d +SOURCE_URL=https://framagit.org/framasoft/mobilizon/-/archive/0e69d98b99847de942a8d59ade983b2ed784eb88/mobilizon-0e69d98b99847de942a8d59ade983b2ed784eb88.tar.gz +SOURCE_SUM=ab075a035df822c3e8388e8a19b0daa03ada818cbbe3c2bd39cafd8ff902b796 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/scripts/install b/scripts/install index aeedc93..60aacd9 100644 --- a/scripts/install +++ b/scripts/install @@ -14,7 +14,6 @@ source /usr/share/yunohost/helpers #================================================= ynh_clean_setup () { - read -p "key" ynh_clean_check_starting } # Exit if an error occurs during the execution of the script From 29a2084b787525b44573b9d474e56dbf9450243b Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 8 Oct 2020 02:24:33 +0200 Subject: [PATCH 04/48] Upgrade to 20101008 --- conf/app.src | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/app.src b/conf/app.src index c2eaf29..ac96c98 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://framagit.org/framasoft/mobilizon/-/archive/0e69d98b99847de942a8d59ade983b2ed784eb88/mobilizon-0e69d98b99847de942a8d59ade983b2ed784eb88.tar.gz -SOURCE_SUM=ab075a035df822c3e8388e8a19b0daa03ada818cbbe3c2bd39cafd8ff902b796 +SOURCE_URL=https://framagit.org/framasoft/mobilizon/-/archive/b67239cf2eed5007406634a47b8f6adc9ac93de4/mobilizon-b67239cf2eed5007406634a47b8f6adc9ac93de4.tar.gz +SOURCE_SUM=2d5eeb26bc36202fed40202bd223016b7808e6a24721ff2b0a1573c04e639477 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true From 3db8bbb89f6733dc118a3a0f9bfeae5ef23641e4 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 9 Oct 2020 08:25:01 +0200 Subject: [PATCH 05/48] Fix service start --- scripts/change_url | 2 +- scripts/install | 3 ++- scripts/restore | 2 +- scripts/upgrade | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index 07d9ec9..ab619ce 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -132,7 +132,7 @@ ynh_store_file_checksum --file="$config" ynh_script_progression --message="Starting a systemd service..." # Start a systemd service -ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Access MobilizonWeb.Endpoint at" +ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Access Mobilizon.Web.Endpoint at" #================================================= # RELOAD NGINX diff --git a/scripts/install b/scripts/install index 60aacd9..4b73a61 100644 --- a/scripts/install +++ b/scripts/install @@ -155,6 +155,7 @@ pushd $final_path/$app sudo -u "$app" MIX_ENV=prod mix deps.get sudo -u "$app" MIX_ENV=prod mix compile sudo -u "$app" MIX_ENV=prod mix mobilizon.instance gen --force --output $config --output-psql /tmp/setup_db.psql --domain $domain --instance-name $name --admin-email $admin_email --dbhost localhost --dbname $db_name --dbuser $db_user --dbpass $db_pwd --listen-port $port + sudo -u "$app" MIX_ENV=prod mix ecto.migrate sudo -u "$app" MIX_ENV=prod mix mobilizon.users.new "$admin_email" --admin --password "$password" popd @@ -197,7 +198,7 @@ yunohost service add $app --description "$app daemon for Mobilizon" ynh_script_progression --message="Starting a systemd service..." # Start a systemd service -ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Access MobilizonWeb.Endpoint at" +ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Access Mobilizon.Web.Endpoint at" #================================================= # SETUP SSOWAT diff --git a/scripts/restore b/scripts/restore index ef65315..1218c66 100644 --- a/scripts/restore +++ b/scripts/restore @@ -126,7 +126,7 @@ yunohost service add $app --description "$app daemon for Mobilizon" #================================================= ynh_script_progression --message="Starting a systemd service..." -ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Access MobilizonWeb.Endpoint at" +ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Access Mobilizon.Web.Endpoint at" #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index 2dfc974..491432a 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -226,7 +226,7 @@ fi #================================================= ynh_script_progression --message="Starting a systemd service..." -ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Access MobilizonWeb.Endpoint at" +ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Access Mobilizon.Web.Endpoint at" #================================================= # RELOAD NGINX From aca154a5cf1c0ca11274eb8d7624b82dc58609a0 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 12 Oct 2020 02:59:44 +0200 Subject: [PATCH 06/48] Adding cmake --- scripts/_common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index e5f878e..f2efa95 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,7 +5,7 @@ #================================================= # dependencies used by the app -pkg_dependencies="build-essential inotify-tools postgresql postgresql-client postgresql-contrib git curl gnupg openssl postgis make gcc libc-dev argon2 imagemagick webp gifsicle jpegoptim optipng pngquant" +pkg_dependencies="build-essential inotify-tools postgresql postgresql-client postgresql-contrib git curl gnupg openssl postgis make gcc libc-dev argon2 imagemagick webp gifsicle jpegoptim optipng pngquant cmake" extra_pkg_dependencies="elixir esl-erlang" NODEJS_VERSION=12 From fb45e31e3171a64300b3084e8173d19476017b53 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Tue, 13 Oct 2020 21:12:08 +0200 Subject: [PATCH 07/48] Fix path for css/js assets in nginx conf --- conf/nginx.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index eb3c411..f90d0fb 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -21,7 +21,7 @@ location / { client_max_body_size 16m; location ~* \.(css|js)$ { - root /home/mobilizon/live/priv/static; + root __FINALPATH__/mobilizon/priv/static; etag off; expires 1y; access_log off; From e053864cc17532179182748f5acf4064d7800a76 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Tue, 13 Oct 2020 21:55:06 +0200 Subject: [PATCH 08/48] Upgrade to mobilizon-1.0.0rc1 --- conf/app.src | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/conf/app.src b/conf/app.src index ac96c98..38ed806 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,6 +1,6 @@ -SOURCE_URL=https://framagit.org/framasoft/mobilizon/-/archive/b67239cf2eed5007406634a47b8f6adc9ac93de4/mobilizon-b67239cf2eed5007406634a47b8f6adc9ac93de4.tar.gz -SOURCE_SUM=2d5eeb26bc36202fed40202bd223016b7808e6a24721ff2b0a1573c04e639477 +SOURCE_URL=https://framagit.org/framasoft/mobilizon/-/archive/1.0.0-rc.1/mobilizon-1.0.0-rc.1.tar.gz +SOURCE_SUM=26042e61963382d02819ac75d031dbf40cec8135b34b897b8c400e6395dbd724 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true -SOURCE_FILENAME=mobilizon-1.0.0-beta.3.tar.gz \ No newline at end of file +SOURCE_FILENAME=mobilizon-1.0.0-rc.1.tar.gz From b7dd6c2265b1485d145caf761e009ffc13926ee6 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Tue, 13 Oct 2020 21:58:49 +0200 Subject: [PATCH 09/48] Propagate version to manifest and README --- README.md | 2 +- manifest.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 549344b..ff7b1b7 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ MobiliZon aims to solve existing platform's problems to organize events in a dec Mobilizon is a tool designed to create platforms for managing communities and events. Its purpose is to help as many people as possible to free themselves from Facebook groups and events, from Meetup, etc. -**Shipped version:** 1.0.0-beta.3 +**Shipped version:** 1.0.0-rc1 ## Important points to read before installing diff --git a/manifest.json b/manifest.json index 41298ad..6bf5035 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "A decentralized and federated platform to organize events", "fr": "Une plateforme décentralisée et fédérée pour organiser des événements" }, - "version": "1.0.0-beta.3~ynh1", + "version": "1.0.0-rc1~ynh1", "url": "https://joinmobilizon.org/", "license": "AGPL-3.0-or-later", "maintainer": { From 93820ef3acf2989778f5fc197d3a748c368bf78a Mon Sep 17 00:00:00 2001 From: yalh76 Date: Wed, 14 Oct 2020 21:59:34 +0200 Subject: [PATCH 10/48] Fix check process --- check_process | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/check_process b/check_process index f1906fd..03201ea 100644 --- a/check_process +++ b/check_process @@ -5,7 +5,7 @@ language="fr" is_public=1 (PUBLIC|public=1|private=0) password="pass" - name="My Mobilizon" + name="My_Mobilizon" ; Checks pkg_linter=1 setup_sub_dir=0 From 6ace375a6c50ece1642e6d393dbb99a22caef4b4 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Wed, 14 Oct 2020 22:05:10 +0200 Subject: [PATCH 11/48] Add dependency --- scripts/_common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index f2efa95..4cb929b 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,7 +5,7 @@ #================================================= # dependencies used by the app -pkg_dependencies="build-essential inotify-tools postgresql postgresql-client postgresql-contrib git curl gnupg openssl postgis make gcc libc-dev argon2 imagemagick webp gifsicle jpegoptim optipng pngquant cmake" +pkg_dependencies="build-essential inotify-tools postgresql postgresql-client postgresql-contrib git curl unzip gnupg openssl postgis make gcc libc-dev argon2 imagemagick webp gifsicle jpegoptim optipng pngquant cmake" extra_pkg_dependencies="elixir esl-erlang" NODEJS_VERSION=12 From 85deb71343be1a812a969f59ebf0777cd636a67d Mon Sep 17 00:00:00 2001 From: yalh76 Date: Wed, 14 Oct 2020 22:10:19 +0200 Subject: [PATCH 12/48] When it's done, don't forget to remove the setup_db.psql file. --- scripts/install | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/install b/scripts/install index 4b73a61..a8a1c88 100644 --- a/scripts/install +++ b/scripts/install @@ -155,6 +155,7 @@ pushd $final_path/$app sudo -u "$app" MIX_ENV=prod mix deps.get sudo -u "$app" MIX_ENV=prod mix compile sudo -u "$app" MIX_ENV=prod mix mobilizon.instance gen --force --output $config --output-psql /tmp/setup_db.psql --domain $domain --instance-name $name --admin-email $admin_email --dbhost localhost --dbname $db_name --dbuser $db_user --dbpass $db_pwd --listen-port $port + ynh_secure_remove --file="/tmp/setup_db.psql" sudo -u "$app" MIX_ENV=prod mix ecto.migrate sudo -u "$app" MIX_ENV=prod mix mobilizon.users.new "$admin_email" --admin --password "$password" popd From 2d64c17ed7414741ac149870856100b4813c2b6d Mon Sep 17 00:00:00 2001 From: yalh76 Date: Wed, 14 Oct 2020 22:19:45 +0200 Subject: [PATCH 13/48] The nginx configuration has been changed with improvements and support for custom error pages. --- conf/nginx.conf | 40 +++++++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index f90d0fb..8a76cee 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -4,28 +4,46 @@ location / { rewrite ^ https://$server_name$request_uri? permanent; } - gzip off; - proxy_http_version 1.1; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + gzip on; + gzip_disable "msie6"; + gzip_vary on; + gzip_proxied any; + gzip_comp_level 6; + gzip_buffers 16 8k; + gzip_http_version 1.1; + gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript application/activity+json application/atom+xml; - # For Websocket support + # the nginx default is 1m, not enough for large media uploads + client_max_body_size 16m; + + proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $http_host; - - proxy_redirect off; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; proxy_pass http://localhost:__PORT__; - client_max_body_size 16m; - location ~* \.(css|js)$ { root __FINALPATH__/mobilizon/priv/static; etag off; - expires 1y; access_log off; - add_header Cache-Control public; + add_header Cache-Control "public, max-age=31536000, immutable"; + } + + location ~ ^/(media|proxy) { + etag off; + access_log off; + add_header Cache-Control "public, max-age=31536000, immutable"; + proxy_pass http://localhost:__PORT__; + } + + error_page 500 501 502 503 504 @error; + location @error { + root __FINALPATH__/mobilizon/priv/errors; + try_files /error.html 502; } # Include SSOWAT user panel. From eaffa4f2e291927ce871379ea0edb31ad1361592 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Wed, 14 Oct 2020 22:22:16 +0200 Subject: [PATCH 14/48] Update README.md --- README.md | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/README.md b/README.md index ff7b1b7..b223be7 100644 --- a/README.md +++ b/README.md @@ -17,22 +17,7 @@ Mobilizon is a tool designed to create platforms for managing communities and ev ## Important points to read before installing -1. **Mobilizon** is in early development, like an Alpha, all functionalities are not available 1. **Mobilizon** require a dedicated **root domain**, eg. mobilizon.domain.tld -1. Even if requested during installation: admin, language and password variables are not used -1. Admin Dashboard is still not implemented -1. When your mobilizon instance is installed, you need to register. -1. When registered, to be admin you have to manually goes in PostgreSQL, database $app, table users, and change the role value to `administrator` instead of `user` (other role available: `moderator`) - -Example to manually put user with id=1 as administrator: -```bash -su -l postgres -psql -\c mobilizon -UPDATE public.users SET role='administrator' where id=1; -\q -exit -``` ## Screenshots From e27075e3c8b016e7159aee118ab7e901262b72ee Mon Sep 17 00:00:00 2001 From: yalh76 Date: Wed, 14 Oct 2020 22:34:29 +0200 Subject: [PATCH 15/48] Apply last example_ynh --- issue_template.md | 33 +++++++++++++++++++++------------ manifest.json | 2 +- scripts/change_url | 8 ++------ scripts/install | 2 +- scripts/remove | 4 ++-- scripts/upgrade | 38 +++++++++++++++++++++++--------------- 6 files changed, 50 insertions(+), 37 deletions(-) diff --git a/issue_template.md b/issue_template.md index e7ad54a..4713927 100644 --- a/issue_template.md +++ b/issue_template.md @@ -1,22 +1,24 @@ --- 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:* +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 Mobilizon itself. Refer to its documentation or repository for help.* - - *If you have a doubt, post here, we will figure it out together.* -3. *Delete the italic comments as you write over them below, and remove this guide.* + - *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.* --- -**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 mobilizon @@ -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 6bf5035..b5e3189 100644 --- a/manifest.json +++ b/manifest.json @@ -35,7 +35,7 @@ "type": "user", "ask": { "en": "Choose an admin user", - "fr": "Choisissez l’administrateur" + "fr": "Choisissez l'administrateur" }, "example": "johndoe" }, diff --git a/scripts/change_url b/scripts/change_url index ab619ce..8a9902b 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -113,14 +113,10 @@ fi ynh_script_progression --message="Modifying a config file..." config="$final_path/$app/config/prod.secret.exs" +ynh_backup_if_checksum_is_different --file="$config" + ynh_replace_string --match_string="$old_domain" --replace_string="$new_domain" --target_file="$config" -#================================================= -# STORE THE CONFIG FILE CHECKSUM -#================================================= -ynh_script_progression --message="Storing the config file checksum..." - -ynh_backup_if_checksum_is_different --file="$config" # Recalculate and store the checksum of the file for the next upgrade. ynh_store_file_checksum --file="$config" diff --git a/scripts/install b/scripts/install index a8a1c88..74fbefd 100644 --- a/scripts/install +++ b/scripts/install @@ -14,7 +14,7 @@ source /usr/share/yunohost/helpers #================================================= ynh_clean_setup () { - ynh_clean_check_starting + ynh_clean_check_starting } # Exit if an error occurs during the execution of the script ynh_abort_if_errors diff --git a/scripts/remove b/scripts/remove index 97cc9be..7a6b0af 100644 --- a/scripts/remove +++ b/scripts/remove @@ -31,7 +31,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) # 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 @@ -49,7 +49,7 @@ ynh_remove_systemd_config ynh_script_progression --message="Removing the PostgreSQL database..." # Remove a database if it exists, along with the associated user -ynh_psql_remove_db --db_user="$db_user" --db_name="$db_name" +ynh_psql_remove_db --db_user=$db_user --db_name=$db_name #================================================= # REMOVE DEPENDENCIES diff --git a/scripts/upgrade b/scripts/upgrade index 491432a..c48cb70 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -171,23 +171,24 @@ ynh_script_progression --message="Making setup..." chown -R "$app":"$app" "$final_path" pushd $final_path/$app/js - ynh_use_nodejs - sudo -u $app env PATH=$PATH yarn install - sudo -u $app env PATH=$PATH yarn run build + ynh_use_nodejs + sudo -u $app env PATH=$PATH yarn install + sudo -u $app env PATH=$PATH yarn run build popd 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 #================================================= # STORE THE CONFIG FILE CHECKSUM #================================================= ynh_script_progression --message="Storing the config file checksum..." + # Recalculate and store the checksum of the file for the next upgrade. ynh_store_file_checksum --file="$config" @@ -209,6 +210,20 @@ ynh_script_progression --message="Securing files and directories..." # Set permissions on app files chown -R "$app":"$app" "$final_path" +#================================================= +# INTEGRATE SERVICE IN YUNOHOST +#================================================= +ynh_script_progression --message="Integrating service in YunoHost..." + +yunohost service add $app --description "$app daemon for Mobilizon" + +#================================================= +# START SYSTEMD SERVICE +#================================================= +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 #================================================= @@ -221,13 +236,6 @@ then ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" fi -#================================================= -# START SYSTEMD SERVICE -#================================================= -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" - #================================================= # RELOAD NGINX #================================================= From ea32d93e8e143fe172d45eedebe4830e75ba7eb7 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Wed, 14 Oct 2020 22:52:11 +0200 Subject: [PATCH 16/48] Implement LDAP --- conf/ldap.exs | 11 +++++++++++ scripts/install | 1 + scripts/upgrade | 17 +++++++++++++++++ 3 files changed, 29 insertions(+) create mode 100644 conf/ldap.exs diff --git a/conf/ldap.exs b/conf/ldap.exs new file mode 100644 index 0000000..692720e --- /dev/null +++ b/conf/ldap.exs @@ -0,0 +1,11 @@ +config :mobilizon, Mobilizon.Service.Auth.Authenticator, Mobilizon.Service.Auth.LDAPAuthenticator +config :mobilizon, :ldap, + enabled: true, + host: "localhost", + port: 389, + ssl: false, + # sslopts: [], + tls: false, + # tlsopts: [], + base: "ou=users,dc=yunohost,dc=org", + uid: "uid" diff --git a/scripts/install b/scripts/install index 74fbefd..a691d98 100644 --- a/scripts/install +++ b/scripts/install @@ -155,6 +155,7 @@ pushd $final_path/$app sudo -u "$app" MIX_ENV=prod mix deps.get sudo -u "$app" MIX_ENV=prod mix compile sudo -u "$app" MIX_ENV=prod mix mobilizon.instance gen --force --output $config --output-psql /tmp/setup_db.psql --domain $domain --instance-name $name --admin-email $admin_email --dbhost localhost --dbname $db_name --dbuser $db_user --dbpass $db_pwd --listen-port $port + cat "../conf/ldap.exs" >> "$config" ynh_secure_remove --file="/tmp/setup_db.psql" sudo -u "$app" MIX_ENV=prod mix ecto.migrate sudo -u "$app" MIX_ENV=prod mix mobilizon.users.new "$admin_email" --admin --password "$password" diff --git a/scripts/upgrade b/scripts/upgrade index c48cb70..a1f7624 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -91,6 +91,23 @@ ynh_script_progression --message="Stopping a systemd service..." ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped" +#================================================= +# UPGRADE FROM PREVIOUS VERSION +#================================================= + +if ynh_version_gt "1.0.0-rc1~ynh1" "${previous_version}" ; then + ynh_script_progression --message="Upgrade configuration to 1.0.0-rc1~ynh1..." + + config="$final_path/$app/config/prod.secret.exs" + ynh_backup_if_checksum_is_different --file="$config" + + # Implement ldap + cat "../conf/ldap.exs" >> "$config" + + # Recalculate and store the checksum of the file for the next upgrade. + ynh_store_file_checksum --file="$config" +fi + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= From 68bf3a27add6c5525e25093cc6c369495ce9fc00 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Wed, 14 Oct 2020 22:56:40 +0200 Subject: [PATCH 17/48] [password: {"The chosen password is too short.", [count: 6, validation: :length, kind: :min, type: :string]}] --- check_process | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/check_process b/check_process index 03201ea..34b50c5 100644 --- a/check_process +++ b/check_process @@ -4,7 +4,7 @@ admin="john" (USER) language="fr" is_public=1 (PUBLIC|public=1|private=0) - password="pass" + password="password" name="My_Mobilizon" ; Checks pkg_linter=1 From 300150aa0c497a883c544b4dc23538e5c5ace3f3 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 15 Oct 2020 03:21:30 +0200 Subject: [PATCH 18/48] [emerg] named location "@error" can be on the server level only --- conf/nginx.conf | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 8a76cee..cff60cc 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -41,11 +41,12 @@ location / { } error_page 500 501 502 503 504 @error; - location @error { - root __FINALPATH__/mobilizon/priv/errors; - try_files /error.html 502; - } # Include SSOWAT user panel. include conf.d/yunohost_panel.conf.inc; } + +location @error { + root __FINALPATH__/mobilizon/priv/errors; + try_files /error.html 502; +} \ No newline at end of file From 95d2414c10788970437a1df00970ea0195df10de Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 15 Oct 2020 18:36:52 +0200 Subject: [PATCH 19/48] Fix cat: ../conf/ldap.exs: No such file or directory --- scripts/install | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index a691d98..d98fd3f 100644 --- a/scripts/install +++ b/scripts/install @@ -155,7 +155,11 @@ pushd $final_path/$app sudo -u "$app" MIX_ENV=prod mix deps.get sudo -u "$app" MIX_ENV=prod mix compile sudo -u "$app" MIX_ENV=prod mix mobilizon.instance gen --force --output $config --output-psql /tmp/setup_db.psql --domain $domain --instance-name $name --admin-email $admin_email --dbhost localhost --dbname $db_name --dbuser $db_user --dbpass $db_pwd --listen-port $port - cat "../conf/ldap.exs" >> "$config" +popd + +cat "../conf/ldap.exs" >> "$config" + +pushd $final_path/$app ynh_secure_remove --file="/tmp/setup_db.psql" sudo -u "$app" MIX_ENV=prod mix ecto.migrate sudo -u "$app" MIX_ENV=prod mix mobilizon.users.new "$admin_email" --admin --password "$password" From 19e4846c5a57dca7497712fb370cf883ac972d01 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 15 Oct 2020 20:31:49 +0200 Subject: [PATCH 20/48] Missing ynh_package_version --- scripts/upgrade | 1 + scripts/ynh_package_version | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 scripts/ynh_package_version diff --git a/scripts/upgrade b/scripts/upgrade index a1f7624..cbad65f 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -7,6 +7,7 @@ #================================================= source _common.sh +source ynh_package_version source /usr/share/yunohost/helpers #================================================= diff --git a/scripts/ynh_package_version b/scripts/ynh_package_version new file mode 100644 index 0000000..d6cdc4d --- /dev/null +++ b/scripts/ynh_package_version @@ -0,0 +1,26 @@ +#!/bin/bash + +read_json () { + sudo python3 -c "import sys, json;print(json.load(open('$1'))['$2'])" +} + +read_manifest () { + if [ -f '../manifest.json' ] ; then + read_json '../manifest.json' "$1" + else + read_json '../settings/manifest.json' "$1" + fi +} +abort_if_up_to_date () { + version=$(read_json "/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json" 'version' 2> /dev/null || echo '20160501-7') + last_version=$(read_manifest 'version') + if [ "${version}" = "${last_version}" ]; then + ynh_print_info "Up-to-date, nothing to do" + ynh_die "" 0 + fi +} + +ynh_version_gt () +{ + dpkg --compare-versions "$1" gt "$2" +} From 9488e76cf0645a40fb823fce620663f9f860093b Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 16 Oct 2020 19:34:41 +0200 Subject: [PATCH 21/48] adjust the maximum memory used --- scripts/install | 2 +- scripts/upgrade | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 4b73a61..c930926 100644 --- a/scripts/install +++ b/scripts/install @@ -146,7 +146,7 @@ config="$final_path/$app/config/prod.secret.exs" pushd $final_path/$app/js ynh_use_nodejs sudo -u $app env PATH=$PATH yarn install - sudo -u $app env PATH=$PATH yarn run build + sudo -u $app env PATH=$PATH NODE_BUILD_MEMORY=1024 yarn run build popd pushd $final_path/$app diff --git a/scripts/upgrade b/scripts/upgrade index 491432a..a26e33d 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -173,7 +173,7 @@ chown -R "$app":"$app" "$final_path" pushd $final_path/$app/js ynh_use_nodejs sudo -u $app env PATH=$PATH yarn install - sudo -u $app env PATH=$PATH yarn run build + sudo -u $app env PATH=$PATH NODE_BUILD_MEMORY=1024 yarn run build popd pushd $final_path/$app From f86d714ce1d1362253d163952b84e73d7dd8621d Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 17 Oct 2020 20:02:42 +0200 Subject: [PATCH 22/48] Adding script progression during setup --- scripts/upgrade | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index a26e33d..31a0e5b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -165,18 +165,19 @@ ynh_backup_if_checksum_is_different --file="$config" #================================================= # MAKE SETUP #================================================= -ynh_script_progression --message="Making setup..." # Give permission to the final_path chown -R "$app":"$app" "$final_path" pushd $final_path/$app/js + ynh_script_progression --message="Building NodeJS..." ynh_use_nodejs sudo -u $app env PATH=$PATH yarn install sudo -u $app env PATH=$PATH NODE_BUILD_MEMORY=1024 yarn run build popd pushd $final_path/$app + ynh_script_progression --message="Building Elixir..." 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 From d0ca5068735d9d92a50a4b4c793b3811ffcaf8c4 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 18 Oct 2020 14:11:32 +0200 Subject: [PATCH 23/48] Trying to fix upgrade for package_check --- scripts/upgrade | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 31a0e5b..a6f80a3 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -178,8 +178,8 @@ popd pushd $final_path/$app ynh_script_progression --message="Building Elixir..." - 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 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 From 4a0dd4bc9aef2fe2ae56989fdfbabd4e845e31ff Mon Sep 17 00:00:00 2001 From: yalh76 Date: Tue, 20 Oct 2020 20:18:30 +0200 Subject: [PATCH 24/48] Upgrade 1.0.0-rc.2 --- README.md | 2 +- conf/app.src | 6 +++--- manifest.json | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index ff7b1b7..7593ca0 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ MobiliZon aims to solve existing platform's problems to organize events in a dec Mobilizon is a tool designed to create platforms for managing communities and events. Its purpose is to help as many people as possible to free themselves from Facebook groups and events, from Meetup, etc. -**Shipped version:** 1.0.0-rc1 +**Shipped version:** 1.0.0-rc.2 ## Important points to read before installing diff --git a/conf/app.src b/conf/app.src index 38ed806..e4fa6f1 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,6 +1,6 @@ -SOURCE_URL=https://framagit.org/framasoft/mobilizon/-/archive/1.0.0-rc.1/mobilizon-1.0.0-rc.1.tar.gz -SOURCE_SUM=26042e61963382d02819ac75d031dbf40cec8135b34b897b8c400e6395dbd724 +SOURCE_URL=https://framagit.org/framasoft/mobilizon/-/archive/1.0.0-rc.2/mobilizon-1.0.0-rc.2.tar.gz +SOURCE_SUM=ba3815fbdf58c8fc26a893cb5a67bd5c834bd4c47c3eb8f828915d0773c0093f SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true -SOURCE_FILENAME=mobilizon-1.0.0-rc.1.tar.gz +SOURCE_FILENAME=mobilizon-1.0.0-rc.2.tar.gz diff --git a/manifest.json b/manifest.json index 6bf5035..3252b55 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "A decentralized and federated platform to organize events", "fr": "Une plateforme décentralisée et fédérée pour organiser des événements" }, - "version": "1.0.0-rc1~ynh1", + "version": "1.0.0-rc.2~ynh1", "url": "https://joinmobilizon.org/", "license": "AGPL-3.0-or-later", "maintainer": { From 1cd402629403974bfd38901b3f5cc07c04427216 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 22 Oct 2020 20:34:05 +0200 Subject: [PATCH 25/48] Upgrade to 1.0.0-rc.4 --- README.md | 2 +- conf/app.src | 6 +++--- manifest.json | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 7593ca0..2e7eeee 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ MobiliZon aims to solve existing platform's problems to organize events in a dec Mobilizon is a tool designed to create platforms for managing communities and events. Its purpose is to help as many people as possible to free themselves from Facebook groups and events, from Meetup, etc. -**Shipped version:** 1.0.0-rc.2 +**Shipped version:** 1.0.0-rc.4 ## Important points to read before installing diff --git a/conf/app.src b/conf/app.src index e4fa6f1..7a1c82e 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,6 +1,6 @@ -SOURCE_URL=https://framagit.org/framasoft/mobilizon/-/archive/1.0.0-rc.2/mobilizon-1.0.0-rc.2.tar.gz -SOURCE_SUM=ba3815fbdf58c8fc26a893cb5a67bd5c834bd4c47c3eb8f828915d0773c0093f +SOURCE_URL=https://framagit.org/framasoft/mobilizon/-/archive/1.0.0-rc.4/mobilizon-1.0.0-rc.4.tar.gz +SOURCE_SUM=54412680e10928a3d68a07d2201310eed548e51cccf19a0aaf8641af9a5ee8d0 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true -SOURCE_FILENAME=mobilizon-1.0.0-rc.2.tar.gz +SOURCE_FILENAME=mobilizon-1.0.0-rc.4.tar.gz diff --git a/manifest.json b/manifest.json index 3252b55..e52e012 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "A decentralized and federated platform to organize events", "fr": "Une plateforme décentralisée et fédérée pour organiser des événements" }, - "version": "1.0.0-rc.2~ynh1", + "version": "1.0.0-rc.4~ynh1", "url": "https://joinmobilizon.org/", "license": "AGPL-3.0-or-later", "maintainer": { From fbd3d330c52944d6fe3e7ee7e88a45fcba79c6c2 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 24 Oct 2020 09:18:25 +0200 Subject: [PATCH 26/48] Fix upgrade --- scripts/upgrade | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/upgrade b/scripts/upgrade index 9a28706..3ff4849 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -38,6 +38,10 @@ ynh_script_progression --message="Checking version..." upgrade_type=$(ynh_check_app_version_changed) +abort_if_up_to_date +# previous function is what defines 'version', more precisely the 'previous version' +previous_version="${version}" + #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= From 5c13c6bcd74eea3705e12a69562d4784dcdad7ec Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 26 Oct 2020 01:23:13 +0100 Subject: [PATCH 27/48] Fix permissions for config file + fix backup/restore of configuration during upgrade ? --- scripts/install | 3 ++- scripts/upgrade | 13 ++++--------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/scripts/install b/scripts/install index 51ba7c7..15c071a 100644 --- a/scripts/install +++ b/scripts/install @@ -144,7 +144,7 @@ chown -R "$app":"$app" "$final_path" config="$final_path/$app/config/prod.secret.exs" pushd $final_path/$app/js - ynh_use_nodejs + ynh_use_nodejs sudo -u $app env PATH=$PATH yarn install sudo -u $app env PATH=$PATH NODE_BUILD_MEMORY=1024 yarn run build popd @@ -160,6 +160,7 @@ popd cat "../conf/ldap.exs" >> "$config" pushd $final_path/$app + chown o-rwx $config ynh_secure_remove --file="/tmp/setup_db.psql" sudo -u "$app" MIX_ENV=prod mix ecto.migrate sudo -u "$app" MIX_ENV=prod mix mobilizon.users.new "$admin_email" --admin --password "$password" diff --git a/scripts/upgrade b/scripts/upgrade index 3ff4849..5e9381d 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -125,10 +125,7 @@ then tmpdir="$(mktemp -d)" # Backup the config file in the temp dir - if [ -s "$final_path/$app/config/prod.exs" ] - then - cp -a "$final_path/$app/config/prod.exs" "$tmpdir/prod.secret.exs" - fi + 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" @@ -137,10 +134,7 @@ then ynh_setup_source --dest_dir="$final_path/$app" #Copy the admin saved settings from tmp directory to final path - if [ -s "$tmpdir/prod.exs" ] - then - cp -a "$tmpdir/prod.exs" "$final_path/$app/config/prod.secret.exs" - fi + cp -a "$tmpdir/prod.secret.exs" "$final_path/$app/config/prod.secret.exs" # Remove the tmp directory securely ynh_secure_remove --file="$tmpdir" @@ -183,6 +177,7 @@ ynh_script_progression --message="Modifying a config file..." config="$final_path/$app/config/prod.secret.exs" ynh_backup_if_checksum_is_different --file="$config" +chown o-rwx $config #================================================= # MAKE SETUP @@ -193,7 +188,7 @@ chown -R "$app":"$app" "$final_path" pushd $final_path/$app/js ynh_script_progression --message="Building NodeJS..." - ynh_use_nodejs + ynh_use_nodejs sudo -u $app env PATH=$PATH yarn install sudo -u $app env PATH=$PATH yarn run build popd From eed8ecda7ca0aefb30076044f24328600097e00b Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 26 Oct 2020 16:06:08 +0100 Subject: [PATCH 28/48] Bump to 1.0.0 --- README.md | 4 ++-- conf/app.src | 6 +++--- manifest.json | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 7b335fa..3a60915 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ MobiliZon aims to solve existing platform's problems to organize events in a dec Mobilizon is a tool designed to create platforms for managing communities and events. Its purpose is to help as many people as possible to free themselves from Facebook groups and events, from Meetup, etc. -**Shipped version:** 1.0.0-rc.4 +**Shipped version:** 1.0.0 ## Important points to read before installing @@ -29,7 +29,7 @@ Mobilizon is a tool designed to create platforms for managing communities and ev ## YunoHost specific features -#### Supported architectures +#### Supported achitectures * 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/) diff --git a/conf/app.src b/conf/app.src index 7a1c82e..6c7df20 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,6 +1,6 @@ -SOURCE_URL=https://framagit.org/framasoft/mobilizon/-/archive/1.0.0-rc.4/mobilizon-1.0.0-rc.4.tar.gz -SOURCE_SUM=54412680e10928a3d68a07d2201310eed548e51cccf19a0aaf8641af9a5ee8d0 +SOURCE_URL=https://framagit.org/framasoft/mobilizon/-/archive/1.0.0/mobilizon-1.0.0.tar.gz +SOURCE_SUM=a66712b859b923403945ad3e1e05f3ef537c7eb2a598f511dd99018ee4c06feb SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true -SOURCE_FILENAME=mobilizon-1.0.0-rc.4.tar.gz +SOURCE_FILENAME=mobilizon-1.0.0.tar.gz diff --git a/manifest.json b/manifest.json index 29baa21..16e338c 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "A decentralized and federated platform to organize events", "fr": "Une plateforme décentralisée et fédérée pour organiser des événements" }, - "version": "1.0.0-rc.4~ynh1", + "version": "1.0.0~ynh1", "url": "https://joinmobilizon.org/", "license": "AGPL-3.0-or-later", "maintainer": { From 952f62c061333873ba165467060cad8bbd974e67 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 26 Oct 2020 17:06:47 +0100 Subject: [PATCH 29/48] Do not enable gzip --- conf/nginx.conf | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index cff60cc..56b0305 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -4,15 +4,6 @@ location / { rewrite ^ https://$server_name$request_uri? permanent; } - gzip on; - gzip_disable "msie6"; - gzip_vary on; - gzip_proxied any; - gzip_comp_level 6; - gzip_buffers 16 8k; - gzip_http_version 1.1; - gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript application/activity+json application/atom+xml; - # the nginx default is 1m, not enough for large media uploads client_max_body_size 16m; @@ -49,4 +40,4 @@ location / { location @error { root __FINALPATH__/mobilizon/priv/errors; try_files /error.html 502; -} \ No newline at end of file +} From 02c7d136f60e04a9d1b4415c9135759505db08a9 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 26 Oct 2020 17:17:17 +0100 Subject: [PATCH 30/48] add_header -> more_set_headers --- conf/nginx.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 56b0305..e21dafd 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -21,13 +21,13 @@ location / { root __FINALPATH__/mobilizon/priv/static; etag off; access_log off; - add_header Cache-Control "public, max-age=31536000, immutable"; + more_set_headers "Cache-Control: public, max-age=31536000, immutable"; } location ~ ^/(media|proxy) { etag off; access_log off; - add_header Cache-Control "public, max-age=31536000, immutable"; + more_set_headers "Cache-Control: public, max-age=31536000, immutable"; proxy_pass http://localhost:__PORT__; } From 2dda85301e2d9dca59247f07a5288bc09317424c Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 26 Oct 2020 17:22:34 +0100 Subject: [PATCH 31/48] Fix version number for upgrade test --- scripts/upgrade | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 5e9381d..bc5413d 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -100,8 +100,8 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line # UPGRADE FROM PREVIOUS VERSION #================================================= -if ynh_version_gt "1.0.0-rc1~ynh1" "${previous_version}" ; then - ynh_script_progression --message="Upgrade configuration to 1.0.0-rc1~ynh1..." +if ynh_version_gt "0.1.1" "${previous_version}" ; then + ynh_script_progression --message="Upgrade configuration to 1.0.0..." config="$final_path/$app/config/prod.secret.exs" ynh_backup_if_checksum_is_different --file="$config" From 9ab0387d122b46c00ddb32d2a7750dd66c1b8cf5 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 26 Oct 2020 17:23:02 +0100 Subject: [PATCH 32/48] Bump version number to 4.0 --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 16e338c..19fcdec 100644 --- a/manifest.json +++ b/manifest.json @@ -13,7 +13,7 @@ "name": "yalh76" }, "requirements": { - "yunohost": ">= 3.5" + "yunohost": ">= 4.0" }, "multi_instance": true, "services": [ From b76947f8aa8c59a7a20a3c91cb2b93faf9e39f19 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 26 Oct 2020 17:42:03 +0100 Subject: [PATCH 33/48] Tweak manifest question to simplify / be more consistent --- manifest.json | 30 ++++++++++-------------------- scripts/install | 4 +--- scripts/upgrade | 1 - 3 files changed, 11 insertions(+), 24 deletions(-) diff --git a/manifest.json b/manifest.json index 19fcdec..08f7b46 100644 --- a/manifest.json +++ b/manifest.json @@ -30,15 +30,6 @@ }, "example": "example.com" }, - { - "name": "admin", - "type": "user", - "ask": { - "en": "Choose an admin user", - "fr": "Choisissez l'administrateur" - }, - "example": "johndoe" - }, { "name": "is_public", "type": "boolean", @@ -58,6 +49,15 @@ "choices": ["fr", "en"], "default": "fr" }, + { + "name": "admin", + "type": "user", + "ask": { + "en": "Choose an admin user", + "fr": "Choisissez l'administrateur" + }, + "example": "johndoe" + }, { "name": "password", "type": "password", @@ -66,17 +66,7 @@ "fr": "Définissez le mot de passe administrateur" }, "example": "Choose a password" - }, - { - "name": "name", - "type": "string", - "ask": { - "en": "Choose the instance name", - "fr": "Choisissez le nom de l'instance" - }, - "example": "Mobilizon", - "default": "Mobilizon" - } + } ] } } diff --git a/scripts/install b/scripts/install index 15c071a..bdd81a3 100644 --- a/scripts/install +++ b/scripts/install @@ -30,7 +30,6 @@ is_public=$YNH_APP_ARG_IS_PUBLIC language=$YNH_APP_ARG_LANGUAGE password=$YNH_APP_ARG_PASSWORD -name=$YNH_APP_ARG_NAME admin_email=$(ynh_user_get_info $admin 'mail') app=$YNH_APP_INSTANCE_NAME @@ -56,7 +55,6 @@ 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=name --value=$name ynh_app_setting_set --app=$app --key=admin_email --value=$admin_email #================================================= @@ -154,7 +152,7 @@ pushd $final_path/$app 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 mobilizon.instance gen --force --output $config --output-psql /tmp/setup_db.psql --domain $domain --instance-name $name --admin-email $admin_email --dbhost localhost --dbname $db_name --dbuser $db_user --dbpass $db_pwd --listen-port $port + sudo -u "$app" MIX_ENV=prod mix mobilizon.instance gen --force --output $config --output-psql /tmp/setup_db.psql --domain $domain --instance-name "Mobilizon" --admin-email $admin_email --dbhost localhost --dbname $db_name --dbuser $db_user --dbpass $db_pwd --listen-port $port popd cat "../conf/ldap.exs" >> "$config" diff --git a/scripts/upgrade b/scripts/upgrade index bc5413d..ca8a5bc 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -28,7 +28,6 @@ db_user=$db_name db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) port=$(ynh_app_setting_get --app=$app --key=port) secret=$(ynh_app_setting_get --app=$app --key=secret) -name=$(ynh_app_setting_get --app=$app --key=name) admin_email=$(ynh_app_setting_get --app=$app --key=admin_email) #================================================= From fd7d0bb695e6182d3be929f91477d885556bf101 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 26 Oct 2020 18:06:08 +0100 Subject: [PATCH 34/48] Validate that there's an email address for the admin user --- scripts/install | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/install b/scripts/install index bdd81a3..33272bc 100644 --- a/scripts/install +++ b/scripts/install @@ -45,6 +45,8 @@ test ! -e "$final_path" || ynh_die --message="This path already contains a folde # Register (book) web path ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url +[ -n "$admin_email" ] || ynh_die --message="Did not found the email address for the admin user ?" + #================================================= # STORE SETTINGS FROM MANIFEST #================================================= From 4d35cfa0e4044254cfd1c3959dacb47dd83646c7 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 26 Oct 2020 18:11:07 +0100 Subject: [PATCH 35/48] Explicitly require postgresql-postgis-scripts which may not get installed on systems with --no-install-recommends by default in apt preferences --- scripts/_common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 4cb929b..da4bfa5 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,7 +5,7 @@ #================================================= # dependencies used by the app -pkg_dependencies="build-essential inotify-tools postgresql postgresql-client postgresql-contrib git curl unzip gnupg openssl postgis make gcc libc-dev argon2 imagemagick webp gifsicle jpegoptim optipng pngquant cmake" +pkg_dependencies="build-essential inotify-tools postgresql postgresql-client postgresql-contrib postgis postgresql-postgis-scripts git curl unzip gnupg openssl make gcc libc-dev argon2 imagemagick webp gifsicle jpegoptim optipng pngquant cmake" extra_pkg_dependencies="elixir esl-erlang" NODEJS_VERSION=12 From 7611c86cdda39376c520927490b59c2c679b2782 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 26 Oct 2020 18:22:37 +0100 Subject: [PATCH 36/48] Aaaand I made a typo / untested commit :'< --- scripts/install | 2 +- scripts/upgrade | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 33272bc..b16dfa0 100644 --- a/scripts/install +++ b/scripts/install @@ -160,7 +160,7 @@ popd cat "../conf/ldap.exs" >> "$config" pushd $final_path/$app - chown o-rwx $config + chmod o-rwx $config ynh_secure_remove --file="/tmp/setup_db.psql" sudo -u "$app" MIX_ENV=prod mix ecto.migrate sudo -u "$app" MIX_ENV=prod mix mobilizon.users.new "$admin_email" --admin --password "$password" diff --git a/scripts/upgrade b/scripts/upgrade index ca8a5bc..4e7524f 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -176,7 +176,7 @@ ynh_script_progression --message="Modifying a config file..." config="$final_path/$app/config/prod.secret.exs" ynh_backup_if_checksum_is_different --file="$config" -chown o-rwx $config +chmod o-rwx $config #================================================= # MAKE SETUP From b17c8fd8629416af67fd8f09af2b2f456014a8c1 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 26 Oct 2020 19:13:42 +0100 Subject: [PATCH 37/48] Fix ldap config + remove the need to define a password since authentication uses LDAP --- conf/ldap.exs | 9 +++++++-- manifest.json | 11 +---------- scripts/install | 6 +++++- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/conf/ldap.exs b/conf/ldap.exs index 692720e..eb484a5 100644 --- a/conf/ldap.exs +++ b/conf/ldap.exs @@ -1,11 +1,16 @@ + config :mobilizon, Mobilizon.Service.Auth.Authenticator, Mobilizon.Service.Auth.LDAPAuthenticator config :mobilizon, :ldap, enabled: true, - host: "localhost", + host: "127.0.0.1", port: 389, ssl: false, # sslopts: [], tls: false, # tlsopts: [], base: "ou=users,dc=yunohost,dc=org", - uid: "uid" + uid: "uid", + require_bind_for_search: false, + bind_uid: nil, + bind_password: nil + diff --git a/manifest.json b/manifest.json index 08f7b46..8e832cf 100644 --- a/manifest.json +++ b/manifest.json @@ -57,16 +57,7 @@ "fr": "Choisissez l'administrateur" }, "example": "johndoe" - }, - { - "name": "password", - "type": "password", - "ask": { - "en": "Set the administrator password", - "fr": "Définissez le mot de passe administrateur" - }, - "example": "Choose a password" - } + } ] } } diff --git a/scripts/install b/scripts/install index b16dfa0..88ed3f0 100644 --- a/scripts/install +++ b/scripts/install @@ -28,7 +28,6 @@ path_url="/" admin=$YNH_APP_ARG_ADMIN is_public=$YNH_APP_ARG_IS_PUBLIC language=$YNH_APP_ARG_LANGUAGE -password=$YNH_APP_ARG_PASSWORD admin_email=$(ynh_user_get_info $admin 'mail') @@ -161,8 +160,13 @@ cat "../conf/ldap.exs" >> "$config" pushd $final_path/$app chmod o-rwx $config + # Compile *again* because we added ldap conf in between... dunno if the first is relevant + sudo -u "$app" MIX_ENV=prod mix compile ynh_secure_remove --file="/tmp/setup_db.psql" sudo -u "$app" MIX_ENV=prod mix ecto.migrate + + # We generate a dummy password ... this will actually *not* be used because the admin is supposed to connect via the ldap + password=$(ynh_string_random --length=30) sudo -u "$app" MIX_ENV=prod mix mobilizon.users.new "$admin_email" --admin --password "$password" popd From e186da6477d7d1eb44e50a32ffdd351154ff1ad8 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 26 Oct 2020 19:48:54 +0100 Subject: [PATCH 38/48] (to be validated...) Integrate mail .. which requires a dummy user --- conf/mail.exs | 18 ++++++++++++++++++ scripts/install | 10 ++++++++-- scripts/remove | 2 ++ scripts/restore | 4 ++++ scripts/upgrade | 12 +++++++++++- 5 files changed, 43 insertions(+), 3 deletions(-) create mode 100644 conf/mail.exs diff --git a/conf/mail.exs b/conf/mail.exs new file mode 100644 index 0000000..f22ef70 --- /dev/null +++ b/conf/mail.exs @@ -0,0 +1,18 @@ + +config :mobilizon, Mobilizon.Web.Email.Mailer, + adapter: Bamboo.SMTPAdapter, + server: "127.0.0.1", + #hostname: "127.0.0.1", + # usually 25, 465 or 587 + port: 25, + username: "__YNH_USER__", + password: "__YNH_USER_PASSWORD__", + # can be `:always` or `:never` + tls: :never, + allowed_tls_versions: [:"tlsv1.2"], + retries: 1, + # can be `true` + no_mx_lookups: false, + # can be `:always`. If your smtp relay requires authentication set it to `:always`. + auth: :always + diff --git a/scripts/install b/scripts/install index 88ed3f0..b657d9c 100644 --- a/scripts/install +++ b/scripts/install @@ -28,9 +28,8 @@ path_url="/" admin=$YNH_APP_ARG_ADMIN is_public=$YNH_APP_ARG_IS_PUBLIC language=$YNH_APP_ARG_LANGUAGE - admin_email=$(ynh_user_get_info $admin 'mail') - +ynh_user_password=$(ynh_string_random --length=30) app=$YNH_APP_INSTANCE_NAME #================================================= @@ -57,6 +56,7 @@ 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 #================================================= # STANDARD MODIFICATIONS @@ -130,6 +130,9 @@ ynh_script_progression --message="Configuring system user..." # Create a system user ynh_system_user_create --username=$app --home_dir=$final_path +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 + #================================================= # SPECIFIC SETUP #================================================= @@ -157,9 +160,12 @@ pushd $final_path/$app popd cat "../conf/ldap.exs" >> "$config" +cat "../conf/mail.exs" >> "$config" pushd $final_path/$app chmod o-rwx $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" # Compile *again* because we added ldap conf in between... dunno if the first is relevant sudo -u "$app" MIX_ENV=prod mix compile ynh_secure_remove --file="/tmp/setup_db.psql" diff --git a/scripts/remove b/scripts/remove index 7a6b0af..578eb37 100644 --- a/scripts/remove +++ b/scripts/remove @@ -107,6 +107,8 @@ ynh_script_progression --message="Removing the dedicated system user..." # Delete a system user ynh_system_user_delete --username=$app +yunohost user delete ${app}_notifs + #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index 1218c66..6ca26c2 100644 --- a/scripts/restore +++ b/scripts/restore @@ -34,6 +34,7 @@ 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) +ynh_user_password=$(ynh_app_setting_get --app=$app --key=ynh_user_password) #================================================= # CHECK IF THE APP CAN BE RESTORED @@ -69,6 +70,9 @@ 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 +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 + #================================================= # RESTORE USER RIGHTS #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 4e7524f..a97a13d 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -102,12 +102,22 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line if ynh_version_gt "0.1.1" "${previous_version}" ; then 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 + + 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 + config="$final_path/$app/config/prod.secret.exs" ynh_backup_if_checksum_is_different --file="$config" - # Implement ldap + # Implement ldap and mail 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" + # Recalculate and store the checksum of the file for the next upgrade. ynh_store_file_checksum --file="$config" fi From ce6b2a01d3f109532d140f804c86f5eacbfc5629 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 26 Oct 2020 20:22:55 +0100 Subject: [PATCH 39/48] Update documentation link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3a60915..0f24173 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Mobilizon is a tool designed to create platforms for managing communities and ev ## Documentation - * Official documentation: https://framasoft.frama.io/mobilizon/ + * Official documentation: https://docs.joinmobilizon.org ## YunoHost specific features From 04ecff22a1d8c17c395901162a57e52c65974655 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 26 Oct 2020 21:49:48 +0100 Subject: [PATCH 40/48] Fix mail configuration --- conf/mail.exs | 2 +- scripts/install | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/mail.exs b/conf/mail.exs index f22ef70..f91d016 100644 --- a/conf/mail.exs +++ b/conf/mail.exs @@ -8,7 +8,7 @@ config :mobilizon, Mobilizon.Web.Email.Mailer, username: "__YNH_USER__", password: "__YNH_USER_PASSWORD__", # can be `:always` or `:never` - tls: :never, + tls: :if_available, allowed_tls_versions: [:"tlsv1.2"], retries: 1, # can be `true` diff --git a/scripts/install b/scripts/install index b657d9c..753dfbe 100644 --- a/scripts/install +++ b/scripts/install @@ -156,7 +156,7 @@ pushd $final_path/$app 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 mobilizon.instance gen --force --output $config --output-psql /tmp/setup_db.psql --domain $domain --instance-name "Mobilizon" --admin-email $admin_email --dbhost localhost --dbname $db_name --dbuser $db_user --dbpass $db_pwd --listen-port $port + sudo -u "$app" MIX_ENV=prod mix mobilizon.instance gen --force --output $config --output-psql /tmp/setup_db.psql --domain $domain --instance-name "Mobilizon" --admin-email "$app@$domain" --dbhost localhost --dbname $db_name --dbuser $db_user --dbpass $db_pwd --listen-port $port popd cat "../conf/ldap.exs" >> "$config" From 0505c2cba63562a39fec590d9f1c3ccd85be3550 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 26 Oct 2020 21:51:43 +0100 Subject: [PATCH 41/48] Fix weird stuff about firewall --- scripts/install | 2 +- scripts/remove | 10 ---------- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/scripts/install b/scripts/install index 753dfbe..3147141 100644 --- a/scripts/install +++ b/scripts/install @@ -63,7 +63,7 @@ ynh_app_setting_set --app=$app --key=ynh_user_password --value=$ynh_user_passwor #================================================= # FIND AND OPEN A PORT #================================================= -ynh_script_progression --message="Configuring firewall..." +ynh_script_progression --message="Finding an available port..." # Find an available port port=$(ynh_find_port --port=8095) diff --git a/scripts/remove b/scripts/remove index 578eb37..db6153d 100644 --- a/scripts/remove +++ b/scripts/remove @@ -77,16 +77,6 @@ ynh_script_progression --message="Removing nginx web server configuration..." # Remove the dedicated nginx config ynh_remove_nginx_config -#================================================= -# CLOSE A PORT -#================================================= - -if yunohost firewall list | grep -q "\- $port$" -then - ynh_script_progression --message="Closing port $port..." - ynh_exec_warn_less yunohost firewall disallow TCP $port -fi - #================================================= # SPECIFIC REMOVE #================================================= From a49b787a9452acc344a0b6e48159091d435fbc2c Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Tue, 27 Oct 2020 12:37:10 +0100 Subject: [PATCH 42/48] Improve messages ? --- scripts/install | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 3147141..d081447 100644 --- a/scripts/install +++ b/scripts/install @@ -138,7 +138,7 @@ yunohost user update ${app}_notifs --add-mailalias $app@$domain --add-mailforwar #================================================= # MAKE SETUP #================================================= -ynh_script_progression --message="Making setup..." +ynh_script_progression --message="Installing dependencies and building app..." --weight=5 # Give permission to the final_path chown -R "$app":"$app" "$final_path" @@ -147,10 +147,13 @@ config="$final_path/$app/config/prod.secret.exs" pushd $final_path/$app/js ynh_use_nodejs + ynh_print_info --message="Installing dependencies (this is going to take a while...)" sudo -u $app env PATH=$PATH yarn install + ynh_print_info --message="Building application (this is going to take a while...)" sudo -u $app env PATH=$PATH NODE_BUILD_MEMORY=1024 yarn run build popd +ynh_print_info --message="Configuring Mobilizon..." pushd $final_path/$app sudo -u "$app" MIX_ENV=prod mix local.hex --force sudo -u "$app" MIX_ENV=prod mix local.rebar --force From 3254fb672f513c142d5face325bfdb7180235698 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Tue, 27 Oct 2020 20:04:58 +0100 Subject: [PATCH 43/48] Fix line 74: admin_email: unbound variable --- scripts/restore | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/restore b/scripts/restore index 6ca26c2..5358caa 100644 --- a/scripts/restore +++ b/scripts/restore @@ -35,6 +35,7 @@ db_user=$db_name db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) port=$(ynh_app_setting_get --app=$app --key=port) ynh_user_password=$(ynh_app_setting_get --app=$app --key=ynh_user_password) +admin_email=$(ynh_app_setting_get --app=$app --key=admin_email) #================================================= # CHECK IF THE APP CAN BE RESTORED From a998de28544a7e25b82615cf2b9e0e1927039bac Mon Sep 17 00:00:00 2001 From: yalh76 Date: Tue, 27 Oct 2020 22:58:13 +0100 Subject: [PATCH 44/48] Improve messages --- scripts/install | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index d081447..5458eda 100644 --- a/scripts/install +++ b/scripts/install @@ -147,13 +147,13 @@ config="$final_path/$app/config/prod.secret.exs" pushd $final_path/$app/js ynh_use_nodejs - ynh_print_info --message="Installing dependencies (this is going to take a while...)" + ynh_script_progression --message="Installing NodeJS dependencies (this is going to take a while...)" sudo -u $app env PATH=$PATH yarn install - ynh_print_info --message="Building application (this is going to take a while...)" + 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_print_info --message="Configuring Mobilizon..." +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 From 401e6e5415a1cd8bd1f4949220275f1b75f03ce8 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Tue, 27 Oct 2020 23:17:52 +0100 Subject: [PATCH 45/48] Fix upgrade from previous version previously using .env --- conf/prod.secret.exs | 31 +++++++++++++++++++++++++++++++ scripts/upgrade | 30 ++++++++++++++++++++++-------- 2 files changed, 53 insertions(+), 8 deletions(-) create mode 100644 conf/prod.secret.exs diff --git a/conf/prod.secret.exs b/conf/prod.secret.exs new file mode 100644 index 0000000..70b2f99 --- /dev/null +++ b/conf/prod.secret.exs @@ -0,0 +1,31 @@ +# Mobilizon instance configuration + +import Config + +config :mobilizon, Mobilizon.Web.Endpoint, + url: [host: "__DOMAIN__"], + http: [port: __PORT__], + secret_key_base: "__SECRET__" + +config :mobilizon, Mobilizon.Web.Auth.Guardian, + secret_key: "" + +config :mobilizon, :instance, + name: "Mobilizon", + description: "Change this to a proper description of your instance", + hostname: "__DOMAIN__", + registrations_open: false, + demo: false, + allow_relay: true, + federating: true, + email_from: "__APP__@__DOMAIN__", + email_reply_to: "__APP__@__DOMAIN__" + +config :mobilizon, Mobilizon.Storage.Repo, + adapter: Ecto.Adapters.Postgres, + username: "__DB_USER__", + password: "__DB_PWD__", + database: "__DB_NAME__", + hostname: "localhost", + port: "5432", + pool_size: 10 diff --git a/scripts/upgrade b/scripts/upgrade index a97a13d..103189a 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -99,7 +99,7 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line # UPGRADE FROM PREVIOUS VERSION #================================================= -if ynh_version_gt "0.1.1" "${previous_version}" ; then +if ynh_version_gt "1.0.0" "${previous_version}" ; then ynh_script_progression --message="Upgrade configuration to 1.0.0..." ynh_user_password=$(ynh_string_random --length=30) @@ -108,8 +108,22 @@ if ynh_version_gt "0.1.1" "${previous_version}" ; then 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" + + # Configure Mobilizon config="$final_path/$app/config/prod.secret.exs" - ynh_backup_if_checksum_is_different --file="$config" + cp ../conf/prod.secret.exs "$config" + ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$config" + ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$config" + ynh_replace_string --match_string="__SECRET__" --replace_string="$secret" --target_file="$config" + ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$config" + ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_user" --target_file="$config" + ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$config" + ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$config" + ynh_replace_string --match_string="__ADMIN_EMAIL__" --replace_string="$admin_email" --target_file="$config" # Implement ldap and mail cat "../conf/ldap.exs" >> "$config" @@ -196,20 +210,20 @@ chmod o-rwx $config chown -R "$app":"$app" "$final_path" pushd $final_path/$app/js - ynh_script_progression --message="Building NodeJS..." 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 - sudo -u $app env PATH=$PATH yarn run build + 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 - ynh_script_progression --message="Building Elixir..." - #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 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 #================================================= From 1fdf878a8d4915bfe01c47c8eb1adbbf2fde3fb6 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Wed, 28 Oct 2020 16:22:48 +0100 Subject: [PATCH 46/48] Fix version comparison during upgrade --- scripts/upgrade | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 103189a..14fcdfe 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -99,8 +99,8 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line # UPGRADE FROM PREVIOUS VERSION #================================================= -if ynh_version_gt "1.0.0" "${previous_version}" ; then - ynh_script_progression --message="Upgrade configuration to 1.0.0..." +if ynh_version_gt "1.0.0~ynh1" "${previous_version}" ; then + 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 From c1ccf25947ad40b8793687dd0d219e56e459b1a7 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Wed, 28 Oct 2020 21:20:47 +0100 Subject: [PATCH 47/48] update notification email --- scripts/change_url | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/change_url b/scripts/change_url index 8a9902b..4df3fd5 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -103,6 +103,7 @@ then mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf # Store file checksum for the new config file location ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" + yunohost user update "${app}_notifs" --mail ${app}_notifs@{$new_domain} fi #================================================= From 52737cccdfeb2838e91542c32327537fb010856b Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Thu, 29 Oct 2020 17:47:39 +0100 Subject: [PATCH 48/48] Also propagate domain change on alias --- scripts/change_url | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/change_url b/scripts/change_url index 4df3fd5..bb7b90a 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -103,7 +103,7 @@ then mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf # Store file checksum for the new config file location ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" - yunohost user update "${app}_notifs" --mail ${app}_notifs@{$new_domain} + yunohost user update "${app}_notifs" --mail ${app}_notifs@{$new_domain} --remove-mailalias ${app}@${old_domain} --add-mailalias ${app}@${new_domain} fi #=================================================