From 6d862b034e81ae2c7745348c7420681e3bb8ce4f Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 7 Jan 2022 03:03:06 +0100 Subject: [PATCH 1/4] Upgrade to 2.0.2~ynh1 --- README.md | 2 +- README_fr.md | 2 +- check_process | 4 ++ conf/amd64.src | 7 +++ conf/app.src | 7 --- conf/arm.src | 7 +++ conf/arm64.src | 7 +++ conf/nginx.conf | 8 ---- conf/systemd.service | 14 +++--- manifest.json | 10 ++-- scripts/_common.sh | 5 +- scripts/backup | 6 +++ scripts/change_url | 2 +- scripts/install | 111 ++++++++++++++++--------------------------- scripts/remove | 31 ++++++++---- scripts/restore | 21 +++----- scripts/upgrade | 86 ++++++++------------------------- 17 files changed, 138 insertions(+), 192 deletions(-) create mode 100644 conf/amd64.src delete mode 100644 conf/app.src create mode 100644 conf/arm.src create mode 100644 conf/arm64.src diff --git a/README.md b/README.md index b90679a..29237e4 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in A decentralized and federated platform to organize events -**Shipped version:** 1.3.2~ynh1 +**Shipped version:** 2.0.2~ynh1 **Demo:** https://demo.mobilizon.org diff --git a/README_fr.md b/README_fr.md index f9561a9..be6962e 100644 --- a/README_fr.md +++ b/README_fr.md @@ -13,7 +13,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour Une plateforme décentralisée et fédérée pour organiser des événements -**Version incluse :** 1.3.2~ynh1 +**Version incluse :** 2.0.2~ynh1 **Démo :** https://demo.mobilizon.org diff --git a/check_process b/check_process index 42717d5..98c9f1c 100644 --- a/check_process +++ b/check_process @@ -22,6 +22,8 @@ upgrade=1 from_commit=b63c7833f80de56bbc4a255ddda3b865a5637afc # 1.2.3~ynh1 upgrade=1 from_commit=42d479d2cc5bcdc40806ac01802d8eac9df5b2ea + # 1.3.2~ynh1 + upgrade=1 from_commit=e3c0b208c0b76a55e8df2a3947f57bb762b017d4 backup_restore=1 multi_instance=1 port_already_use=0 @@ -38,3 +40,5 @@ Notification=all name=1.2.2~ynh1 ; commit=42d479d2cc5bcdc40806ac01802d8eac9df5b2ea name=1.2.3~ynh1 + ; commit=e3c0b208c0b76a55e8df2a3947f57bb762b017d4 + name=1.3.2~ynh1 diff --git a/conf/amd64.src b/conf/amd64.src new file mode 100644 index 0000000..d975554 --- /dev/null +++ b/conf/amd64.src @@ -0,0 +1,7 @@ +SOURCE_URL=https://packages.joinmobilizon.org/2.0.2/mobilizon_2.0.2_amd64.tar.gz +SOURCE_SUM=1c734435f9e23e599de2de057a95b25a978ae5bd65ffbd95213c4e0da40fc592 +SOURCE_SUM_PRG=sha256sum +SOURCE_FORMAT=tar.gz +SOURCE_IN_SUBDIR=true +SOURCE_FILENAME= +SOURCE_EXTRACT=true diff --git a/conf/app.src b/conf/app.src deleted file mode 100644 index 682b8a7..0000000 --- a/conf/app.src +++ /dev/null @@ -1,7 +0,0 @@ -SOURCE_URL=https://framagit.org/framasoft/mobilizon/-/archive/1.3.2/mobilizon-1.3.2.tar.gz -SOURCE_SUM=74af9537ddd3ab4f549ee67e6e9b9b67946cf687c6f325b53947741348105e0a -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=tar.gz -SOURCE_IN_SUBDIR=true -SOURCE_FILENAME=mobilizon-1.3.2.tar.gz -SOURCE_EXTRACT=true diff --git a/conf/arm.src b/conf/arm.src new file mode 100644 index 0000000..e131720 --- /dev/null +++ b/conf/arm.src @@ -0,0 +1,7 @@ +SOURCE_URL=https://packages.joinmobilizon.org/2.0.2/mobilizon_2.0.2_arm.tar.gz +SOURCE_SUM=1ac4241b46cf9b165a7fdf641af16310aceb36bbb411ac477332af4057826b3c +SOURCE_SUM_PRG=sha256sum +SOURCE_FORMAT=tar.gz +SOURCE_IN_SUBDIR=true +SOURCE_FILENAME= +SOURCE_EXTRACT=true diff --git a/conf/arm64.src b/conf/arm64.src new file mode 100644 index 0000000..60044f1 --- /dev/null +++ b/conf/arm64.src @@ -0,0 +1,7 @@ +SOURCE_URL=https://packages.joinmobilizon.org/2.0.2/mobilizon_2.0.2_arm64.tar.gz +SOURCE_SUM=f8dbc38c7d61f0f10001df3ddf934d9c6313af614d8980f2ff19624058e68d4a +SOURCE_SUM_PRG=sha256sum +SOURCE_FORMAT=tar.gz +SOURCE_IN_SUBDIR=true +SOURCE_FILENAME= +SOURCE_EXTRACT=true diff --git a/conf/nginx.conf b/conf/nginx.conf index 6a4db4c..2bc566d 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -19,15 +19,7 @@ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; location / { - # Force usage of https - if ($scheme = http) { - rewrite ^ https://$server_name$request_uri? permanent; - } - proxy_pass http://localhost:__PORT__; - - # Include SSOWAT user panel. - # include conf.d/yunohost_panel.conf.inc; } location ~ ^/(js|css) { diff --git a/conf/systemd.service b/conf/systemd.service index e4c6deb..45a4014 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -5,8 +5,8 @@ After=network.target postgresql.service [Service] User=__APP__ WorkingDirectory=__FINALPATH__/live/ -ExecStart=/usr/bin/env mix phx.server -ExecReload=/bin/kill $MAINPID +ExecStart=__FINALPATH__/live/bin/mobilizon start +ExecStop=__FINALPATH__/live/bin/mobilizon stop KillMode=process Restart=on-failure Environment=MIX_ENV=prod @@ -14,14 +14,14 @@ Environment=MIX_ENV=prod SyslogIdentifier=mobilizon ; Some security directives. +; Ensures that the service process and all its children can never gain new privileges through execve(). +NoNewPrivileges=yes ; Use private /tmp and /var/tmp folders inside a new file system namespace, which are discarded after the process stops. -PrivateTmp=true +PrivateTmp=yes +; Sets up a new /dev mount for the process and only adds API pseudo devices like /dev/null, /dev/zero or /dev/random but not physical devices. Disabled by default because it may not work on devices like the Raspberry Pi. +PrivateDevices=no ; Mount /usr, /boot, and /etc as read-only for processes invoked by this service. ProtectSystem=full -; Sets up a new /dev mount for the process and only adds API pseudo devices like /dev/null, /dev/zero or /dev/random but not physical devices. Disabled by default because it may not work on devices like the Raspberry Pi. -PrivateDevices=false -; Ensures that the service process and all its children can never gain new privileges through execve(). -NoNewPrivileges=true [Install] diff --git a/manifest.json b/manifest.json index fcdb787..0695a8c 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.3.2~ynh1", + "version": "2.0.2~ynh1", "url": "https://joinmobilizon.org/", "upstream": { "license": "AGPL-3.0-or-later", @@ -20,7 +20,7 @@ "name": "yalh76" }, "requirements": { - "yunohost": ">= 4.1.3" + "yunohost": ">= 4.3.0" }, "multi_instance": true, "services": [ @@ -30,13 +30,11 @@ "install" : [ { "name": "domain", - "type": "domain", - "example": "example.com" + "type": "domain" }, { "name": "admin", - "type": "user", - "example": "johndoe" + "type": "user" }, { "name": "is_public", diff --git a/scripts/_common.sh b/scripts/_common.sh index 9c7a7b7..b1fd3f3 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,10 +5,7 @@ #================================================= # dependencies used by the app -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=14 +pkg_dependencies="postgresql postgresql-client postgresql-contrib postgis postgresql-postgis-scripts argon2 imagemagick webp gifsicle jpegoptim optipng pngquant" #================================================= # PERSONAL HELPERS diff --git a/scripts/backup b/scripts/backup index 4795b27..fd70fe0 100644 --- a/scripts/backup +++ b/scripts/backup @@ -63,6 +63,12 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup --src_path="/etc/systemd/system/$app.service" +#================================================= +# BACKUP VARIOUS FILES +#================================================= + +ynh_backup --src_path="/etc/$app/" + #================================================= # BACKUP THE POSTGRESQL DATABASE #================================================= diff --git a/scripts/change_url b/scripts/change_url index 00f22f0..ac2b095 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -113,7 +113,7 @@ fi #================================================= ynh_script_progression --message="Modifying a config file..." -config="$final_path/live/config/runtime.exs" +config="/etc/$app/config.exs" ynh_backup_if_checksum_is_different --file="$config" ynh_replace_string --match_string="$old_domain" --replace_string="$new_domain" --target_file="$config" diff --git a/scripts/install b/scripts/install index 7782765..746d8c9 100644 --- a/scripts/install +++ b/scripts/install @@ -30,6 +30,8 @@ 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) +architecture=$YNH_ARCH + app=$YNH_APP_INSTANCE_NAME #================================================= @@ -75,18 +77,6 @@ ynh_script_progression --message="Installing dependencies..." ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies -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' - -if dpkg --compare-versions $(cat /etc/debian_version) ge 11.0 -then - ynh_install_extra_app_dependencies --repo="deb http://packages.erlang-solutions.com/debian buster contrib" --package="$extra_pkg_dependencies" --key='https://packages.erlang-solutions.com/debian/erlang_solutions.asc' -else - 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' -fi - #================================================= # CREATE DEDICATED USER #================================================= @@ -122,7 +112,7 @@ 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 -ynh_setup_source --dest_dir="$final_path/live" +ynh_setup_source --dest_dir="$final_path/live" --source_id=$architecture chmod 750 "$final_path" chmod -R o-rwx "$final_path" @@ -153,62 +143,6 @@ chmod 750 "$datadir" chmod -R o-rwx "$datadir" chown -R $app:$app "$datadir" -#================================================= -# MAKE SETUP -#================================================= -ynh_script_progression --message="Installing dependencies and building app..." --weight=5 - -config="$final_path/live/config/runtime.exs" - -pushd $final_path/live/js - ynh_use_nodejs - ynh_script_progression --message="Installing NodeJS dependencies (this is going to take a while...)" - ynh_exec_warn_less sudo -u $app env PATH=$PATH yarn install - ynh_script_progression --message="Building NodeJS application (this is going to take a while...)" - ynh_exec_warn_less sudo -u $app env PATH=$PATH NODE_BUILD_MEMORY=1024 yarn run build -popd - -ynh_secure_remove --file="$final_path/live/js" - -ynh_script_progression --message="Building Elixir application (this is going to take a while...)" -pushd $final_path/live - sudo -u "$app" MIX_ENV=prod mix local.hex --force - sudo -u "$app" MIX_ENV=prod mix local.rebar --force - ynh_exec_warn_less sudo -u "$app" MIX_ENV=prod mix deps.get - ynh_exec_warn_less 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 "$app@$domain" --dbhost localhost --dbname $db_name --dbuser $db_user --dbpass $db_pwd --listen-port $port -popd - -cat "../conf/ldap.exs" >> "$config" -cat "../conf/mail.exs" >> "$config" -ynh_replace_string --match_string="__DATADIR__" --replace_string="$datadir" --target_file="../conf/uploads.exs" -cat "../conf/uploads.exs" >> "$config" - -chmod 750 "$datadir" -chmod -R o-rwx "$datadir" -chown -R $app:$app "$datadir" - -pushd $final_path/live - 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" - 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 - -ynh_secure_remove --file="$final_path/.cache" - -ynh_store_file_checksum --file="$config" - -chmod 400 "$config" -chown $app:$app "$config" - #================================================= # SETUP SYSTEMD #================================================= @@ -217,6 +151,45 @@ ynh_script_progression --message="Configuring a systemd service..." # Create a dedicated systemd config ynh_add_systemd_config +#================================================= +# MAKE SETUP +#================================================= +ynh_script_progression --message="Making setup..." + +mkdir -p /etc/$app +chown -R $app:$app /etc/$app + +config="/etc/$app/config.exs" + +pushd $final_path/live + ynh_exec_as $app MIX_ENV=prod ./bin/mobilizon_ctl 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 + ynh_secure_remove --file="/tmp/setup_db.psql" +popd + +cat "../conf/ldap.exs" >> "$config" +ynh_replace_string --match_string="__YNH_USER__" --replace_string="${app}_notifs" --target_file="../conf/mail.exs" +ynh_replace_string --match_string="__YNH_USER_PASSWORD__" --replace_string="${ynh_user_password}" --target_file="../conf/mail.exs" +cat "../conf/mail.exs" >> "$config" +ynh_replace_string --match_string="__DATADIR__" --replace_string="$datadir" --target_file="../conf/uploads.exs" +cat "../conf/uploads.exs" >> "$config" + +ynh_store_file_checksum --file="$config" + +chmod 400 "$config" +chown $app:$app "$config" + +pushd $final_path/live + ynh_exec_as $app ./bin/mobilizon_ctl migrate + + ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Access Mobilizon.Web.Endpoint at" + + # 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) + ynh_exec_as $app ./bin/mobilizon_ctl users.new "$admin_email" --admin --password "$password" + + ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped" +popd + #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/remove b/scripts/remove index d8b4be0..31d7cd7 100644 --- a/scripts/remove +++ b/scripts/remove @@ -51,15 +51,6 @@ 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 -#================================================= -# REMOVE DEPENDENCIES -#================================================= -ynh_script_progression --message="Removing dependencies..." - -# Remove metapackage and its dependencies -ynh_remove_nodejs -ynh_remove_app_dependencies - #================================================= # REMOVE APP MAIN DIR #================================================= @@ -68,6 +59,17 @@ ynh_script_progression --message="Removing app main directory..." # Remove the app directory securely ynh_secure_remove --file="$final_path" +#================================================= +# REMOVE DATA DIR +#================================================= + +# Remove the data directory if --purge option is used +if [ "${YNH_APP_PURGE:-0}" -eq 1 ] +then + ynh_script_progression --message="Removing app data directory..." + ynh_secure_remove --file="$datadir" +fi + #================================================= # REMOVE NGINX CONFIGURATION #================================================= @@ -76,6 +78,14 @@ ynh_script_progression --message="Removing NGINX web server configuration..." # Remove the dedicated NGINX config ynh_remove_nginx_config +#================================================= +# REMOVE DEPENDENCIES +#================================================= +ynh_script_progression --message="Removing dependencies..." + +# Remove metapackage and its dependencies +ynh_remove_app_dependencies + #================================================= # SPECIFIC REMOVE #================================================= @@ -83,6 +93,9 @@ ynh_remove_nginx_config #================================================= ynh_script_progression --message="Removing various files..." +# Remove a directory securely +ynh_secure_remove --file="/etc/$app" + # Remove the log files ynh_secure_remove --file="/var/log/$app" diff --git a/scripts/restore b/scripts/restore index 61f45e7..eb59477 100644 --- a/scripts/restore +++ b/scripts/restore @@ -43,8 +43,6 @@ datadir=$(ynh_app_setting_get --app=$app --key=datadir) #================================================= 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}" test ! -d $final_path \ || ynh_die --message="There is already a directory: $final_path " @@ -103,18 +101,6 @@ ynh_script_progression --message="Reinstalling dependencies..." # Define and install dependencies ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies -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' - -if dpkg --compare-versions $(cat /etc/debian_version) ge 11.0 -then - ynh_install_extra_app_dependencies --repo="deb http://packages.erlang-solutions.com/debian buster contrib" --package="$extra_pkg_dependencies" --key='https://packages.erlang-solutions.com/debian/erlang_solutions.asc' -else - 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' -fi - #================================================= # RESTORE THE POSTGRESQL DATABASE #================================================= @@ -127,6 +113,13 @@ ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --datab ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS unaccent;" --database=$db_name ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name +#================================================= +# RESTORE VARIOUS FILES +#================================================= +ynh_script_progression --message="Restoring various files..." + +ynh_restore_file --origin_path="/etc/$app/" + #================================================= # RESTORE SYSTEMD #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index d247b07..5628f18 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -29,6 +29,7 @@ port=$(ynh_app_setting_get --app=$app --key=port) secret=$(ynh_app_setting_get --app=$app --key=secret) admin_email=$(ynh_app_setting_get --app=$app --key=admin_email) datadir=$(ynh_app_setting_get --app=$app --key=datadir) +architecture=$YNH_ARCH #================================================= # CHECK VERSION @@ -111,10 +112,9 @@ if ynh_version_gt "1.0.0~ynh1" "${previous_version}" ; then # Implement ldap and mail cat "../conf/ldap.exs" >> "$config" + ynh_replace_string --match_string="__YNH_USER__" --replace_string="${app}_notifs" --target_file="../conf/mail.exs" + ynh_replace_string --match_string="__YNH_USER_PASSWORD__" --replace_string="${ynh_user_password}" --target_file="../conf/mail.exs" 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" @@ -161,12 +161,20 @@ if ynh_version_gt "1.2.3~ynh1" "${previous_version}" ; then ynh_store_file_checksum --file="$final_path/live/config/runtime.exs" fi -if [ ! -f "$final_path/live/config/runtime.exs" ]; then - ynh_delete_file_checksum --file="$final_path/$app/config/prod.secret.exs" - ynh_delete_file_checksum --file="$final_path/live/config/prod.secret.exs" - mv "$final_path/live/config/prod.secret.exs" "$final_path/live/config/runtime.exs" - ynh_replace_string --match_string="server: true," --replace_string="" --target_file="$final_path/live/config/runtime.exs" - ynh_store_file_checksum --file="$final_path/live/config/runtime.exs" +ynh_remove_nodejs + +if ynh_version_gt "2.0.2~ynh1" "${previous_version}" ; then + mkdir -p /etc/$app + if [ -f "$final_path/live/config/prod.secret.exs" ]; then + ynh_delete_file_checksum --file="$final_path/live/config/prod.secret.exs" + mv -f "$final_path/live/config/prod.secret.exs" "/etc/$app/config.exs" + fi + if [ -f "$final_path/live/config/runtime.exs" ]; then + ynh_delete_file_checksum --file="$final_path/live/config/runtime.exs" + mv -f "$final_path/live/config/runtime.exs" "/etc/$app/config.exs" + fi + chown -R $app:$app /etc/$app + ynh_store_file_checksum --file="/etc/$app/config.exs" fi #================================================= @@ -184,24 +192,12 @@ ynh_system_user_create --username=$app --home_dir=$final_path if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading source files..." - - # Create a temporary directory - tmpdir="$(mktemp -d)" - - # Backup the config file in the temp dir - cp -af "$final_path/live/config/runtime.exs" "$tmpdir/runtime.exs" # Remove the app directory securely ynh_secure_remove --file="$final_path/live" # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$final_path/live" - - # Restore the config file - cp -af "$tmpdir/runtime.exs" "$final_path/live/config/runtime.exs" - - # Remove the tmp directory securely - ynh_secure_remove --file="$tmpdir" + ynh_setup_source --dest_dir="$final_path/live" --source_id=$architecture fi chmod 750 "$final_path" @@ -223,18 +219,6 @@ ynh_script_progression --message="Upgrading dependencies..." ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies -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' - -if dpkg --compare-versions $(cat /etc/debian_version) ge 11.0 -then - ynh_install_extra_app_dependencies --repo="deb http://packages.erlang-solutions.com/debian buster contrib" --package="$extra_pkg_dependencies" --key='https://packages.erlang-solutions.com/debian/erlang_solutions.asc' -else - 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' -fi - #================================================= # SPECIFIC UPGRADE #================================================= @@ -259,46 +243,18 @@ chown -R $app:$app "$datadir" #================================================= # MAKE SETUP #================================================= +ynh_script_progression --message="Making setup..." -pushd $final_path/live/js - ynh_use_nodejs - ynh_script_progression --message="Installing NodeJS dependencies (this is going to take a while...)" - ynh_exec_warn_less sudo -u $app env PATH=$PATH yarn install - ynh_script_progression --message="Building NodeJS application (this is going to take a while...)" - ynh_exec_warn_less sudo -u $app env PATH=$PATH NODE_BUILD_MEMORY=1024 yarn run build - sudo -u $app env PATH=$PATH yarn cache clean --all -popd - -ynh_secure_remove --file="$final_path/live/js" - -ynh_script_progression --message="Building Elixir application (this is going to take a while...)" pushd $final_path/live - sudo -u "$app" MIX_ENV=prod mix local.hex --force - sudo -u "$app" MIX_ENV=prod mix local.rebar --force - ynh_exec_warn_less sudo -u "$app" MIX_ENV=prod mix deps.get - ynh_exec_warn_less sudo -u "$app" MIX_ENV=prod mix compile - sudo -u "$app" MIX_ENV=prod mix ecto.migrate + ynh_exec_as $app ./bin/mobilizon_ctl migrate popd -ynh_secure_remove --file="$final_path/.cache" - -#================================================= -# RUN APP MIGRATIONS -#================================================= - -if ynh_version_gt "1.0.3~ynh1" "${previous_version}" ; then - ynh_script_progression --message="Mobilizon v1.0.3: Refresh remote profiles to save avatars locally" - pushd $final_path/live - sudo -u "$app" MIX_ENV=prod mix mobilizon.actors.refresh --all - popd -fi - #================================================= # UPDATE A CONFIG FILE #================================================= ynh_script_progression --message="Updating a configuration file..." -config="$final_path/live/config/runtime.exs" +config="/etc/$app/config.exs" ynh_backup_if_checksum_is_different --file="$config" ynh_store_file_checksum --file="$config" From 6a81662140c9e9d00c6eda87258fd3c2e2b985b2 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 7 Jan 2022 19:53:50 +0100 Subject: [PATCH 2/4] Disable multi instance --- check_process | 2 +- manifest.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/check_process b/check_process index 98c9f1c..65980fe 100644 --- a/check_process +++ b/check_process @@ -25,7 +25,7 @@ # 1.3.2~ynh1 upgrade=1 from_commit=e3c0b208c0b76a55e8df2a3947f57bb762b017d4 backup_restore=1 - multi_instance=1 + multi_instance=0 port_already_use=0 change_url=1 ;;; Options diff --git a/manifest.json b/manifest.json index 0695a8c..7cb471e 100644 --- a/manifest.json +++ b/manifest.json @@ -22,7 +22,7 @@ "requirements": { "yunohost": ">= 4.3.0" }, - "multi_instance": true, + "multi_instance": false, "services": [ "nginx" ], From d0d90be1562f209742d86f568c94a526dbb5bf68 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 10 Jan 2022 21:32:26 +0100 Subject: [PATCH 3/4] Fixing disclaimer --- doc/DESCRIPTION.md | 6 ++++++ doc/DISCLAIMER.md | 12 +++++------- 2 files changed, 11 insertions(+), 7 deletions(-) create mode 100644 doc/DESCRIPTION.md diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md new file mode 100644 index 0000000..e9fa04c --- /dev/null +++ b/doc/DESCRIPTION.md @@ -0,0 +1,6 @@ +A decentralized and federated platform to organize events + +- Mobilizon is a tool that helps you find, create and organize events. + +- You can also create a page for your group where the members will be able to get organized together. + diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md index 338585a..c114b1b 100644 --- a/doc/DISCLAIMER.md +++ b/doc/DISCLAIMER.md @@ -1,8 +1,6 @@ -* Any known limitations, constrains or stuff not working, such as (but not limited to): - * **Mobilizon** require a dedicated **root domain**, eg. mobilizon.domain.tld - * To connect as **Mobilizon** administrator, use the email address and password of the user you choose during install - * By default registrations are closed - * All YunoHost users are allowed to connect +* **Mobilizon** require a dedicated **root domain**, eg. mobilizon.domain.tld +* To connect as **Mobilizon** administrator, use the email address and password of the user you choose during install +* By default registrations are closed +* All YunoHost users are allowed to connect -* Other infos that people should be aware of, such as: - * Configuration can be made in the Mobilizon administration panel. +* Configuration can be made in the Mobilizon administration panel. From 8582fc3b53c4bd2d3caeb604744dccc36e03a026 Mon Sep 17 00:00:00 2001 From: Yunohost-Bot <> Date: Mon, 10 Jan 2022 20:32:31 +0000 Subject: [PATCH 4/4] Auto-update README --- README.md | 18 +++++++++++------- README_fr.md | 20 ++++++++++++-------- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 29237e4..1be2d24 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,12 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in A decentralized and federated platform to organize events +- Mobilizon is a tool that helps you find, create and organize events. + +- You can also create a page for your group where the members will be able to get organized together. + + + **Shipped version:** 2.0.2~ynh1 **Demo:** https://demo.mobilizon.org @@ -27,14 +33,12 @@ A decentralized and federated platform to organize events ## Disclaimers / important information -* Any known limitations, constrains or stuff not working, such as (but not limited to): - * **Mobilizon** require a dedicated **root domain**, eg. mobilizon.domain.tld - * To connect as **Mobilizon** administrator, use the email address and password of the user you choose during install - * By default registrations are closed - * All YunoHost users are allowed to connect +* **Mobilizon** require a dedicated **root domain**, eg. mobilizon.domain.tld +* To connect as **Mobilizon** administrator, use the email address and password of the user you choose during install +* By default registrations are closed +* All YunoHost users are allowed to connect -* Other infos that people should be aware of, such as: - * Configuration can be made in the Mobilizon administration panel. +* Configuration can be made in the Mobilizon administration panel. ## Documentation and resources diff --git a/README_fr.md b/README_fr.md index be6962e..efb011b 100644 --- a/README_fr.md +++ b/README_fr.md @@ -11,7 +11,13 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour ## Vue d'ensemble -Une plateforme décentralisée et fédérée pour organiser des événements +A decentralized and federated platform to organize events + +- Mobilizon is a tool that helps you find, create and organize events. + +- You can also create a page for your group where the members will be able to get organized together. + + **Version incluse :** 2.0.2~ynh1 @@ -23,14 +29,12 @@ Une plateforme décentralisée et fédérée pour organiser des événements ## Avertissements / informations importantes -* Any known limitations, constrains or stuff not working, such as (but not limited to): - * **Mobilizon** require a dedicated **root domain**, eg. mobilizon.domain.tld - * To connect as **Mobilizon** administrator, use the email address and password of the user you choose during install - * By default registrations are closed - * All YunoHost users are allowed to connect +* **Mobilizon** require a dedicated **root domain**, eg. mobilizon.domain.tld +* To connect as **Mobilizon** administrator, use the email address and password of the user you choose during install +* By default registrations are closed +* All YunoHost users are allowed to connect -* Other infos that people should be aware of, such as: - * Configuration can be made in the Mobilizon administration panel. +* Configuration can be made in the Mobilizon administration panel. ## Documentations et ressources