From 71bde1371ae797f4e6bd219f52d848e2e6abdfe7 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 13 Jul 2019 15:30:14 +0200 Subject: [PATCH 01/26] Update README.md --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index f61256c..06d0659 100644 --- a/README.md +++ b/README.md @@ -103,7 +103,6 @@ The app can be used by multiple users. Developers info ---------------- -**Only if you want to use a testing branch for coding, instead of merging directly into master.** Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/pleroma_ynh/tree/testing). To try the testing branch, please proceed like that. From 270bdfc898d6c8eb8db4c450652e98ccc40dfcf6 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Tue, 16 Jul 2019 22:11:02 +0200 Subject: [PATCH 02/26] Upgrade to 1.0.1 --- README.md | 2 +- conf/app.src | 4 ++-- manifest.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 06d0659..83ff2c6 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ For user friendly details about Pleroma: [see here](https://blog.soykaf.com/post - Tootdon (Android + iOS) - Tootle (iOS) -**Shipped version:** 0.9.99999 +**Shipped version:** 1.0.1 ## Important points to read before installing diff --git a/conf/app.src b/conf/app.src index cd01bbe..373c88f 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/archive/v0.9.99999/pleroma-v0.9.99999.tar.gz -SOURCE_SUM=b79ee12d598a162bc16ebd7ec18ee7b0b78cb623574757ad6a0fe19d6a5a23d4 +SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/archive/v1.0.1/pleroma-v1.0.1.tar.gz +SOURCE_SUM=f97c6bd9eaa583916c6770665c94fd896f999210ca811bedd9ae9f72f04d4c1c SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/manifest.json b/manifest.json index 6b27de1..6de7bd5 100755 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Pleroma is an OStatus-compatible social networking server written in Elixir, compatible with GNU Social and Mastodon", "fr": "Pleroma est un réseau social écrit en Elixir, compatible avec OStatus, GNU Social et Mastodon" }, - "version": "0.9.99999~ynh1", + "version": "1.0.1~ynh1", "url": "https://git.pleroma.social/pleroma/pleroma", "license": "AGPL-3.0-only", "maintainer": [ From 03cac4d75d17604ab6b53a3f87ff45ccee5c3f5f Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 27 Jul 2019 11:16:50 +0200 Subject: [PATCH 03/26] Update install --- scripts/install | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 783e3bb..fb62bbf 100755 --- a/scripts/install +++ b/scripts/install @@ -37,8 +37,7 @@ random_key=$(ynh_string_random --length=64) admin_email=$(ynh_user_get_info --username=$admin --key="mail") ## Bypass package_checker name not compatible with pleroma -if [ "$admin" = "package_checker" ] -then +if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then admin="test" fi From 871a0991d811e675b9b1c513d066924418f4aacf Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 27 Jul 2019 23:42:11 +0200 Subject: [PATCH 04/26] OTP First Release --- conf/app.src | 6 -- conf/arm.src | 6 ++ conf/arm64.src | 6 ++ conf/generated_config.exs | 18 ++++-- conf/systemd.service | 14 ++--- conf/x86-64.src | 6 ++ scripts/_common.sh | 2 +- scripts/install | 111 +++++++++++++++++++++++-------------- scripts/restore | 4 +- scripts/upgrade | 8 ++- scripts/ynh_detect_arch__2 | 25 +++++++++ 11 files changed, 139 insertions(+), 67 deletions(-) delete mode 100644 conf/app.src create mode 100644 conf/arm.src create mode 100644 conf/arm64.src create mode 100644 conf/x86-64.src create mode 100644 scripts/ynh_detect_arch__2 diff --git a/conf/app.src b/conf/app.src deleted file mode 100644 index 373c88f..0000000 --- a/conf/app.src +++ /dev/null @@ -1,6 +0,0 @@ -SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/archive/v1.0.1/pleroma-v1.0.1.tar.gz -SOURCE_SUM=f97c6bd9eaa583916c6770665c94fd896f999210ca811bedd9ae9f72f04d4c1c -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=tar.gz -SOURCE_IN_SUBDIR=true -SOURCE_FILENAME= diff --git a/conf/arm.src b/conf/arm.src new file mode 100644 index 0000000..87f12bd --- /dev/null +++ b/conf/arm.src @@ -0,0 +1,6 @@ +SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/45357/artifacts/download +SOURCE_SUM=3f223062fca6010abd36aaf9c3ebee8d1c808012ed26639df49103a8969c5af0 +SOURCE_SUM_PRG=sha256sum +SOURCE_FORMAT=zip +SOURCE_IN_SUBDIR=true +SOURCE_FILENAME=pleroma-v1.0.1.zip diff --git a/conf/arm64.src b/conf/arm64.src new file mode 100644 index 0000000..f687dff --- /dev/null +++ b/conf/arm64.src @@ -0,0 +1,6 @@ +SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/45359/artifacts/download +SOURCE_SUM=68f0b6e09b423eb1df5774a7fc4aac1518aa3df27cdaae5b824b73ec8839d7f7 +SOURCE_SUM_PRG=sha256sum +SOURCE_FORMAT=zip +SOURCE_IN_SUBDIR=true +SOURCE_FILENAME=pleroma-v1.0.1.zip diff --git a/conf/generated_config.exs b/conf/generated_config.exs index 8781368..22aebd9 100644 --- a/conf/generated_config.exs +++ b/conf/generated_config.exs @@ -3,19 +3,21 @@ # NOTE: This file should not be committed to a repo or otherwise made public # without removing sensitive information. -use Mix.Config +import Config config :pleroma, Pleroma.Web.Endpoint, url: [host: "__DOMAIN__", scheme: "https", port: 443], secret_key_base: "__KEY__", + signing_salt: "__SIGNING_SALT__", http: [ip: {127, 0, 0, 1}, port: __PORT__] config :pleroma, :instance, name: "__INSTANCE_NAME__", email: "__ADMIN_EMAIL__", + notify_email: "__ADMIN_EMAIL__", limit: 5000, registrations_open: __REG__, - dedupe_media: false + dynamic_configuration: false config :pleroma, :media_proxy, enabled: __MEDIA_CACHE__, @@ -30,6 +32,16 @@ config :pleroma, Pleroma.Repo, hostname: "localhost", pool_size: 10 +# Configure web push notifications +config :web_push_encryption, :vapid_details, + subject: "mailto:__ADMIN_EMAIL__", + public_key: "__PUBLIC_KEY__", + private_key: "__PRIVATE_KEY__" + +config :pleroma, :database, rum_enabled: false +config :pleroma, :instance, static_dir: "__DATADIR__/static" +config :pleroma, Pleroma.Uploaders.Local, uploads: "__DATADIR__/uploads" + # Enable Strict-Transport-Security once SSL is working: # config :pleroma, :http_security, # sts: true @@ -69,5 +81,3 @@ config :pleroma, Pleroma.Repo, # storage_url: "https://swift-endpoint.prodider.com/v1/AUTH_/", # object_url: "https://cdn-endpoint.provider.com/" # - - diff --git a/conf/systemd.service b/conf/systemd.service index 104157b..614d91e 100755 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -1,27 +1,23 @@ [Unit] Description=__APP__ social network -After=network.target postgresql.service +After=network.target postgresql.service nginx.service [Service] -ExecReload=/bin/kill $MAINPID KillMode=process Restart=on-failure ; Name of the user that runs the Pleroma service. User=__APP__ Group=__APP__ -; Declares that Pleroma runs in production mode. -Environment="MIX_ENV=prod" ; Make sure that all paths fit your installation. ; Path to the home directory of the user running the Pleroma service. -Environment="HOME=__FINALPATH__" +Environment="HOME=__FINALPATH__/__APP__" ; Path to the folder containing the Pleroma installation. WorkingDirectory=__FINALPATH__/__APP__ -; Path to the Mix binary. -ExecStart=/usr/bin/mix phx.server -StandardOutput=syslog -StandardError=syslog +; Path to the Pleroma binary. +ExecStart=__FINALPATH__/__APP__/bin/pleroma start +ExecStop=__FINALPATH__/__APP__/bin/pleroma stop ; Some security directives. ; Use private /tmp and /var/tmp folders inside a new file system namespace, which are discarded after the process stops. diff --git a/conf/x86-64.src b/conf/x86-64.src new file mode 100644 index 0000000..6162f81 --- /dev/null +++ b/conf/x86-64.src @@ -0,0 +1,6 @@ +SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/45355/artifacts/download +SOURCE_SUM=426013286094411c5e53330515cc6601b41fab4b8a53b724b7739f92c95154a2 +SOURCE_SUM_PRG=sha256sum +SOURCE_FORMAT=zip +SOURCE_IN_SUBDIR=true +SOURCE_FILENAME=pleroma-v1.0.1.zip diff --git a/scripts/_common.sh b/scripts/_common.sh index 5faffde..d02af56 100755 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,7 +5,7 @@ #================================================= # dependencies used by the app -pkg_dependencies="git build-essential postgresql postgresql-contrib openssl ssh sudo" +pkg_dependencies="curl unzip libncurses5 postgresql postgresql-contrib" extra_pkg_dependencies="elixir erlang-dev erlang-tools erlang-parsetools erlang-eldap erlang-xmerl" #================================================= diff --git a/scripts/install b/scripts/install index fb62bbf..aeee439 100755 --- a/scripts/install +++ b/scripts/install @@ -7,6 +7,7 @@ #================================================= source _common.sh +source ynh_detect_arch__2 source ynh_add_extra_apt_repos__3 source /usr/share/yunohost/helpers @@ -15,6 +16,7 @@ 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 @@ -34,6 +36,7 @@ registration=$YNH_APP_ARG_REGISTRATION cache=$YNH_APP_ARG_CACHE size=$YNH_APP_ARG_SIZE random_key=$(ynh_string_random --length=64) +signing_salt=$(ynh_string_random --length=8) admin_email=$(ynh_user_get_info --username=$admin --key="mail") ## Bypass package_checker name not compatible with pleroma @@ -69,6 +72,7 @@ ynh_app_setting_set --app=$app --key=cache --value="$cache" ynh_app_setting_set --app=$app --key=size --value="$size" ynh_app_setting_set --app=$app --key=admin_email --value="$admin_email" ynh_app_setting_set --app=$app --key=random_key --value="$random_key" +ynh_app_setting_set --app=$app --key=signing_salt --value="$signing_salt" #================================================= # STANDARD MODIFICATIONS @@ -88,8 +92,8 @@ ynh_print_info --message="Installing dependencies..." ynh_install_app_dependencies $pkg_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' +#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' #================================================= # CREATE A POSTGRESQL DATABASE @@ -115,7 +119,8 @@ ynh_print_info --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/$app" +architecture=$(ynh_detect_arch) +ynh_setup_source --dest_dir="$final_path/$app" --source_id=$architecture #================================================= # NGINX CONFIGURATION @@ -146,60 +151,61 @@ ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # SPECIFIC SETUP +#================================================= +# CREATE THE DATA DIRECTORY +#================================================= +ynh_print_info --message="Create the data directory..." + +# Define app's data directory +datadir="/home/yunohost.app/${app}/storage" + +# Create app folders +mkdir -p "$datadir" +mkdir -p "$datadir/uploads" +mkdir -p "$datadir/static" +mkdir -p "$datadir/static/emoji" + +# Give permission to the datadir +chown -R "$app":"$app" "$datadir" + +ynh_app_setting_set --app=$app --key=datadir --value="$datadir" + #================================================= # MODIFY A CONFIG FILE #================================================= -cp -f ../conf/generated_config.exs "$final_path/$app/config/prod.secret.exs" +mkdir -p /etc/$app +chown -R $app /etc/$app -ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$final_path/$app/config/prod.secret.exs" -ynh_replace_string --match_string="__KEY__" --replace_string="$random_key" --target_file="$final_path/$app/config/prod.secret.exs" -ynh_replace_string --match_string="__INSTANCE_NAME__" --replace_string="$name" --target_file="$final_path/$app/config/prod.secret.exs" -ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$final_path/$app/config/prod.secret.exs" -ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$final_path/$app/config/prod.secret.exs" -ynh_replace_string --match_string="__ADMIN_EMAIL__" --replace_string="$admin_email" --target_file="$final_path/$app/config/prod.secret.exs" -ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/$app/config/prod.secret.exs" +config="/etc/$app/config.exs" + +cp -f ../conf/generated_config.exs $config + +ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$config" +ynh_replace_string --match_string="__KEY__" --replace_string="$random_key" --target_file="$config" +ynh_replace_string --match_string="__SIGNING_SALT__" --replace_string="$signing_salt" --target_file="$config" +ynh_replace_string --match_string="__INSTANCE_NAME__" --replace_string="$name" --target_file="$config" +ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$config" +ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$config" +ynh_replace_string --match_string="__ADMIN_EMAIL__" --replace_string="$admin_email" --target_file="$config" +ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$config" +ynh_replace_string --match_string="__DATADIR__" --replace_string="$datadir" --target_file="$config" if [ $cache -eq 1 ] then - ynh_replace_string --match_string="__MEDIA_CACHE__" --replace_string="true" --target_file="$final_path/$app/config/prod.secret.exs" + ynh_replace_string --match_string="__MEDIA_CACHE__" --replace_string="true" --target_file="$config" else - ynh_replace_string --match_string="__MEDIA_CACHE__" --replace_string="false" --target_file="$final_path/$app/config/prod.secret.exs" + ynh_replace_string --match_string="__MEDIA_CACHE__" --replace_string="false" --target_file="$config" fi # Set registrations open/closed if [ $registration -eq 1 ] then - ynh_replace_string --match_string="__REG__" --replace_string="true" --target_file="$final_path/$app/config/prod.secret.exs" + ynh_replace_string --match_string="__REG__" --replace_string="true" --target_file="$config" else - ynh_replace_string --match_string="__REG__" --replace_string="false" --target_file="$final_path/$app/config/prod.secret.exs" + ynh_replace_string --match_string="__REG__" --replace_string="false" --target_file="$config" fi -#================================================= -# MAKE SETUP -#================================================= - -# Give permission to the final_path -chown -R "$app":"$app" "$final_path" - -pushd $final_path/$app - # App setup and db migration - 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 - - # Add user - sudo -u "$app" MIX_ENV=prod mix pleroma.user new "$admin" "$admin_email" --password "$password" --moderator --admin -y - - #Generate key pair - sudo -u "$app" MIX_ENV=prod mix web_push.gen.keypair >> "config/prod.secret.exs" - ynh_replace_string --match_string="administrator@example.com" --replace_string="$admin_email" --target_file="$final_path/$app/config/prod.secret.exs" - - #Create uploads dir - mkdir uploads -popd - #================================================= # SETUP SYSTEMD #================================================= @@ -208,12 +214,33 @@ ynh_print_info --message="Configuring a systemd service..." # Create a dedicated systemd config ynh_add_systemd_config +#================================================= +# MAKE SETUP +#================================================= + +# Give permission to the final_path +chown -R "$app":"$app" "$final_path" + +pushd $final_path/$app + su "$app" -s $SHELL -lc "PLEROMA_CONFIG_PATH=$config $final_path/$app/bin/pleroma_ctl migrate" + + ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="check_if_time_to_update" + + # Add user + su pleroma -s $SHELL -lc "PLEROMA_CONFIG_PATH=$config $final_path/$app/bin/pleroma_ctl user new $admin $admin_email --password $password --moderator --admin -y" + + #Generate key pair + #sudo -u "$app" MIX_ENV=prod mix web_push.gen.keypair >> "config/prod.secret.exs" + su pleroma -s $SHELL -lc "PLEROMA_CONFIG_PATH=$config $final_path/$app/bin/pleroma_ctl gen keypair" >> "$config" + #ynh_replace_string --match_string="administrator@example.com" --replace_string="$admin_email" --target_file="$config" +popd + #================================================= # STORE THE CONFIG FILE CHECKSUM #================================================= # Calculate and store the config file checksum into the app settings -ynh_store_file_checksum --file="$final_path/$app/config/prod.secret.exs" +ynh_store_file_checksum --file="$config" #================================================= # GENERIC FINALIZATION @@ -245,7 +272,7 @@ yunohost service add $app --description "$app daemon for Pleroma" --log "/var/lo #================================================= ynh_print_info --message="Starting a systemd service..." -ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Running Pleroma.Web.Endpoint" +ynh_systemd_action --service_name=$app --action="restart" --log_path=systemd --line_match="Started pleroma social network" #================================================= # SETUP SSOWAT diff --git a/scripts/restore b/scripts/restore index ccf2b86..96b3b52 100755 --- a/scripts/restore +++ b/scripts/restore @@ -90,8 +90,8 @@ ynh_print_info --message="Reinstalling dependencies..." # Define and install dependencies ynh_install_app_dependencies $pkg_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' +#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' #================================================= # RESTORE THE POSTGRESQL DATABASE diff --git a/scripts/upgrade b/scripts/upgrade index 91f5248..32b30e1 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -7,6 +7,7 @@ #================================================= source _common.sh +source ynh_detect_arch__2 source ynh_add_extra_apt_repos__3 source /usr/share/yunohost/helpers @@ -129,7 +130,8 @@ then ynh_print_info --message="Upgrading source files..." # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$final_path/$app" + architecture=$(ynh_detect_arch) + ynh_setup_source --dest_dir="$final_path/$app" --source_id=$architecture fi #================================================= @@ -160,8 +162,8 @@ ynh_print_info --message="Upgrading dependencies..." ynh_install_app_dependencies $pkg_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' +#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' #================================================= # CREATE DEDICATED USER diff --git a/scripts/ynh_detect_arch__2 b/scripts/ynh_detect_arch__2 new file mode 100644 index 0000000..b1c7375 --- /dev/null +++ b/scripts/ynh_detect_arch__2 @@ -0,0 +1,25 @@ +#!/bin/bash + +# Check the architecture +# +# example: architecture=$(ynh_detect_arch) +# +# usage: ynh_detect_arch +# +# Requires YunoHost version 2.2.4 or higher. + +ynh_detect_arch(){ + local architecture + if [ -n "$(uname -m | grep arm64)" ] || [ -n "$(uname -m | grep aarch64)" ]; then + architecture="arm64" + elif [ -n "$(uname -m | grep 64)" ]; then + architecture="x86-64" + elif [ -n "$(uname -m | grep 86)" ]; then + architecture="i386" + elif [ -n "$(uname -m | grep arm)" ]; then + architecture="arm" + else + architecture="unknown" + fi + echo $architecture +} From 6000fad7bcc19a5c60131d5a292a63663df5fbc5 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 29 Jul 2019 00:04:57 +0200 Subject: [PATCH 05/26] Update install --- conf/systemd.service | 2 +- scripts/install | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/conf/systemd.service b/conf/systemd.service index 614d91e..4f0cc2c 100755 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -1,5 +1,5 @@ [Unit] -Description=__APP__ social network +Description=__APP__ social network After=network.target postgresql.service nginx.service [Service] diff --git a/scripts/install b/scripts/install index aeee439..d5ab39e 100755 --- a/scripts/install +++ b/scripts/install @@ -231,7 +231,7 @@ pushd $final_path/$app #Generate key pair #sudo -u "$app" MIX_ENV=prod mix web_push.gen.keypair >> "config/prod.secret.exs" - su pleroma -s $SHELL -lc "PLEROMA_CONFIG_PATH=$config $final_path/$app/bin/pleroma_ctl gen keypair" >> "$config" + #su pleroma -s $SHELL -lc "PLEROMA_CONFIG_PATH=$config $final_path/$app/bin/pleroma_ctl gen keypair" >> "$config" #ynh_replace_string --match_string="administrator@example.com" --replace_string="$admin_email" --target_file="$config" popd @@ -272,7 +272,7 @@ yunohost service add $app --description "$app daemon for Pleroma" --log "/var/lo #================================================= ynh_print_info --message="Starting a systemd service..." -ynh_systemd_action --service_name=$app --action="restart" --log_path=systemd --line_match="Started pleroma social network" +ynh_systemd_action --service_name=$app --action="restart" --log_path=systemd --line_match="Started pleroma" #================================================= # SETUP SSOWAT From c331d56d0e50a985536ed8687665c9bfa313e8ae Mon Sep 17 00:00:00 2001 From: yalh76 Date: Wed, 2 Oct 2019 00:14:24 +0200 Subject: [PATCH 06/26] 1.0.7 + ldap --- README.md | 2 +- conf/arm.src | 6 ++-- conf/arm64.src | 6 ++-- conf/generated_config.exs | 14 +++++++- conf/x86-64.src | 6 ++-- manifest.json | 6 ++-- scripts/install | 72 +++++++++++++++++++++++++-------------- 7 files changed, 72 insertions(+), 40 deletions(-) diff --git a/README.md b/README.md index 83ff2c6..2557630 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ For user friendly details about Pleroma: [see here](https://blog.soykaf.com/post - Tootdon (Android + iOS) - Tootle (iOS) -**Shipped version:** 1.0.1 +**Shipped version:** 1.0.7 ## Important points to read before installing diff --git a/conf/arm.src b/conf/arm.src index 87f12bd..5f74a90 100644 --- a/conf/arm.src +++ b/conf/arm.src @@ -1,6 +1,6 @@ -SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/45357/artifacts/download -SOURCE_SUM=3f223062fca6010abd36aaf9c3ebee8d1c808012ed26639df49103a8969c5af0 +SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/63065/artifacts/download +SOURCE_SUM=3a6c57ce974751dbfc97832af22020df4ff6355c710b30013dfac9fffab74fa4 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=true -SOURCE_FILENAME=pleroma-v1.0.1.zip +SOURCE_FILENAME=pleroma-v1.0.7.zip diff --git a/conf/arm64.src b/conf/arm64.src index f687dff..ae52c19 100644 --- a/conf/arm64.src +++ b/conf/arm64.src @@ -1,6 +1,6 @@ -SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/45359/artifacts/download -SOURCE_SUM=68f0b6e09b423eb1df5774a7fc4aac1518aa3df27cdaae5b824b73ec8839d7f7 +SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/63067/artifacts/download +SOURCE_SUM=fd7ebb7689723bf2874e5fd3ff5c2b8261045d868d4f8e8c9699bee8e1f28a10 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=true -SOURCE_FILENAME=pleroma-v1.0.1.zip +SOURCE_FILENAME=pleroma-v1.0.7.zip diff --git a/conf/generated_config.exs b/conf/generated_config.exs index 22aebd9..28e013f 100644 --- a/conf/generated_config.exs +++ b/conf/generated_config.exs @@ -9,7 +9,7 @@ config :pleroma, Pleroma.Web.Endpoint, url: [host: "__DOMAIN__", scheme: "https", port: 443], secret_key_base: "__KEY__", signing_salt: "__SIGNING_SALT__", - http: [ip: {127, 0, 0, 1}, port: __PORT__] + http: [ip: {127, 0, 0, 1}, port: 8095] config :pleroma, :instance, name: "__INSTANCE_NAME__", @@ -81,3 +81,15 @@ config :pleroma, Pleroma.Uploaders.Local, uploads: "__DATADIR__/uploads" # storage_url: "https://swift-endpoint.prodider.com/v1/AUTH_/", # object_url: "https://cdn-endpoint.provider.com/" # + +config :pleroma, Pleroma.Web.Auth.Authenticator, Pleroma.Web.Auth.LDAPAuthenticator +config :pleroma, :ldap, + enabled: true, + host: "localhost", + port: 389, + ssl: false, + # sslopts: [], + tls: false, + # tlsopts: [], + base: "ou=users,dc=yunohost,dc=org", + uid: "cn" diff --git a/conf/x86-64.src b/conf/x86-64.src index 6162f81..6601cbd 100644 --- a/conf/x86-64.src +++ b/conf/x86-64.src @@ -1,6 +1,6 @@ -SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/45355/artifacts/download -SOURCE_SUM=426013286094411c5e53330515cc6601b41fab4b8a53b724b7739f92c95154a2 +SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/63063/artifacts/download +SOURCE_SUM=f248a074baed3a36fbccaf89cc5d643d57eae43ee22c50dd720da5206b89d125 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=true -SOURCE_FILENAME=pleroma-v1.0.1.zip +SOURCE_FILENAME=pleroma-v1.0.7.zip diff --git a/manifest.json b/manifest.json index 6de7bd5..37a348f 100755 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Pleroma is an OStatus-compatible social networking server written in Elixir, compatible with GNU Social and Mastodon", "fr": "Pleroma est un réseau social écrit en Elixir, compatible avec OStatus, GNU Social et Mastodon" }, - "version": "1.0.1~ynh1", + "version": "1.0.7~ynh1", "url": "https://git.pleroma.social/pleroma/pleroma", "license": "AGPL-3.0-only", "maintainer": [ @@ -69,8 +69,8 @@ "en": "Choose a name for your Pleroma instance", "fr": "Choisissez un nom pour votre instance Pleroma" }, - "example": "My Pleroma", - "default": "My Pleroma" + "example": "My_Pleroma", + "default": "My_Pleroma" }, { "name": "registration", diff --git a/scripts/install b/scripts/install index d5ab39e..ce4dde9 100755 --- a/scripts/install +++ b/scripts/install @@ -179,32 +179,32 @@ chown -R $app /etc/$app config="/etc/$app/config.exs" -cp -f ../conf/generated_config.exs $config +#cp -f ../conf/generated_config.exs $config -ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$config" -ynh_replace_string --match_string="__KEY__" --replace_string="$random_key" --target_file="$config" -ynh_replace_string --match_string="__SIGNING_SALT__" --replace_string="$signing_salt" --target_file="$config" -ynh_replace_string --match_string="__INSTANCE_NAME__" --replace_string="$name" --target_file="$config" -ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$config" -ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$config" -ynh_replace_string --match_string="__ADMIN_EMAIL__" --replace_string="$admin_email" --target_file="$config" -ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$config" -ynh_replace_string --match_string="__DATADIR__" --replace_string="$datadir" --target_file="$config" +# ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$config" +#ynh_replace_string --match_string="__KEY__" --replace_string="$random_key" --target_file="$config" +#ynh_replace_string --match_string="__SIGNING_SALT__" --replace_string="$signing_salt" --target_file="$config" +# ynh_replace_string --match_string="__INSTANCE_NAME__" --replace_string="$name" --target_file="$config" +# ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$config" +# ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$config" +# ynh_replace_string --match_string="__ADMIN_EMAIL__" --replace_string="$admin_email" --target_file="$config" +# ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$config" +# ynh_replace_string --match_string="__DATADIR__" --replace_string="$datadir" --target_file="$config" -if [ $cache -eq 1 ] -then - ynh_replace_string --match_string="__MEDIA_CACHE__" --replace_string="true" --target_file="$config" -else - ynh_replace_string --match_string="__MEDIA_CACHE__" --replace_string="false" --target_file="$config" -fi +#if [ $cache -eq 1 ] +#then +# ynh_replace_string --match_string="__MEDIA_CACHE__" --replace_string="true" --target_file="$config" +#else +# ynh_replace_string --match_string="__MEDIA_CACHE__" --replace_string="false" --target_file="$config" +#fi # Set registrations open/closed -if [ $registration -eq 1 ] -then - ynh_replace_string --match_string="__REG__" --replace_string="true" --target_file="$config" -else - ynh_replace_string --match_string="__REG__" --replace_string="false" --target_file="$config" -fi +#if [ $registration -eq 1 ] +#then +# ynh_replace_string --match_string="__REG__" --replace_string="true" --target_file="$config" +#else +# ynh_replace_string --match_string="__REG__" --replace_string="false" --target_file="$config" +#fi #================================================= # SETUP SYSTEMD @@ -222,12 +222,32 @@ ynh_add_systemd_config chown -R "$app":"$app" "$final_path" pushd $final_path/$app - su "$app" -s $SHELL -lc "PLEROMA_CONFIG_PATH=$config $final_path/$app/bin/pleroma_ctl migrate" + su "$app" -s $SHELL -lc "$final_path/$app/bin/pleroma_ctl instance gen --force \ + --output $config \ + --output-psql /tmp/setup_db.psql \ + --domain $domain \ + --instance-name \"$name\" \ + --admin-email $admin_email \ + --notify-email $admin_email \ + --dbhost localhost \ + --dbname $db_name \ + --dbuser $db_user \ + --dbpass $db_pwd \ + --rum N \ + --indexable Y \ + --db-configurable Y \ + --uploads-dir $datadir/uploads \ + --static-dir $datadir/static \ + --listen-ip 127.0.0.1 \ + --listen-port $port" - ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="check_if_time_to_update" + su "$app" -s $SHELL -lc "$final_path/$app/bin/pleroma_ctl migrate" + + ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Started $app social network." + sleep 20 # Add user - su pleroma -s $SHELL -lc "PLEROMA_CONFIG_PATH=$config $final_path/$app/bin/pleroma_ctl user new $admin $admin_email --password $password --moderator --admin -y" + su pleroma -s $SHELL -lc "$final_path/$app/bin/pleroma_ctl user new $admin $admin_email --password $password --moderator --admin -y" #Generate key pair #sudo -u "$app" MIX_ENV=prod mix web_push.gen.keypair >> "config/prod.secret.exs" @@ -272,7 +292,7 @@ yunohost service add $app --description "$app daemon for Pleroma" --log "/var/lo #================================================= ynh_print_info --message="Starting a systemd service..." -ynh_systemd_action --service_name=$app --action="restart" --log_path=systemd --line_match="Started pleroma" +ynh_systemd_action --service_name=$app --action="restart" --log_path=systemd --line_match="Started $app social network." #================================================= # SETUP SSOWAT From b91aa73eb81b3a376bc824e64bb24762f154abe8 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 10 Oct 2019 21:26:10 +0200 Subject: [PATCH 07/26] upgrade to 1.0.91 --- README.md | 2 +- conf/arm.src | 6 +++--- conf/arm64.src | 6 +++--- conf/x86-64.src | 6 +++--- manifest.json | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 2557630..1e60712 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ For user friendly details about Pleroma: [see here](https://blog.soykaf.com/post - Tootdon (Android + iOS) - Tootle (iOS) -**Shipped version:** 1.0.7 +**Shipped version:** 1.0.91 ## Important points to read before installing diff --git a/conf/arm.src b/conf/arm.src index 5f74a90..e8a6160 100644 --- a/conf/arm.src +++ b/conf/arm.src @@ -1,6 +1,6 @@ -SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/63065/artifacts/download -SOURCE_SUM=3a6c57ce974751dbfc97832af22020df4ff6355c710b30013dfac9fffab74fa4 +SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/67457/artifacts/download +SOURCE_SUM=d03710cc5ffa64e0e648bf303f91cdf70b354be1bc09311d17692b3eeb2adc53 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=true -SOURCE_FILENAME=pleroma-v1.0.7.zip +SOURCE_FILENAME=pleroma-v1.0.91.zip diff --git a/conf/arm64.src b/conf/arm64.src index ae52c19..39bdff0 100644 --- a/conf/arm64.src +++ b/conf/arm64.src @@ -1,6 +1,6 @@ -SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/63067/artifacts/download -SOURCE_SUM=fd7ebb7689723bf2874e5fd3ff5c2b8261045d868d4f8e8c9699bee8e1f28a10 +SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/67459/artifacts/download +SOURCE_SUM=717d4e493f0ebd247cd98f9ee9ec62e687a1bf487afd0f2054ba9ed97179c770 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=true -SOURCE_FILENAME=pleroma-v1.0.7.zip +SOURCE_FILENAME=pleroma-v1.0.91.zip diff --git a/conf/x86-64.src b/conf/x86-64.src index 6601cbd..5f13fa1 100644 --- a/conf/x86-64.src +++ b/conf/x86-64.src @@ -1,6 +1,6 @@ -SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/63063/artifacts/download -SOURCE_SUM=f248a074baed3a36fbccaf89cc5d643d57eae43ee22c50dd720da5206b89d125 +SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/67455/artifacts/download +SOURCE_SUM=6608472d98f0db6fba9cbb8ed1760bf4f81ff29940cf16f4c93ff831b091205c SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=true -SOURCE_FILENAME=pleroma-v1.0.7.zip +SOURCE_FILENAME=pleroma-v1.0.91.zip diff --git a/manifest.json b/manifest.json index 37a348f..6824c1d 100755 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Pleroma is an OStatus-compatible social networking server written in Elixir, compatible with GNU Social and Mastodon", "fr": "Pleroma est un réseau social écrit en Elixir, compatible avec OStatus, GNU Social et Mastodon" }, - "version": "1.0.7~ynh1", + "version": "1.0.91~ynh1", "url": "https://git.pleroma.social/pleroma/pleroma", "license": "AGPL-3.0-only", "maintainer": [ From 4e01598ae8265e69ffab5e3ef7100b5a76178e27 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 10 Oct 2019 22:17:48 +0200 Subject: [PATCH 08/26] Install issue workaround --- scripts/install | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index ce4dde9..b2dd0d4 100755 --- a/scripts/install +++ b/scripts/install @@ -222,6 +222,7 @@ ynh_add_systemd_config chown -R "$app":"$app" "$final_path" pushd $final_path/$app + ynh_replace_string --match_string="static_dir" --replace_string="static" --target_file="$final_path/$app/releases/1.0.91-2-gac113f67-maint-1-1/releases.exs" su "$app" -s $SHELL -lc "$final_path/$app/bin/pleroma_ctl instance gen --force \ --output $config \ --output-psql /tmp/setup_db.psql \ @@ -235,7 +236,6 @@ pushd $final_path/$app --dbpass $db_pwd \ --rum N \ --indexable Y \ - --db-configurable Y \ --uploads-dir $datadir/uploads \ --static-dir $datadir/static \ --listen-ip 127.0.0.1 \ @@ -244,7 +244,7 @@ pushd $final_path/$app su "$app" -s $SHELL -lc "$final_path/$app/bin/pleroma_ctl migrate" ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Started $app social network." - sleep 20 + sleep 60 # Add user su pleroma -s $SHELL -lc "$final_path/$app/bin/pleroma_ctl user new $admin $admin_email --password $password --moderator --admin -y" From 4bd4c73a5aa82434bfddcbe78d32f3d5ef1d8c3a Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 18 Oct 2019 23:30:37 +0200 Subject: [PATCH 09/26] upgrade to 1.1.0 --- README.md | 2 +- conf/arm.src | 6 +++--- conf/arm64.src | 6 +++--- conf/x86-64.src | 6 +++--- manifest.json | 2 +- scripts/install | 3 ++- 6 files changed, 13 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 1e60712..203f25e 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ For user friendly details about Pleroma: [see here](https://blog.soykaf.com/post - Tootdon (Android + iOS) - Tootle (iOS) -**Shipped version:** 1.0.91 +**Shipped version:** 1.1.1 ## Important points to read before installing diff --git a/conf/arm.src b/conf/arm.src index e8a6160..1ef05b2 100644 --- a/conf/arm.src +++ b/conf/arm.src @@ -1,6 +1,6 @@ -SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/67457/artifacts/download -SOURCE_SUM=d03710cc5ffa64e0e648bf303f91cdf70b354be1bc09311d17692b3eeb2adc53 +SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/69896/artifacts/download +SOURCE_SUM=4350d3e22525c1d3a31180bbcfee69c38832b883e121eae5781f3b863c11725b SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=true -SOURCE_FILENAME=pleroma-v1.0.91.zip +SOURCE_FILENAME=pleroma-v1.1.1-arm.zip diff --git a/conf/arm64.src b/conf/arm64.src index 39bdff0..06324e5 100644 --- a/conf/arm64.src +++ b/conf/arm64.src @@ -1,6 +1,6 @@ -SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/67459/artifacts/download -SOURCE_SUM=717d4e493f0ebd247cd98f9ee9ec62e687a1bf487afd0f2054ba9ed97179c770 +SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/69898/artifacts/download +SOURCE_SUM=705ef794a52e4d341c0395d5747d41203a80731f785572c9cca3bd7ac3dffcb0 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=true -SOURCE_FILENAME=pleroma-v1.0.91.zip +SOURCE_FILENAME=pleroma-v1.1.1-arm64.zip diff --git a/conf/x86-64.src b/conf/x86-64.src index 5f13fa1..4daece1 100644 --- a/conf/x86-64.src +++ b/conf/x86-64.src @@ -1,6 +1,6 @@ -SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/67455/artifacts/download -SOURCE_SUM=6608472d98f0db6fba9cbb8ed1760bf4f81ff29940cf16f4c93ff831b091205c +SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/69894/artifacts/download +SOURCE_SUM=e4e46ddd6b627afe4ebf38625c24ea25f8f29afeffd85efcca1f48a38ec60241 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=true -SOURCE_FILENAME=pleroma-v1.0.91.zip +SOURCE_FILENAME=pleroma-v1.1.1-x86-64.zip diff --git a/manifest.json b/manifest.json index 6824c1d..67fbfe4 100755 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Pleroma is an OStatus-compatible social networking server written in Elixir, compatible with GNU Social and Mastodon", "fr": "Pleroma est un réseau social écrit en Elixir, compatible avec OStatus, GNU Social et Mastodon" }, - "version": "1.0.91~ynh1", + "version": "1.1.1~ynh1", "url": "https://git.pleroma.social/pleroma/pleroma", "license": "AGPL-3.0-only", "maintainer": [ diff --git a/scripts/install b/scripts/install index b2dd0d4..5f266ac 100755 --- a/scripts/install +++ b/scripts/install @@ -222,7 +222,8 @@ ynh_add_systemd_config chown -R "$app":"$app" "$final_path" pushd $final_path/$app - ynh_replace_string --match_string="static_dir" --replace_string="static" --target_file="$final_path/$app/releases/1.0.91-2-gac113f67-maint-1-1/releases.exs" + #ynh_replace_string --match_string="static_dir" --replace_string="static" --target_file="$final_path/$app/releases/1.1.1/releases.exs" + ynh_replace_string --match_string="shift" --replace_string="" --target_file="$final_path/$app/releases/1.1.1/releases.exs" su "$app" -s $SHELL -lc "$final_path/$app/bin/pleroma_ctl instance gen --force \ --output $config \ --output-psql /tmp/setup_db.psql \ From 944cb7c873e156304a6526981146a98c17d8e40d Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 19 Oct 2019 01:57:09 +0200 Subject: [PATCH 10/26] upgrade to develop --- conf/arm.src | 4 ++-- conf/arm64.src | 4 ++-- conf/x86-64.src | 4 ++-- scripts/install | 3 +-- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/conf/arm.src b/conf/arm.src index 1ef05b2..62b5173 100644 --- a/conf/arm.src +++ b/conf/arm.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/69896/artifacts/download -SOURCE_SUM=4350d3e22525c1d3a31180bbcfee69c38832b883e121eae5781f3b863c11725b +SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/70233/artifacts/download +SOURCE_SUM=4fc234c0c214056d7e7c60a8583eaa9cbc366fd0d5465b6fb6431705b481ece8 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=true diff --git a/conf/arm64.src b/conf/arm64.src index 06324e5..8893893 100644 --- a/conf/arm64.src +++ b/conf/arm64.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/69898/artifacts/download -SOURCE_SUM=705ef794a52e4d341c0395d5747d41203a80731f785572c9cca3bd7ac3dffcb0 +SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/70235/artifacts/download +SOURCE_SUM=b746915ac44293168d924817027b1dbcec75de2a8205d327c4c4c10c5e563065 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=true diff --git a/conf/x86-64.src b/conf/x86-64.src index 4daece1..d92313a 100644 --- a/conf/x86-64.src +++ b/conf/x86-64.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/69894/artifacts/download -SOURCE_SUM=e4e46ddd6b627afe4ebf38625c24ea25f8f29afeffd85efcca1f48a38ec60241 +SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/70231/artifacts/download +SOURCE_SUM=091973bdaf99c11fd1a30984a3c9c906e5a3c3183f685f589d12290fdaa37a53 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=true diff --git a/scripts/install b/scripts/install index 5f266ac..3d11420 100755 --- a/scripts/install +++ b/scripts/install @@ -222,8 +222,6 @@ ynh_add_systemd_config chown -R "$app":"$app" "$final_path" pushd $final_path/$app - #ynh_replace_string --match_string="static_dir" --replace_string="static" --target_file="$final_path/$app/releases/1.1.1/releases.exs" - ynh_replace_string --match_string="shift" --replace_string="" --target_file="$final_path/$app/releases/1.1.1/releases.exs" su "$app" -s $SHELL -lc "$final_path/$app/bin/pleroma_ctl instance gen --force \ --output $config \ --output-psql /tmp/setup_db.psql \ @@ -236,6 +234,7 @@ pushd $final_path/$app --dbuser $db_user \ --dbpass $db_pwd \ --rum N \ + --db-configurable Y \ --indexable Y \ --uploads-dir $datadir/uploads \ --static-dir $datadir/static \ From 8fcf55fae390ee9b9ee4f0cff974ee748bfab142 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Tue, 22 Oct 2019 01:12:00 +0200 Subject: [PATCH 11/26] Upgrade to 1.1.2 --- README.md | 2 +- conf/arm.src | 6 +++--- conf/arm64.src | 6 +++--- conf/x86-64.src | 6 +++--- manifest.json | 2 +- scripts/install | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 203f25e..fe00fdf 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ For user friendly details about Pleroma: [see here](https://blog.soykaf.com/post - Tootdon (Android + iOS) - Tootle (iOS) -**Shipped version:** 1.1.1 +**Shipped version:** 1.1.2 ## Important points to read before installing diff --git a/conf/arm.src b/conf/arm.src index 62b5173..16b4ef7 100644 --- a/conf/arm.src +++ b/conf/arm.src @@ -1,6 +1,6 @@ -SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/70233/artifacts/download -SOURCE_SUM=4fc234c0c214056d7e7c60a8583eaa9cbc366fd0d5465b6fb6431705b481ece8 +SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/70196/artifacts/download +SOURCE_SUM=d15f37b672fd761b509cefc6bdc4e4faa74b9d94fb161917077b6055f62af881 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=true -SOURCE_FILENAME=pleroma-v1.1.1-arm.zip +SOURCE_FILENAME=pleroma-v1.1.2-arm.zip diff --git a/conf/arm64.src b/conf/arm64.src index 8893893..bd64de4 100644 --- a/conf/arm64.src +++ b/conf/arm64.src @@ -1,6 +1,6 @@ -SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/70235/artifacts/download -SOURCE_SUM=b746915ac44293168d924817027b1dbcec75de2a8205d327c4c4c10c5e563065 +SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/70198/artifacts/download +SOURCE_SUM=d7f51b25c932ebfe4f38332ad3a121d78a33f08aa330941d8ad0ae910fa93e18 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=true -SOURCE_FILENAME=pleroma-v1.1.1-arm64.zip +SOURCE_FILENAME=pleroma-v1.1.2-arm64.zip diff --git a/conf/x86-64.src b/conf/x86-64.src index d92313a..38b55c2 100644 --- a/conf/x86-64.src +++ b/conf/x86-64.src @@ -1,6 +1,6 @@ -SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/70231/artifacts/download -SOURCE_SUM=091973bdaf99c11fd1a30984a3c9c906e5a3c3183f685f589d12290fdaa37a53 +SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/70194/artifacts/download +SOURCE_SUM=25648bdfc31a7ab5167009c35c691d279b6b785fceb96f4fa3ee66831ef30cba SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=true -SOURCE_FILENAME=pleroma-v1.1.1-x86-64.zip +SOURCE_FILENAME=pleroma-v1.1.2-x86-64.zip diff --git a/manifest.json b/manifest.json index 67fbfe4..c34320c 100755 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Pleroma is an OStatus-compatible social networking server written in Elixir, compatible with GNU Social and Mastodon", "fr": "Pleroma est un réseau social écrit en Elixir, compatible avec OStatus, GNU Social et Mastodon" }, - "version": "1.1.1~ynh1", + "version": "1.1.2~ynh1", "url": "https://git.pleroma.social/pleroma/pleroma", "license": "AGPL-3.0-only", "maintainer": [ diff --git a/scripts/install b/scripts/install index 3d11420..7d44265 100755 --- a/scripts/install +++ b/scripts/install @@ -222,6 +222,7 @@ ynh_add_systemd_config chown -R "$app":"$app" "$final_path" pushd $final_path/$app + #ynh_replace_string --match_string="_dir" --replace_string="" --target_file="/var/www/pleroma/pleroma/releases/1.1.2-2-g59d447d5-release-1-1-2/releases.exs" su "$app" -s $SHELL -lc "$final_path/$app/bin/pleroma_ctl instance gen --force \ --output $config \ --output-psql /tmp/setup_db.psql \ @@ -234,7 +235,6 @@ pushd $final_path/$app --dbuser $db_user \ --dbpass $db_pwd \ --rum N \ - --db-configurable Y \ --indexable Y \ --uploads-dir $datadir/uploads \ --static-dir $datadir/static \ From 3e89263c931720160feeeec0254d27af77df0bd2 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 22 Nov 2019 02:49:21 +0100 Subject: [PATCH 12/26] Upgrade to 1.1.6 --- README.md | 2 +- conf/arm.src | 6 +++--- conf/arm64.src | 6 +++--- conf/x86-64.src | 6 +++--- manifest.json | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index fe00fdf..ec75a62 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ For user friendly details about Pleroma: [see here](https://blog.soykaf.com/post - Tootdon (Android + iOS) - Tootle (iOS) -**Shipped version:** 1.1.2 +**Shipped version:** 1.1.6 ## Important points to read before installing diff --git a/conf/arm.src b/conf/arm.src index 16b4ef7..c7cd416 100644 --- a/conf/arm.src +++ b/conf/arm.src @@ -1,6 +1,6 @@ -SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/70196/artifacts/download -SOURCE_SUM=d15f37b672fd761b509cefc6bdc4e4faa74b9d94fb161917077b6055f62af881 +SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/78966/artifacts/download +SOURCE_SUM=62486afa30cfe06e5b5d0b36165315c2e1f6aa11c47bccf56e95c442ea804619 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=true -SOURCE_FILENAME=pleroma-v1.1.2-arm.zip +SOURCE_FILENAME=pleroma-v1.1.6-arm.zip diff --git a/conf/arm64.src b/conf/arm64.src index bd64de4..d1b69ad 100644 --- a/conf/arm64.src +++ b/conf/arm64.src @@ -1,6 +1,6 @@ -SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/70198/artifacts/download -SOURCE_SUM=d7f51b25c932ebfe4f38332ad3a121d78a33f08aa330941d8ad0ae910fa93e18 +SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/78968/artifacts/download +SOURCE_SUM=59b652f0a437b57cbaa915ac62d7cc5d4f4077e1c9f30e5ea9437463d982c3dd SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=true -SOURCE_FILENAME=pleroma-v1.1.2-arm64.zip +SOURCE_FILENAME=pleroma-v1.1.6-arm64.zip diff --git a/conf/x86-64.src b/conf/x86-64.src index 38b55c2..53421b0 100644 --- a/conf/x86-64.src +++ b/conf/x86-64.src @@ -1,6 +1,6 @@ -SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/70194/artifacts/download -SOURCE_SUM=25648bdfc31a7ab5167009c35c691d279b6b785fceb96f4fa3ee66831ef30cba +SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/78964/artifacts/download +SOURCE_SUM=9d19b8865e1ad6c916d08d644da58b76255f15d730d6c6a54e783d8558c9eeca SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=true -SOURCE_FILENAME=pleroma-v1.1.2-x86-64.zip +SOURCE_FILENAME=pleroma-v1.1.6-x86-64.zip diff --git a/manifest.json b/manifest.json index c34320c..b409cca 100755 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Pleroma is an OStatus-compatible social networking server written in Elixir, compatible with GNU Social and Mastodon", "fr": "Pleroma est un réseau social écrit en Elixir, compatible avec OStatus, GNU Social et Mastodon" }, - "version": "1.1.2~ynh1", + "version": "1.1.6~ynh1", "url": "https://git.pleroma.social/pleroma/pleroma", "license": "AGPL-3.0-only", "maintainer": [ From b1a46b14a7b62f01f4d9bf68f6913b3145ea9683 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 28 Dec 2019 21:44:14 +0100 Subject: [PATCH 13/26] Upgrade to 1.1.7 --- README.md | 2 +- conf/arm.src | 6 +- conf/arm64.src | 6 +- conf/x86-64.src | 6 +- manifest.json | 2 +- scripts/_common.sh | 1 - scripts/backup | 12 +- scripts/change_url | 2 +- scripts/install | 61 +----- scripts/remove | 24 +-- scripts/restore | 39 ++-- scripts/upgrade | 95 +++++----- scripts/ynh_add_extra_apt_repos__3 | 294 ----------------------------- scripts/ynh_package_version | 6 + 14 files changed, 109 insertions(+), 447 deletions(-) delete mode 100644 scripts/ynh_add_extra_apt_repos__3 create mode 100644 scripts/ynh_package_version diff --git a/README.md b/README.md index ec75a62..1668451 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ For user friendly details about Pleroma: [see here](https://blog.soykaf.com/post - Tootdon (Android + iOS) - Tootle (iOS) -**Shipped version:** 1.1.6 +**Shipped version:** 1.1.7 ## Important points to read before installing diff --git a/conf/arm.src b/conf/arm.src index c7cd416..fae8824 100644 --- a/conf/arm.src +++ b/conf/arm.src @@ -1,6 +1,6 @@ -SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/78966/artifacts/download -SOURCE_SUM=62486afa30cfe06e5b5d0b36165315c2e1f6aa11c47bccf56e95c442ea804619 +SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/84826/artifacts/download +SOURCE_SUM=aeb527340dbecc5056cd3aca459ed0a0f3b41808afc492e61f998032e5c3d874 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=true -SOURCE_FILENAME=pleroma-v1.1.6-arm.zip +SOURCE_FILENAME=pleroma-v1.1.7-arm.zip diff --git a/conf/arm64.src b/conf/arm64.src index d1b69ad..f827990 100644 --- a/conf/arm64.src +++ b/conf/arm64.src @@ -1,6 +1,6 @@ -SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/78968/artifacts/download -SOURCE_SUM=59b652f0a437b57cbaa915ac62d7cc5d4f4077e1c9f30e5ea9437463d982c3dd +SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/84828/artifacts/download +SOURCE_SUM=74032e08b6f89321eb5545ff77fb0b1f142cba49c691d69316963d296d16b727 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=true -SOURCE_FILENAME=pleroma-v1.1.6-arm64.zip +SOURCE_FILENAME=pleroma-v1.1.7-arm64.zip diff --git a/conf/x86-64.src b/conf/x86-64.src index 53421b0..4cf360d 100644 --- a/conf/x86-64.src +++ b/conf/x86-64.src @@ -1,6 +1,6 @@ -SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/78964/artifacts/download -SOURCE_SUM=9d19b8865e1ad6c916d08d644da58b76255f15d730d6c6a54e783d8558c9eeca +SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/84824/artifacts/download +SOURCE_SUM=6cd69e80894af966bb88505dae572e197c96da02ba980357a606bcc948a78e36 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=true -SOURCE_FILENAME=pleroma-v1.1.6-x86-64.zip +SOURCE_FILENAME=pleroma-v1.1.7-x86-64.zip diff --git a/manifest.json b/manifest.json index b409cca..02f7691 100755 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Pleroma is an OStatus-compatible social networking server written in Elixir, compatible with GNU Social and Mastodon", "fr": "Pleroma est un réseau social écrit en Elixir, compatible avec OStatus, GNU Social et Mastodon" }, - "version": "1.1.6~ynh1", + "version": "1.1.7~ynh1", "url": "https://git.pleroma.social/pleroma/pleroma", "license": "AGPL-3.0-only", "maintainer": [ diff --git a/scripts/_common.sh b/scripts/_common.sh index d02af56..31f2804 100755 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -6,7 +6,6 @@ # dependencies used by the app pkg_dependencies="curl unzip libncurses5 postgresql postgresql-contrib" -extra_pkg_dependencies="elixir erlang-dev erlang-tools erlang-parsetools erlang-eldap erlang-xmerl" #================================================= # PERSONAL HELPERS diff --git a/scripts/backup b/scripts/backup index 546f825..526ff42 100755 --- a/scripts/backup +++ b/scripts/backup @@ -6,6 +6,7 @@ # IMPORT GENERIC HELPERS #================================================= +#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers @@ -29,7 +30,6 @@ app=$YNH_APP_INSTANCE_NAME final_path=$(ynh_app_setting_get --app=$app --key=final_path) domain=$(ynh_app_setting_get --app=$app --key=domain) db_name=$(ynh_app_setting_get --app=$app --key=db_name) -cache=$(ynh_app_setting_get --app=$app --key=cache) #================================================= # STANDARD BACKUP STEPS @@ -38,7 +38,7 @@ cache=$(ynh_app_setting_get --app=$app --key=cache) #================================================= ynh_print_info --message="Stopping a systemd service..." -ynh_systemd_action --service_name=$app --action="stop" +ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped pleroma social network" #================================================= # BACKUP THE APP MAIN DIR @@ -69,11 +69,11 @@ ynh_psql_dump_db --database="$db_name" > db.sql #================================================= # SPECIFIC BACKUP #================================================= -# BACKUP LOGROTATE +# BACKUP CONFIG FILE #================================================= -ynh_print_info --message="Backing up logrotate configuration..." +ynh_print_info --message="Backing up configuration file..." -ynh_backup --src_path="/etc/logrotate.d/$app" +ynh_backup --src_path="/etc/$app/config.exs" #================================================= # BACKUP SYSTEMD @@ -87,7 +87,7 @@ ynh_backup --src_path="/etc/systemd/system/$app.service" #================================================= ynh_print_info --message="Starting a systemd service..." -ynh_systemd_action --service_name=$app --action="start" +ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Running Pleroma.Web.Endpoint" #================================================= # END OF SCRIPT diff --git a/scripts/change_url b/scripts/change_url index d291b2d..66249fa 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -57,7 +57,7 @@ fi #================================================= ynh_print_info --message="Stopping a systemd service..." -ynh_systemd_action --service_name=$app --action="stop" +ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped pleroma social network" #================================================= # MODIFY URL IN NGINX CONF diff --git a/scripts/install b/scripts/install index 7d44265..4b3af45 100755 --- a/scripts/install +++ b/scripts/install @@ -8,7 +8,6 @@ source _common.sh source ynh_detect_arch__2 -source ynh_add_extra_apt_repos__3 source /usr/share/yunohost/helpers #================================================= @@ -16,7 +15,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 @@ -81,7 +79,7 @@ ynh_app_setting_set --app=$app --key=signing_salt --value="$signing_salt" #================================================= ynh_print_info --message="Configuring firewall..." -# Find a free port +# Find an available port port=$(ynh_find_port --port=8095) ynh_app_setting_set --app=$app --key=port --value=$port @@ -92,9 +90,6 @@ ynh_print_info --message="Installing dependencies..." ynh_install_app_dependencies $pkg_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' - #================================================= # CREATE A POSTGRESQL DATABASE #================================================= @@ -144,7 +139,7 @@ fi #================================================= # CREATE DEDICATED USER #================================================= -ynh_print_info --message="Configuring system user ..." +ynh_print_info --message="Configuring system user..." # Create a system user ynh_system_user_create --username=$app --home_dir="$final_path" @@ -157,7 +152,7 @@ ynh_system_user_create --username=$app --home_dir="$final_path" ynh_print_info --message="Create the data directory..." # Define app's data directory -datadir="/home/yunohost.app/${app}/storage" +datadir="/home/yunohost.app/${app}" # Create app folders mkdir -p "$datadir" @@ -179,33 +174,6 @@ chown -R $app /etc/$app config="/etc/$app/config.exs" -#cp -f ../conf/generated_config.exs $config - -# ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$config" -#ynh_replace_string --match_string="__KEY__" --replace_string="$random_key" --target_file="$config" -#ynh_replace_string --match_string="__SIGNING_SALT__" --replace_string="$signing_salt" --target_file="$config" -# ynh_replace_string --match_string="__INSTANCE_NAME__" --replace_string="$name" --target_file="$config" -# ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$config" -# ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$config" -# ynh_replace_string --match_string="__ADMIN_EMAIL__" --replace_string="$admin_email" --target_file="$config" -# ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$config" -# ynh_replace_string --match_string="__DATADIR__" --replace_string="$datadir" --target_file="$config" - -#if [ $cache -eq 1 ] -#then -# ynh_replace_string --match_string="__MEDIA_CACHE__" --replace_string="true" --target_file="$config" -#else -# ynh_replace_string --match_string="__MEDIA_CACHE__" --replace_string="false" --target_file="$config" -#fi - -# Set registrations open/closed -#if [ $registration -eq 1 ] -#then -# ynh_replace_string --match_string="__REG__" --replace_string="true" --target_file="$config" -#else -# ynh_replace_string --match_string="__REG__" --replace_string="false" --target_file="$config" -#fi - #================================================= # SETUP SYSTEMD #================================================= @@ -222,8 +190,7 @@ ynh_add_systemd_config chown -R "$app":"$app" "$final_path" pushd $final_path/$app - #ynh_replace_string --match_string="_dir" --replace_string="" --target_file="/var/www/pleroma/pleroma/releases/1.1.2-2-g59d447d5-release-1-1-2/releases.exs" - su "$app" -s $SHELL -lc "$final_path/$app/bin/pleroma_ctl instance gen --force \ + su "$app" -s $SHELL -lc "$final_path/$app/bin/pleroma_ctl instance gen --force \ --output $config \ --output-psql /tmp/setup_db.psql \ --domain $domain \ @@ -248,11 +215,6 @@ pushd $final_path/$app # Add user su pleroma -s $SHELL -lc "$final_path/$app/bin/pleroma_ctl user new $admin $admin_email --password $password --moderator --admin -y" - - #Generate key pair - #sudo -u "$app" MIX_ENV=prod mix web_push.gen.keypair >> "config/prod.secret.exs" - #su pleroma -s $SHELL -lc "PLEROMA_CONFIG_PATH=$config $final_path/$app/bin/pleroma_ctl gen keypair" >> "$config" - #ynh_replace_string --match_string="administrator@example.com" --replace_string="$admin_email" --target_file="$config" popd #================================================= @@ -272,26 +234,17 @@ ynh_store_file_checksum --file="$config" chown -R "$app":"$app" "$final_path" #================================================= -# SETUP LOGROTATE -#================================================= -ynh_print_info --message="Configuring log rotation..." - -# Use logrotate to manage application logfile(s) -ynh_use_logrotate - -#================================================= -# ADVERTISE SERVICE IN ADMIN PANEL +# INTEGRATE SERVICE IN YUNOHOST #================================================= -#yunohost service add $app --log "/var/log/$app/APP.log" -# if using yunohost version 3.2 or more in the 'manifest.json', a description can be added -yunohost service add $app --description "$app daemon for Pleroma" --log "/var/log/$app/$app.log" +yunohost service add $app --description "$app daemon for Pleroma" --log_type "systemd" #================================================= # START SYSTEMD SERVICE #================================================= ynh_print_info --message="Starting a systemd service..." +# Start a systemd service ynh_systemd_action --service_name=$app --action="restart" --log_path=systemd --line_match="Started $app social network." #================================================= diff --git a/scripts/remove b/scripts/remove index f4fb419..cf4eba1 100755 --- a/scripts/remove +++ b/scripts/remove @@ -21,16 +21,16 @@ port=$(ynh_app_setting_get --app=$app --key=port) db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name final_path=$(ynh_app_setting_get --app=$app --key=final_path) -cache=$(ynh_app_setting_get --app=$app --key=cache) +datadir=$(ynh_app_setting_get --app=$app --key=datadir) #================================================= # STANDARD REMOVE #================================================= -# REMOVE SERVICE FROM ADMIN PANEL +# REMOVE SERVICE INTEGRATION IN YUNOHOST #================================================= -# Remove a service from the admin panel, added by `yunohost service add` -if yunohost service status $app >/dev/null 2>&1 +# 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..." yunohost service remove $app @@ -77,14 +77,6 @@ ynh_print_info --message="Removing nginx web server configuration..." ynh_remove_nginx_config ynh_secure_remove --file="/etc/nginx/conf.d/$app-cache.conf" -#================================================= -# REMOVE LOGROTATE CONFIGURATION -#================================================= -ynh_print_info --message="Removing logrotate configuration..." - -# Remove the app-specific logrotate config -ynh_remove_logrotate - #================================================= # CLOSE A PORT #================================================= @@ -99,14 +91,14 @@ fi #================================================= # SPECIFIC REMOVE #================================================= -# REMOVE THE CRON FILE +# REMOVE DIRECTORIES #================================================= -# Remove a directory securely +# Remove the config directory securely ynh_secure_remove "/etc/$app/" -# Remove the log files -ynh_secure_remove "/var/log/$app/" +# Remove the data directory securely +ynh_secure_remove "$datadir/" #================================================= # GENERIC FINALIZATION diff --git a/scripts/restore b/scripts/restore index 96b3b52..818a01a 100755 --- a/scripts/restore +++ b/scripts/restore @@ -6,8 +6,8 @@ # IMPORT GENERIC HELPERS #================================================= +#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 #================================================= @@ -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) cache=$(ynh_app_setting_get --app=$app --key=cache) +datadir=$(ynh_app_setting_get --app=$app --key=datadir) #================================================= # CHECK IF THE APP CAN BE RESTORED @@ -82,6 +83,29 @@ chown -R "$app":"$app" "$final_path" #================================================= # SPECIFIC RESTORATION +#================================================= +# RECREATE THE DATA DIRECTORY +#================================================= +ynh_print_info --message="Recreate the data directory..." + +# Create app folders +mkdir -p "$datadir" +mkdir -p "$datadir/uploads" +mkdir -p "$datadir/static" +mkdir -p "$datadir/static/emoji" + +# Give permission to the datadir +chown -R "$app":"$app" "$datadir" + +ynh_app_setting_set --app=$app --key=datadir --value="$datadir" + +#================================================= +# RESTORE THE CONFIG FILE +#================================================= +ynh_print_info --message="Restoring the config file..." + +ynh_restore_file --origin_path="/etc/$app/config.exs" + #================================================= # REINSTALL DEPENDENCIES #================================================= @@ -90,9 +114,6 @@ ynh_print_info --message="Reinstalling dependencies..." # Define and install dependencies ynh_install_app_dependencies $pkg_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' - #================================================= # RESTORE THE POSTGRESQL DATABASE #================================================= @@ -115,10 +136,10 @@ ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service #================================================= -# ADVERTISE SERVICE IN ADMIN PANEL +# INTEGRATE SERVICE IN YUNOHOST #================================================= -yunohost service add $app --description "$app daemon for Pleroma" --log "/var/log/$app/$app.log" +yunohost service add $app --description "$app daemon for Pleroma" --log_type "systemd" #================================================= # START SYSTEMD SERVICE @@ -127,12 +148,6 @@ ynh_print_info --message="Starting a systemd service..." ynh_systemd_action --action=start --service_name=$app --log_path=systemd --line_match="Running Pleroma.Web.Endpoint" -#================================================= -# RESTORE THE LOGROTATE CONFIGURATION -#================================================= - -ynh_restore_file --origin_path="/etc/logrotate.d/$app" - #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 32b30e1..dadc055 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -7,8 +7,8 @@ #================================================= source _common.sh +source ynh_package_version source ynh_detect_arch__2 -source ynh_add_extra_apt_repos__3 source /usr/share/yunohost/helpers #================================================= @@ -90,6 +90,7 @@ fi ynh_secure_remove --file="/etc/apt/sources.list.d/erlang-solutions.list" apt-key del A14F4FCA + #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -105,21 +106,47 @@ ynh_clean_setup () { # Exit if an error occurs during the execution of the script ynh_abort_if_errors -#================================================= -# CHECK THE PATH -#================================================= - -# Normalize the URL path syntax -path_url=$(ynh_normalize_url_path --path_url=$path_url) - #================================================= # STANDARD UPGRADE STEPS +#================================================= +# UPGRADE TO OTP RELEASE +#================================================= +ynh_print_info --message="Upgrading to OTP release..." + +if ynh_version_gt "1.1.1~ynh1" "${previous_version}" ; then + # Define app's data directory + datadir="/home/yunohost.app/${app}" + ynh_app_setting_set --app=$app --key=datadir --value="$datadir" + + # Create app folders + mkdir -p "$datadir" + mkdir -p "$datadir/uploads" + mkdir -p "$datadir/static" + mkdir -p "$datadir/static/emoji" + + # Give permission to the datadir + chown -R "$app":"$app" "$datadir" + + mv $final_path/$app/uploads/* "$datadir/uploads" + mv $final_path/$app/instance/static "$datadir/static" + + ls -d $final_path/$app/priv/static/emoji/*/ | xargs -i sh -c 'mv "{}" "$datadir/static/emoji/$(basename {})"' + mv $final_path/$app/priv/static/emoji /var/lib/pleroma/static/emoji + + mkdir -p /etc/$app + chown -R $app /etc/$app + config="/etc/$app/config.exs" + mv $final_path/$app/config/prod.secret.exs /etc/pleroma/config.exs + + rm -r $final_path/$app/* +fi + #================================================= # STOP SYSTEMD SERVICE #================================================= ynh_print_info --message="Stopping a systemd service..." -ynh_systemd_action --service_name=$app --action="stop" +ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped pleroma social network" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -162,9 +189,6 @@ ynh_print_info --message="Upgrading dependencies..." ynh_install_app_dependencies $pkg_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' - #================================================= # CREATE DEDICATED USER #================================================= @@ -179,31 +203,9 @@ ynh_system_user_create --username=$app --home_dir="$final_path" # MODIFY A CONFIG FILE #================================================= -ynh_backup_if_checksum_is_different --file="$final_path/$app/config/prod.secret.exs" -cp -f ../conf/generated_config.exs "$final_path/$app/config/prod.secret.exs" +config="/etc/$app/config.exs" -ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$final_path/$app/config/prod.secret.exs" -ynh_replace_string --match_string="__KEY__" --replace_string="$random_key" --target_file="$final_path/$app/config/prod.secret.exs" -ynh_replace_string --match_string="__INSTANCE_NAME__" --replace_string="$name" --target_file="$final_path/$app/config/prod.secret.exs" -ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$final_path/$app/config/prod.secret.exs" -ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$final_path/$app/config/prod.secret.exs" -ynh_replace_string --match_string="__ADMIN_EMAIL__" --replace_string="$admin_email" --target_file="$final_path/$app/config/prod.secret.exs" -ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/$app/config/prod.secret.exs" - -if [ $cache -eq 1 ] -then - ynh_replace_string --match_string="__MEDIA_CACHE__" --replace_string="true" --target_file="$final_path/$app/config/prod.secret.exs" -else - ynh_replace_string --match_string="__MEDIA_CACHE__" --replace_string="false" --target_file="$final_path/$app/config/prod.secret.exs" -fi - -# Set registrations open/closed -if [ $registration -eq 1 ] -then - ynh_replace_string --match_string="__REG__" --replace_string="true" --target_file="$final_path/$app/config/prod.secret.exs" -else - ynh_replace_string --match_string="__REG__" --replace_string="false" --target_file="$final_path/$app/config/prod.secret.exs" -fi +ynh_store_file_checksum --file="$config" #================================================= # MAKE UPGRADE @@ -211,13 +213,10 @@ fi # Give permission to the final_path chown -R "$app":"$app" "$final_path" + pushd $final_path/$app - sudo -u "$app" MIX_ENV=prod mix deps.get - sudo -u "$app" MIX_ENV=prod mix ecto.migrate - - #Generate key pair - sudo -u "$app" MIX_ENV=prod mix web_push.gen.keypair >> "config/prod.secret.exs" - ynh_replace_string --match_string="administrator@example.com" --replace_string="$admin_email" --target_file="$final_path/$app/config/prod.secret.exs" + su "$app" -s $SHELL -lc "$final_path/$app/bin/pleroma_ctl update" + su "$app" -s $SHELL -lc "$final_path/$app/bin/pleroma_ctl migrate" popd #================================================= @@ -225,15 +224,7 @@ popd #================================================= # Recalculate and store the checksum of the file for the next upgrade. -ynh_store_file_checksum --file="$final_path/$app/config/prod.secret.exs" - -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_print_info --message="Upgrading logrotate configuration..." - -# Use logrotate to manage app-specific logfile(s) -ynh_use_logrotate --non-append +ynh_store_file_checksum --file="$config" #================================================= # SETUP SYSTEMD @@ -265,7 +256,7 @@ then fi #================================================= -# START SERVICE +# START SYSTEMD SERVICE #================================================= ynh_print_info --message="Starting a systemd service..." diff --git a/scripts/ynh_add_extra_apt_repos__3 b/scripts/ynh_add_extra_apt_repos__3 deleted file mode 100644 index 3276f00..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 "/etc/apt/sources.list.d/$name.list" - ynh_secure_remove "/etc/apt/preferences.d/$name" - ynh_secure_remove "/etc/apt/trusted.gpg.d/$name.gpg" - ynh_secure_remove "/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}" -} diff --git a/scripts/ynh_package_version b/scripts/ynh_package_version new file mode 100644 index 0000000..3b37f09 --- /dev/null +++ b/scripts/ynh_package_version @@ -0,0 +1,6 @@ +#!/bin/bash + +ynh_version_gt () +{ + dpkg --compare-versions "$1" gt "$2" +} From 2e91721226a7581ba6a196cb89759406dfa923dc Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 28 Dec 2019 21:48:58 +0100 Subject: [PATCH 14/26] Delete generated_config.exs --- conf/generated_config.exs | 95 --------------------------------------- 1 file changed, 95 deletions(-) delete mode 100644 conf/generated_config.exs diff --git a/conf/generated_config.exs b/conf/generated_config.exs deleted file mode 100644 index 28e013f..0000000 --- a/conf/generated_config.exs +++ /dev/null @@ -1,95 +0,0 @@ -# Pleroma instance configuration - -# NOTE: This file should not be committed to a repo or otherwise made public -# without removing sensitive information. - -import Config - -config :pleroma, Pleroma.Web.Endpoint, - url: [host: "__DOMAIN__", scheme: "https", port: 443], - secret_key_base: "__KEY__", - signing_salt: "__SIGNING_SALT__", - http: [ip: {127, 0, 0, 1}, port: 8095] - -config :pleroma, :instance, - name: "__INSTANCE_NAME__", - email: "__ADMIN_EMAIL__", - notify_email: "__ADMIN_EMAIL__", - limit: 5000, - registrations_open: __REG__, - dynamic_configuration: false - -config :pleroma, :media_proxy, - enabled: __MEDIA_CACHE__, - redirect_on_failure: true - #base_url: "https://cache.pleroma.social" - -config :pleroma, Pleroma.Repo, - adapter: Ecto.Adapters.Postgres, - username: "__DB_NAME__", - password: "__DB_PWD__", - database: "__DB_NAME__", - hostname: "localhost", - pool_size: 10 - -# Configure web push notifications -config :web_push_encryption, :vapid_details, - subject: "mailto:__ADMIN_EMAIL__", - public_key: "__PUBLIC_KEY__", - private_key: "__PRIVATE_KEY__" - -config :pleroma, :database, rum_enabled: false -config :pleroma, :instance, static_dir: "__DATADIR__/static" -config :pleroma, Pleroma.Uploaders.Local, uploads: "__DATADIR__/uploads" - -# Enable Strict-Transport-Security once SSL is working: -# config :pleroma, :http_security, -# sts: true - -# Configure S3 support if desired. -# The public S3 endpoint is different depending on region and provider, -# consult your S3 provider's documentation for details on what to use. -# -# config :pleroma, Pleroma.Uploaders.S3, -# bucket: "some-bucket", -# public_endpoint: "https://s3.amazonaws.com" -# -# Configure S3 credentials: -# config :ex_aws, :s3, -# access_key_id: "xxxxxxxxxxxxx", -# secret_access_key: "yyyyyyyyyyyy", -# region: "us-east-1", -# scheme: "https://" -# -# For using third-party S3 clones like wasabi, also do: -# config :ex_aws, :s3, -# host: "s3.wasabisys.com" - - -# Configure Openstack Swift support if desired. -# -# Many openstack deployments are different, so config is left very open with -# no assumptions made on which provider you're using. This should allow very -# wide support without needing separate handlers for OVH, Rackspace, etc. -# -# config :pleroma, Pleroma.Uploaders.Swift, -# container: "some-container", -# username: "api-username-yyyy", -# password: "api-key-xxxx", -# tenant_id: "", -# auth_url: "https://keystone-endpoint.provider.com", -# storage_url: "https://swift-endpoint.prodider.com/v1/AUTH_/", -# object_url: "https://cdn-endpoint.provider.com/" -# - -config :pleroma, Pleroma.Web.Auth.Authenticator, Pleroma.Web.Auth.LDAPAuthenticator -config :pleroma, :ldap, - enabled: true, - host: "localhost", - port: 389, - ssl: false, - # sslopts: [], - tls: false, - # tlsopts: [], - base: "ou=users,dc=yunohost,dc=org", - uid: "cn" From 4e69057e1c34188bfcaa2d732cb2ab42c7fff5ac Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 28 Dec 2019 22:28:19 +0100 Subject: [PATCH 15/26] Fix install and remove --- scripts/install | 6 +++++- scripts/remove | 7 +++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 4b3af45..1d508ef 100755 --- a/scripts/install +++ b/scripts/install @@ -190,7 +190,11 @@ ynh_add_systemd_config chown -R "$app":"$app" "$final_path" pushd $final_path/$app - su "$app" -s $SHELL -lc "$final_path/$app/bin/pleroma_ctl instance gen --force \ + #Workaround for static-dir error + ynh_replace_string --match_string="_dir" --replace_string="" --target_file="/var/www/pleroma/pleroma/releases/1.1.7/releases.exs" + + #Generate instance + su "$app" -s $SHELL -lc "$final_path/$app/bin/pleroma_ctl instance gen --force \ --output $config \ --output-psql /tmp/setup_db.psql \ --domain $domain \ diff --git a/scripts/remove b/scripts/remove index cf4eba1..fbdd39c 100755 --- a/scripts/remove +++ b/scripts/remove @@ -36,6 +36,13 @@ then yunohost service remove $app fi +#================================================= +# STOP ALL PLEROMA SERVICES +#================================================= +ynh_print_info --message="Stopping all pleroma services..." + +pkill -u $app + #================================================= # STOP AND REMOVE SERVICE #================================================= From 15316c6ac66bc28e6fadca040319f9ec43549e83 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 29 Dec 2019 15:21:03 +0100 Subject: [PATCH 16/26] Update check_process --- check_process | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/check_process b/check_process index b898676..56d9f28 100755 --- a/check_process +++ b/check_process @@ -9,7 +9,7 @@ admin="john" (USER) is_public=1 (PUBLIC|public=1|private=0) password="pass" - name="My Pleroma" + name="My_Pleroma" registration=0 (BOOLEAN) cache=1 (BOOLEAN) size="5g" From 7939f45176775408b6be53dc4c25ae85684eec33 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 29 Dec 2019 23:37:02 +0100 Subject: [PATCH 17/26] Apply example_ynh --- README.md | 1 - scripts/backup | 4 ++++ scripts/change_url | 22 +++++++++++++++++++++- scripts/install | 26 +++++++++++--------------- scripts/remove | 3 ++- scripts/restore | 8 +++++++- scripts/upgrade | 25 ++++++++++++++++--------- 7 files changed, 61 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 1668451..ed3191a 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,6 @@ The app can be used by multiple users. * x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/pleroma%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/pleroma/) * ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/pleroma%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/pleroma/) -* Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/ci/logs/pleroma%20%28Apps%29.svg)](https://ci-stretch.nohost.me/ci/apps/pleroma/) ## Limitations diff --git a/scripts/backup b/scripts/backup index 526ff42..94b1139 100755 --- a/scripts/backup +++ b/scripts/backup @@ -13,6 +13,7 @@ source /usr/share/yunohost/helpers #================================================= # MANAGE SCRIPT FAILURE #================================================= +ynh_print_info --message="Managing script failure..." ynh_clean_setup () { ynh_clean_check_starting @@ -88,6 +89,9 @@ ynh_backup --src_path="/etc/systemd/system/$app.service" ynh_print_info --message="Starting a systemd service..." ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Running Pleroma.Web.Endpoint" +if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then + sleep 60 +fi #================================================= # END OF SCRIPT diff --git a/scripts/change_url b/scripts/change_url index 66249fa..82ab97a 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -34,6 +34,23 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #db_user=$db_name #db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) +#================================================= +# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +#================================================= +ynh_print_info --message="Backing up the app before changing its url (may take a while)..." + +# Backup the current version of the app +ynh_backup_before_upgrade +ynh_clean_setup () { + # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. + ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" + + # restore it if the upgrade fails + ynh_restore_upgradebackup +} +# Exit if an error occurs during the execution of the script +ynh_abort_if_errors + #================================================= # CHECK WHICH PARTS SHOULD BE CHANGED #================================================= @@ -53,7 +70,7 @@ fi #================================================= # STANDARD MODIFICATIONS #================================================= -# STOP SERVICE +# STOP SYSTEMD SERVICE #================================================= ynh_print_info --message="Stopping a systemd service..." @@ -112,6 +129,9 @@ ynh_store_file_checksum --file="$final_path/$app/config/prod.secret.exs" ynh_print_info --message="Starting a systemd service..." ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Running Pleroma.Web.Endpoint" +if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then + sleep 60 +fi #================================================= # RELOAD NGINX diff --git a/scripts/install b/scripts/install index 1d508ef..2dbfc86 100755 --- a/scripts/install +++ b/scripts/install @@ -13,6 +13,7 @@ source /usr/share/yunohost/helpers #================================================= # MANAGE SCRIPT FAILURE #================================================= +ynh_print_info --message="Managing script failure..." ynh_clean_setup () { ynh_clean_check_starting @@ -23,6 +24,7 @@ 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="/" @@ -64,13 +66,13 @@ ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=admin --value=$admin ynh_app_setting_set --app=$app --key=is_public --value=$is_public -ynh_app_setting_set --app=$app --key=name --value="$name" -ynh_app_setting_set --app=$app --key=registration --value="$registration" -ynh_app_setting_set --app=$app --key=cache --value="$cache" -ynh_app_setting_set --app=$app --key=size --value="$size" -ynh_app_setting_set --app=$app --key=admin_email --value="$admin_email" -ynh_app_setting_set --app=$app --key=random_key --value="$random_key" -ynh_app_setting_set --app=$app --key=signing_salt --value="$signing_salt" +ynh_app_setting_set --app=$app --key=name --value=$name +ynh_app_setting_set --app=$app --key=registration --value=$registration +ynh_app_setting_set --app=$app --key=cache --value=$cache +ynh_app_setting_set --app=$app --key=size --value=$size +ynh_app_setting_set --app=$app --key=admin_email --value=$admin_email +ynh_app_setting_set --app=$app --key=random_key --value=$random_key +ynh_app_setting_set --app=$app --key=signing_salt --value=$signing_salt #================================================= # STANDARD MODIFICATIONS @@ -233,6 +235,7 @@ ynh_store_file_checksum --file="$config" #================================================= # SECURE FILES AND DIRECTORIES #================================================= +ynh_print_info --message="Securing files and directories..." # Set permissions to app files chown -R "$app":"$app" "$final_path" @@ -240,17 +243,10 @@ chown -R "$app":"$app" "$final_path" #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= +ynh_print_info --message="Integrating service in YunoHost..." yunohost service add $app --description "$app daemon for Pleroma" --log_type "systemd" -#================================================= -# START SYSTEMD SERVICE -#================================================= -ynh_print_info --message="Starting a systemd service..." - -# Start a systemd service -ynh_systemd_action --service_name=$app --action="restart" --log_path=systemd --line_match="Started $app social network." - #================================================= # SETUP SSOWAT #================================================= diff --git a/scripts/remove b/scripts/remove index fbdd39c..18ffb57 100755 --- a/scripts/remove +++ b/scripts/remove @@ -28,6 +28,7 @@ datadir=$(ynh_app_setting_get --app=$app --key=datadir) #================================================= # 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 @@ -87,7 +88,7 @@ ynh_secure_remove --file="/etc/nginx/conf.d/$app-cache.conf" #================================================= # CLOSE A PORT #================================================= -ynh_print_info --message="Closing ports" +ynh_print_info --message="Closing a port" if yunohost firewall list | grep -q "\- $port$" then diff --git a/scripts/restore b/scripts/restore index 818a01a..4facb08 100755 --- a/scripts/restore +++ b/scripts/restore @@ -13,6 +13,7 @@ source /usr/share/yunohost/helpers #================================================= # MANAGE SCRIPT FAILURE #================================================= +ynh_print_info --message="Managing script failure..." ynh_clean_setup () { ynh_clean_check_starting @@ -77,6 +78,7 @@ ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # RESTORE USER RIGHTS #================================================= +ynh_print_info --message="Restoring user rights..." # Restore permissions on app files chown -R "$app":"$app" "$final_path" @@ -138,6 +140,7 @@ systemctl enable $app.service #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= +ynh_print_info --message="Integrating service in YunoHost..." yunohost service add $app --description "$app daemon for Pleroma" --log_type "systemd" @@ -146,7 +149,10 @@ yunohost service add $app --description "$app daemon for Pleroma" --log_type "sy #================================================= ynh_print_info --message="Starting a systemd service..." -ynh_systemd_action --action=start --service_name=$app --log_path=systemd --line_match="Running Pleroma.Web.Endpoint" +ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Running Pleroma.Web.Endpoint" +if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then + sleep 60 +fi #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index dadc055..8fd0731 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -108,6 +108,13 @@ ynh_abort_if_errors #================================================= # STANDARD UPGRADE STEPS +#================================================= +# STOP SYSTEMD SERVICE +#================================================= +ynh_print_info --message="Stopping a systemd service..." + +ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped pleroma social network" + #================================================= # UPGRADE TO OTP RELEASE #================================================= @@ -141,16 +148,10 @@ if ynh_version_gt "1.1.1~ynh1" "${previous_version}" ; then rm -r $final_path/$app/* fi -#================================================= -# STOP SYSTEMD SERVICE -#================================================= -ynh_print_info --message="Stopping a systemd service..." - -ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped pleroma social network" - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= +ynh_print_info --message="Upgrading source files..." if [ "$upgrade_type" == "UPGRADE_APP" ] then @@ -202,14 +203,16 @@ ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # MODIFY A CONFIG FILE #================================================= +ynh_print_info --message="Modifying a config file..." config="/etc/$app/config.exs" -ynh_store_file_checksum --file="$config" +ynh_backup_if_checksum_is_different --file="$config" #================================================= # MAKE UPGRADE #================================================= +ynh_print_info --message="Making upgrade..." # Give permission to the final_path chown -R "$app":"$app" "$final_path" @@ -222,6 +225,7 @@ popd #================================================= # STORE THE CONFIG FILE CHECKSUM #================================================= +ynh_print_info --message="Storing the config file checksum..." # Recalculate and store the checksum of the file for the next upgrade. ynh_store_file_checksum --file="$config" @@ -239,6 +243,7 @@ ynh_add_systemd_config #================================================= # SECURE FILES AND DIRECTORIES #================================================= +ynh_print_info --message="Securing files and directories..." # Set permissions on app files chown -R "$app":"$app" "$final_path" @@ -261,7 +266,9 @@ fi ynh_print_info --message="Starting a systemd service..." ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Running Pleroma.Web.Endpoint" -sleep 10 +if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then + sleep 60 +fi #================================================= # RELOAD NGINX From 936e3cf84e588543fe14b3406ac1d3350f889de8 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 30 Dec 2019 01:09:46 +0100 Subject: [PATCH 18/26] Fix backup --- scripts/backup | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/backup b/scripts/backup index 94b1139..a141a18 100755 --- a/scripts/backup +++ b/scripts/backup @@ -32,6 +32,8 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) domain=$(ynh_app_setting_get --app=$app --key=domain) db_name=$(ynh_app_setting_get --app=$app --key=db_name) +cache=$(ynh_app_setting_get --app=$app --key=cache) + #================================================= # STANDARD BACKUP STEPS #================================================= From 2c5ea1950bdb8548bb69bbed9063bf2c23831b21 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 30 Dec 2019 01:29:36 +0100 Subject: [PATCH 19/26] deactivate multi-instance --- check_process | 2 +- manifest.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/check_process b/check_process index 56d9f28..b7951d7 100755 --- a/check_process +++ b/check_process @@ -23,7 +23,7 @@ upgrade=1 upgrade=1 from_commit=14d3be2f782048e64696cef85f4fb7dff1ab6181 backup_restore=1 - multi_instance=1 + multi_instance=0 # This test is no longer necessary since the version 2.7 (PR: https://github.com/YunoHost/yunohost/pull/304), you can still do it if your app could be installed with this version. # incorrect_path=1 port_already_use=0 diff --git a/manifest.json b/manifest.json index 02f7691..d247b31 100755 --- a/manifest.json +++ b/manifest.json @@ -20,7 +20,7 @@ "requirements": { "yunohost": ">= 3.5" }, - "multi_instance": true, + "multi_instance": false, "services": [ "nginx" ], From 3fc57ef26f091ee46536757e05e4da71b944b8cd Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 30 Dec 2019 20:49:29 +0100 Subject: [PATCH 20/26] fix previous_version --- scripts/upgrade | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/upgrade b/scripts/upgrade index 8fd0731..83c0676 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -90,6 +90,13 @@ fi ynh_secure_remove --file="/etc/apt/sources.list.d/erlang-solutions.list" apt-key del A14F4FCA +#================================================= +# CHECK VERSION NUMBER +#================================================= + +abort_if_up_to_date +# previous function is what defines 'version', more precisely the 'previous version' +previous_version="${version}" #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP From 67befa53120756d92ed6a83b72807e7e9029241c Mon Sep 17 00:00:00 2001 From: yalh76 Date: Tue, 31 Dec 2019 00:58:12 +0100 Subject: [PATCH 21/26] missing functions --- scripts/ynh_package_version | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/scripts/ynh_package_version b/scripts/ynh_package_version index 3b37f09..d6cdc4d 100644 --- a/scripts/ynh_package_version +++ b/scripts/ynh_package_version @@ -1,5 +1,25 @@ #!/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 fc245b635435ad1cb9a7343f9e4f4b479a55b268 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Tue, 31 Dec 2019 18:30:07 +0100 Subject: [PATCH 22/26] Fix upgrade step --- scripts/upgrade | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/upgrade b/scripts/upgrade index 83c0676..5dd2e97 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -94,6 +94,9 @@ apt-key del A14F4FCA # CHECK VERSION NUMBER #================================================= +if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then + sleep 60 +fi abort_if_up_to_date # previous function is what defines 'version', more precisely the 'previous version' previous_version="${version}" From b7dad8cb2a921a421e0e26335e7c70f771c87584 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Wed, 1 Jan 2020 16:08:27 +0100 Subject: [PATCH 23/26] Update check_process --- check_process | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/check_process b/check_process index b7951d7..491412f 100755 --- a/check_process +++ b/check_process @@ -21,7 +21,7 @@ setup_private=1 setup_public=1 upgrade=1 - upgrade=1 from_commit=14d3be2f782048e64696cef85f4fb7dff1ab6181 + upgrade=1 from_commit=edf199768f57000f4df6e2c704483e1036a78203 backup_restore=1 multi_instance=0 # 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. From 0a489109e2534785e00253ffe50f74932d83bc6b Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 2 Jan 2020 22:31:30 +0100 Subject: [PATCH 24/26] Fix upgrade --- scripts/upgrade | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 5dd2e97..e9318e9 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -144,11 +144,11 @@ if ynh_version_gt "1.1.1~ynh1" "${previous_version}" ; then # Give permission to the datadir chown -R "$app":"$app" "$datadir" - mv $final_path/$app/uploads/* "$datadir/uploads" - mv $final_path/$app/instance/static "$datadir/static" + mv $final_path/$app/uploads/* "$datadir/uploads" 2>/dev/null + mv $final_path/$app/instance/static "$datadir/static" 2>/dev/null ls -d $final_path/$app/priv/static/emoji/*/ | xargs -i sh -c 'mv "{}" "$datadir/static/emoji/$(basename {})"' - mv $final_path/$app/priv/static/emoji /var/lib/pleroma/static/emoji + mv $final_path/$app/priv/static/emoji /var/lib/pleroma/static/emoji 2>/dev/null mkdir -p /etc/$app chown -R $app /etc/$app From a483be17d0f25bedf6c14532a15def984061491b Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 5 Jan 2020 21:39:03 +0100 Subject: [PATCH 25/26] Fix --- scripts/backup | 2 +- scripts/change_url | 2 +- scripts/upgrade | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/backup b/scripts/backup index a141a18..19cb8f3 100755 --- a/scripts/backup +++ b/scripts/backup @@ -41,7 +41,7 @@ cache=$(ynh_app_setting_get --app=$app --key=cache) #================================================= ynh_print_info --message="Stopping a systemd service..." -ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped pleroma social network" +ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped pleroma" #================================================= # BACKUP THE APP MAIN DIR diff --git a/scripts/change_url b/scripts/change_url index 82ab97a..fc39e53 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -74,7 +74,7 @@ fi #================================================= ynh_print_info --message="Stopping a systemd service..." -ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped pleroma social network" +ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped pleroma" #================================================= # MODIFY URL IN NGINX CONF diff --git a/scripts/upgrade b/scripts/upgrade index e9318e9..6e9a794 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -123,7 +123,7 @@ ynh_abort_if_errors #================================================= ynh_print_info --message="Stopping a systemd service..." -ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped pleroma social network" +ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped pleroma" #================================================= # UPGRADE TO OTP RELEASE From 71f91451e251876bd1c696af0feb45c949f2a25c Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 6 Jan 2020 00:05:00 +0100 Subject: [PATCH 26/26] Service start fix --- scripts/backup | 4 ++-- scripts/change_url | 4 ++-- scripts/install | 10 +++++----- scripts/restore | 10 +++++----- scripts/upgrade | 27 +++++++++++++++++---------- 5 files changed, 31 insertions(+), 24 deletions(-) diff --git a/scripts/backup b/scripts/backup index 19cb8f3..bdc445c 100755 --- a/scripts/backup +++ b/scripts/backup @@ -41,7 +41,7 @@ cache=$(ynh_app_setting_get --app=$app --key=cache) #================================================= ynh_print_info --message="Stopping a systemd service..." -ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped pleroma" +ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped $app" #================================================= # BACKUP THE APP MAIN DIR @@ -90,7 +90,7 @@ ynh_backup --src_path="/etc/systemd/system/$app.service" #================================================= ynh_print_info --message="Starting a systemd service..." -ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Running Pleroma.Web.Endpoint" +ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Started $app" if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then sleep 60 fi diff --git a/scripts/change_url b/scripts/change_url index fc39e53..65d9cfb 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -74,7 +74,7 @@ fi #================================================= ynh_print_info --message="Stopping a systemd service..." -ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped pleroma" +ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped $app" #================================================= # MODIFY URL IN NGINX CONF @@ -128,7 +128,7 @@ ynh_store_file_checksum --file="$final_path/$app/config/prod.secret.exs" #================================================= ynh_print_info --message="Starting a systemd service..." -ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Running Pleroma.Web.Endpoint" +ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Started $app" if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then sleep 60 fi diff --git a/scripts/install b/scripts/install index 2dbfc86..e443567 100755 --- a/scripts/install +++ b/scripts/install @@ -157,10 +157,10 @@ ynh_print_info --message="Create the data directory..." datadir="/home/yunohost.app/${app}" # Create app folders -mkdir -p "$datadir" -mkdir -p "$datadir/uploads" -mkdir -p "$datadir/static" -mkdir -p "$datadir/static/emoji" +mkdir -p "$datadir/" +mkdir -p "$datadir/uploads/" +mkdir -p "$datadir/static/" +mkdir -p "$datadir/static/emoji/" # Give permission to the datadir chown -R "$app":"$app" "$datadir" @@ -216,7 +216,7 @@ pushd $final_path/$app su "$app" -s $SHELL -lc "$final_path/$app/bin/pleroma_ctl migrate" - ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Started $app social network." + ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Started $app" sleep 60 # Add user diff --git a/scripts/restore b/scripts/restore index 4facb08..f7149f3 100755 --- a/scripts/restore +++ b/scripts/restore @@ -91,10 +91,10 @@ chown -R "$app":"$app" "$final_path" ynh_print_info --message="Recreate the data directory..." # Create app folders -mkdir -p "$datadir" -mkdir -p "$datadir/uploads" -mkdir -p "$datadir/static" -mkdir -p "$datadir/static/emoji" +mkdir -p "$datadir/" +mkdir -p "$datadir/uploads/" +mkdir -p "$datadir/static/" +mkdir -p "$datadir/static/emoji/" # Give permission to the datadir chown -R "$app":"$app" "$datadir" @@ -149,7 +149,7 @@ yunohost service add $app --description "$app daemon for Pleroma" --log_type "sy #================================================= ynh_print_info --message="Starting a systemd service..." -ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Running Pleroma.Web.Endpoint" +ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Started $app" if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then sleep 60 fi diff --git a/scripts/upgrade b/scripts/upgrade index 6e9a794..1d22f2e 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -28,6 +28,7 @@ admin_email=$(ynh_app_setting_get --app=$app --key=admin_email) random_key=$(ynh_app_setting_get --app=$app --key=random_key) name=$(ynh_app_setting_get --app=$app --key=name) port=$(ynh_app_setting_get --app=$app --key=port) +db_user=$(ynh_app_setting_get --app=$app --key=db_user) db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) cache=$(ynh_app_setting_get --app=$app --key=cache) size=$(ynh_app_setting_get --app=$app --key=size) @@ -109,6 +110,7 @@ ynh_print_info --message="Backing up the app before upgrading (may take a while) # Backup the current version of the app ynh_backup_before_upgrade ynh_clean_setup () { + read -p "key" # restore it if the upgrade fails ynh_restore_upgradebackup ynh_clean_check_starting @@ -123,7 +125,7 @@ ynh_abort_if_errors #================================================= ynh_print_info --message="Stopping a systemd service..." -ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped pleroma" +ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped $app" #================================================= # UPGRADE TO OTP RELEASE @@ -136,24 +138,29 @@ if ynh_version_gt "1.1.1~ynh1" "${previous_version}" ; then ynh_app_setting_set --app=$app --key=datadir --value="$datadir" # Create app folders - mkdir -p "$datadir" - mkdir -p "$datadir/uploads" - mkdir -p "$datadir/static" - mkdir -p "$datadir/static/emoji" + mkdir -p "$datadir/" + mkdir -p "$datadir/uploads/" + mkdir -p "$datadir/static/" + mkdir -p "$datadir/static/emoji/" # Give permission to the datadir chown -R "$app":"$app" "$datadir" - mv $final_path/$app/uploads/* "$datadir/uploads" 2>/dev/null - mv $final_path/$app/instance/static "$datadir/static" 2>/dev/null + rsync -a "$final_path/$app/uploads/" "$datadir/uploads/" + if [ -d "$final_path/$app/instance/static/" ]; then + rsync -a "$final_path/$app/instance/static/" "$datadir/static/" + fi ls -d $final_path/$app/priv/static/emoji/*/ | xargs -i sh -c 'mv "{}" "$datadir/static/emoji/$(basename {})"' - mv $final_path/$app/priv/static/emoji /var/lib/pleroma/static/emoji 2>/dev/null + rsync -a "$final_path/$app/priv/static/emoji/" "$datadir/static/emoji/" mkdir -p /etc/$app chown -R $app /etc/$app config="/etc/$app/config.exs" - mv $final_path/$app/config/prod.secret.exs /etc/pleroma/config.exs + mv $final_path/$app/config/prod.secret.exs $config + ynh_replace_string --match_string="use Mix.Config" --replace_string="import Config" --target_file="$config" + + ynh_backup_if_checksum_is_different --file="$config" rm -r $final_path/$app/* fi @@ -275,7 +282,7 @@ fi #================================================= ynh_print_info --message="Starting a systemd service..." -ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Running Pleroma.Web.Endpoint" +ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Started $app" if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then sleep 60 fi