From f1c07d6f51cd66bc29a7bfcf1079060b8eb759e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 22 Nov 2021 13:28:08 +0100 Subject: [PATCH 01/15] 2.7.10 (#97) * 2.7.10 --- .github/workflows/updater.sh | 136 +++++++++++++++++++++++++++++++++++ README.md | 2 +- README_fr.md | 2 +- conf/app.src | 4 +- conf/nginx.conf | 4 -- conf/systemd.service | 30 ++++++++ doc/DESCRIPTION.md | 1 + doc/DESCRIPTION_fr.md | 1 + manifest.json | 4 +- 9 files changed, 174 insertions(+), 10 deletions(-) create mode 100755 .github/workflows/updater.sh create mode 100644 doc/DESCRIPTION.md create mode 100644 doc/DESCRIPTION_fr.md diff --git a/.github/workflows/updater.sh b/.github/workflows/updater.sh new file mode 100755 index 0000000..c4d53fc --- /dev/null +++ b/.github/workflows/updater.sh @@ -0,0 +1,136 @@ +#!/bin/bash + +#================================================= +# PACKAGE UPDATING HELPER +#================================================= + +# This script is meant to be run by GitHub Actions +# The YunoHost-Apps organisation offers a template Action to run this script periodically +# Since each app is different, maintainers can adapt its contents so as to perform +# automatic actions when a new upstream release is detected. + +# Remove this exit command when you are ready to run this Action +exit 1 + +#================================================= +# FETCHING LATEST RELEASE AND ITS ASSETS +#================================================= + +# Fetching information +current_version=$(cat manifest.json | jq -j '.version|split("~")[0]') +repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]') +# Some jq magic is needed, because the latest upstream release is not always the latest version (e.g. security patches for older versions) +version=$(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '.[] | select( .prerelease != true ) | .tag_name' | sort -V | tail -1) +assets=($(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '[ .[] | select(.tag_name=="'$version'").assets[].browser_download_url ] | join(" ") | @sh' | tr -d "'")) + +# Later down the script, we assume the version has only digits and dots +# Sometimes the release name starts with a "v", so let's filter it out. +# You may need more tweaks here if the upstream repository has different naming conventions. +if [[ ${version:0:1} == "v" || ${version:0:1} == "V" ]]; then + version=${version:1} +fi + +# Setting up the environment variables +echo "Current version: $current_version" +echo "Latest release from upstream: $version" +echo "VERSION=$version" >> $GITHUB_ENV +# For the time being, let's assume the script will fail +echo "PROCEED=false" >> $GITHUB_ENV + +# Proceed only if the retrieved version is greater than the current one +if ! dpkg --compare-versions "$current_version" "lt" "$version" ; then + echo "::warning ::No new version available" + exit 0 +# Proceed only if a PR for this new version does not already exist +elif git ls-remote -q --exit-code --heads https://github.com/$GITHUB_REPOSITORY.git ci-auto-update-v$version ; then + echo "::warning ::A branch already exists for this update" + exit 0 +fi + +# Each release can hold multiple assets (e.g. binaries for different architectures, source code, etc.) +echo "${#assets[@]} available asset(s)" + +#================================================= +# UPDATE SOURCE FILES +#================================================= + +# Here we use the $assets variable to get the resources published in the upstream release. +# Here is an example for Grav, it has to be adapted in accordance with how the upstream releases look like. + +# Let's loop over the array of assets URLs +for asset_url in ${assets[@]}; do + +echo "Handling asset at $asset_url" + +# Assign the asset to a source file in conf/ directory +# Here we base the source file name upon a unique keyword in the assets url (admin vs. update) +# Leave $src empty to ignore the asset +case $asset_url in + *"admin"*) + src="app" + ;; + *"update"*) + src="app-upgrade" + ;; + *) + src="" + ;; +esac + +# If $src is not empty, let's process the asset +if [ ! -z "$src" ]; then + +# Create the temporary directory +tempdir="$(mktemp -d)" + +# Download sources and calculate checksum +filename=${asset_url##*/} +curl --silent -4 -L $asset_url -o "$tempdir/$filename" +checksum=$(sha256sum "$tempdir/$filename" | head -c 64) + +# Delete temporary directory +rm -rf $tempdir + +# Get extension +if [[ $filename == *.tar.gz ]]; then + extension=tar.gz +else + extension=${filename##*.} +fi + +# Rewrite source file +cat < conf/$src.src +SOURCE_URL=$asset_url +SOURCE_SUM=$checksum +SOURCE_SUM_PRG=sha256sum +SOURCE_FORMAT=$extension +SOURCE_IN_SUBDIR=true +SOURCE_FILENAME= +EOT +echo "... conf/$src.src updated" + +else +echo "... asset ignored" +fi + +done + +#================================================= +# SPECIFIC UPDATE STEPS +#================================================= + +# Any action on the app's source code can be done. +# The GitHub Action workflow takes care of committing all changes after this script ends. + +#================================================= +# GENERIC FINALIZATION +#================================================= + +# Replace new version in manifest +echo "$(jq -s --indent 4 ".[] | .version = \"$version~ynh1\"" manifest.json)" > manifest.json + +# No need to update the README, yunohost-bot takes care of it + +# The Action will proceed only if the PROCEED environment variable is set to true +echo "PROCEED=true" >> $GITHUB_ENV +exit 0 diff --git a/README.md b/README.md index f655c83..d817823 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Discussion platform -**Shipped version:** 2.7.9~ynh1 +**Shipped version:** 2.7.10~ynh1 **Demo:** https://try.discourse.org diff --git a/README_fr.md b/README_fr.md index 05ae701..e4d48b2 100644 --- a/README_fr.md +++ b/README_fr.md @@ -13,7 +13,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour Plateforme de discussion -**Version incluse :** 2.7.9~ynh1 +**Version incluse :** 2.7.10~ynh1 **Démo :** https://try.discourse.org diff --git a/conf/app.src b/conf/app.src index 2f1642b..0e4de38 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/discourse/discourse/archive/v2.7.9.tar.gz -SOURCE_SUM=91a0ff0a00937cdb506f9558e30a57ebc496d75911f6da305eb388f9c1b30a00 +SOURCE_URL=https://github.com/discourse/discourse/archive/v2.7.10.tar.gz +SOURCE_SUM=550eeaaeaf28ca63be5efc4424cfb93a39fc90b4351c68f785979cc68e9cb65e SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/conf/nginx.conf b/conf/nginx.conf index 063886b..d9b5922 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -32,10 +32,6 @@ alias __FINALPATH__/public/; proxy_hide_header ETag; - if ($scheme = http) { - rewrite ^ https://$server_name$request_uri? permanent; - } - # auth_basic on; # auth_basic_user_file /etc/nginx/htpasswd; diff --git a/conf/systemd.service b/conf/systemd.service index 655e184..3e35b20 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -18,5 +18,35 @@ ExecStart=__RBENV_ROOT__/shims/bundle exec unicorn --config config/unicorn.conf. Restart=always RestartSec=10 +# Sandboxing options to harden security +# Depending on specificities of your service/app, you may need to tweak these +# .. but this should be a good baseline +# Details for these options: https://www.freedesktop.org/software/systemd/man/systemd.exec.html +NoNewPrivileges=yes +PrivateTmp=yes +PrivateDevices=yes +RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 +RestrictNamespaces=yes +RestrictRealtime=yes +DevicePolicy=closed +ProtectSystem=full +ProtectControlGroups=yes +ProtectKernelModules=yes +ProtectKernelTunables=yes +LockPersonality=yes +SystemCallFilter=~@clock @debug @module @mount @obsolete @reboot @setuid @swap + +# Denying access to capabilities that should not be relevant for webapps +# Doc: https://man7.org/linux/man-pages/man7/capabilities.7.html +CapabilityBoundingSet=~CAP_RAWIO CAP_MKNOD +CapabilityBoundingSet=~CAP_AUDIT_CONTROL CAP_AUDIT_READ CAP_AUDIT_WRITE +CapabilityBoundingSet=~CAP_SYS_BOOT CAP_SYS_TIME CAP_SYS_MODULE CAP_SYS_PACCT +CapabilityBoundingSet=~CAP_LEASE CAP_LINUX_IMMUTABLE CAP_IPC_LOCK +CapabilityBoundingSet=~CAP_BLOCK_SUSPEND CAP_WAKE_ALARM +CapabilityBoundingSet=~CAP_SYS_TTY_CONFIG +CapabilityBoundingSet=~CAP_MAC_ADMIN CAP_MAC_OVERRIDE +CapabilityBoundingSet=~CAP_NET_ADMIN CAP_NET_BROADCAST CAP_NET_RAW +CapabilityBoundingSet=~CAP_SYS_ADMIN CAP_SYS_PTRACE CAP_SYSLOG + [Install] WantedBy=multi-user.target diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md new file mode 100644 index 0000000..29dd95c --- /dev/null +++ b/doc/DESCRIPTION.md @@ -0,0 +1 @@ +Discourse is modern forum software for your community. Use it as a mailing list, discussion forum, long-form chat room, and more! \ No newline at end of file diff --git a/doc/DESCRIPTION_fr.md b/doc/DESCRIPTION_fr.md new file mode 100644 index 0000000..d901451 --- /dev/null +++ b/doc/DESCRIPTION_fr.md @@ -0,0 +1 @@ +Discourse est un logiciel de forum moderne pour votre communauté. Utilisez-le comme liste de diffusion, forum de discussion, salle de discussion longue durée, et plus encore ! \ No newline at end of file diff --git a/manifest.json b/manifest.json index 45470c4..6c39e75 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Discussion platform", "fr": "Plateforme de discussion" }, - "version": "2.7.9~ynh1", + "version": "2.7.10~ynh1", "url": "http://Discourse.org", "upstream": { "license": "GPL-2.0", @@ -21,7 +21,7 @@ "url": "" }, "requirements": { - "yunohost": ">= 4.2.0" + "yunohost": ">= 4.3.0" }, "multi_instance": true, "services": [ From 04dcf9271984f918c1711bccf52edbd11d9b6457 Mon Sep 17 00:00:00 2001 From: Yunohost-Bot <> Date: Mon, 22 Nov 2021 12:28:11 +0000 Subject: [PATCH 02/15] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d817823..22951ad 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in ## Overview -Discussion platform +Discourse is modern forum software for your community. Use it as a mailing list, discussion forum, long-form chat room, and more! **Shipped version:** 2.7.10~ynh1 diff --git a/README_fr.md b/README_fr.md index e4d48b2..82993d3 100644 --- a/README_fr.md +++ b/README_fr.md @@ -11,7 +11,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour ## Vue d'ensemble -Plateforme de discussion +Discourse est un logiciel de forum moderne pour votre communauté. Utilisez-le comme liste de diffusion, forum de discussion, salle de discussion longue durée, et plus encore ! **Version incluse :** 2.7.10~ynh1 From e8dc08580b7adf6a52f25e1a2dcdf3716f0408d2 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 6 Dec 2021 22:36:39 +0100 Subject: [PATCH 03/15] 2.7.11 --- conf/app.src | 4 ++-- manifest.json | 2 +- scripts/restore | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/conf/app.src b/conf/app.src index 0e4de38..4f8a3d6 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/discourse/discourse/archive/v2.7.10.tar.gz -SOURCE_SUM=550eeaaeaf28ca63be5efc4424cfb93a39fc90b4351c68f785979cc68e9cb65e +SOURCE_URL=https://github.com/discourse/discourse/archive/v2.7.11.tar.gz +SOURCE_SUM=da01ea751849ab924e5870430a91c73ff7c30fcc0a8d043a38608af2e1955542 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/manifest.json b/manifest.json index 6c39e75..813f4d7 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Discussion platform", "fr": "Plateforme de discussion" }, - "version": "2.7.10~ynh1", + "version": "2.7.11~ynh1", "url": "http://Discourse.org", "upstream": { "license": "GPL-2.0", diff --git a/scripts/restore b/scripts/restore index acb2b3f..3f53b85 100644 --- a/scripts/restore +++ b/scripts/restore @@ -38,8 +38,7 @@ db_user=$db_name #================================================= ynh_script_progression --message="Validating restoration parameters..." -test ! -d $final_path \ - || ynh_die --message="There is already a directory: $final_path " +test ! -d $final_path || ynh_die --message="There is already a directory: $final_path " if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then : From 91a9491973101b50381e93694b189cc202d77264 Mon Sep 17 00:00:00 2001 From: Yunohost-Bot <> Date: Mon, 6 Dec 2021 21:36:46 +0000 Subject: [PATCH 04/15] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 22951ad..5db57a3 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Discourse is modern forum software for your community. Use it as a mailing list, discussion forum, long-form chat room, and more! -**Shipped version:** 2.7.10~ynh1 +**Shipped version:** 2.7.11~ynh1 **Demo:** https://try.discourse.org diff --git a/README_fr.md b/README_fr.md index 82993d3..8df1b66 100644 --- a/README_fr.md +++ b/README_fr.md @@ -13,7 +13,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour Discourse est un logiciel de forum moderne pour votre communauté. Utilisez-le comme liste de diffusion, forum de discussion, salle de discussion longue durée, et plus encore ! -**Version incluse :** 2.7.10~ynh1 +**Version incluse :** 2.7.11~ynh1 **Démo :** https://try.discourse.org From 4c132a527ba5d0ea52f244a99310702aee6668fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 26 Dec 2021 12:05:22 +0100 Subject: [PATCH 05/15] V2.7.12 (#100) * v2.7.12 * Auto-update README Co-authored-by: Yunohost-Bot <> --- README.md | 2 +- README_fr.md | 2 +- conf/app.src | 4 ++-- manifest.json | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 5db57a3..18b51a9 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Discourse is modern forum software for your community. Use it as a mailing list, discussion forum, long-form chat room, and more! -**Shipped version:** 2.7.11~ynh1 +**Shipped version:** 2.7.12~ynh1 **Demo:** https://try.discourse.org diff --git a/README_fr.md b/README_fr.md index 8df1b66..fae505b 100644 --- a/README_fr.md +++ b/README_fr.md @@ -13,7 +13,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour Discourse est un logiciel de forum moderne pour votre communauté. Utilisez-le comme liste de diffusion, forum de discussion, salle de discussion longue durée, et plus encore ! -**Version incluse :** 2.7.11~ynh1 +**Version incluse :** 2.7.12~ynh1 **Démo :** https://try.discourse.org diff --git a/conf/app.src b/conf/app.src index 4f8a3d6..36fdb2b 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/discourse/discourse/archive/v2.7.11.tar.gz -SOURCE_SUM=da01ea751849ab924e5870430a91c73ff7c30fcc0a8d043a38608af2e1955542 +SOURCE_URL=https://github.com/discourse/discourse/archive/v2.7.12.tar.gz +SOURCE_SUM=9b1257e7106fe55777012da5e106be75ab7e2bf7ac66fdc5788cd73b6e76012b SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/manifest.json b/manifest.json index 813f4d7..95d3b93 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Discussion platform", "fr": "Plateforme de discussion" }, - "version": "2.7.11~ynh1", + "version": "2.7.12~ynh1", "url": "http://Discourse.org", "upstream": { "license": "GPL-2.0", From 0327d1b43b5a70e6db86f6e2603dd9aebee1b9b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 24 Jan 2022 22:35:57 +0100 Subject: [PATCH 06/15] 2.7.13 (#102) * 2.7.13 --- README.md | 2 +- README_fr.md | 2 +- conf/app.src | 4 ++-- manifest.json | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 18b51a9..977eca6 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Discourse is modern forum software for your community. Use it as a mailing list, discussion forum, long-form chat room, and more! -**Shipped version:** 2.7.12~ynh1 +**Shipped version:** 2.7.13~ynh1 **Demo:** https://try.discourse.org diff --git a/README_fr.md b/README_fr.md index fae505b..25d3fc7 100644 --- a/README_fr.md +++ b/README_fr.md @@ -13,7 +13,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour Discourse est un logiciel de forum moderne pour votre communauté. Utilisez-le comme liste de diffusion, forum de discussion, salle de discussion longue durée, et plus encore ! -**Version incluse :** 2.7.12~ynh1 +**Version incluse :** 2.7.13~ynh1 **Démo :** https://try.discourse.org diff --git a/conf/app.src b/conf/app.src index 36fdb2b..9280981 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/discourse/discourse/archive/v2.7.12.tar.gz -SOURCE_SUM=9b1257e7106fe55777012da5e106be75ab7e2bf7ac66fdc5788cd73b6e76012b +SOURCE_URL=https://github.com/discourse/discourse/archive/v2.7.13.tar.gz +SOURCE_SUM=29905c395311844fb3dacbbc11de37d3147ec45fc6c5f0a68b5d8ea98a2bc364 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/manifest.json b/manifest.json index 95d3b93..33a0d28 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Discussion platform", "fr": "Plateforme de discussion" }, - "version": "2.7.12~ynh1", + "version": "2.7.13~ynh1", "url": "http://Discourse.org", "upstream": { "license": "GPL-2.0", From 048083e25885a234535107bd36bb58e343db481f Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 29 May 2022 17:36:13 +0200 Subject: [PATCH 07/15] Apply last example_ynh --- check_process | 4 +- conf/app.src | 2 + conf/discourse_defaults.conf | 338 +++++++++++++++++++++++++++++++++++ conf/nginx.conf | 4 +- conf/settings.yml | 24 +++ conf/systemd.service | 5 +- manifest.json | 10 +- scripts/_common.sh | 19 +- scripts/backup | 3 +- scripts/change_url | 6 +- scripts/install | 79 ++------ scripts/remove | 24 +-- scripts/restore | 33 ++-- scripts/upgrade | 118 ++++-------- 14 files changed, 473 insertions(+), 196 deletions(-) create mode 100644 conf/discourse_defaults.conf create mode 100644 conf/settings.yml diff --git a/check_process b/check_process index fcc1533..0ab6265 100644 --- a/check_process +++ b/check_process @@ -2,8 +2,8 @@ ; Manifest domain="domain.tld" path="/path" - admin="john" is_public=1 + admin="john" ; Checks pkg_linter=1 setup_sub_dir=1 @@ -25,4 +25,4 @@ Notification=none ;;; Upgrade options ; commit=c626379c98bb7f052061446cd152e4406979d49d name=2.6.1~ynh2 - manifest_arg=domain=DOMAIN&path=PATH&admin=USER&is_public=1& + manifest_arg=domain=DOMAIN&path=PATH&admin=USER&is_public=1 diff --git a/conf/app.src b/conf/app.src index 9280981..9f59e18 100644 --- a/conf/app.src +++ b/conf/app.src @@ -3,3 +3,5 @@ SOURCE_SUM=29905c395311844fb3dacbbc11de37d3147ec45fc6c5f0a68b5d8ea98a2bc364 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true +SOURCE_FILENAME= +SOURCE_EXTRACT=true diff --git a/conf/discourse_defaults.conf b/conf/discourse_defaults.conf new file mode 100644 index 0000000..c366954 --- /dev/null +++ b/conf/discourse_defaults.conf @@ -0,0 +1,338 @@ +# +# DO NOT EDIT THIS FILE +# If you need to make changes create a file called discourse.conf in this directory with your changes +# On import this file will be imported using ERB +# + +# Discourse supports multiple mechanisms for production config. +# +# 1. You can do nothing and get these defaults (not recommended, you should at least set hostname) +# 2. You can copy this file to config/discourse.conf and amend with your settings +# 3. You can pass in config from your environment, all the settings below are available. +# Append DISCOURSE_ and upper case the setting in ENV. For example: +# to pass in db_timeout of 200 you would use DISCOURSE_DB_TIMEOUT=200 + +# All settings apply to production only + +# connection pool size, sidekiq is set to 5, allowing an extra 3 for bg threads +db_pool = 8 + +# ActiveRecord connection pool timeout in milliseconds +db_timeout = 5000 + +# Database connection timeout in seconds +db_connect_timeout = 5 + +# socket file used to access db +db_socket = + +# host address for db server +# This is set to blank so it tries to use sockets first +db_host = + +# host address for db server when taking a backup via `pg_dump` +# Defaults to `db_host` if not configured +db_backup_host = + +# port running db server, no need to set it +db_port = + +# db server port to use when taking a backup via `pg_dump` +db_backup_port = 5432 + +# database name running discourse +db_name = __DB_NAME__ + +# username accessing database +db_username = __DB_USER__ + +# password used to access the db +db_password = __DB_PWD__ + +# Disallow prepared statements +# see: https://github.com/rails/rails/issues/21992 +db_prepared_statements = false + +# host address for db replica server +db_replica_host = + +# port running replica db server, defaults to 5432 if not set +db_replica_port = + +db_advisory_locks = true + +# hostname running the forum +hostname = "__DOMAIN__" + +# backup hostname mainly for cdn use +backup_hostname = + +# address of smtp server used to send emails +smtp_address = localhost + +# port of smtp server used to send emails +smtp_port = 25 + +# domain passed to smtp server +smtp_domain = __DOMAIN__ + +# username for smtp server +smtp_user_name = + +# password for smtp server +smtp_password = + +# smtp authentication mechanism +smtp_authentication = plain + +# enable TLS encryption for smtp connections +smtp_enable_start_tls = false + +# mode for verifying smtp server certificates +# to disable, set to 'none' +smtp_openssl_verify_mode = + +# force implicit TLS as per RFC 8314 3.3 +smtp_force_tls = false + +# load MiniProfiler in production, to be used by developers +load_mini_profiler = false + +# Every how many requests should MP profile a request (aka take snapshot) +# Default is never +mini_profiler_snapshots_period = 0 + +# specify the URL of the destination that MiniProfiler should ship snapshots to +# mini_profiler_snapshots_transport_auth_key is required as well +mini_profiler_snapshots_transport_url = + +# authorization key that will be included as a header in requests made by the +# snapshots transporter to the URL specified above. The destination should +# know this key and only accept requests that have this key in the +# `Mini-Profiler-Transport-Auth` header. +mini_profiler_snapshots_transport_auth_key = + +# recommended, cdn used to access assets +cdn_url = + +# The hostname used by the CDN to request assets +cdn_origin_hostname = + +# comma delimited list of emails that have developer level access +developer_emails = __ADMIN_MAIL__ + +# redis server address +redis_host = localhost + +# redis server port +redis_port = 6379 + +# redis replica server address +redis_replica_host = + +# redis replica server port +redis_replica_port = 6379 + +# redis database +redis_db = __REDIS_DB__ + +# redis password +redis_password = + +# skip configuring client id for cloud providers who support no client commands +redis_skip_client_commands = false + +# uses SSL for all Redis connections if true +redis_use_ssl = false + +# message bus redis server switch +message_bus_redis_enabled = false + +# message bus redis server address +message_bus_redis_host = localhost + +# message bus redis server port +message_bus_redis_port = 6379 + +# message bus redis replica server address +message_bus_redis_replica_host = + +# message bus redis slave server port +message_bus_redis_replica_port = 6379 + +# message bus redis database +message_bus_redis_db = 0 + +# message bus redis password +message_bus_redis_password = + +# skip configuring client id for cloud providers who support no client commands +message_bus_redis_skip_client_commands = false + +# enable Cross-origin Resource Sharing (CORS) directly at the application level +enable_cors = false +cors_origin = '' + +# enable if you really need to serve assets in prd +serve_static_assets = true + +# number of sidekiq workers (launched via unicorn master) +sidekiq_workers = 5 + +# adjust stylesheets to rtl (requires "rtlit" gem) +rtl_css = false + +# connection reaping helps keep connection counts down, postgres +# will not work properly with huge numbers of open connections +# reap connections from pool that are older than 30 seconds +connection_reaper_age = 30 + +# run reap check every 30 seconds +connection_reaper_interval = 30 + +# set to relative URL (for subdirectory hosting) +# IMPORTANT: path must not include a trailing / +# EG: /forum +relative_url_root = "__PATH_URL__" + +# increasing this number will increase redis memory use +# this ensures backlog (ability of channels to catch up are capped) +# message bus default cap is 1000, we are winding it down to 100 +message_bus_max_backlog_size = 100 + +# must be a 64 byte hex string, anything else will be ignored with a warning +secret_key_base = + +# fallback path for all assets which are served via the application +# used by static_controller +# in multi host setups this allows you to have old unicorn instances serve +# newly compiled assets +fallback_assets_path = + +# S3 settings used for serving ALL public files +# be sure to configre a CDN as well per cdn_url +s3_bucket = +s3_region = +s3_access_key_id = +s3_secret_access_key = +s3_use_iam_profile = +s3_cdn_url = +s3_endpoint = +s3_http_continue_timeout = +s3_install_cors_rule = + +### rate limits apply to all sites +max_user_api_reqs_per_minute = 20 +max_user_api_reqs_per_day = 2880 + +max_admin_api_reqs_per_key_per_minute = 60 + +max_reqs_per_ip_per_minute = 200 +max_reqs_per_ip_per_10_seconds = 50 + +# applies to asset type routes (avatars/css and so on) +max_asset_reqs_per_ip_per_10_seconds = 200 + +# global rate limiter will simply warn if the limit is exceeded, can be warn+block, warn, block or none +max_reqs_per_ip_mode = block + +# bypass rate limiting any IP resolved as a private IP +max_reqs_rate_limit_on_private = false + +# logged in DoS protection + +# protection will only trigger for requests that queue longer than this amount +force_anonymous_min_queue_seconds = 1 +# only trigger anon if we see more than N requests for this path in last 10 seconds +force_anonymous_min_per_10_seconds = 3 + +# Any requests with the headers Discourse-Background = true will not be allowed to queue +# longer than this amount of time. +# Discourse will rate limit and ask client to try again later. +background_requests_max_queue_length = 0.5 + +# if a message bus request queues for 100ms or longer, we will reject it and ask consumer +# to back off +reject_message_bus_queue_seconds = 0.1 + +# disable search if app server is queueing for longer than this (in seconds) +disable_search_queue_threshold = 1 + +# maximum number of posts rebaked across the cluster in the periodical job +# rebake process is very expensive, on multisite we have to make sure we never +# flood the queue +max_old_rebakes_per_15_minutes = 300 + +# maximum number of log messages in /logs +max_logster_logs = 1000 + +# during precompile update maxmind database if older than N days +# set to 0 to disable +refresh_maxmind_db_during_precompile_days = 2 + +# backup path containing maxmind db files +maxmind_backup_path = + +# register an account at: https://www.maxmind.com/en/geolite2/signup +# then head to profile and get your license key +maxmind_license_key= + +# when enabled the following headers will be added to every response: +# (note, if measurements do not exist for the header they will be omitted) +# +# X-Redis-Calls: 10 +# X-Redis-Time: 1.02 +# X-Sql-Calls: 102 +# X-Sql-Time: 1.02 +# X-Queue-Time: 1.01 +enable_performance_http_headers = false + +# gather JavaScript errors from clients (rate limited to 1 error per IP per minute) +enable_js_error_reporting = true + +# This is probably not a number you want to touch, it controls the number of workers +# we allow mini scheduler to run. Prior to 2019 we ran a single worker. +# On extremely busy setups this could lead to situations where regular jobs would +# starve. Specifically jobs such as "run heartbeat" which keeps sidekiq running. +# Having a high number here is very low risk. Regular jobs are limited in scope and scale. +mini_scheduler_workers = 5 + +# enable compression on anonymous cache redis entries +# this slightly increases the cost of storing cache entries but can make it much +# cheaper to retrieve cache entries when redis is stores on a different machine to the one +# running the web +compress_anon_cache = false + +# Only store entries in redis for anonymous cache if they are observed more than N times +# for a specific key +# +# This ensures there are no pathological cases where we keep storing data in anonymous cache +# never to use it, set to 1 to store immediately, set to 0 to disable anon cache +anon_cache_store_threshold = 2 + +# EXPERIMENTAL - not yet supported in production +# by default admins can install and amend any theme +# you may restrict it so only specific themes are approved +# in allowlist mode all theme updates must happen via git repos +# themes missing from the list are automatically disallowed +# list is a comma seperated list of git repos eg: +# https://github.com/discourse/discourse-custom-header-links.git,https://github.com/discourse/discourse-simple-theme.git +allowed_theme_repos = + +# Demon::EmailSync is used in conjunction with the enable_imap site setting +# to sync N IMAP mailboxes with specific groups. It is a process started in +# unicorn.conf, and it spawns N threads (one for each multisite connection) and +# for each database spans another N threads (one for each configured group). +# +# We want this off by default so the process is not started when it does not +# need to be (e.g. development, test, certain hosting tiers) +enable_email_sync_demon = false + +# we never want to queue more than 10000 digests per 30 minute block +# this can easily lead to blocking sidekiq +# on multisites we recommend a far lower number +max_digests_enqueued_per_30_mins_per_site = 10000 + +# This cluster name can be passed to the /srv/status route to verify +# the application cluster is the same one you are expecting +cluster_name = diff --git a/conf/nginx.conf b/conf/nginx.conf index d9b5922..5c95f86 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -29,7 +29,7 @@ #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; location __PATH__/ { - alias __FINALPATH__/public/; + alias __FINALPATH__/public/ ; proxy_hide_header ETag; # auth_basic on; @@ -199,7 +199,7 @@ location __PATH__/downloads/ { internal; - alias __FINALPATH__/public/; + alias __FINALPATH__/public/ ; } location @__NAME__ { diff --git a/conf/settings.yml b/conf/settings.yml new file mode 100644 index 0000000..75729a9 --- /dev/null +++ b/conf/settings.yml @@ -0,0 +1,24 @@ +plugins: + ldap_enabled: + default: true + ldap_user_create_mode: + default: 'auto' + ldap_lookup_users_by: + default: 'email' + ldap_hostname: + default: 'localhost' + ldap_port: + default: 389 + ldap_method: + default: 'plain' + ldap_base: + default: 'ou=users,dc=yunohost,dc=org' + ldap_uid: + default: 'uid' + ldap_bind_dn: + default: '' + ldap_password: + default: '' + secret: true + ldap_filter: + default: '' diff --git a/conf/systemd.service b/conf/systemd.service index 3e35b20..6af31d1 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -14,7 +14,8 @@ Environment=RAILS_ENV=production Environment=UNICORN_SIDEKIQS=1 Environment=LD_PRELOAD=__LIBJEMALLOC__ Environment=UNICORN_LISTENER=__FINALPATH__/tmp/sockets/unicorn.sock -ExecStart=__RBENV_ROOT__/shims/bundle exec unicorn --config config/unicorn.conf.rb -E production +Environment="__YNH_RUBY_LOAD_PATH__" +ExecStart=__FINALPATH__/bin/bundle exec unicorn --config config/unicorn.conf.rb -E production Restart=always RestartSec=10 @@ -25,7 +26,7 @@ RestartSec=10 NoNewPrivileges=yes PrivateTmp=yes PrivateDevices=yes -RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 +RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 AF_NETLINK RestrictNamespaces=yes RestrictRealtime=yes DevicePolicy=closed diff --git a/manifest.json b/manifest.json index 33a0d28..84c868a 100644 --- a/manifest.json +++ b/manifest.json @@ -28,7 +28,7 @@ "nginx" ], "arguments": { - "install" : [ + "install": [ { "name": "domain", "type": "domain" @@ -39,14 +39,14 @@ "example": "/forum", "default": "/forum" }, - { - "name": "admin", - "type": "user" - }, { "name": "is_public", "type": "boolean", "default": true + }, + { + "name": "admin", + "type": "user" } ] } diff --git a/scripts/_common.sh b/scripts/_common.sh index 8de55b6..ec936a5 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,8 +5,9 @@ #================================================= pkg_dependencies="g++ libjemalloc1|libjemalloc2 libjemalloc-dev zlib1g-dev libreadline-dev libpq-dev libssl-dev libyaml-dev libcurl4-dev libapr1-dev libxslt1-dev libxml2-dev vim imagemagick postgresql postgresql-server-dev-all postgresql-contrib optipng jhead jpegoptim gifsicle brotli" +build_pkg_dependencies="" -RUBY_VERSION="2.7.1" +ruby_version="2.7.1" #================================================= # PERSONAL HELPERS @@ -163,6 +164,12 @@ rbenv_install_dir="/opt/rbenv" ruby_version_path="$rbenv_install_dir/versions" # RBENV_ROOT is the directory of rbenv, it needs to be loaded as a environment variable. export RBENV_ROOT="$rbenv_install_dir" +export rbenv_root="$rbenv_install_dir" + +ruby_dependencies="" +build_ruby_dependencies="libjemalloc-dev curl build-essential libreadline-dev zlib1g-dev libsqlite3-dev libssl-dev libxml2-dev libxslt-dev autoconf automake bison libtool" +pkg_dependencies="$pkg_dependencies $ruby_dependencies" +build_pkg_dependencies="$build_pkg_dependencies $build_ruby_dependencies" # Load the version of Ruby for an app, and set variables. # @@ -187,9 +194,9 @@ export RBENV_ROOT="$rbenv_install_dir" # Finally, to start a Ruby service with the correct version, 2 solutions # Either the app is dependent of Ruby or gem, but does not called it directly. # In such situation, you need to load PATH -# `Environment="__YNH_RUBY_LOAD_ENV_PATH__"` +# `Environment="__YNH_RUBY_LOAD_PATH__"` # `ExecStart=__FINALPATH__/my_app` -# You will replace __YNH_RUBY_LOAD_ENV_PATH__ with $ynh_ruby_load_path +# You will replace __YNH_RUBY_LOAD_PATH__ with $ynh_ruby_load_path # # Or Ruby start the app directly, then you don't need to load the PATH variable # `ExecStart=__YNH_RUBY__ my_app run` @@ -201,7 +208,7 @@ export RBENV_ROOT="$rbenv_install_dir" # # usage: ynh_use_ruby # -# Requires YunoHost version 2.7.12 or higher. +# Requires YunoHost version 3.2.2 or higher. ynh_use_ruby () { ruby_version=$(ynh_app_setting_get --app=$app --key=ruby_version) @@ -246,7 +253,7 @@ ynh_use_ruby () { # usage: ynh_install_ruby --ruby_version=ruby_version # | arg: -v, --ruby_version= - Version of ruby to install. # -# Requires YunoHost version 2.7.12 or higher. +# Requires YunoHost version 3.2.2 or higher. ynh_install_ruby () { # Declare an array to define the options of this helper. local legacy_args=v @@ -464,7 +471,7 @@ ynh_cleanup_ruby () { # | returns: the database number to use ynh_redis_get_free_db() { local result max db - result="$(redis-cli INFO keyspace)" + result=$(redis-cli INFO keyspace) # get the num max=$(cat /etc/redis/redis.conf | grep ^databases | grep -Eow "[0-9]+") diff --git a/scripts/backup b/scripts/backup index 1f4c370..37a5e95 100644 --- a/scripts/backup +++ b/scripts/backup @@ -15,7 +15,7 @@ source /usr/share/yunohost/helpers #================================================= ynh_clean_setup () { - ynh_clean_check_starting + true } # Exit if an error occurs during the execution of the script ynh_abort_if_errors @@ -30,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) -unicorn_workers=$(ynh_app_setting_get --app=$app --key=unicorn_workers) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP diff --git a/scripts/change_url b/scripts/change_url index 1a5dbd5..becbf93 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -133,13 +133,11 @@ ynh_use_ruby exec_login_as $app RAILS_ENV=production bin/bundle exec script/discourse remap ${old_path%/}/uploads ${new_path%/}/uploads <<< "YES # " -rake_exec="exec_login_as $app RAILS_ENV=production bin/rake" - # Regenerate assets -ynh_exec_warn_less $rake_exec assets:precompile +ynh_exec_warn_less exec_login_as $app RAILS_ENV=production bin/rake assets:precompile # Regenerate all forum posts -ynh_exec_warn_less $rake_exec posts:rebake +ynh_exec_warn_less exec_login_as $app RAILS_ENV=production bin/rake posts:rebake #================================================= # GENERIC FINALISATION diff --git a/scripts/install b/scripts/install index 3820082..2839254 100644 --- a/scripts/install +++ b/scripts/install @@ -14,7 +14,6 @@ source /usr/share/yunohost/helpers #================================================= ynh_clean_setup () { - # Clean remainings not handled by remove script ynh_clean_check_starting } # Exit if an error occurs during the execution of the script @@ -26,8 +25,8 @@ ynh_abort_if_errors domain=$YNH_APP_ARG_DOMAIN path_url=$YNH_APP_ARG_PATH -admin=$YNH_APP_ARG_ADMIN is_public=$YNH_APP_ARG_IS_PUBLIC +admin=$YNH_APP_ARG_ADMIN app=$YNH_APP_INSTANCE_NAME @@ -65,8 +64,8 @@ ynh_app_setting_set --app=$app --key=admin --value=$admin #================================================= ynh_script_progression --message="Installing dependencies..." -ynh_install_app_dependencies $pkg_dependencies 2>/dev/null -ynh_install_ruby --ruby_version=$RUBY_VERSION 2>/dev/null +ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies $build_pkg_dependencies +ynh_exec_warn_less ynh_install_ruby --ruby_version=$ruby_version #================================================= # CREATE DEDICATED USER @@ -83,14 +82,13 @@ ynh_script_progression --message="Creating a PostgreSQL database..." db_name=$(ynh_sanitize_dbid --db_name=$app) db_user=$db_name -db_pwd=$(ynh_string_random) ynh_app_setting_set --app=$app --key=db_name --value=$db_name -ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd ynh_psql_test_if_first_run -ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd +ynh_psql_setup_db --db_user=$db_user --db_name=$db_name # Set extensions ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS hstore;" --database=$db_name ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --database=$db_name +db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -135,51 +133,17 @@ ynh_store_file_checksum --file="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # SPECIFIC SETUP #================================================= -# CONFIGURE DISCOURSE +# ADD A CONFIGURATION #================================================= -ynh_script_progression --message="Configuring Discourse..." +ynh_script_progression --message="Adding a configuration file..." -# Configure database -discourse_config_file="$final_path/config/discourse.conf" -cp $final_path/config/discourse_defaults.conf $discourse_config_file -ynh_replace_string --match_string="db_name = discourse" --replace_string="db_name = $db_name" --target_file="$discourse_config_file" -ynh_replace_string --match_string="db_username = discourse" --replace_string="db_username = $db_name" --target_file="$discourse_config_file" -ynh_replace_string --match_string="db_password =" --replace_string="db_password = $db_pwd" --target_file="$discourse_config_file" - -# Configure hostname -ynh_replace_string --match_string="hostname = \"www.example.com\"" --replace_string="hostname = \"$domain\"" --target_file="$discourse_config_file" -ynh_replace_string --match_string="relative_url_root =" --replace_string="relative_url_root = ${path_url%/}" --target_file="$discourse_config_file" - -# Serve static assets (i.e. images, js, etc.) -ynh_replace_string --match_string="serve_static_assets = false" --replace_string="serve_static_assets = true" --target_file="$discourse_config_file" - -# Don't show miniprofiler -ynh_replace_string --match_string="load_mini_profiler = true" --replace_string="load_mini_profiler = false" --target_file="$discourse_config_file" - -# Configure e-mail server -admin_mail=$(ynh_user_get_info "$admin" mail) -ynh_replace_string --match_string="developer_emails =" --replace_string="developer_emails = $admin_mail" --target_file="$discourse_config_file" -ynh_replace_string --match_string="smtp_address =" --replace_string="smtp_address = localhost" --target_file="$discourse_config_file" -ynh_replace_string --match_string="smtp_domain =" --replace_string="smtp_domain = $domain" --target_file="$discourse_config_file" -ynh_replace_string --match_string="smtp_enable_start_tls = true" --replace_string="smtp_enable_start_tls = false" --target_file="$discourse_config_file" - -# Configure redis +admin_mail=$(ynh_user_get_info --username=$admin --key=mail) redis_db=$(ynh_redis_get_free_db) ynh_app_setting_set --app="$app" --key=redis_db --value="$redis_db" -ynh_replace_string --match_string="redis_db = 0" --replace_string="redis_db = $redis_db" --target_file="$discourse_config_file" -# Don't notify on new versions (handled by the YunoHost package) -ynh_replace_string --match_string="new_version_emails = true" --replace_string="new_version_emails = false" --target_file="$discourse_config_file" +ynh_add_config --template="../conf/discourse_defaults.conf" --destination="$final_path/config/discourse.conf" -# Calculate and store the config file checksum -ynh_store_file_checksum --file="$discourse_config_file" - -# Configure LDAP plugin -ldap_config_file="$final_path/plugins/discourse-ldap-auth/config/settings.yml" -ynh_replace_string --match_string="adfs.example.com" --replace_string="localhost" --target_file="$ldap_config_file" -ynh_replace_string --match_string="dc=example,dc=com" --replace_string="ou=users,dc=yunohost,dc=org" --target_file="$ldap_config_file" -ynh_replace_string --match_string="sAMAccountName" --replace_string="uid" --target_file="$ldap_config_file" -ynh_store_file_checksum --file="$ldap_config_file" +ynh_add_config --template="../conf/settings.yml" --destination="$final_path/plugins/discourse-ldap-auth/config/settings.yml" # Disable svgo worker echo "svgo: false" > $final_path/.image_optim.yml @@ -193,11 +157,6 @@ ynh_script_progression --message="Setting up Unicorn..." secret="$(ynh_string_random)" ynh_add_config --template="../conf/secrets.yml" --destination="$final_path/config/secrets.yml" -# Set permissions to app files -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" - pushd "$final_path" ynh_use_ruby # Install bundler, a gems installer @@ -231,9 +190,11 @@ fi #================================================= ynh_script_progression --message="Preparing the database..." -rake_exec="exec_login_as $app RAILS_ENV=production bin/rake" -ynh_exec_warn_less $rake_exec db:migrate -ynh_exec_warn_less $rake_exec assets:precompile +ynh_exec_warn_less exec_login_as $app RAILS_ENV=production bin/rake db:migrate +ynh_exec_warn_less exec_login_as $app RAILS_ENV=production bin/rake assets:precompile + +ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies +ynh_package_autoremove #================================================= # POPULATE THE DATABASE @@ -262,7 +223,7 @@ ynh_script_progression --message="Creating Discourse admin user..." # Create a random password admin_pwd=$(ynh_string_random) -$rake_exec admin:create <<< "$admin_mail +exec_login_as $app RAILS_ENV=production bin/rake admin:create <<< "$admin_mail $admin_pwd $admin_pwd y @@ -276,7 +237,7 @@ ynh_script_progression --message="Configuring plugins..." # Patch ldap-auth plugin dependency (omniauth-ldap) to fix it when using domain subfolder # (Can only do that now because we are patching dependencies which have just been downloaded) # Patch applied: https://github.com/omniauth/omniauth-ldap/pull/16 -(cd $final_path/plugins/discourse-ldap-auth/gems/${RUBY_VERSION}/gems/omniauth-ldap*/ +(cd $final_path/plugins/discourse-ldap-auth/gems/${ruby_version}/gems/omniauth-ldap*/ patch -p1 < $YNH_CWD/../conf/ldap-auth-fix-subfolder.patch) #================================================= @@ -284,8 +245,6 @@ patch -p1 < $YNH_CWD/../conf/ldap-auth-fix-subfolder.patch) #================================================= ynh_script_progression --message="Configuring a systemd service..." -ynh_replace_string --match_string="__RBENV_ROOT__" --replace_string="$RBENV_ROOT" --target_file="../conf/systemd.service" - # We assume for the moment that ARM devices are only dual core, so # we restrict the number of workers to 2 (the default is 3) if [ -n "$(uname -m | grep arm)" ] ; then @@ -296,9 +255,7 @@ else unicorn_workers=3 fi ynh_app_setting_set --app=$app --key=unicorn_workers --value=$unicorn_workers - -ynh_replace_string --match_string="__ADDITIONAL_ENV__" --replace_string="$additional_env" --target_file="../conf/systemd.service" -ynh_replace_string --match_string="__LIBJEMALLOC__" --replace_string="$(ldconfig -p | grep libjemalloc | awk 'END {print $NF}')" --target_file="../conf/systemd.service" +libjemalloc="$(ldconfig -p | grep libjemalloc | awk 'END {print $NF}')" ynh_add_systemd_config #================================================= diff --git a/scripts/remove b/scripts/remove index 9f8a08c..1870a93 100644 --- a/scripts/remove +++ b/scripts/remove @@ -51,13 +51,6 @@ ynh_script_progression --message="Removing the PostgreSQL database..." # Remove a database if it exists, along with the associated user ynh_psql_remove_db --db_user="$db_user" --db_name="$db_name" -#================================================= -# REMOVE RUBY -#================================================= -ynh_script_progression --message="Removing Ruby..." - -ynh_remove_ruby - #================================================= # REMOVE THE REDIS DATABASE #================================================= @@ -65,14 +58,6 @@ ynh_script_progression --message="Removing the redis database..." ynh_redis_remove_db "$redis_db" -#================================================= -# REMOVE DEPENDENCIES -#================================================= -ynh_script_progression --message="Removing dependencies..." - -# Remove metapackage and its dependencies -ynh_remove_app_dependencies - #================================================= # REMOVE APP MAIN DIR #================================================= @@ -89,6 +74,15 @@ ynh_script_progression --message="Removing NGINX web server configuration..." # Remove the dedicated NGINX config ynh_remove_nginx_config +#================================================= +# REMOVE DEPENDENCIES +#================================================= +ynh_script_progression --message="Removing dependencies..." + +# Remove metapackage and its dependencies +ynh_remove_ruby +ynh_remove_app_dependencies + #================================================= # REMOVE LOGROTATE CONFIGURATION #================================================= diff --git a/scripts/restore b/scripts/restore index 3f53b85..95e7430 100644 --- a/scripts/restore +++ b/scripts/restore @@ -38,7 +38,8 @@ db_user=$db_name #================================================= ynh_script_progression --message="Validating restoration parameters..." -test ! -d $final_path || ynh_die --message="There is already a directory: $final_path " +test ! -d $final_path \ + || ynh_die --message="There is already a directory: $final_path " if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then : @@ -83,8 +84,20 @@ chown -R $app:www-data "$final_path" ynh_script_progression --message="Reinstalling dependencies..." # Define and install dependencies -ynh_install_app_dependencies $pkg_dependencies 2>/dev/null -ynh_install_ruby --ruby_version=$RUBY_VERSION 2>/dev/null +ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies $build_pkg_dependencies +ynh_exec_warn_less ynh_install_ruby --ruby_version=$ruby_version + +#================================================= +# RESTORE THE POSTGRESQL DATABASE +#================================================= +ynh_script_progression --message="Restoring the PostgreSQL database..." + +ynh_psql_test_if_first_run +db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) +ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd +ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS hstore;" --database=$db_name +ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --database=$db_name +ynh_psql_execute_file_as_root --file="./db.sql" --database="$db_name" #================================================= # REINSTALL BUNDLE GEM @@ -96,20 +109,6 @@ pushd "$final_path" ynh_gem install bundler popd -#================================================= -# RESTORE THE POSTGRESQL DATABASE -#================================================= -ynh_script_progression --message="Restoring the PostgreSQL database..." - -db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) -ynh_psql_test_if_first_run -ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd -# Set extensions -ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS hstore;" --database=$db_name -ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --database=$db_name -# Restore dump -ynh_psql_execute_file_as_root --file="./db.sql" --database="$db_name" - #================================================= # RESTORE SYSTEMD #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 46d7081..16da0f0 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -21,7 +21,8 @@ path_url=$(ynh_app_setting_get --app=$app --key=path) admin=$(ynh_app_setting_get --app=$app --key=admin) final_path=$(ynh_app_setting_get --app=$app --key=final_path) db_name=$(ynh_app_setting_get --app=$app --key=db_name) -db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) +db_user=$db_name +db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) redis_db=$(ynh_app_setting_get --app=$app --key=redis_db) unicorn_workers=$(ynh_app_setting_get --app=$app --key=unicorn_workers) @@ -39,32 +40,6 @@ ynh_script_progression --message="Checking version..." upgrade_type=$(ynh_check_app_version_changed) -#================================================= -# ENSURE DOWNWARD COMPATIBILITY -#================================================= -ynh_script_progression --message="Ensuring downward compatibility..." - -# If unicorn_workers doesn't exist, create it -if [ -z "$unicorn_workers" ] -then - # We assume for the moment that ARM devices are only dual core, so - # we restrict the number of workers to 2 (the default is 3) - if [ -n "$(uname -m | grep arm)" ] - then - unicorn_workers=2 - else - unicorn_workers=3 - fi - ynh_app_setting_set --app=$app --key=unicorn_workers --value=$unicorn_workers -fi - -# Cleaning legacy permissions -if ynh_legacy_permissions_exists; then - ynh_legacy_permissions_delete_all - - ynh_app_setting_delete --app=$app --key=is_public -fi - #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -96,6 +71,32 @@ ynh_script_progression --message="Stopping a systemd service..." ynh_systemd_action --service_name=$app --action="stop" --log_path="$final_path/log/unicorn.stderr.log" +#================================================= +# ENSURE DOWNWARD COMPATIBILITY +#================================================= +ynh_script_progression --message="Ensuring downward compatibility..." + +# If unicorn_workers doesn't exist, create it +if [ -z "$unicorn_workers" ] +then + # We assume for the moment that ARM devices are only dual core, so + # we restrict the number of workers to 2 (the default is 3) + if [ -n "$(uname -m | grep arm)" ] + then + unicorn_workers=2 + else + unicorn_workers=3 + fi + ynh_app_setting_set --app=$app --key=unicorn_workers --value=$unicorn_workers +fi + +# Cleaning legacy permissions +if ynh_legacy_permissions_exists; then + ynh_legacy_permissions_delete_all + + ynh_app_setting_delete --app=$app --key=is_public +fi + #================================================= # CREATE DEDICATED USER #================================================= @@ -190,62 +191,23 @@ ynh_store_file_checksum --file="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= ynh_script_progression --message="Upgrading dependencies..." -ynh_install_app_dependencies $pkg_dependencies 2>/dev/null -ynh_install_ruby --ruby_version=$RUBY_VERSION 2>/dev/null +ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies $build_pkg_dependencies +ynh_exec_warn_less ynh_install_ruby --ruby_version=$ruby_version ynh_use_ruby #================================================= # SPECIFIC UPGRADE #================================================= -# CONFIGURE DISCOURSE +# UPDATE A CONFIG FILE #================================================= if [ "$upgrade_type" == "UPGRADE_APP" ] then - ynh_script_progression --message="Configuring Discourse..." + ynh_script_progression --message="Updating a config file..." - # Configure Discourse - discourse_config_file="$final_path/config/discourse.conf" - # Make a backup of the original config file if modified - ynh_backup_if_checksum_is_different --file="$discourse_config_file" + ynh_add_config --template="../conf/discourse_defaults.conf" --destination="$final_path/config/discourse.conf" - cp $final_path/config/discourse_defaults.conf $discourse_config_file - - ynh_replace_string --match_string="db_name = discourse" --replace_string="db_name = $db_name" --target_file="$discourse_config_file" - ynh_replace_string --match_string="db_username = discourse" --replace_string="db_username = $db_name" --target_file="$discourse_config_file" - ynh_replace_string --match_string="db_password =" --replace_string="db_password = $db_pwd" --target_file="$discourse_config_file" - # Configure hostname - ynh_replace_string --match_string="hostname = \"www.example.com\"" --replace_string="hostname = \"$domain\"" --target_file="$discourse_config_file" - ynh_replace_string --match_string="relative_url_root =" --replace_string="relative_url_root = ${path_url%/}" --target_file="$discourse_config_file" - # Serve static assets (i.e. images, js, etc.) - ynh_replace_string --match_string="serve_static_assets = false" --replace_string="serve_static_assets = true" --target_file="$discourse_config_file" - # Don't show miniprofiler - ynh_replace_string --match_string="load_mini_profiler = true" --replace_string="load_mini_profiler = false" --target_file="$discourse_config_file" - # Configure e-mail server - admin_mail=$(ynh_user_get_info "$admin" mail) - ynh_replace_string --match_string="developer_emails =" --replace_string="developer_emails = $admin_mail" --target_file="$discourse_config_file" - ynh_replace_string --match_string="smtp_address =" --replace_string="smtp_address = localhost" --target_file="$discourse_config_file" - ynh_replace_string --match_string="smtp_domain =" --replace_string="smtp_domain = $domain" --target_file="$discourse_config_file" - ynh_replace_string --match_string="smtp_enable_start_tls = true" --replace_string="smtp_enable_start_tls = false" --target_file="$discourse_config_file" - # Configure redis - ynh_replace_string --match_string="redis_db = 0" --replace_string="redis_db = $redis_db" --target_file="$discourse_config_file" - # Don't notify on new versions (handled by the YunoHost package) - ynh_replace_string --match_string="new_version_emails = true" --replace_string="new_version_emails = false" --target_file="$discourse_config_file" - - # Calculate and store the config file checksum - ynh_store_file_checksum --file="$discourse_config_file" - - # Configure LDAP plugin - ldap_config_file="$final_path/plugins/discourse-ldap-auth/config/settings.yml" - # Make a backup of the original config file if modified - ynh_backup_if_checksum_is_different "$ldap_config_file" - - ynh_replace_string --match_string="adfs.example.com" --replace_string="localhost" --target_file="$ldap_config_file" - ynh_replace_string --match_string="dc=example,dc=com" --replace_string="ou=users,dc=yunohost,dc=org" --target_file="$ldap_config_file" - ynh_replace_string --match_string="sAMAccountName" --replace_string="uid" --target_file="$ldap_config_file" - - # Calculate and store the config file checksum - ynh_store_file_checksum --file="$ldap_config_file" + ynh_add_config --template="../conf/settings.yml" --destination="$final_path/plugins/discourse-ldap-auth/config/settings.yml" # Disable svgo worker echo "svgo: false" > $final_path/.image_optim.yml @@ -311,9 +273,8 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Preparing the database..." - rake_exec="exec_login_as $app RAILS_ENV=production bin/rake" - ynh_exec_warn_less $rake_exec db:migrate - ynh_exec_warn_less $rake_exec assets:precompile + ynh_exec_warn_less exec_login_as $app RAILS_ENV=production bin/rake db:migrate + ynh_exec_warn_less exec_login_as $app RAILS_ENV=production bin/rake assets:precompile fi #================================================= @@ -328,7 +289,7 @@ then # (Can only do that now because we are patching dependencies which have just been downloaded) # Patch applied: https://github.com/omniauth/omniauth-ldap/pull/16 ( - cd $final_path/plugins/discourse-ldap-auth/gems/${RUBY_VERSION}/gems/omniauth-ldap*/ + cd $final_path/plugins/discourse-ldap-auth/gems/${ruby_version}/gems/omniauth-ldap*/ patch -p1 < $YNH_CWD/../conf/ldap-auth-fix-subfolder.patch ) fi @@ -341,11 +302,8 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Configuring a systemd service..." - ynh_replace_string --match_string="__RBENV_ROOT__" --replace_string="$RBENV_ROOT" --target_file="../conf/systemd.service" - additional_env="UNICORN_WORKERS=$unicorn_workers" - ynh_replace_string --match_string="__ADDITIONAL_ENV__" --replace_string="$additional_env" --target_file="../conf/systemd.service" - ynh_replace_string --match_string="__LIBJEMALLOC__" --replace_string="$(ldconfig -p | grep libjemalloc | awk 'END {print $NF}')" --target_file="../conf/systemd.service" + libjemalloc="$(ldconfig -p | grep libjemalloc | awk 'END {print $NF}')" ynh_add_systemd_config fi From c0f48c30f81c2f3ff4ab20dde0052aade9852d6d Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Sun, 29 May 2022 15:36:18 +0000 Subject: [PATCH 08/15] Auto-update README --- README.md | 17 +++++++++-------- README_fr.md | 23 ++++++++++++++--------- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 977eca6..f6120b9 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ It shall NOT be edited by hand. # Discourse for YunoHost -[![Integration level](https://dash.yunohost.org/integration/discourse.svg)](https://dash.yunohost.org/appci/app/discourse) ![](https://ci-apps.yunohost.org/ci/badges/discourse.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/discourse.maintain.svg) +[![Integration level](https://dash.yunohost.org/integration/discourse.svg)](https://dash.yunohost.org/appci/app/discourse) ![Working status](https://ci-apps.yunohost.org/ci/badges/discourse.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/discourse.maintain.svg) [![Install Discourse with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=discourse) *[Lire ce readme en français.](./README_fr.md)* @@ -23,7 +23,7 @@ Discourse is modern forum software for your community. Use it as a mailing list, ## Screenshots -![](./doc/screenshots/screenshot.png) +![Screenshot of Discourse](./doc/screenshots/screenshot.png) ## Disclaimers / important information @@ -131,20 +131,21 @@ systemctl restart discourse ## Documentation and resources -* Official app website: http://Discourse.org -* Upstream app code repository: https://github.com/discourse/discourse -* YunoHost documentation for this app: https://yunohost.org/app_discourse -* Report a bug: https://github.com/YunoHost-Apps/discourse_ynh/issues +* Official app website: +* Upstream app code repository: +* YunoHost documentation for this app: +* Report a bug: ## Developer info Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/discourse_ynh/tree/testing). To try the testing branch, please proceed like that. -``` + +``` bash sudo yunohost app install https://github.com/YunoHost-Apps/discourse_ynh/tree/testing --debug or sudo yunohost app upgrade discourse -u https://github.com/YunoHost-Apps/discourse_ynh/tree/testing --debug ``` -**More info regarding app packaging:** https://yunohost.org/packaging_apps \ No newline at end of file +**More info regarding app packaging:** diff --git a/README_fr.md b/README_fr.md index 25d3fc7..04d1b21 100644 --- a/README_fr.md +++ b/README_fr.md @@ -1,10 +1,14 @@ + + # Discourse pour YunoHost -[![Niveau d'intégration](https://dash.yunohost.org/integration/discourse.svg)](https://dash.yunohost.org/appci/app/discourse) ![](https://ci-apps.yunohost.org/ci/badges/discourse.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/discourse.maintain.svg) +[![Niveau d'intégration](https://dash.yunohost.org/integration/discourse.svg)](https://dash.yunohost.org/appci/app/discourse) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/discourse.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/discourse.maintain.svg) [![Installer Discourse avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=discourse) *[Read this readme in english.](./README.md)* -*[Lire ce readme en français.](./README_fr.md)* > *Ce package vous permet d'installer Discourse rapidement et simplement sur un serveur YunoHost. Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.* @@ -19,7 +23,7 @@ Discourse est un logiciel de forum moderne pour votre communauté. Utilisez-le c ## Captures d'écran -![](./doc/screenshots/screenshot.png) +![Capture d'écran de Discourse](./doc/screenshots/screenshot.png) ## Avertissements / informations importantes @@ -190,20 +194,21 @@ systemctl restart discourse ## Documentations et ressources -* Site officiel de l'app : http://Discourse.org -* Dépôt de code officiel de l'app : https://github.com/discourse/discourse -* Documentation YunoHost pour cette app : https://yunohost.org/app_discourse -* Signaler un bug : https://github.com/YunoHost-Apps/discourse_ynh/issues +* Site officiel de l'app : +* Dépôt de code officiel de l'app : +* Documentation YunoHost pour cette app : +* Signaler un bug : ## Informations pour les développeurs Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/discourse_ynh/tree/testing). Pour essayer la branche testing, procédez comme suit. -``` + +``` bash sudo yunohost app install https://github.com/YunoHost-Apps/discourse_ynh/tree/testing --debug ou sudo yunohost app upgrade discourse -u https://github.com/YunoHost-Apps/discourse_ynh/tree/testing --debug ``` -**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps \ No newline at end of file +**Plus d'infos sur le packaging d'applications :** From c557a7b872ad7fd06105029b8b2b298faf1110de Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 2 Jun 2022 23:48:32 +0200 Subject: [PATCH 09/15] Update upgrade --- scripts/upgrade | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/upgrade b/scripts/upgrade index 16da0f0..1bb59eb 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -205,6 +205,7 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Updating a config file..." + admin_mail=$(ynh_user_get_info --username=$admin --key=mail) ynh_add_config --template="../conf/discourse_defaults.conf" --destination="$final_path/config/discourse.conf" ynh_add_config --template="../conf/settings.yml" --destination="$final_path/plugins/discourse-ldap-auth/config/settings.yml" From 77ad1bebc51e92ff6d8420e57146ceb28acf9cd2 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 3 Jun 2022 01:08:42 +0200 Subject: [PATCH 10/15] Update remove --- scripts/remove | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/remove b/scripts/remove index 1870a93..a604496 100644 --- a/scripts/remove +++ b/scripts/remove @@ -43,6 +43,14 @@ ynh_script_progression --message="Stopping and removing the systemd service..." # Remove the dedicated systemd config ynh_remove_systemd_config +#================================================= +# REMOVE LOGROTATE CONFIGURATION +#================================================= +ynh_script_progression --message="Removing logrotate configuration..." + +# Remove the app-specific logrotate config +ynh_remove_logrotate + #================================================= # REMOVE THE POSTGRESQL DATABASE #================================================= @@ -83,14 +91,6 @@ ynh_script_progression --message="Removing dependencies..." ynh_remove_ruby ynh_remove_app_dependencies -#================================================= -# REMOVE LOGROTATE CONFIGURATION -#================================================= -ynh_script_progression --message="Removing logrotate configuration..." - -# Remove the app-specific logrotate config -ynh_remove_logrotate - #================================================= # GENERIC FINALIZATION #================================================= From 039eff0e7fd1284e96ee991ff766f99e4e136aac Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 3 Jun 2022 01:08:48 +0200 Subject: [PATCH 11/15] Update restore --- scripts/restore | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/scripts/restore b/scripts/restore index 95e7430..e2342a8 100644 --- a/scripts/restore +++ b/scripts/restore @@ -109,6 +109,9 @@ pushd "$final_path" ynh_gem install bundler popd +ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies +ynh_package_autoremove + #================================================= # RESTORE SYSTEMD #================================================= @@ -117,6 +120,13 @@ ynh_script_progression --message="Restoring the systemd configuration..." ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service --quiet +#================================================= +# RESTORE THE LOGROTATE CONFIGURATION +#================================================= +ynh_script_progression --message="Restoring the logrotate configuration..." + +ynh_restore_file --origin_path="/etc/logrotate.d/$app" + #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= @@ -137,13 +147,6 @@ fi ynh_app_setting_set --app=$app --key=unicorn_workers --value=$unicorn_workers ynh_systemd_action --service_name=$app --action="start" --log_path="$final_path/log/unicorn.stderr.log" --line_match="INFO -- : worker=$((unicorn_workers-1)) ready" -#================================================= -# RESTORE THE LOGROTATE CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the logrotate configuration..." - -ynh_restore_file --origin_path="/etc/logrotate.d/$app" - #================================================= # GENERIC FINALIZATION #================================================= From 37eec48d0cce20bad03d1b84d051d759dbc0a9d2 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 3 Jun 2022 01:08:53 +0200 Subject: [PATCH 12/15] Update upgrade --- scripts/upgrade | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/upgrade b/scripts/upgrade index 1bb59eb..cd7476a 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -278,6 +278,9 @@ then ynh_exec_warn_less exec_login_as $app RAILS_ENV=production bin/rake assets:precompile fi +ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies +ynh_package_autoremove + #================================================= # CONFIGURE PLUGINS #================================================= From 45283b6b5db9270e815b0180916381f07e8a12c7 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 3 Jun 2022 01:27:11 +0200 Subject: [PATCH 13/15] Update change_url --- scripts/change_url | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/change_url b/scripts/change_url index becbf93..a04cb6f 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -32,7 +32,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) # Add settings here as needed by your application db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name -db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) +db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) unicorn_workers=$(ynh_app_setting_get --app=$app --key=unicorn_workers) #================================================= @@ -43,6 +43,7 @@ ynh_script_progression --message="Backing up the app before changing its URL (ma # Backup the current version of the app ynh_backup_before_upgrade ynh_clean_setup () { + ynh_clean_check_starting # 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" @@ -114,6 +115,9 @@ fi #================================================= # SPECIFIC MODIFICATIONS #================================================= +# UPDATE A CONFIG FILE +#================================================= +ynh_script_progression --message="Updating a config file..." discourse_config_file="$final_path/config/discourse.conf" # Configure hostname From 588c1d3eb64b4bda819697d9c4d50cef987c80eb Mon Sep 17 00:00:00 2001 From: yalh76 Date: Tue, 7 Jun 2022 20:16:04 +0200 Subject: [PATCH 14/15] Update manifest.json --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 84c868a..cad2a2b 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Discussion platform", "fr": "Plateforme de discussion" }, - "version": "2.7.13~ynh1", + "version": "2.7.13~ynh2", "url": "http://Discourse.org", "upstream": { "license": "GPL-2.0", From 895e686305eb1ffc950a3cf1ebef66ed9c1b0dc0 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Tue, 7 Jun 2022 18:16:08 +0000 Subject: [PATCH 15/15] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f6120b9..66d0299 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Discourse is modern forum software for your community. Use it as a mailing list, discussion forum, long-form chat room, and more! -**Shipped version:** 2.7.13~ynh1 +**Shipped version:** 2.7.13~ynh2 **Demo:** https://try.discourse.org diff --git a/README_fr.md b/README_fr.md index 04d1b21..01a165b 100644 --- a/README_fr.md +++ b/README_fr.md @@ -17,7 +17,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour Discourse est un logiciel de forum moderne pour votre communauté. Utilisez-le comme liste de diffusion, forum de discussion, salle de discussion longue durée, et plus encore ! -**Version incluse :** 2.7.13~ynh1 +**Version incluse :** 2.7.13~ynh2 **Démo :** https://try.discourse.org