From b9e6199d36345619da2aea9132c03afe7d8bf6fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 23 Nov 2020 22:36:49 +0100 Subject: [PATCH 01/33] Fix linter warning (#195) Co-authored-by: Pierre de La Morinerie --- check_process | 9 --------- 1 file changed, 9 deletions(-) diff --git a/check_process b/check_process index 29aff32..e03437e 100644 --- a/check_process +++ b/check_process @@ -23,16 +23,7 @@ # Checks not applicable setup_nourl=0 ;;; Levels - Level 1=auto - Level 2=auto - Level 3=auto - Level 4=auto Level 5=auto - Level 6=auto - Level 7=auto - Level 8=0 - Level 9=0 - Level 10=0 ;;; Options Email=kemenaran@gmail.com Notification=change From 38df7cde6b84d778c6e0bbb6c3dffc8716efcc43 Mon Sep 17 00:00:00 2001 From: Amy Blais Date: Fri, 4 Dec 2020 08:57:31 -0500 Subject: [PATCH 02/33] Propose Upgrading to Mattermost v5.29.1 Hi @kemenaran, Mattermost v5.29.1 release is officially out. You can find download links with hash numbers [here](https://community.mattermost.com/core/pl/yaiz48x5ppy99makhmw5jcccry). Changelog with notes on patch releases is available [here](https://docs.mattermost.com/administration/changelog.html). Thanks! --- conf/app.src | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/conf/app.src b/conf/app.src index a947b73..951e1ff 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,6 +1,6 @@ -SOURCE_URL=https://releases.mattermost.com/5.29.0/mattermost-5.29.0-linux-amd64.tar.gz -SOURCE_SUM=14c7aac7e39061b81085d3bab98a1de5e18adb24ecdc0e126b573cfd58b757e2 +SOURCE_URL=https://releases.mattermost.com/5.29.1/mattermost-5.29.1-linux-amd64.tar.gz +SOURCE_SUM=66175918186cf402213143903230cd8a8b4a96c18d2ee50445f303685accb2c7 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true -SOURCE_FILENAME=mattermost-5.29.0-linux-amd64.tar.gz +SOURCE_FILENAME=mattermost-5.29.1-linux-amd64.tar.gz From dbe805cf0eea0d56cfce12d82d36a0ad34532f72 Mon Sep 17 00:00:00 2001 From: Amy Blais Date: Fri, 4 Dec 2020 08:57:58 -0500 Subject: [PATCH 03/33] Update manifest.json --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 45e5d5e..c63e156 100644 --- a/manifest.json +++ b/manifest.json @@ -8,7 +8,7 @@ }, "url": "http://www.mattermost.org/", "license": "GPL-3.0-only", - "version": "5.29.0~ynh1", + "version": "5.29.1~ynh1", "maintainer": { "name": "pmorinerie", "email": "kemenaran@gmail.com" From 3326ca7487c29ed6bdd35c7720bd5d87137f16ce Mon Sep 17 00:00:00 2001 From: Amy Blais Date: Fri, 18 Dec 2020 13:53:06 -0500 Subject: [PATCH 04/33] Update app.src --- conf/app.src | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/conf/app.src b/conf/app.src index 951e1ff..5226b55 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,6 +1,6 @@ -SOURCE_URL=https://releases.mattermost.com/5.29.1/mattermost-5.29.1-linux-amd64.tar.gz -SOURCE_SUM=66175918186cf402213143903230cd8a8b4a96c18d2ee50445f303685accb2c7 +SOURCE_URL=https://releases.mattermost.com/5.30.1/mattermost-5.30.1-linux-amd64.tar.gz +SOURCE_SUM=14018addf86c040200515cb0141308a6d213f149f8afe425dd171347be516401 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true -SOURCE_FILENAME=mattermost-5.29.1-linux-amd64.tar.gz +SOURCE_FILENAME=mattermost-5.30.1-linux-amd64.tar.gz From 6623be967ea843a695da9f93da9a994e0615fd0c Mon Sep 17 00:00:00 2001 From: Amy Blais Date: Fri, 18 Dec 2020 13:54:17 -0500 Subject: [PATCH 05/33] Update manifest.json --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index c63e156..83a3f14 100644 --- a/manifest.json +++ b/manifest.json @@ -8,7 +8,7 @@ }, "url": "http://www.mattermost.org/", "license": "GPL-3.0-only", - "version": "5.29.1~ynh1", + "version": "5.30.1~ynh1", "maintainer": { "name": "pmorinerie", "email": "kemenaran@gmail.com" From 705b3da0e740aa09a6afb6d74315019bba0eb70e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 11 Jan 2021 23:46:48 +0100 Subject: [PATCH 06/33] repackage (#200) * repackage --- README.md | 77 ++++-- README_fr.md | 67 ++++++ check_process | 31 +-- conf/config.json | 544 +++++++++++++++++++++++++++++++++++++++++++ conf/systemd.service | 5 +- manifest.json | 60 +++-- scripts/_common.sh | 31 +++ scripts/backup | 50 ++-- scripts/change_url | 129 ++++++++++ scripts/install | 285 +++++++++++------------ scripts/remove | 70 +++--- scripts/restore | 112 ++++----- scripts/upgrade | 247 ++++++++++++-------- 13 files changed, 1296 insertions(+), 412 deletions(-) create mode 100644 README_fr.md create mode 100644 conf/config.json create mode 100644 scripts/_common.sh create mode 100644 scripts/change_url diff --git a/README.md b/README.md index e28685c..fc8491a 100644 --- a/README.md +++ b/README.md @@ -1,42 +1,71 @@ # Mattermost for YunoHost [![Integration level](https://dash.yunohost.org/integration/mattermost.svg)](https://dash.yunohost.org/appci/app/mattermost) ![](https://ci-apps.yunohost.org/ci/badges/mattermost.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/mattermost.maintain.svg) -[![Install Mattermost with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=mattermost) +[![Install Mattermost with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=mattermost) + +*[Lire ce readme en français.](./README_fr.md)* + +> *This package allows you to install Mattermost quickly and simply on a YunoHost server. +If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.* ## Overview -A Yunohost package for [Mattermost](http://www.mattermost.org/), an open-source, self-hosted alternative to Slack. +Mattermost est un logiciel et un service de messagerie instantanée libre auto-hébergeable. Il est conçu comme un chat interne pour les organisations et les entreprises, et il est présenté comme une alternative à Slack. -## Requirements +**Shipped version:** 5.30.1 -Mattermost requires: +## Screenshots -* A x86_64 system (check with `uname -m`) (ARM Raspberry Pi won’t work, sorry), -* Yunohost 3.0 or higher (check in Yunohost Admin panel), -* MySQL 5.6 or higher, or MariaDB 10 or higher (check with `mysql --version`). +![](https://ucarecdn.com/8cd90d9d-8902-4845-a15b-f4664e5fcfb3/-/format/auto/-/quality/lighter/-/max_icc_size/10/-/resize/1288x/) -## Installing +## Demo -You can either : +* [Official demo](Link to a demo site for this app.) -* Install by clicking the button above; -* Install from the Yunohost Admin web interface, from the Community Apps list; -* Install from the command-line: `sudo yunohost app install https://github.com/YunoHost-Apps/mattermost_ynh`. +## Configuration -## What works +How to configure this app: From an admin panel, a plain file with SSH, or any other way. -* Installation on domain root or sub-directory -* Notification emails -* Push notifications (through Mattermost relay server) -* Service control in Yunohost Services panel +## Documentation -## TODO + * Official documentation: https://docs.mattermost.com/ + * YunoHost documentation: https://yunohost.org/#/app_mattermost -* ARM compatible package for Raspberry Pi (see #124) -* LDAP integration (only paid Entreprise Edition, see [#58](https://github.com/YunoHost-Apps/mattermost_ynh/issues/58)) +## YunoHost specific features -## About telemetrics +#### Multi-user support -Mattermost can collect some anonymous telemetrics about your usage of the software. These data are sent to a third-party service named [segment.com](https://segment.com/). -You can find more information about this behavior in the [Mattermost documentation](https://docs.mattermost.com/administration/telemetry.html). + * Are LDAP and HTTP auth supported? **No** + * Can the app be used by multiple users? **Yes** -In this Yunohost package telemetrics collection is strictly opt-in, and can be turned on or off before the app is installed. +#### Supported architectures + +* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/mattermost%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/mattermost/) +* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/mattermost%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/mattermost/) + +## Limitations + +* Any known limitations. + +## Additional information + +* Other info you would like to add about this app. + +## Links + + * Report a bug: https://github.com/YunoHost-Apps/mattermost_ynh/issues + * App website: http://www.mattermost.org/ + * Upstream app repository: https://github.com/mattermost/mattermost-server + * YunoHost website: https://yunohost.org/ + +--- + +## Developer info + +Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/mattermost_ynh/tree/testing). + +To try the testing branch, please proceed like that. +``` +sudo yunohost app install https://github.com/YunoHost-Apps/mattermost_ynh/tree/testing --debug +or +sudo yunohost app upgrade mattermost -u https://github.com/YunoHost-Apps/mattermost_ynh/tree/testing --debug +``` diff --git a/README_fr.md b/README_fr.md new file mode 100644 index 0000000..c043aa4 --- /dev/null +++ b/README_fr.md @@ -0,0 +1,67 @@ +# Mattermost pour YunoHost + +[![Niveau d'intégration](https://dash.yunohost.org/integration/mattermost.svg)](https://dash.yunohost.org/appci/app/mattermost) ![](https://ci-apps.yunohost.org/ci/badges/mattermost.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/mattermost.maintain.svg) +[![Installer Mattermost avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=mattermost) + +*[Read this readme in english.](./README.md)* + +> *Ce package vous permet d'installer Mattermost rapidement et simplement sur un serveur YunoHost. +Si vous n'avez pas YunoHost, consultez [le guide](https://yunohost.org/#/install) pour apprendre comment l'installer.* + +## Vue d'ensemble +Mattermost est un logiciel et un service de messagerie instantanée libre auto-hébergeable. Il est conçu comme un chat interne pour les organisations et les entreprises, et il est présenté comme une alternative à Slack. + +**Version incluse :** 5.30.1 + +## Captures d'écran + +![](https://ucarecdn.com/8cd90d9d-8902-4845-a15b-f4664e5fcfb3/-/format/auto/-/quality/lighter/-/max_icc_size/10/-/resize/1288x/) + +## Configuration + + * Comment configurer cette application : via le panneau d'administration + +## Documentation + + * Documentation officielle : https://docs.mattermost.com/ + * Documentation YunoHost : https://yunohost.org/#/app_mattermost_fr + +## Caractéristiques spécifiques YunoHost + +#### Support multi-utilisateur + + * L'authentification LDAP et HTTP est-elle prise en charge ? **Non** + * L'application peut-elle être utilisée par plusieurs utilisateurs ? **Oui** + +#### Supported architectures + +* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/mattermost%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/mattermost/) +* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/mattermost%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/mattermost/) + +## Limitations + +* Limitations connues. + +## Informations additionnelles + +* Autres informations que vous souhaitez ajouter sur cette application. + +## Liens + + * Signaler un bug : https://github.com/YunoHost-Apps/mattermost_ynh/issues + * Site de l'application : http://www.mattermost.org/ + * Dépôt de l'application principale : https://github.com/mattermost/mattermost-server + * Site web YunoHost : https://yunohost.org/ + +--- + +## Informations pour les développeurs + +Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/mattermost_ynh/tree/testing). + +Pour essayer la branche testing, procédez comme suit. +``` +sudo yunohost app install https://github.com/YunoHost-Apps/mattermost_ynh/tree/testing --debug +ou +sudo yunohost app upgrade mattermost -u https://github.com/YunoHost-Apps/mattermost_ynh/tree/testing --debug +``` diff --git a/check_process b/check_process index e03437e..d6be4a9 100644 --- a/check_process +++ b/check_process @@ -1,29 +1,32 @@ -;; Mattermost +# See here for more information +# https://github.com/YunoHost/package_check#syntax-check_process-file + +;; Test complet ; Manifest - domain="ynhtests.local" (DOMAIN) - path="/path" (PATH) - admin_email="john@gmail.com" - admin_password="admin!42" - admin_locale="fr" + domain="domain.tld" (DOMAIN) + path="/path" (PATH) + admin="john" (USER) + email="john@gmail.com" + password="admin!42" + language="fr" team_display_name="Mon équipe" is_public=1 (PUBLIC|public=1|private=0) - analytics=0 ; Checks pkg_linter=1 setup_sub_dir=1 setup_root=1 + setup_nourl=0 setup_private=1 setup_public=1 upgrade=1 backup_restore=1 multi_instance=1 - port_already_use=1 (8085) - # Checks not supported yet + port_already_use=0 change_url=0 - # Checks not applicable - setup_nourl=0 -;;; Levels - Level 5=auto ;;; Options Email=kemenaran@gmail.com -Notification=change +Notification=none +;;; Upgrade options + ; commit=CommitHash + name=Name and date of the commit. + manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666& diff --git a/conf/config.json b/conf/config.json new file mode 100644 index 0000000..54aecd3 --- /dev/null +++ b/conf/config.json @@ -0,0 +1,544 @@ +{ + "ServiceSettings": { + "SiteURL": "__URL__", + "WebsocketURL": "", + "LicenseFileLocation": "", + "ListenAddress": "__PORT__", + "ConnectionSecurity": "", + "TLSCertFile": "", + "TLSKeyFile": "", + "TLSMinVer": "1.2", + "TLSStrictTransport": false, + "TLSStrictTransportMaxAge": 63072000, + "TLSOverwriteCiphers": [], + "UseLetsEncrypt": false, + "LetsEncryptCertificateCacheFile": "./config/letsencrypt.cache", + "Forward80To443": false, + "TrustedProxyIPHeader": [], + "ReadTimeout": 300, + "WriteTimeout": 300, + "IdleTimeout": 60, + "MaximumLoginAttempts": 10, + "GoroutineHealthThreshold": -1, + "GoogleDeveloperKey": "", + "EnableOAuthServiceProvider": false, + "EnableIncomingWebhooks": true, + "EnableOutgoingWebhooks": true, + "EnableCommands": true, + "EnableOnlyAdminIntegrations": true, + "EnablePostUsernameOverride": false, + "EnablePostIconOverride": false, + "EnableLinkPreviews": true, + "EnableTesting": false, + "EnableDeveloper": false, + "EnableOpenTracing": false, + "EnableSecurityFixAlert": true, + "EnableInsecureOutgoingConnections": false, + "AllowedUntrustedInternalConnections": "", + "EnableMultifactorAuthentication": false, + "EnforceMultifactorAuthentication": false, + "EnableUserAccessTokens": false, + "AllowCorsFrom": "", + "CorsExposedHeaders": "", + "CorsAllowCredentials": false, + "CorsDebug": false, + "AllowCookiesForSubdomains": false, + "ExtendSessionLengthWithActivity": true, + "SessionLengthWebInDays": 30, + "SessionLengthMobileInDays": 30, + "SessionLengthSSOInDays": 30, + "SessionCacheInMinutes": 10, + "SessionIdleTimeoutInMinutes": 43200, + "WebsocketSecurePort": 443, + "WebsocketPort": 80, + "WebserverMode": "gzip", + "EnableCustomEmoji": true, + "EnableEmojiPicker": true, + "EnableGifPicker": true, + "GfycatApiKey": "2_KtH_W5", + "GfycatApiSecret": "3wLVZPiswc3DnaiaFoLkDvB4X0IV6CpMkj4tf2inJRsBY6-FnkT08zGmppWFgeof", + "RestrictCustomEmojiCreation": "all", + "RestrictPostDelete": "all", + "AllowEditPost": "always", + "PostEditTimeLimit": -1, + "TimeBetweenUserTypingUpdatesMilliseconds": 5000, + "EnablePostSearch": true, + "MinimumHashtagLength": 3, + "EnableUserTypingMessages": true, + "EnableChannelViewedMessages": true, + "EnableUserStatuses": true, + "ExperimentalEnableAuthenticationTransfer": true, + "ClusterLogTimeoutMilliseconds": 2000, + "CloseUnusedDirectMessages": false, + "EnablePreviewFeatures": true, + "EnableTutorial": true, + "ExperimentalEnableDefaultChannelLeaveJoinMessages": true, + "ExperimentalGroupUnreadChannels": "disabled", + "ExperimentalChannelOrganization": false, + "ExperimentalChannelSidebarOrganization": "disabled", + "ExperimentalDataPrefetch": true, + "ImageProxyType": "", + "ImageProxyURL": "", + "ImageProxyOptions": "", + "EnableAPITeamDeletion": false, + "EnableAPIUserDeletion": false, + "ExperimentalEnableHardenedMode": false, + "DisableLegacyMFA": true, + "ExperimentalStrictCSRFEnforcement": false, + "EnableEmailInvitations": false, + "DisableBotsWhenOwnerIsDeactivated": true, + "EnableBotAccountCreation": false, + "EnableSVGs": false, + "EnableLatex": false, + "EnableAPIChannelDeletion": false, + "EnableLocalMode": false, + "LocalModeSocketLocation": "/var/tmp/mattermost_local.socket", + "EnableAWSMetering": false, + "SplitKey": "", + "FeatureFlagSyncIntervalSeconds": 30, + "DebugSplit": false, + "ThreadAutoFollow": true, + "ManagedResourcePaths": "" + }, + "TeamSettings": { + "SiteName": "Mattermost", + "MaxUsersPerTeam": 50, + "EnableTeamCreation": true, + "EnableUserCreation": true, + "EnableOpenServer": false, + "EnableUserDeactivation": false, + "RestrictCreationToDomains": "", + "EnableCustomBrand": false, + "CustomBrandText": "", + "CustomDescriptionText": "", + "RestrictDirectMessage": "any", + "RestrictTeamInvite": "all", + "RestrictPublicChannelManagement": "all", + "RestrictPrivateChannelManagement": "all", + "RestrictPublicChannelCreation": "all", + "RestrictPrivateChannelCreation": "all", + "RestrictPublicChannelDeletion": "all", + "RestrictPrivateChannelDeletion": "all", + "RestrictPrivateChannelManageMembers": "all", + "EnableXToLeaveChannelsFromLHS": false, + "UserStatusAwayTimeout": 300, + "MaxChannelsPerTeam": 2000, + "MaxNotificationsPerChannel": 1000, + "EnableConfirmNotificationsToChannel": true, + "TeammateNameDisplay": "username", + "ExperimentalViewArchivedChannels": true, + "ExperimentalEnableAutomaticReplies": false, + "ExperimentalHideTownSquareinLHS": false, + "ExperimentalTownSquareIsReadOnly": false, + "LockTeammateNameDisplay": false, + "ExperimentalPrimaryTeam": "", + "ExperimentalDefaultChannels": [] + }, + "ClientRequirements": { + "AndroidLatestVersion": "", + "AndroidMinVersion": "", + "DesktopLatestVersion": "", + "DesktopMinVersion": "", + "IosLatestVersion": "", + "IosMinVersion": "" + }, + "SqlSettings": { + "DriverName": "mysql", + "DataSource": "__DB_USER__:__DB_PASS__@tcp(localhost:3306)/__DB_NAME__?charset=utf8mb4,utf8", + "DataSourceReplicas": [], + "DataSourceSearchReplicas": [], + "MaxIdleConns": 20, + "ConnMaxLifetimeMilliseconds": 3600000, + "MaxOpenConns": 300, + "Trace": false, + "AtRestEncryptKey": "", + "QueryTimeout": 30, + "DisableDatabaseSearch": false + }, + "LogSettings": { + "EnableConsole": true, + "ConsoleLevel": "INFO", + "ConsoleJson": true, + "EnableFile": true, + "FileLevel": "INFO", + "FileJson": true, + "FileLocation": "", + "EnableWebhookDebugging": true, + "EnableDiagnostics": false, + "EnableSentry": true, + "AdvancedLoggingConfig": "" + }, + "ExperimentalAuditSettings": { + "FileEnabled": false, + "FileName": "", + "FileMaxSizeMB": 100, + "FileMaxAgeDays": 0, + "FileMaxBackups": 0, + "FileCompress": false, + "FileMaxQueueSize": 1000, + "AdvancedLoggingConfig": "" + }, + "NotificationLogSettings": { + "EnableConsole": false, + "ConsoleLevel": "INFO", + "ConsoleJson": true, + "EnableFile": true, + "FileLevel": "INFO", + "FileJson": true, + "FileLocation": "__LOG__", + "AdvancedLoggingConfig": "" + }, + "PasswordSettings": { + "MinimumLength": 8, + "Lowercase": false, + "Number": false, + "Uppercase": false, + "Symbol": false + }, + "FileSettings": { + "EnableFileAttachments": true, + "EnableMobileUpload": true, + "EnableMobileDownload": true, + "MaxFileSize": 52428800, + "DriverName": "local", + "Directory": "__DATA__", + "EnablePublicLink": false, + "PublicLinkSalt": "", + "InitialFont": "nunito-bold.ttf", + "AmazonS3AccessKeyId": "", + "AmazonS3SecretAccessKey": "", + "AmazonS3Bucket": "", + "AmazonS3PathPrefix": "", + "AmazonS3Region": "", + "AmazonS3Endpoint": "s3.amazonaws.com", + "AmazonS3SSL": true, + "AmazonS3SignV2": false, + "AmazonS3SSE": false, + "AmazonS3Trace": false + }, + "EmailSettings": { + "EnableSignUpWithEmail": true, + "EnableSignInWithEmail": true, + "EnableSignInWithUsername": true, + "SendEmailNotifications": true, + "UseChannelInEmailNotifications": false, + "RequireEmailVerification": false, + "FeedbackName": "Mattermost notification", + "FeedbackEmail": "__FEEDBACK__", + "ReplyToAddress": "", + "FeedbackOrganization": "", + "EnableSMTPAuth": false, + "SMTPUsername": "__USER__", + "SMTPPassword": "__USER_PW__", + "SMTPServer": "localhost", + "SMTPPort": "25", + "SMTPServerTimeout": 10, + "ConnectionSecurity": "", + "SendPushNotifications": true, + "PushNotificationServer": "https://push-test.mattermost.com", + "PushNotificationContents": "full", + "PushNotificationBuffer": 1000, + "EnableEmailBatching": false, + "EmailBatchingBufferSize": 256, + "EmailBatchingInterval": 30, + "EnablePreviewModeBanner": true, + "SkipServerCertificateVerification": false, + "EmailNotificationContentsType": "full", + "LoginButtonColor": "#0000", + "LoginButtonBorderColor": "#2389D7", + "LoginButtonTextColor": "#2389D7" + }, + "RateLimitSettings": { + "Enable": false, + "PerSec": 10, + "MaxBurst": 100, + "MemoryStoreSize": 10000, + "VaryByRemoteAddr": true, + "VaryByUser": false, + "VaryByHeader": "" + }, + "PrivacySettings": { + "ShowEmailAddress": true, + "ShowFullName": true + }, + "SupportSettings": { + "TermsOfServiceLink": "https://about.mattermost.com/default-terms/", + "PrivacyPolicyLink": "https://about.mattermost.com/default-privacy-policy/", + "AboutLink": "https://about.mattermost.com/default-about/", + "HelpLink": "https://about.mattermost.com/default-help/", + "ReportAProblemLink": "https://about.mattermost.com/default-report-a-problem/", + "SupportEmail": "feedback@mattermost.com", + "CustomTermsOfServiceEnabled": false, + "CustomTermsOfServiceReAcceptancePeriod": 365, + "EnableAskCommunityLink": true + }, + "AnnouncementSettings": { + "EnableBanner": false, + "BannerText": "", + "BannerColor": "#f2a93b", + "BannerTextColor": "#333333", + "AllowBannerDismissal": true, + "AdminNoticesEnabled": true, + "UserNoticesEnabled": true, + "NoticesURL": "https://notices.mattermost.com/", + "NoticesFetchFrequency": 3600, + "NoticesSkipCache": false + }, + "ThemeSettings": { + "EnableThemeSelection": true, + "DefaultTheme": "default", + "AllowCustomThemes": true, + "AllowedThemes": [] + }, + "GitLabSettings": { + "Enable": false, + "Secret": "", + "Id": "", + "Scope": "", + "AuthEndpoint": "", + "TokenEndpoint": "", + "UserApiEndpoint": "" + }, + "GoogleSettings": { + "Enable": false, + "Secret": "", + "Id": "", + "Scope": "profile email", + "AuthEndpoint": "https://accounts.google.com/o/oauth2/v2/auth", + "TokenEndpoint": "https://www.googleapis.com/oauth2/v4/token", + "UserApiEndpoint": "https://people.googleapis.com/v1/people/me?personFields=names,emailAddresses,nicknames,metadata" + }, + "Office365Settings": { + "Enable": false, + "Secret": "", + "Id": "", + "Scope": "User.Read", + "AuthEndpoint": "https://login.microsoftonline.com/common/oauth2/v2.0/authorize", + "TokenEndpoint": "https://login.microsoftonline.com/common/oauth2/v2.0/token", + "UserApiEndpoint": "https://graph.microsoft.com/v1.0/me", + "DirectoryId": "" + }, + "LdapSettings": { + "Enable": false, + "EnableSync": false, + "LdapServer": "ldap://127.0.0.1", + "LdapPort": 389, + "ConnectionSecurity": "", + "BaseDN": "ou=users,dc=yunohost,dc=org", + "BindUsername": "cn", + "BindPassword": "", + "UserFilter": "", + "GroupFilter": "(&(|(objectclass=posixAccount))(uid={{username}})(permission=cn=mattermost.main,ou=permission,dc=yunohost,dc=org))", + "GuestFilter": "", + "EnableAdminFilter": false, + "AdminFilter": "", + "GroupDisplayNameAttribute": "", + "GroupIdAttribute": "", + "FirstNameAttribute": "", + "LastNameAttribute": "", + "EmailAttribute": "", + "UsernameAttribute": "", + "NicknameAttribute": "", + "IdAttribute": "", + "PositionAttribute": "", + "LoginIdAttribute": "", + "PictureAttribute": "", + "SyncIntervalMinutes": 60, + "SkipCertificateVerification": false, + "PublicCertificateFile": "", + "PrivateKeyFile": "", + "QueryTimeout": 60, + "MaxPageSize": 0, + "LoginFieldName": "", + "LoginButtonColor": "#0000", + "LoginButtonBorderColor": "#2389D7", + "LoginButtonTextColor": "#2389D7", + "Trace": false + }, + "ComplianceSettings": { + "Enable": false, + "Directory": "./data/", + "EnableDaily": false + }, + "LocalizationSettings": { + "DefaultServerLocale": "__LANGUAGE__", + "DefaultClientLocale": "__LANGUAGE__", + "AvailableLocales": "" + }, + "SamlSettings": { + "Enable": false, + "EnableSyncWithLdap": false, + "EnableSyncWithLdapIncludeAuth": false, + "IgnoreGuestsLdapSync": false, + "Verify": true, + "Encrypt": true, + "SignRequest": false, + "IdpUrl": "", + "IdpDescriptorUrl": "", + "IdpMetadataUrl": "", + "ServiceProviderIdentifier": "", + "AssertionConsumerServiceURL": "", + "SignatureAlgorithm": "RSAwithSHA1", + "CanonicalAlgorithm": "Canonical1.0", + "ScopingIDPProviderId": "", + "ScopingIDPName": "", + "IdpCertificateFile": "", + "PublicCertificateFile": "", + "PrivateKeyFile": "", + "IdAttribute": "", + "GuestAttribute": "", + "EnableAdminAttribute": false, + "AdminAttribute": "", + "FirstNameAttribute": "", + "LastNameAttribute": "", + "EmailAttribute": "", + "UsernameAttribute": "", + "NicknameAttribute": "", + "LocaleAttribute": "", + "PositionAttribute": "", + "LoginButtonText": "SAML", + "LoginButtonColor": "#34a28b", + "LoginButtonBorderColor": "#2389D7", + "LoginButtonTextColor": "#ffffff" + }, + "NativeAppSettings": { + "AppDownloadLink": "https://mattermost.com/download/#mattermostApps", + "AndroidAppDownloadLink": "https://about.mattermost.com/mattermost-android-app/", + "IosAppDownloadLink": "https://about.mattermost.com/mattermost-ios-app/" + }, + "ClusterSettings": { + "Enable": false, + "ClusterName": "", + "OverrideHostname": "", + "NetworkInterface": "", + "BindAddress": "", + "AdvertiseAddress": "", + "UseIpAddress": true, + "UseExperimentalGossip": false, + "EnableExperimentalGossipEncryption": false, + "ReadOnlyConfig": true, + "GossipPort": 8074, + "StreamingPort": 8075, + "MaxIdleConns": 100, + "MaxIdleConnsPerHost": 128, + "IdleConnTimeoutMilliseconds": 90000 + }, + "MetricsSettings": { + "Enable": false, + "BlockProfileRate": 0, + "ListenAddress": ":8067" + }, + "ExperimentalSettings": { + "ClientSideCertEnable": false, + "ClientSideCertCheck": "secondary", + "EnableClickToReply": false, + "LinkMetadataTimeoutMilliseconds": 5000, + "RestrictSystemAdmin": false, + "UseNewSAMLLibrary": false, + "CloudUserLimit": 0, + "CloudBilling": false, + "EnableSharedChannels": false + }, + "AnalyticsSettings": { + "MaxUsersForStatistics": 2500 + }, + "ElasticsearchSettings": { + "ConnectionUrl": "http://localhost:9200", + "Username": "elastic", + "Password": "changeme", + "EnableIndexing": false, + "EnableSearching": false, + "EnableAutocomplete": false, + "Sniff": true, + "PostIndexReplicas": 1, + "PostIndexShards": 1, + "ChannelIndexReplicas": 1, + "ChannelIndexShards": 1, + "UserIndexReplicas": 1, + "UserIndexShards": 1, + "AggregatePostsAfterDays": 365, + "PostsAggregatorJobStartTime": "03:00", + "IndexPrefix": "", + "LiveIndexingBatchSize": 1, + "BulkIndexingTimeWindowSeconds": 3600, + "RequestTimeoutSeconds": 30, + "SkipTLSVerification": false, + "Trace": "" + }, + "BleveSettings": { + "IndexDir": "", + "EnableIndexing": false, + "EnableSearching": false, + "EnableAutocomplete": false, + "BulkIndexingTimeWindowSeconds": 3600 + }, + "DataRetentionSettings": { + "EnableMessageDeletion": false, + "EnableFileDeletion": false, + "MessageRetentionDays": 365, + "FileRetentionDays": 365, + "DeletionJobStartTime": "02:00" + }, + "MessageExportSettings": { + "EnableExport": false, + "ExportFormat": "actiance", + "DailyRunTime": "01:00", + "ExportFromTimestamp": 0, + "BatchSize": 10000, + "DownloadExportResults": false, + "GlobalRelaySettings": { + "CustomerType": "A9", + "SmtpUsername": "", + "SmtpPassword": "", + "EmailAddress": "", + "SMTPServerTimeout": 1800 + } + }, + "JobSettings": { + "RunJobs": true, + "RunScheduler": true + }, + "PluginSettings": { + "Enable": true, + "EnableUploads": false, + "AllowInsecureDownloadUrl": false, + "EnableHealthCheck": true, + "Directory": "./plugins", + "ClientDirectory": "./client/plugins", + "Plugins": {}, + "PluginStates": { + "com.mattermost.nps": { + "Enable": true + } + }, + "EnableMarketplace": true, + "EnableRemoteMarketplace": true, + "AutomaticPrepackagedPlugins": true, + "RequirePluginSignature": false, + "MarketplaceUrl": "https://api.integrations.mattermost.com", + "SignaturePublicKeyFiles": [] + }, + "DisplaySettings": { + "CustomUrlSchemes": [], + "ExperimentalTimezone": true + }, + "GuestAccountsSettings": { + "Enable": false, + "AllowEmailAccounts": true, + "EnforceMultifactorAuthentication": false, + "RestrictCreationToDomains": "" + }, + "ImageProxySettings": { + "Enable": false, + "ImageProxyType": "local", + "RemoteImageProxyURL": "", + "RemoteImageProxyOptions": "" + }, + "CloudSettings": { + "CWSUrl": "https://customers.mattermost.com" + }, + "FeatureFlags": { + "TestFeature": "off", + "CloudDelinquentEmailJobsEnabled": false + } +} \ No newline at end of file diff --git a/conf/systemd.service b/conf/systemd.service index f9b7136..0a3b276 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -1,6 +1,3 @@ -# This file is managed by the Yunohost Mattermost package, -# and will be overwritten on upgrade. - [Unit] Description=Mattermost After=network.target @@ -15,7 +12,7 @@ Restart=always RestartSec=10 WorkingDirectory=__FINALPATH__ User=__APP__ -Group=www-data +Group=__APP__ LimitNOFILE=49152 [Install] diff --git a/manifest.json b/manifest.json index 83a3f14..f628a74 100644 --- a/manifest.json +++ b/manifest.json @@ -1,24 +1,25 @@ { - "packaging_format": 1, "name": "Mattermost", "id": "mattermost", + "packaging_format": 1, "description": { - "en": "An open-source, self-hosted alternative to Slack", - "fr": "Une alternative open-source et auto-hébergée à Slack" + "en": "Open source collaboration platform built for developers", + "fr": "Plateforme de collaboration open source conçue pour les développeurs" }, + "version": "5.30.1~ynh1", "url": "http://www.mattermost.org/", "license": "GPL-3.0-only", - "version": "5.30.1~ynh1", "maintainer": { "name": "pmorinerie", "email": "kemenaran@gmail.com" }, "multi_instance": true, "services": [ - "nginx" + "nginx", + "mysql" ], "requirements": { - "yunohost": ">= 3.0.0" + "yunohost": ">= 3.8.1" }, "arguments": { "install" : [ @@ -38,45 +39,48 @@ "en": "Choose a path for Mattermost", "fr": "Choisissez un chemin pour Mattermost" }, - "example": "/chat", - "default": "/chat" + "example": "/mattermost", + "default": "/mattermost" }, { "name": "is_public", "type": "boolean", "ask": { - "en": "Can users non registered on Yunohost access this chat?", - "fr": "Les invités non-enregistrés sur Yunohost peuvent-ils accéder à ce chat ?" + "en": "Is it a public application?", + "fr": "Est-ce une application publique ?" + }, + "help": { + "en": "If enabled, Mattermost will be accessible by people who do not have an account. This can be changed later via the webadmin.", + "fr": "Si cette case est cochée, Mattermost sera accessible aux personnes n’ayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin." }, "default": true }, { - "name": "admin_email", - "type": "string", + "name": "admin", + "type": "user", "ask": { - "en": "Login email for the chat admin", - "fr": "Adresse email de login pour l’administrateur du chat" + "en": "Choose an admin user", + "fr": "Choisissez l'administrateur" }, - "example": "john@gmail.com", - "optional": false + "example": "johndoe" }, { - "name": "admin_password", + "name": "password", "type": "password", "ask": { - "en": "Password for the chat admin. At least 8 characters.", - "fr": "Mot de passe pour l’administrateur du chat. Minimum 8 caractères." + "en": "Set the administrator password", + "fr": "Définissez le mot de passe administrateur" }, - "optional": false + "example": "Choose a password" }, { - "name": "admin_locale", + "name": "language", "type": "string", "ask": { "en": "Choose the language of the chat for the admin", "fr": "Choissisez la langue utilisée pour l'administrateur" }, - "choices": ["en", "fr"], + "choices": ["de", "en", "es", "fr", "it", "pt"], "default": "en" }, { @@ -87,17 +91,7 @@ "fr": "Choisissez le nom de l’équipe" }, "example": "Team", - "default": "Team", - "optional": false - }, - { - "name": "analytics", - "type": "boolean", - "ask": { - "en": "Allow Mattermost to send some telemetrics about your usage of this app?", - "fr": "Autorisez-vous Mattermost à envoyer des informations anonymes sur votre usage de l’application ?" - }, - "default": false + "default": "Team" } ] } diff --git a/scripts/_common.sh b/scripts/_common.sh new file mode 100644 index 0000000..7401a47 --- /dev/null +++ b/scripts/_common.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +#================================================= +# COMMON VARIABLES +#================================================= + +#================================================= +# PERSONAL HELPERS +#================================================= + +#================================================= +# EXPERIMENTAL HELPERS +#================================================= + +#================================================= +# FUTURE OFFICIAL HELPERS +#================================================= + +# Execute a command as another user +# usage: ynh_exec_as USER COMMAND [ARG ...] +ynh_exec_as() { + local USER=$1 + shift 1 + + if [[ $USER = $(whoami) ]]; then + eval "$@" + else + sudo -u "$USER" "$@" + fi +} + diff --git a/scripts/backup b/scripts/backup index 859f559..a97b6a8 100755 --- a/scripts/backup +++ b/scripts/backup @@ -10,49 +10,67 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= +ynh_clean_setup () { + ynh_clean_check_starting +} # Exit if an error occurs during the execution of the script ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= +ynh_print_info --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME -final_path="/var/www/$app" -data_path="/home/yunohost.app/$app" -domain=$(ynh_app_setting_get $app domain) -db_name="$app" +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) #================================================= -# STANDARD BACKUP STEPS +# DECLARE DATA AND CONF FILES TO BACKUP +#================================================= +ynh_print_info --message="Declaring files to be backed up..." + #================================================= # BACKUP THE APP MAIN DIR #================================================= -ynh_backup "$final_path" +ynh_backup --src_path="$final_path" #================================================= # BACKUP THE APP DATA #================================================= -ynh_backup "$data_path" - -#================================================= -# BACKUP THE DATABASE -#================================================= - -ynh_mysql_dump_db "$db_name" > db.sql -ynh_backup "db.sql" +ynh_backup --src_path="/home/yunohost.app/$app" #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= -ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" +ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" + +#================================================= +# BACKUP LOGROTATE +#================================================= + +ynh_backup --src_path="/etc/logrotate.d/$app" #================================================= # BACKUP SYSTEMD #================================================= -ynh_backup "/etc/systemd/system/$app.service" +ynh_backup --src_path="/etc/systemd/system/$app.service" + +#================================================= +# BACKUP THE POSTGRESQL DATABASE +#================================================= +ynh_print_info --message="Backing up the MySQL database..." + +ynh_mysql_dump_db --database="$db_name" > db.sql + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." diff --git a/scripts/change_url b/scripts/change_url new file mode 100644 index 0000000..1cea7e4 --- /dev/null +++ b/scripts/change_url @@ -0,0 +1,129 @@ +#!/bin/bash + +#================================================= +# GENERIC STARTING +#================================================= +# IMPORT GENERIC HELPERS +#================================================= + +source _common.sh +source /usr/share/yunohost/helpers + +#================================================= +# RETRIEVE ARGUMENTS +#================================================= + +old_domain=$YNH_APP_OLD_DOMAIN +old_path=$YNH_APP_OLD_PATH + +new_domain=$YNH_APP_NEW_DOMAIN +new_path=$YNH_APP_NEW_PATH + +app=$YNH_APP_INSTANCE_NAME + +#================================================= +# LOAD SETTINGS +#================================================= +ynh_script_progression --message="Loading installation settings..." --weight=1 + +# Needed for helper "ynh_add_nginx_config" +final_path=$(ynh_app_setting_get --app=$app --key=final_path) +port=$(ynh_app_setting_get --app=$app --key=port) + +# 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) + +#================================================= +# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +#================================================= +ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1 + +# 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 +#================================================= + +change_domain=0 +if [ "$old_domain" != "$new_domain" ] +then + change_domain=1 +fi + +change_path=0 +if [ "$old_path" != "$new_path" ] +then + change_path=1 +fi + +#================================================= +# STANDARD MODIFICATIONS +#================================================= +# STOP SYSTEMD SERVICE +#================================================= +ynh_script_progression --message="Stopping a systemd service..." --weight=1 + +ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" + +#================================================= +# MODIFY URL IN NGINX CONF +#================================================= +ynh_script_progression --message="Updating NGINX web server configuration..." --weight=2 + +nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf + +# Change the path in the NGINX config file +if [ $change_path -eq 1 ] +then + # Make a backup of the original NGINX config file if modified + ynh_backup_if_checksum_is_different --file="$nginx_conf_path" + # Set global variables for NGINX helper + domain="$old_domain" + path_url="$new_path" + # Create a dedicated NGINX config + ynh_add_nginx_config +fi + +# Change the domain for NGINX +if [ $change_domain -eq 1 ] +then + # Delete file checksum for the old conf file location + ynh_delete_file_checksum --file="$nginx_conf_path" + mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf + # Store file checksum for the new config file location + ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" +fi + +#================================================= +# GENERIC FINALISATION +#================================================= +# START SYSTEMD SERVICE +#================================================= +ynh_script_progression --message="Starting a systemd service..." --weight=3 + +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started Mattermost" + +#================================================= +# RELOAD NGINX +#================================================= +ynh_script_progression --message="Reloading NGINX web server..." --weight=2 + +ynh_systemd_action --service_name=nginx --action=reload + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_script_progression --message="Change of URL completed for $app" --last diff --git a/scripts/install b/scripts/install index ca07780..77505c4 100644 --- a/scripts/install +++ b/scripts/install @@ -6,12 +6,16 @@ # IMPORT GENERIC HELPERS #================================================= +source _common.sh source /usr/share/yunohost/helpers #================================================= # MANAGE SCRIPT FAILURE #================================================= +ynh_clean_setup () { + ynh_clean_check_starting +} # Exit if an error occurs during the execution of the script ynh_abort_if_errors @@ -19,206 +23,201 @@ ynh_abort_if_errors # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= -app=$YNH_APP_INSTANCE_NAME domain=$YNH_APP_ARG_DOMAIN path_url=$YNH_APP_ARG_PATH is_public=$YNH_APP_ARG_IS_PUBLIC -admin_email=$YNH_APP_ARG_ADMIN_EMAIL -admin_password=$YNH_APP_ARG_ADMIN_PASSWORD -admin_locale=$YNH_APP_ARG_ADMIN_LOCALE +admin=$YNH_APP_ARG_ADMIN +email=$(ynh_user_get_info "$admin" mail) +password=$YNH_APP_ARG_PASSWORD +language=$YNH_APP_ARG_LANGUAGE team_display_name=$YNH_APP_ARG_TEAM_DISPLAY_NAME -analytics=$YNH_APP_ARG_ANALYTICS + +app=$YNH_APP_INSTANCE_NAME #================================================= -# CHECK IF THE APP CAN BE INSTALLED +# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= +ynh_script_progression --message="Validating installation parameters..." --weight=1 -# Allow using the `ynh_die` command without triggering linter warnings -function script_die () { - die_command=$(printf '%s%s' 'ynh_' 'die') - $die_command "$*" -} +final_path=/var/www/$app +test ! -e "$final_path" || ynh_die --message="This path already contains a folder" -# Check for 64 bits support -arch="$(uname -m)" -if [[ "$arch" != "x86_64" ]]; then - script_die "Mattermost requires an x86_64 machine, but this one is '${arch}'." -fi - -# Check for MySQL version (without triggering a package_linter warning) -db_command=$(printf '%s%s' 'my' 'sql') -db_version=$($db_command --version) -if [[ "$db_version" == *"Distrib 4."* ]] \ - || [[ "$db_version" == *"Distrib 5.0"* ]] \ - || [[ "$db_version" == *"Distrib 5.1"* ]] \ - || [[ "$db_version" == *"Distrib 5.2"* ]] \ - || [[ "$db_version" == *"Distrib 5.3"* ]] \ - || [[ "$db_version" == *"Distrib 5.4"* ]] \ - || [[ "$db_version" == *"Distrib 5.5"* ]]; -then - script_die "Mattermost requires MySQL 5.6 or higher, or MariaDB 10 or higher." -fi - -#================================================= -# FIND AN AVAILABLE PATH -#================================================= - -# Normalize the url path syntax -path_url=$(ynh_normalize_url_path $path_url) -# Check web path availability -ynh_webpath_available "$domain" "$path_url" # Register (book) web path -ynh_webpath_register "$app" "$domain" "$path_url" -# Store setting -ynh_app_setting_set "$app" domain "$domain" -ynh_app_setting_set "$app" path "$path_url" +ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url + +#================================================= +# STORE SETTINGS FROM MANIFEST +#================================================= +ynh_script_progression --message="Storing installation settings..." --weight=6 + +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=is_public --value=$is_public +ynh_app_setting_set --app=$app --key=admin --value=$admin +ynh_app_setting_set --app=$app --key=password --value=$password +ynh_app_setting_set --app=$app --key=language --value=$language +ynh_app_setting_set --app=$app --key=team_display_name --value=$team_display_name #================================================= # FIND AN AVAILABLE PORT #================================================= +ynh_script_progression --message="Finding an available port..." --weight=3 # Find an available port -port=$(ynh_find_port 8065) -# Store setting -ynh_app_setting_set "$app" port "$port" - -#================================================= -# SET UP INSTALLATION VARIABLES -#================================================= - -root_path="$(pwd)/.." -final_path="/var/www/$app" -data_path="/home/yunohost.app/$app" -logs_path="/var/log/$app" +port=$(ynh_find_port --port=8065) +ynh_app_setting_set --app=$app --key=port --value=$port #================================================= # CREATE A MYSQL DATABASE #================================================= +ynh_script_progression --message="Creating a MySQL database..." --weight=10 -db_name="$app" -db_user="$YNH_APP_INSTANCE_NAME" -db_password=$(ynh_string_random --length=24) -ynh_mysql_create_db "$db_name" "$db_user" "$db_password" -ynh_app_setting_set "$app" mysqluser "$db_user" -ynh_app_setting_set "$app" mysqlpwd "$db_password" +db_name=$(ynh_sanitize_dbid --db_name=$app) +db_user=$db_name +#db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) + +ynh_app_setting_set --app=$app --key=db_name --value=$db_name +ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name #================================================= -# CREATE USER FOR EMAIL NOTIFICATIONS +# CREATE DEDICATED USER #================================================= +ynh_script_progression --message="Configuring system user..." --weight=3 -mattermost_user="$app" -mattermost_user_password=$(ynh_string_random --length=24) -useradd -M --shell /bin/false -p $(openssl passwd -1 "$mattermost_user_password") "$mattermost_user" -ynh_app_setting_set "$app" smtppwd "$mattermost_user_password" +# Create a system user +ynh_system_user_create --username=$app #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= +ynh_script_progression --message="Setting up source files..." --weight=3 -ynh_app_setting_set "$app" final_path "$final_path" -ynh_setup_source "$final_path" +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" -mkdir -p "$data_path" -mkdir -p "$logs_path" +#================================================= +# CREATE DIRECTORY FOR DATA +#================================================= +ynh_script_progression --message="Creating the data directory..." --weight=1 + +# Create datadir folder +mkdir -p "/home/yunohost.app/$app" +# Define app's data directory +data_path="/home/yunohost.app/$app" +# Give permission to the datadir +chown -R $app: "$data_path" + +#================================================= +# HANDLE LOG FILES AND LOGROTATE +#================================================= +ynh_script_progression --message="Configuring log rotation..." --weight=1 + +# Create log directory +mkdir -p /var/log/$app +#touch /var/log/$app/$app.log +logs_path="/var/log/$app" +chown $app -R $logs_path + +# Setup logrotate +ynh_use_logrotate #================================================= # EDIT MATTERMOST CONFIG #================================================= +# MODIFY A CONFIG FILE +#================================================= +ynh_script_progression --message="Modifying a config file..." --weight=3 -# Configure Service Settings -ynh_replace_string --match_string "\"SiteURL\": \"\"" --replace_string "\"SiteURL\": \"https://${domain}${path_url}\"" --target_file $final_path/config/config.json -ynh_replace_string --match_string "\"ListenAddress\": \".*\"" --replace_string "\"ListenAddress\": \"127.0.0.1:${port}\"" --target_file $final_path/config/config.json -# Configure the database connection -db_connection_url="${db_user}:${db_password}@tcp(127.0.0.1:3306)/${db_name}?charset=utf8mb4,utf8" -ynh_replace_string --match_string "\"DataSource\": \".*\"" --replace_string "\"DataSource\": \"${db_connection_url}\"" --target_file $final_path/config/config.json -# Configure uploaded files directory -ynh_replace_string --match_string "\"Directory\": \"./data/\"" --replace_string "\"Directory\": \"${data_path}/\"" --target_file $final_path/config/config.json -# Configure SMTP account for sending email notifications -ynh_replace_string --match_string "\"SendEmailNotifications\": false" --replace_string "\"SendEmailNotifications\": true" --target_file $final_path/config/config.json -ynh_replace_string --match_string "\"FeedbackName\": \"\"" --replace_string "\"FeedbackName\": \"Mattermost notification\"" --target_file $final_path/config/config.json -ynh_replace_string --match_string "\"FeedbackEmail\": \"\"" --replace_string "\"FeedbackEmail\": \"no-reply@${domain}\"" --target_file $final_path/config/config.json -ynh_replace_string --match_string "\"SMTPUsername\": \"\"" --replace_string "\"SMTPUsername\": \"${mattermost_user}\"" --target_file $final_path/config/config.json -ynh_replace_string --match_string "\"SMTPPassword\": \"\"" --replace_string "\"SMTPPassword\": \"${mattermost_user_password}\"" --target_file $final_path/config/config.json -ynh_replace_string --match_string "\"SMTPServer\": \"\"" --replace_string "\"SMTPServer\": \"localhost\"" --target_file $final_path/config/config.json -ynh_replace_string --match_string "\"SMTPPort\": \".*\"" --replace_string "\"SMTPPort\": \"25\"" --target_file $final_path/config/config.json -# Disable Mattermost debug console by default -ynh_replace_string --match_string "\"EnableConsole\": true" --replace_string "\"EnableConsole\": false" --target_file $final_path/config/config.json -# Configure log file location -ynh_replace_string --match_string "\"FileLocation\": \"\"" --replace_string "\"FileLocation\": \"$logs_path\"" --target_file $final_path/config/config.json -# Disable questionable password complexity rules -ynh_replace_string --match_string "\"MinimumLength\": 10" --replace_string "\"MinimumLength\": 8" --target_file $final_path/config/config.json -ynh_replace_string --match_string "\"Lowercase\": true" --replace_string "\"Lowercase\": false" --target_file $final_path/config/config.json -ynh_replace_string --match_string "\"Number\": true" --replace_string "\"Number\": false" --target_file $final_path/config/config.json -ynh_replace_string --match_string "\"Uppercase\": true" --replace_string "\"Uppercase\": false" --target_file $final_path/config/config.json -ynh_replace_string --match_string "\"Symbol\": true" --replace_string "\"Symbol\": false" --target_file $final_path/config/config.json -# Configure analytics according to user choice -if [ $analytics -eq 0 ]; then - ynh_replace_string --match_string "\"EnableDiagnostics\": true" --replace_string "\"EnableDiagnostics\": false" --target_file $final_path/config/config.json -fi -ynh_app_setting_set "$app" analytics "$analytics" +cp ../conf/config.json $final_path/config/config.json + +# Main config File +ynh_replace_string --match_string="__URL__" --replace_string="https://$domain$path_url" --target_file="$final_path/config/config.json" +ynh_replace_string --match_string="__PORT__" --replace_string="127.0.0.1:$port" --target_file="$final_path/config/config.json" +ynh_replace_string --match_string="__DB_NAME__" --replace_string=$db_name --target_file="$final_path/config/config.json" +ynh_replace_string --match_string="__DB_USER__" --replace_string=$db_user --target_file="$final_path/config/config.json" +ynh_replace_string --match_string="__DB_PASS__" --replace_string=$db_pwd --target_file="$final_path/config/config.json" +ynh_replace_string --match_string="__DATA__" --replace_string=$data_path --target_file="$final_path/config/config.json" + +ynh_replace_string --match_string="__FEEDBACK__" --replace_string="no-reply@${domain}" --target_file="$final_path/config/config.json" +ynh_replace_string --match_string="__USER__" --replace_string="$app" --target_file="$final_path/config/config.json" +ynh_replace_string --match_string="__USER_PW__" --replace_string="$(ynh_string_random --length=24)" --target_file="$final_path/config/config.json" + +ynh_replace_string --match_string="__LOG__" --replace_string="$logs_path" --target_file="$final_path/config/config.json" +ynh_replace_string --match_string="__LANGUAGE__" --replace_string="$language" --target_file="$final_path/config/config.json" + +ynh_store_file_checksum --file="$final_path/config/config.json" #================================================= # SECURE FILES AND DIRECTORIES #================================================= -chown -R "$mattermost_user:www-data" "$final_path" -chown -R "$mattermost_user:www-data" "$data_path" -chown -R "$mattermost_user:adm" "$logs_path" +chown -R $app: $final_path +chmod -R g+w $final_path #================================================= # NGINX CONFIGURATION #================================================= +ynh_script_progression --message="Configuring NGINX web server..." --weight=2 +# Create a dedicated NGINX config ynh_add_nginx_config #================================================= -# SYSTEMD CONFIGURATION +# SETUP SYSTEMD #================================================= +ynh_script_progression --message="Configuring a systemd service..." --weight=2 +# Create a dedicated systemd config ynh_add_systemd_config -#================================================= -# ADVERTISE SERVICE IN ADMIN PANEL -#================================================= - -yunohost service add "$app" --log "$logs_path/mattermost.log" - -#================================================= -# SETUP SSOWAT -#================================================= - -ynh_app_setting_set "$app" is_public "$is_public" - -if [[ $is_public == "1" ]]; then - # Make the app accessible to the public - ynh_app_setting_set "$app" unprotected_uris "/" -fi - -#================================================= -# RELOAD NGINX -#================================================= - -systemctl reload nginx - -#================================================= -# START SERVER -#================================================= - -systemctl start "$app" - #================================================= # CREATE ADMIN AND FIRST TEAM #================================================= -admin_username=$(cut -d @ -f 1 <<< "$admin_email") team_name=$(echo "$team_display_name" | iconv -f utf8 -t ascii//TRANSLIT//IGNORE | sed -e 's/[^[:alnum:]]/-/g' | tr -s '-' | tr A-Z a-z) -cd "$final_path/bin" -./mattermost user create --username "$admin_username" --email "$admin_email" --password "$admin_password" --locale "$admin_locale" --system_admin -./mattermost user verify "$admin_username" -./mattermost team create --name "$team_name" --display_name "$team_display_name" --email "$admin_email" -./mattermost team add "$team_name" "$admin_username" +pushd "$final_path" + ynh_exec_warn_less ynh_exec_as $app bin/mattermost user create --username "$admin" --email "$email" --password "$password" --locale "$language" --system_admin + ynh_exec_warn_less ynh_exec_as $app bin/mattermost user verify "$admin" + ynh_exec_warn_less ynh_exec_as $app bin/mattermost team create --name "$team_name" --display_name "$team_display_name" --email "$email" + ynh_exec_warn_less ynh_exec_as $app bin/mattermost team add "$team_name" "$admin" +popd -ynh_app_setting_set "$app" admin_email "$admin_email" -ynh_app_setting_set "$app" admin_locale "$admin_locale" -ynh_app_setting_set "$app" team_name "$team_name" +#================================================= +# INTEGRATE SERVICE IN YUNOHOST +#================================================= +ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 + +yunohost service add $app --description="Collaboration platform built for developers" --log="/var/log/$app/$app.log" + +#================================================= +# START SYSTEMD SERVICE +#================================================= +ynh_script_progression --message="Starting a systemd service..." --weight=2 + +# Start a systemd service +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started Mattermost" + +#================================================= +# SETUP SSOWAT +#================================================= +ynh_script_progression --message="Configuring SSOwat..." --weight=1 + +if [ $is_public -eq 1 ] +then + ynh_permission_update --permission "main" --add "visitors" +fi + +#================================================= +# RELOAD NGINX +#================================================= +ynh_script_progression --message="Reloading NGINX web server..." --weight=2 + +ynh_systemd_action --service_name=nginx --action=reload + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_script_progression --message="Installation of $app completed" --last diff --git a/scripts/remove b/scripts/remove index 8f3dfc1..fb1ec22 100755 --- a/scripts/remove +++ b/scripts/remove @@ -1,5 +1,4 @@ #!/bin/bash -set -u # treat unset variables as an error #================================================= # GENERIC START @@ -7,6 +6,7 @@ set -u # treat unset variables as an error # IMPORT GENERIC HELPERS #================================================= +source _common.sh source /usr/share/yunohost/helpers #================================================= @@ -14,69 +14,83 @@ source /usr/share/yunohost/helpers #================================================= app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get $app domain) -db_name="$app" -db_user=$(ynh_app_setting_get $app mysqluser) -db_user=${db_user:-"mmuser"} -mattermost_user="$app" -final_path="/var/www/$app" -data_path="/home/yunohost.app/$app" -logs_path="/var/log/$app" + +domain=$(ynh_app_setting_get --app=$app --key=domain) +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) #================================================= # STANDARD REMOVE #================================================= -#================================================= # REMOVE SERVICE FROM ADMIN PANEL #================================================= -if yunohost service status | grep -q "$app"; then - yunohost service remove "$app" +# Remove the service from the list of services known by Yunohost (added from `yunohost service add`) +if ynh_exec_warn_less yunohost service status $app >/dev/null +then + ynh_script_progression --message="Removing $app service..." --weight=1 + yunohost service remove $app fi #================================================= # STOP AND REMOVE SERVICE #================================================= +ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1 -# Remove systemd service -if $(systemctl -q is-active "$app"); then - systemctl stop "$app" -fi +# Remove the dedicated systemd config ynh_remove_systemd_config -# Legacy, for older versions of this app which used supervisor -if [ -f "/etc/supervisor/conf.d/${app}.conf" ]; then - supervisorctl stop "$app" - ynh_secure_remove --file="/etc/supervisor/conf.d/${app}.conf" -fi - #================================================= -# REMOVE THE MYSQL DATABASE +# REMOVE THE POSTGRESQL DATABASE #================================================= +ynh_script_progression --message="Removing the MySQL database..." --weight=2 -ynh_mysql_remove_db "$db_user" "$db_name" +# Remove a database if it exists, along with the associated user +ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name #================================================= # REMOVE APP MAIN DIR #================================================= +ynh_script_progression --message="Removing $app main directory..." --weight=6 -ynh_secure_remove "$final_path" -ynh_secure_remove "$data_path" +# Remove the app directory securely +ynh_secure_remove --file="$final_path" + +ynh_secure_remove --file="/home/yunohost.app/$app" #================================================= # REMOVE NGINX CONFIGURATION #================================================= +ynh_script_progression --message="Removing NGINX web server configuration..." --weight=5 +# Remove the dedicated NGINX config ynh_remove_nginx_config +#================================================= +# REMOVE LOGROTATE CONFIGURATION +#================================================= +ynh_script_progression --message="Removing logrotate configuration..." --weight=1 + +# Remove the app-specific logrotate config +ynh_remove_logrotate + #================================================= # REMOVE LOG FILE #================================================= -ynh_secure_remove --file="$logs_path" +ynh_secure_remove --file="/var/log/$app" #================================================= # REMOVE DEDICATED USER #================================================= +ynh_script_progression --message="Removing the dedicated system user..." --weight=1 -ynh_system_user_delete "$mattermost_user" +ynh_system_user_delete --username=$app + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_script_progression --message="Removal of $app completed" --last diff --git a/scripts/restore b/scripts/restore index 14f9617..546890c 100644 --- a/scripts/restore +++ b/scripts/restore @@ -1,43 +1,47 @@ #!/bin/bash +#================================================= +# GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= +source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers #================================================= # MANAGE SCRIPT FAILURE #================================================= +ynh_clean_setup () { + ynh_clean_check_starting +} # Exit if an error occurs during the execution of the script ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= +ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get $app domain) -is_public=$(ynh_app_setting_get $app is_public) -path_url=$(ynh_app_setting_get $app path) -final_path="/var/www/$app" -data_path="/home/yunohost.app/$app" -logs_path="/var/log/$app" -db_name="$app" -db_user=$(ynh_app_setting_get $app mysqluser) -db_user=${db_user:-"mmuser"} -mattermost_user="$app" +domain=$(ynh_app_setting_get --app=$app --key=domain) +path_url=$(ynh_app_setting_get --app=$app --key=path) +final_path=$(ynh_app_setting_get --app=$app --key=final_path) +port=$(ynh_app_setting_get --app=$app --key=port) +db_name=$(ynh_app_setting_get --app=$app --key=db_name) +db_user=$db_name #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= +ynh_script_progression --message="Validating restoration parameters..." --weight=1 -ynh_webpath_available $domain $path_url \ - || ynh_die "Path not available: ${domain}" +ynh_webpath_available --domain=$domain --path_url=$path_url \ + || ynh_die --message="Path not available: ${domain}${path_url}" test ! -d $final_path \ - || ynh_die "There is already a directory: $final_path " + || ynh_die --message="There is already a directory: $final_path " #================================================= # STANDARD RESTORATION STEPS @@ -45,63 +49,50 @@ test ! -d $final_path \ # RESTORE THE NGINX CONFIGURATION #================================================= -ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf" +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RESTORE THE APP MAIN DIR #================================================= +ynh_script_progression --message="Restoring the app main directory..." --weight=2 -ynh_restore_file "$final_path" +ynh_restore_file --origin_path="$final_path" + +#================================================= +# RECREATE THE DEDICATED USER +#================================================= +ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 + +# Create the dedicated user (if not existing) +ynh_system_user_create --username=$app #================================================= # RESTORE THE APP DATA #================================================= -ynh_restore_file "$data_path" +ynh_restore_file --origin_path="/home/yunohost.app/$app" +chown -R $app: "/home/yunohost.app/$app" #================================================= # RESTORE THE MYSQL DATABASE #================================================= +ynh_script_progression --message="Restoring the MySQL database..." --weight=6 -db_pwd=$(ynh_app_setting_get $app mysqlpwd) -ynh_mysql_setup_db "$db_user" "$db_name" "$db_pwd" -ynh_mysql_connect_as "$db_user" "$db_pwd" "$db_name" < ./db.sql - -#================================================= -# RECREATE THE DEDICATED USER -#================================================= - -# Create the dedicated user (if not existing) -mattermost_user="$app" -if ! ynh_system_user_exists "$mattermost_user"; then - mattermost_user_password=$(ynh_app_setting_get $app smtppwd) - useradd -M --shell /bin/false -p $(openssl passwd -1 "$mattermost_user_password") "$mattermost_user" -fi +db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) +ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd +ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql #================================================= # RESTORE USER RIGHTS #================================================= # Restore permissions on app files -chown -R "$mattermost_user:www-data" "$final_path" +chown -R $app: $final_path +chmod -R g+w $final_path -mkdir -p "$data_path" -chown -R "$mattermost_user:www-data" "$data_path" - -mkdir -p "$logs_path" -chown -R "$mattermost_user:adm" "$logs_path" - -#================================================= -# RESTORE SSOWAT -#================================================= - -if [[ $is_public == "1" ]]; then - # Make the app accessible to the public - ynh_app_setting_set "$app" unprotected_uris "/" -else - # Remove the public access - ynh_app_setting_delete "$app" skipped_uris -fi +logs_path="/var/log/$app" +mkdir -p $logs_path +chown -R $app: $logs_path #================================================= # SPECIFIC RESTORATION @@ -110,24 +101,39 @@ fi #================================================= ynh_restore_file "/etc/systemd/system/$app.service" -systemctl enable "$app" +systemctl enable $app.service --quiet #================================================= # ADVERTISE SERVICE IN ADMIN PANEL #================================================= -yunohost service add "$app" --log "$logs_path/mattermost.log" +yunohost service add $app --description="Collaboration platform built for developers" --log="/var/log/$app/$app.log" + +#================================================= +# START SYSTEMD SERVICE +#================================================= +ynh_script_progression --message="Starting a systemd service..." --weight=2 + +# Start a systemd service +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started Mattermost" + +#================================================= +# RESTORE THE LOGROTATE CONFIGURATION +#================================================= + +ynh_restore_file --origin_path="/etc/logrotate.d/$app" #================================================= # GENERIC FINALIZATION #================================================= # RELOAD NGINX #================================================= +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 -service nginx reload +ynh_systemd_action --service_name=nginx --action=reload #================================================= -# START SERVER +# END OF SCRIPT #================================================= -systemctl start "$app" +ynh_script_progression --message="Restoration completed for $app" --last diff --git a/scripts/upgrade b/scripts/upgrade index df4af82..afd924d 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -6,93 +6,43 @@ # IMPORT GENERIC HELPERS #================================================= +source _common.sh source /usr/share/yunohost/helpers #================================================= # MANAGE SCRIPT FAILURE #================================================= +ynh_clean_setup () { + ynh_clean_check_starting +} # Exit if an error occurs during the execution of the script ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= +ynh_script_progression --message="Loading installation settings..." --weight=2 app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get $app domain) -path_url=$(ynh_app_setting_get $app path) # used during nginx configuration -is_public=$(ynh_app_setting_get $app is_public) -port=$(ynh_app_setting_get $app port) -mattermost_user="$app" -root_path="$(pwd)/.." -final_path="/var/www/$app" -data_path="/home/yunohost.app/$app" -logs_path="/var/log/$app" +domain=$(ynh_app_setting_get --app=$app --key=domain) +path_url=$(ynh_app_setting_get --app=$app --key=path) +is_public=$(ynh_app_setting_get --app=$app --key=is_public) +port=$(ynh_app_setting_get --app=$app --key=port) +final_path=$(ynh_app_setting_get --app=$app --key=final_path) +language=$(ynh_app_setting_get --app=$app --key=language) +db_name=$(ynh_app_setting_get --app=$app --key=db_name) #================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +# CHECK VERSION #================================================= +ynh_script_progression --message="Checking version..." --weight=1 -# Backup the current version of the app -# (NB: `tee` uses process substitution rather than a pipe, -# to avoid spawning a subshell that would not save global -# variables defined by `ynh_backup_before_upgrade`.) -ynh_backup_before_upgrade > >(tee "upgrade.log") -# Ensure the backup can be restored -if grep -q "mattermost: Warning$" "upgrade.log"; then - can_restore_backup=false -else - can_restore_backup=true -fi - -# If the upgrade fails… -ynh_clean_setup () { - if [ "$can_restore_backup" = true ]; then - # Stop attempting to restart the app - if $(systemctl -q is-active "$app"); then - systemctl stop "$app" - fi - # Restore the backup - ynh_restore_upgradebackup - - else - # Backup restoration is not available: - # let's try at least to restart the server. - systemctl start "$app" - fi -} - -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors +upgrade_type=$(ynh_check_app_version_changed) #================================================= -# STOP SERVER -#================================================= - -# Stop the server (if the app is already using systemd) -if $(systemctl -q is-active "$app"); then - systemctl stop "$app" -fi - -# Legacy, for previous versions of this app which used supervisor -if [ -f "/etc/supervisor/conf.d/${app}.conf" ]; then - supervisorctl stop "$app" - rm -f "/etc/supervisor/conf.d/${app}.conf" -fi - -#================================================= -# BACKUP CONFIGURATION FILE -#================================================= - -config_file="$final_path/config/config.json" -backup_config_file="/tmp/config.json" - -cp -f "$config_file" "$backup_config_file" - -#================================================= -# MIGRATE SETTINGS FROM PREVIOUS VERSIONS +# ENSURE DOWNWARD COMPATIBILITY #================================================= # Convert is_public from "Yes"/"No" to 1 / 0 @@ -101,77 +51,180 @@ if [[ $is_public == "Yes" ]]; then elif [[ $is_public == "No" ]]; then is_public=0 fi -ynh_app_setting_set "$app" is_public "$is_public" +ynh_app_setting_set --app=$app --key=is_public --value=$is_public # Save the port used if not present if ! [[ "$port" ]]; then port=8065 - ynh_app_setting_set "$app" port "$port" + ynh_app_setting_set --app=$app --key=port --value=$port fi +# # Language if not present +# if ! [[ "$language" ]]; then +# language="en" +# ynh_app_setting_set --app=$app --key=language --value=$language +# 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 + +# if ! ynh_permission_exists --permission="admin"; then +# # Create the required permissions +# ynh_permission_create --permission="admin" --url="/admin" --allowed=$admin +# fi + +# # Create a permission if needed +# if ! ynh_permission_exists --permission="api"; then +# ynh_permission_create --permission="api" --url "/api" --allowed="visitors" --show_tile="false" --protected="true" +# fi + +#================================================= +# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +#================================================= +ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1 + +# Backup the current version of the app +ynh_backup_before_upgrade +ynh_clean_setup () { + # Restore it if the upgrade fails + ynh_restore_upgradebackup +} +# Exit if an error occurs during the execution of the script +ynh_abort_if_errors + +#================================================= +# STANDARD UPGRADE STEPS +#================================================= +# STOP SYSTEMD SERVICE +#================================================= +ynh_script_progression --message="Stopping a systemd service..." --weight=3 + +ynh_systemd_action --service_name=$app --action=stop --log_path="/var/log/$app/$app.log" + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_app_setting_set "$app" final_path "$final_path" -ynh_setup_source "$final_path" +if [ "$upgrade_type" == "UPGRADE_APP" ] +then + ynh_script_progression --message="Upgrading source files..." --weight=2 -#================================================= -# RESTORE CONFIGURATION FILE -#================================================= + # Create a temporary directory + tmpdir="$(mktemp -d)" -cp -f "$backup_config_file" "$config_file" + # Backup the config file in the temp dir + cp -a "$final_path/config/config.json" "$tmpdir/config.json" + + # Remove the app directory securely + ynh_secure_remove --file="$final_path" + + # Download, check integrity, uncompress and patch the source from app.src + ynh_setup_source --dest_dir="$final_path" + + # Copy the admin saved settings from tmp directory to final path + cp -a "$tmpdir/config.json" "$final_path/config/config.json" + + # Remove the tmp directory securely + ynh_secure_remove --file="$tmpdir" +fi #================================================= # NGINX CONFIGURATION #================================================= +ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=5 +# Create a dedicated NGINX config ynh_add_nginx_config #================================================= -# SYSTEMD CONFIGURATION +# CREATE DEDICATED USER #================================================= +ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 +# Create a dedicated user (if not existing) +ynh_system_user_create --username=$app + +#================================================= +# SETUP SYSTEMD +#================================================= +ynh_script_progression --message="Upgrading systemd configuration..." --weight=2 + +# Create a dedicated systemd config ynh_add_systemd_config -#================================================= -# ADVERTISE SERVICE IN ADMIN PANEL -#================================================= - -yunohost service add "$app" --log "$logs_path/mattermost.log" - #================================================= # SPECIFIC UPGRADE STEPS #================================================= -# Fix log FileLocation path (changed in Mattermost 3.8, makes Mattermost >= 4.2 crash) -# https://docs.mattermost.com/administration/changelog.html#release-v3-8-3 -ynh_replace_string --match_string "\"FileLocation\": \"/var/log/mattermost.log\"" --replace_string "\"FileLocation\": \"/var/log\"" --target_file "$config_file" +# # Fix log FileLocation path (changed in Mattermost 3.8, makes Mattermost >= 4.2 crash) +# # https://docs.mattermost.com/administration/changelog.html#release-v3-8-3 +# ynh_replace_string --match_string "\"FileLocation\": \"/var/log/mattermost.log\"" --replace_string "\"FileLocation\": \"/var/log\"" --target_file "$config_file" -# Move log files to a directory (rather than directly in /var/log) -# See https://github.com/YunoHost-Apps/mattermost_ynh/issues/61 -mkdir -p "$logs_path" -ynh_replace_string --match_string "\"FileLocation\": \"/var/log\"" --replace_string "\"FileLocation\": \"$logs_path\"" --target_file "$config_file" -if [ -f "/var/log/${app}.log" ]; then - mv "/var/log/${app}.log" "$logs_path/" -fi +# # Move log files to a directory (rather than directly in /var/log) +# # See https://github.com/YunoHost-Apps/mattermost_ynh/issues/61 +# mkdir -p "$logs_path" +# ynh_replace_string --match_string "\"FileLocation\": \"/var/log\"" --replace_string "\"FileLocation\": \"$logs_path\"" --target_file "$config_file" +# if [ -f "/var/log/${app}.log" ]; then +# mv "/var/log/${app}.log" "$logs_path/" +# fi + +#================================================= +# CREATE DIRECTORY FOR DATA +#================================================= +ynh_script_progression --message="Creating the data directory..." --weight=1 + +# Define app's data directory +data_path="/home/yunohost.app/$app" +# Create datadir folder +mkdir -p $data_path +# Give permission to the datadir +chown -R $app: "$data_path" #================================================= # RESTORE FILE PERMISSIONS #================================================= -chown -R "$mattermost_user:www-data" "$final_path" -chown -R "$mattermost_user:www-data" "$data_path" -chown -R "$mattermost_user:adm" "$logs_path" +chown -R $app: $final_path +chmod -R g+w $final_path + +chown -R $app: "/var/log/$app" + +#================================================= +# SETUP LOGROTATE +#================================================= +ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1 + +# Use logrotate to manage app-specific logfile(s) +ynh_use_logrotate --non-append + +#================================================= +# INTEGRATE SERVICE IN YUNOHOST +#================================================= +ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 + +yunohost service add $app --description="Collaboration platform built for developers" --log="/var/log/$app/$app.log" + +#================================================= +# START SYSTEMD SERVICE +#================================================= +ynh_script_progression --message="Starting a systemd service..." --weight=2 + +# Start a systemd service +ynh_systemd_action --service_name=$app --action=start --log_path="systemd" --line_match="Started Mattermost" #================================================= # RELOAD NGINX #================================================= +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 -service nginx reload +ynh_systemd_action --service_name=nginx --action=reload #================================================= -# START SERVER +# END OF SCRIPT #================================================= -systemctl start "$app" +ynh_script_progression --message="Upgrade of $app completed" --last From 7586f5875961924f5a74d6bbb75b7a00bfe5532d Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 12 Jan 2021 00:01:16 +0100 Subject: [PATCH 07/33] Cleaning up --- conf/config.json | 2 +- manifest.json | 2 +- scripts/install | 12 ++++-------- scripts/upgrade | 23 ----------------------- 4 files changed, 6 insertions(+), 33 deletions(-) diff --git a/conf/config.json b/conf/config.json index 54aecd3..bf5e9a2 100644 --- a/conf/config.json +++ b/conf/config.json @@ -228,7 +228,7 @@ "ReplyToAddress": "", "FeedbackOrganization": "", "EnableSMTPAuth": false, - "SMTPUsername": "__USER__", + "SMTPUsername": "mattermost", "SMTPPassword": "__USER_PW__", "SMTPServer": "localhost", "SMTPPort": "25", diff --git a/manifest.json b/manifest.json index f628a74..b946125 100644 --- a/manifest.json +++ b/manifest.json @@ -40,7 +40,7 @@ "fr": "Choisissez un chemin pour Mattermost" }, "example": "/mattermost", - "default": "/mattermost" + "default": "/chat" }, { "name": "is_public", diff --git a/scripts/install b/scripts/install index 77505c4..ef8f81f 100644 --- a/scripts/install +++ b/scripts/install @@ -74,7 +74,6 @@ ynh_script_progression --message="Creating a MySQL database..." --weight=10 db_name=$(ynh_sanitize_dbid --db_name=$app) db_user=$db_name -#db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) ynh_app_setting_set --app=$app --key=db_name --value=$db_name ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name @@ -134,15 +133,12 @@ cp ../conf/config.json $final_path/config/config.json # Main config File ynh_replace_string --match_string="__URL__" --replace_string="https://$domain$path_url" --target_file="$final_path/config/config.json" ynh_replace_string --match_string="__PORT__" --replace_string="127.0.0.1:$port" --target_file="$final_path/config/config.json" -ynh_replace_string --match_string="__DB_NAME__" --replace_string=$db_name --target_file="$final_path/config/config.json" -ynh_replace_string --match_string="__DB_USER__" --replace_string=$db_user --target_file="$final_path/config/config.json" -ynh_replace_string --match_string="__DB_PASS__" --replace_string=$db_pwd --target_file="$final_path/config/config.json" -ynh_replace_string --match_string="__DATA__" --replace_string=$data_path --target_file="$final_path/config/config.json" - +ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$final_path/config/config.json" +ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_user" --target_file="$final_path/config/config.json" +ynh_replace_string --match_string="__DB_PASS__" --replace_string="$db_pwd" --target_file="$final_path/config/config.json" +ynh_replace_string --match_string="__DATA__" --replace_string="$data_path" --target_file="$final_path/config/config.json" ynh_replace_string --match_string="__FEEDBACK__" --replace_string="no-reply@${domain}" --target_file="$final_path/config/config.json" -ynh_replace_string --match_string="__USER__" --replace_string="$app" --target_file="$final_path/config/config.json" ynh_replace_string --match_string="__USER_PW__" --replace_string="$(ynh_string_random --length=24)" --target_file="$final_path/config/config.json" - ynh_replace_string --match_string="__LOG__" --replace_string="$logs_path" --target_file="$final_path/config/config.json" ynh_replace_string --match_string="__LANGUAGE__" --replace_string="$language" --target_file="$final_path/config/config.json" diff --git a/scripts/upgrade b/scripts/upgrade index afd924d..5a6a4f0 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -59,29 +59,6 @@ if ! [[ "$port" ]]; then ynh_app_setting_set --app=$app --key=port --value=$port fi -# # Language if not present -# if ! [[ "$language" ]]; then -# language="en" -# ynh_app_setting_set --app=$app --key=language --value=$language -# 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 - -# if ! ynh_permission_exists --permission="admin"; then -# # Create the required permissions -# ynh_permission_create --permission="admin" --url="/admin" --allowed=$admin -# fi - -# # Create a permission if needed -# if ! ynh_permission_exists --permission="api"; then -# ynh_permission_create --permission="api" --url "/api" --allowed="visitors" --show_tile="false" --protected="true" -# fi - #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= From c425aa5d9405182f616fc53bc97fbddc1854befb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 12 Jan 2021 10:33:02 +0100 Subject: [PATCH 08/33] Arm arch. support (#201) * Add ARM sources * Switch to TEAM edition --- conf/app.src | 6 ------ conf/arm.src | 6 ++++++ conf/arm64.src | 6 ++++++ conf/config.json | 6 +++--- conf/x86-64.src | 6 ++++++ scripts/_common.sh | 27 +++++++++++++++++++++++++++ scripts/change_url | 29 +++++++++++++++++++++++++---- scripts/install | 3 ++- scripts/upgrade | 3 ++- 9 files changed, 77 insertions(+), 15 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 diff --git a/conf/app.src b/conf/app.src deleted file mode 100644 index 5226b55..0000000 --- a/conf/app.src +++ /dev/null @@ -1,6 +0,0 @@ -SOURCE_URL=https://releases.mattermost.com/5.30.1/mattermost-5.30.1-linux-amd64.tar.gz -SOURCE_SUM=14018addf86c040200515cb0141308a6d213f149f8afe425dd171347be516401 -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=tar.gz -SOURCE_IN_SUBDIR=true -SOURCE_FILENAME=mattermost-5.30.1-linux-amd64.tar.gz diff --git a/conf/arm.src b/conf/arm.src new file mode 100644 index 0000000..54444f7 --- /dev/null +++ b/conf/arm.src @@ -0,0 +1,6 @@ +SOURCE_URL=https://github.com/SmartHoneybee/ubiquitous-memory/releases/download/v5.30.1/mattermost-v5.30.1-linux-arm.tar.gz +SOURCE_SUM=2292157939eb5be0ac5e1d58bc690d8f359040f1ae55f37f1f90cab422d11e2d +SOURCE_SUM_PRG=sha256sum +SOURCE_FORMAT=tar.gz +SOURCE_IN_SUBDIR=true +SOURCE_FILENAME=mattermost-v5.30.1-linux-arm.tar.gz diff --git a/conf/arm64.src b/conf/arm64.src new file mode 100644 index 0000000..bd34361 --- /dev/null +++ b/conf/arm64.src @@ -0,0 +1,6 @@ +SOURCE_URL=https://github.com/SmartHoneybee/ubiquitous-memory/releases/download/v5.30.1/mattermost-v5.30.1-linux-arm64.tar.gz +SOURCE_SUM=cbd150100947686c2d177db6067e98a36859e7da2fe4c173b89925a2fd1415d1 +SOURCE_SUM_PRG=sha256sum +SOURCE_FORMAT=tar.gz +SOURCE_IN_SUBDIR=true +SOURCE_FILENAME=mattermost-v5.30.1-linux-arm64.tar.gz diff --git a/conf/config.json b/conf/config.json index bf5e9a2..9adf518 100644 --- a/conf/config.json +++ b/conf/config.json @@ -321,14 +321,14 @@ "LdapSettings": { "Enable": false, "EnableSync": false, - "LdapServer": "ldap://127.0.0.1", + "LdapServer": "", "LdapPort": 389, "ConnectionSecurity": "", - "BaseDN": "ou=users,dc=yunohost,dc=org", + "BaseDN": "", "BindUsername": "cn", "BindPassword": "", "UserFilter": "", - "GroupFilter": "(&(|(objectclass=posixAccount))(uid={{username}})(permission=cn=mattermost.main,ou=permission,dc=yunohost,dc=org))", + "GroupFilter": "", "GuestFilter": "", "EnableAdminFilter": false, "AdminFilter": "", diff --git a/conf/x86-64.src b/conf/x86-64.src new file mode 100644 index 0000000..cc4b71f --- /dev/null +++ b/conf/x86-64.src @@ -0,0 +1,6 @@ +SOURCE_URL=https://releases.mattermost.com/5.30.1/mattermost-team-5.30.1-linux-amd64.tar.gz +SOURCE_SUM=3c4165d7ea240ad49dba8e486d9fd7de83eea7cac2cb9a355d891dd605b3fa52 +SOURCE_SUM_PRG=sha256sum +SOURCE_FORMAT=tar.gz +SOURCE_IN_SUBDIR=true +SOURCE_FILENAME=mattermost-team-5.30.1-linux-amd64.tar.gz diff --git a/scripts/_common.sh b/scripts/_common.sh index 7401a47..7916409 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -12,6 +12,33 @@ # EXPERIMENTAL HELPERS #================================================= +# 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 armv7)" ]; then + architecture="arm" + elif [ -n "$(uname -m | grep armv6)" ]; then + architecture="arm" + elif [ -n "$(uname -m | grep armv5)" ]; then + architecture="arm" + else + architecture="unknown" + fi + echo $architecture +} + + #================================================= # FUTURE OFFICIAL HELPERS #================================================= diff --git a/scripts/change_url b/scripts/change_url index 1cea7e4..7c7cd57 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -31,9 +31,9 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) port=$(ynh_app_setting_get --app=$app --key=port) # 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_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) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP @@ -106,6 +106,27 @@ then ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" fi +#================================================= +# MODIFY A CONFIG FILE +#================================================= +ynh_script_progression --message="Modifying a config file..." --weight=3 + +cp ../conf/config.json $final_path/config/config.json + +# Main config File +ynh_replace_string --match_string="__URL__" --replace_string="https://$new_domain$new_path" --target_file="$final_path/config/config.json" +ynh_replace_string --match_string="__PORT__" --replace_string="127.0.0.1:$port" --target_file="$final_path/config/config.json" +ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$final_path/config/config.json" +ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_user" --target_file="$final_path/config/config.json" +ynh_replace_string --match_string="__DB_PASS__" --replace_string="$db_pwd" --target_file="$final_path/config/config.json" +ynh_replace_string --match_string="__DATA__" --replace_string="$data_path" --target_file="$final_path/config/config.json" +ynh_replace_string --match_string="__FEEDBACK__" --replace_string="no-reply@${new_domain}" --target_file="$final_path/config/config.json" +ynh_replace_string --match_string="__USER_PW__" --replace_string="$(ynh_string_random --length=24)" --target_file="$final_path/config/config.json" +ynh_replace_string --match_string="__LOG__" --replace_string="$logs_path" --target_file="$final_path/config/config.json" +ynh_replace_string --match_string="__LANGUAGE__" --replace_string="$language" --target_file="$final_path/config/config.json" + +ynh_store_file_checksum --file="$final_path/config/config.json" + #================================================= # GENERIC FINALISATION #================================================= @@ -113,7 +134,7 @@ fi #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=3 -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started Mattermost" +ynh_systemd_action --service_name=$app --action=start --log_path="systemd" --line_match="Started Mattermost" #================================================= # RELOAD NGINX diff --git a/scripts/install b/scripts/install index ef8f81f..55b1ee3 100644 --- a/scripts/install +++ b/scripts/install @@ -31,6 +31,7 @@ email=$(ynh_user_get_info "$admin" mail) password=$YNH_APP_ARG_PASSWORD language=$YNH_APP_ARG_LANGUAGE team_display_name=$YNH_APP_ARG_TEAM_DISPLAY_NAME +architecture=$(ynh_detect_arch) app=$YNH_APP_INSTANCE_NAME @@ -93,7 +94,7 @@ ynh_script_progression --message="Setting up source files..." --weight=3 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" +ynh_setup_source --dest_dir="$final_path" --source_id="$architecture" #================================================= # CREATE DIRECTORY FOR DATA diff --git a/scripts/upgrade b/scripts/upgrade index 5a6a4f0..371ae6e 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -33,6 +33,7 @@ port=$(ynh_app_setting_get --app=$app --key=port) final_path=$(ynh_app_setting_get --app=$app --key=final_path) language=$(ynh_app_setting_get --app=$app --key=language) db_name=$(ynh_app_setting_get --app=$app --key=db_name) +architecture=$(ynh_detect_arch) #================================================= # CHECK VERSION @@ -100,7 +101,7 @@ then ynh_secure_remove --file="$final_path" # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$final_path" + ynh_setup_source --dest_dir="$final_path" --source_id="$architecture" # Copy the admin saved settings from tmp directory to final path cp -a "$tmpdir/config.json" "$final_path/config/config.json" From 220af8f1f2a4f5cb5e2157a030894741718f08ff Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 12 Jan 2021 10:39:35 +0100 Subject: [PATCH 09/33] Small typos --- README.md | 10 +++------- README_fr.md | 4 ++-- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index fc8491a..f6dea1f 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.* ## Overview -Mattermost est un logiciel et un service de messagerie instantanée libre auto-hébergeable. Il est conçu comme un chat interne pour les organisations et les entreprises, et il est présenté comme une alternative à Slack. +Mattermost is a self-hosted, open source instant messaging and service software. It's designed as an internal chat for organizations and businesses, and it's touted as an alternative to Slack. **Shipped version:** 5.30.1 @@ -17,13 +17,9 @@ Mattermost est un logiciel et un service de messagerie instantanée libre auto-h ![](https://ucarecdn.com/8cd90d9d-8902-4845-a15b-f4664e5fcfb3/-/format/auto/-/quality/lighter/-/max_icc_size/10/-/resize/1288x/) -## Demo - -* [Official demo](Link to a demo site for this app.) - ## Configuration -How to configure this app: From an admin panel, a plain file with SSH, or any other way. +* How to configure this app: From an admin panel, a plain file with SSH. ## Documentation @@ -48,7 +44,7 @@ How to configure this app: From an admin panel, a plain file with SSH, or any ot ## Additional information -* Other info you would like to add about this app. +* This package can by installed on `ARM`, `ARM64` and `x86-64` architecture. ## Links diff --git a/README_fr.md b/README_fr.md index c043aa4..54b1093 100644 --- a/README_fr.md +++ b/README_fr.md @@ -19,7 +19,7 @@ Mattermost est un logiciel et un service de messagerie instantanée libre auto-h ## Configuration - * Comment configurer cette application : via le panneau d'administration + * Comment configurer cette application : via le panneau d'administration, un fichier brut en SSH. ## Documentation @@ -44,7 +44,7 @@ Mattermost est un logiciel et un service de messagerie instantanée libre auto-h ## Informations additionnelles -* Autres informations que vous souhaitez ajouter sur cette application. +Ce paquet peut être installé sur les architectures `xARM`x, `xARM64`x et `x86-64`. ## Liens From c9d06d101046f99fde0f57fec9a404705edc24d7 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 12 Jan 2021 10:44:50 +0100 Subject: [PATCH 10/33] set change_url to true --- check_process | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/check_process b/check_process index d6be4a9..5b0cb24 100644 --- a/check_process +++ b/check_process @@ -22,7 +22,7 @@ backup_restore=1 multi_instance=1 port_already_use=0 - change_url=0 + change_url=1 ;;; Options Email=kemenaran@gmail.com Notification=none From 80305593371b75faa8ca43b1fa5122e4bbf05d9f Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 12 Jan 2021 11:12:37 +0100 Subject: [PATCH 11/33] Add missing variables --- scripts/change_url | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/change_url b/scripts/change_url index 7c7cd57..abe78ca 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -29,6 +29,7 @@ ynh_script_progression --message="Loading installation settings..." --weight=1 # Needed for helper "ynh_add_nginx_config" final_path=$(ynh_app_setting_get --app=$app --key=final_path) port=$(ynh_app_setting_get --app=$app --key=port) +language=$(ynh_app_setting_get --app=$app --key=language) # Add settings here as needed by your application db_name=$(ynh_app_setting_get --app=$app --key=db_name) @@ -113,6 +114,9 @@ ynh_script_progression --message="Modifying a config file..." --weight=3 cp ../conf/config.json $final_path/config/config.json +data_path="/home/yunohost.app/$app" +logs_path="/var/log/$app" + # Main config File ynh_replace_string --match_string="__URL__" --replace_string="https://$new_domain$new_path" --target_file="$final_path/config/config.json" ynh_replace_string --match_string="__PORT__" --replace_string="127.0.0.1:$port" --target_file="$final_path/config/config.json" From 43bf44ff01a3e743cd7b17b26a39ad42ca935da3 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 12 Jan 2021 12:03:18 +0100 Subject: [PATCH 12/33] Remove change_url --- check_process | 2 +- scripts/change_url | 154 --------------------------------------------- 2 files changed, 1 insertion(+), 155 deletions(-) delete mode 100644 scripts/change_url diff --git a/check_process b/check_process index 5b0cb24..d6be4a9 100644 --- a/check_process +++ b/check_process @@ -22,7 +22,7 @@ backup_restore=1 multi_instance=1 port_already_use=0 - change_url=1 + change_url=0 ;;; Options Email=kemenaran@gmail.com Notification=none diff --git a/scripts/change_url b/scripts/change_url deleted file mode 100644 index abe78ca..0000000 --- a/scripts/change_url +++ /dev/null @@ -1,154 +0,0 @@ -#!/bin/bash - -#================================================= -# GENERIC STARTING -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - -source _common.sh -source /usr/share/yunohost/helpers - -#================================================= -# RETRIEVE ARGUMENTS -#================================================= - -old_domain=$YNH_APP_OLD_DOMAIN -old_path=$YNH_APP_OLD_PATH - -new_domain=$YNH_APP_NEW_DOMAIN -new_path=$YNH_APP_NEW_PATH - -app=$YNH_APP_INSTANCE_NAME - -#================================================= -# LOAD SETTINGS -#================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 - -# Needed for helper "ynh_add_nginx_config" -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -port=$(ynh_app_setting_get --app=$app --key=port) -language=$(ynh_app_setting_get --app=$app --key=language) - -# 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) - -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= -ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1 - -# 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 -#================================================= - -change_domain=0 -if [ "$old_domain" != "$new_domain" ] -then - change_domain=1 -fi - -change_path=0 -if [ "$old_path" != "$new_path" ] -then - change_path=1 -fi - -#================================================= -# STANDARD MODIFICATIONS -#================================================= -# STOP SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Stopping a systemd service..." --weight=1 - -ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" - -#================================================= -# MODIFY URL IN NGINX CONF -#================================================= -ynh_script_progression --message="Updating NGINX web server configuration..." --weight=2 - -nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf - -# Change the path in the NGINX config file -if [ $change_path -eq 1 ] -then - # Make a backup of the original NGINX config file if modified - ynh_backup_if_checksum_is_different --file="$nginx_conf_path" - # Set global variables for NGINX helper - domain="$old_domain" - path_url="$new_path" - # Create a dedicated NGINX config - ynh_add_nginx_config -fi - -# Change the domain for NGINX -if [ $change_domain -eq 1 ] -then - # Delete file checksum for the old conf file location - ynh_delete_file_checksum --file="$nginx_conf_path" - mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf - # Store file checksum for the new config file location - ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" -fi - -#================================================= -# MODIFY A CONFIG FILE -#================================================= -ynh_script_progression --message="Modifying a config file..." --weight=3 - -cp ../conf/config.json $final_path/config/config.json - -data_path="/home/yunohost.app/$app" -logs_path="/var/log/$app" - -# Main config File -ynh_replace_string --match_string="__URL__" --replace_string="https://$new_domain$new_path" --target_file="$final_path/config/config.json" -ynh_replace_string --match_string="__PORT__" --replace_string="127.0.0.1:$port" --target_file="$final_path/config/config.json" -ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$final_path/config/config.json" -ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_user" --target_file="$final_path/config/config.json" -ynh_replace_string --match_string="__DB_PASS__" --replace_string="$db_pwd" --target_file="$final_path/config/config.json" -ynh_replace_string --match_string="__DATA__" --replace_string="$data_path" --target_file="$final_path/config/config.json" -ynh_replace_string --match_string="__FEEDBACK__" --replace_string="no-reply@${new_domain}" --target_file="$final_path/config/config.json" -ynh_replace_string --match_string="__USER_PW__" --replace_string="$(ynh_string_random --length=24)" --target_file="$final_path/config/config.json" -ynh_replace_string --match_string="__LOG__" --replace_string="$logs_path" --target_file="$final_path/config/config.json" -ynh_replace_string --match_string="__LANGUAGE__" --replace_string="$language" --target_file="$final_path/config/config.json" - -ynh_store_file_checksum --file="$final_path/config/config.json" - -#================================================= -# GENERIC FINALISATION -#================================================= -# START SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=3 - -ynh_systemd_action --service_name=$app --action=start --log_path="systemd" --line_match="Started Mattermost" - -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=2 - -ynh_systemd_action --service_name=nginx --action=reload - -#================================================= -# END OF SCRIPT -#================================================= - -ynh_script_progression --message="Change of URL completed for $app" --last From a6dc2d255ec4ec378472788d6fc035a958381620 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 12 Jan 2021 13:06:17 +0100 Subject: [PATCH 13/33] Update check_process --- check_process | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/check_process b/check_process index d6be4a9..65abcff 100644 --- a/check_process +++ b/check_process @@ -19,6 +19,7 @@ setup_private=1 setup_public=1 upgrade=1 + upgrade=1 from_commit=202cc0725652d4b8fbca52630267247bd58c8de1 backup_restore=1 multi_instance=1 port_already_use=0 @@ -27,6 +28,6 @@ Email=kemenaran@gmail.com Notification=none ;;; Upgrade options - ; commit=CommitHash - name=Name and date of the commit. - manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666& + ; commit=202cc0725652d4b8fbca52630267247bd58c8de1 + name=Merge pull request #196 from amyblais/patch-51 + \ No newline at end of file From 5a4ce86d90f542a7301bd824492dca662b72fcca Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 12 Jan 2021 13:16:25 +0100 Subject: [PATCH 14/33] Update check_process --- check_process | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/check_process b/check_process index 65abcff..99e0909 100644 --- a/check_process +++ b/check_process @@ -7,6 +7,7 @@ path="/path" (PATH) admin="john" (USER) email="john@gmail.com" + admin_email="john@gmail.com" password="admin!42" language="fr" team_display_name="Mon équipe" @@ -30,4 +31,3 @@ Notification=none ;;; Upgrade options ; commit=202cc0725652d4b8fbca52630267247bd58c8de1 name=Merge pull request #196 from amyblais/patch-51 - \ No newline at end of file From 86908c04448a77ec18a720797fe2b71d8bfd15f6 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 12 Jan 2021 13:26:03 +0100 Subject: [PATCH 15/33] Update check_process --- check_process | 1 + 1 file changed, 1 insertion(+) diff --git a/check_process b/check_process index 99e0909..1bb3deb 100644 --- a/check_process +++ b/check_process @@ -9,6 +9,7 @@ email="john@gmail.com" admin_email="john@gmail.com" password="admin!42" + admin_password="admin!42" language="fr" team_display_name="Mon équipe" is_public=1 (PUBLIC|public=1|private=0) From fc6a600bb9ad5ea8b2e88ab2d4930f031fba0bb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 13 Jan 2021 11:31:12 +0100 Subject: [PATCH 16/33] Add Team and Enterprise (#202) * Add Team/Entreprise install --- README.md | 6 +++++- check_process | 23 ++++++++++++++++++++++- conf/enterprise.src | 6 ++++++ manifest.json | 14 ++++++++++++++ scripts/install | 11 ++++++++++- scripts/remove | 2 +- scripts/upgrade | 21 ++++++++++++++++++--- 7 files changed, 76 insertions(+), 7 deletions(-) create mode 100644 conf/enterprise.src diff --git a/README.md b/README.md index f6dea1f..d56a2dc 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,10 @@ Mattermost is a self-hosted, open source instant messaging and service software. ## YunoHost specific features +This package can install the [*Entreprise Edition*](https://docs.mattermost.com/overview/product.html#mattermost-enterprise-edition) or the [*Team Edition*](https://docs.mattermost.com/overview/product.html#mattermost-team-edition). + +Mattermost Mobile and Desktop Apps are available [here](https://mattermost.com/download/) + #### Multi-user support * Are LDAP and HTTP auth supported? **No** @@ -44,7 +48,7 @@ Mattermost is a self-hosted, open source instant messaging and service software. ## Additional information -* This package can by installed on `ARM`, `ARM64` and `x86-64` architecture. +* This package can by installed on `ARM`, `ARM64` and `x86-64` architecture (only `x86-64` if you choose to ibstall the *Entreprise Edition*). ## Links diff --git a/check_process b/check_process index 1bb3deb..5be57e9 100644 --- a/check_process +++ b/check_process @@ -1,7 +1,7 @@ # See here for more information # https://github.com/YunoHost/package_check#syntax-check_process-file -;; Test complet +;; Test with Enterprise Edition ; Manifest domain="domain.tld" (DOMAIN) path="/path" (PATH) @@ -11,6 +11,7 @@ password="admin!42" admin_password="admin!42" language="fr" + version="Enterprise" team_display_name="Mon équipe" is_public=1 (PUBLIC|public=1|private=0) ; Checks @@ -26,6 +27,26 @@ multi_instance=1 port_already_use=0 change_url=0 +;; Test with Team Edition + ; Manifest + domain="domain.tld" (DOMAIN) + path="/path" (PATH) + admin="john" (USER) + email="john@gmail.com" + admin_email="john@gmail.com" + password="admin!42" + admin_password="admin!42" + language="fr" + version="Team" + team_display_name="Mon équipe" + is_public=1 (PUBLIC|public=1|private=0) + ; Checks + setup_sub_dir=1 + setup_root=1 + setup_private=1 + setup_public=1 + upgrade=1 + upgrade=1 from_commit=202cc0725652d4b8fbca52630267247bd58c8de1 ;;; Options Email=kemenaran@gmail.com Notification=none diff --git a/conf/enterprise.src b/conf/enterprise.src new file mode 100644 index 0000000..5226b55 --- /dev/null +++ b/conf/enterprise.src @@ -0,0 +1,6 @@ +SOURCE_URL=https://releases.mattermost.com/5.30.1/mattermost-5.30.1-linux-amd64.tar.gz +SOURCE_SUM=14018addf86c040200515cb0141308a6d213f149f8afe425dd171347be516401 +SOURCE_SUM_PRG=sha256sum +SOURCE_FORMAT=tar.gz +SOURCE_IN_SUBDIR=true +SOURCE_FILENAME=mattermost-5.30.1-linux-amd64.tar.gz diff --git a/manifest.json b/manifest.json index b946125..01019f4 100644 --- a/manifest.json +++ b/manifest.json @@ -73,6 +73,20 @@ }, "example": "Choose a password" }, + { + "name": "version", + "type": "string", + "ask": { + "en": "Choose the version you want to install", + "fr": "Choisissez la version que vous souhaitez installer" + }, + "help": { + "en": "Use Team Edition for the open source version (ARM, ARM64 and x86-64 support) or Enterprise Edition if you want to use a license (x86-64 support only)", + "fr": "Utilisez Team Edition pour la version open source (prise en charge ARM, ARM64 et x86-64) ou Enterprise Edition si vous souhaitez utiliser une licence (prise en charge x86-64 uniquement)" + }, + "choices": ["Enterprise", "Team"], + "default": "Team" + }, { "name": "language", "type": "string", diff --git a/scripts/install b/scripts/install index 55b1ee3..a7e0e80 100644 --- a/scripts/install +++ b/scripts/install @@ -32,6 +32,7 @@ password=$YNH_APP_ARG_PASSWORD language=$YNH_APP_ARG_LANGUAGE team_display_name=$YNH_APP_ARG_TEAM_DISPLAY_NAME architecture=$(ynh_detect_arch) +version=$YNH_APP_ARG_VERSION app=$YNH_APP_INSTANCE_NAME @@ -57,6 +58,7 @@ ynh_app_setting_set --app=$app --key=is_public --value=$is_public ynh_app_setting_set --app=$app --key=admin --value=$admin ynh_app_setting_set --app=$app --key=password --value=$password ynh_app_setting_set --app=$app --key=language --value=$language +ynh_app_setting_set --app=$app --key=version --value=$version ynh_app_setting_set --app=$app --key=team_display_name --value=$team_display_name #================================================= @@ -94,7 +96,14 @@ ynh_script_progression --message="Setting up source files..." --weight=3 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" --source_id="$architecture" + +if [ "$version" = "Enterprise" ]; then + # Get Enterprise binary path + ynh_setup_source --dest_dir="$final_path" --source_id="enterprise" +elif [ "$version" = "Team" ]; then + # Get Team binary path + ynh_setup_source --dest_dir="$final_path" --source_id="$architecture" +fi #================================================= # CREATE DIRECTORY FOR DATA diff --git a/scripts/remove b/scripts/remove index fb1ec22..46b9cc8 100755 --- a/scripts/remove +++ b/scripts/remove @@ -43,7 +43,7 @@ ynh_script_progression --message="Stopping and removing the systemd service..." ynh_remove_systemd_config #================================================= -# REMOVE THE POSTGRESQL DATABASE +# REMOVE THE MySQL DATABASE #================================================= ynh_script_progression --message="Removing the MySQL database..." --weight=2 diff --git a/scripts/upgrade b/scripts/upgrade index 371ae6e..5093a14 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -34,6 +34,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) language=$(ynh_app_setting_get --app=$app --key=language) db_name=$(ynh_app_setting_get --app=$app --key=db_name) architecture=$(ynh_detect_arch) +version=$(ynh_app_setting_get --app=$app --key=version) #================================================= # CHECK VERSION @@ -60,6 +61,18 @@ if ! [[ "$port" ]]; then ynh_app_setting_set --app=$app --key=port --value=$port fi +# Save the language used if not present +if ! [[ "$language" ]]; then + language="en" + ynh_app_setting_set --app=$app --key=language --value=$language +fi + +# If version setting doesn't exist +if [ -z "$version" ]; then + version="Enterprise" + ynh_app_setting_set --app=$app --key=version --value=$version +fi + #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -100,8 +113,11 @@ then # Remove the app directory securely ynh_secure_remove --file="$final_path" - # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$final_path" --source_id="$architecture" + if [ "$version" = "Enterprise" ]; then + ynh_setup_source --dest_dir="$final_path" --source_id="enterprise" + elif [ "$version" = "Team" ]; then + ynh_setup_source --dest_dir="$final_path" --source_id="$architecture" + fi # Copy the admin saved settings from tmp directory to final path cp -a "$tmpdir/config.json" "$final_path/config/config.json" @@ -168,7 +184,6 @@ chown -R $app: "$data_path" chown -R $app: $final_path chmod -R g+w $final_path - chown -R $app: "/var/log/$app" #================================================= From 0e2889e68bec1c5d1de6acb7ab5704691bce0967 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 13 Jan 2021 11:41:28 +0100 Subject: [PATCH 17/33] Update README_fr.md --- README_fr.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README_fr.md b/README_fr.md index 54b1093..71b2ffe 100644 --- a/README_fr.md +++ b/README_fr.md @@ -28,6 +28,8 @@ Mattermost est un logiciel et un service de messagerie instantanée libre auto-h ## Caractéristiques spécifiques YunoHost +Ce paquet peut installer la version [*Entreprise Edition*](https://docs.mattermost.com/overview/product.html#mattermost-enterprise-edition) ou la version [*Team Edition*](https://docs.mattermost.com/overview/product.html#mattermost-team-edition). + #### Support multi-utilisateur * L'authentification LDAP et HTTP est-elle prise en charge ? **Non** @@ -44,7 +46,7 @@ Mattermost est un logiciel et un service de messagerie instantanée libre auto-h ## Informations additionnelles -Ce paquet peut être installé sur les architectures `xARM`x, `xARM64`x et `x86-64`. +Ce paquet peut être installé sur les architectures `ARM`, `ARM64` et `x86-64` (mais uniquement `x86-64` si vous choisissez d'installer la version *Enterprise Edition*). ## Liens From e56f308b4e271fd6157e969f898a3cb8a69cd04f Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 13 Jan 2021 18:44:21 +0100 Subject: [PATCH 18/33] Update check_process --- check_process | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/check_process b/check_process index 5be57e9..33881a6 100644 --- a/check_process +++ b/check_process @@ -1,6 +1,3 @@ -# See here for more information -# https://github.com/YunoHost/package_check#syntax-check_process-file - ;; Test with Enterprise Edition ; Manifest domain="domain.tld" (DOMAIN) @@ -53,3 +50,4 @@ Notification=none ;;; Upgrade options ; commit=202cc0725652d4b8fbca52630267247bd58c8de1 name=Merge pull request #196 from amyblais/patch-51 + \ No newline at end of file From ad1ebec045c921f2fd1d8ae61c3d46eb1f43ac9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 14 Jan 2021 08:35:56 +0100 Subject: [PATCH 19/33] Update scripts/upgrade Co-authored-by: Kayou --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 5093a14..be37200 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -62,7 +62,7 @@ if ! [[ "$port" ]]; then fi # Save the language used if not present -if ! [[ "$language" ]]; then +if [ -z "$language" ]; then language="en" ynh_app_setting_set --app=$app --key=language --value=$language fi From 504697a984e1245caf97b0985c93c7503b464a06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 14 Jan 2021 08:36:16 +0100 Subject: [PATCH 20/33] Update scripts/upgrade Co-authored-by: Kayou --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index be37200..90b424c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -56,7 +56,7 @@ fi ynh_app_setting_set --app=$app --key=is_public --value=$is_public # Save the port used if not present -if ! [[ "$port" ]]; then +if [ -z "$port" ]; then port=8065 ynh_app_setting_set --app=$app --key=port --value=$port fi From e85767b9ba356a53cd663809ecb1b8921928b033 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 14 Jan 2021 12:16:52 +0100 Subject: [PATCH 21/33] Update README.md Co-authored-by: Pierre de La Morinerie --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d56a2dc..e3fe100 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ Mattermost Mobile and Desktop Apps are available [here](https://mattermost.com/d ## Additional information -* This package can by installed on `ARM`, `ARM64` and `x86-64` architecture (only `x86-64` if you choose to ibstall the *Entreprise Edition*). +* This package can by installed on `ARM`, `ARM64` and `x86-64` architecture (only `x86-64` if you choose to install the *Entreprise Edition*). ## Links From 387d5308533b6b534f2eb62e8694e2e0ff47a5a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 14 Jan 2021 12:17:05 +0100 Subject: [PATCH 22/33] Update README_fr.md Co-authored-by: Pierre de La Morinerie --- README_fr.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README_fr.md b/README_fr.md index 71b2ffe..a59104e 100644 --- a/README_fr.md +++ b/README_fr.md @@ -42,7 +42,7 @@ Ce paquet peut installer la version [*Entreprise Edition*](https://docs.mattermo ## Limitations -* Limitations connues. +* L'intégration LDAP n'est pas gérée (see #58) ## Informations additionnelles From c7f9432529ebfdedcc207337f966555dc1579dd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 14 Jan 2021 12:19:20 +0100 Subject: [PATCH 23/33] Update manifest.json Co-authored-by: Pierre de La Morinerie --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 01019f4..8535c0f 100644 --- a/manifest.json +++ b/manifest.json @@ -50,7 +50,7 @@ "fr": "Est-ce une application publique ?" }, "help": { - "en": "If enabled, Mattermost will be accessible by people who do not have an account. This can be changed later via the webadmin.", + "en": "If enabled, Mattermost will be accessible by people without a Yunohost account. This can be changed later via the webadmin.", "fr": "Si cette case est cochée, Mattermost sera accessible aux personnes n’ayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin." }, "default": true From 9c3a0960f62644e224fee1c20e20241c14557e9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 14 Jan 2021 12:20:53 +0100 Subject: [PATCH 24/33] Update scripts/backup Co-authored-by: Pierre de La Morinerie --- scripts/backup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/backup b/scripts/backup index a97b6a8..71939c6 100755 --- a/scripts/backup +++ b/scripts/backup @@ -63,7 +63,7 @@ ynh_backup --src_path="/etc/logrotate.d/$app" ynh_backup --src_path="/etc/systemd/system/$app.service" #================================================= -# BACKUP THE POSTGRESQL DATABASE +# BACKUP THE DATABASE #================================================= ynh_print_info --message="Backing up the MySQL database..." From 55823d9b24e5419cc80c15dc452197c67ba756b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 14 Jan 2021 12:21:34 +0100 Subject: [PATCH 25/33] Update manifest.json Co-authored-by: Pierre de La Morinerie --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 8535c0f..4202e1a 100644 --- a/manifest.json +++ b/manifest.json @@ -51,7 +51,7 @@ }, "help": { "en": "If enabled, Mattermost will be accessible by people without a Yunohost account. This can be changed later via the webadmin.", - "fr": "Si cette case est cochée, Mattermost sera accessible aux personnes n’ayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin." + "fr": "Si cette case est cochée, Mattermost sera accessible aux personnes sans compte Yunohost. Vous pourrez changer ceci plus tard via l’interface d’administration." }, "default": true }, From 6c566417ef1403abb7fc3fd6d97f4657f8e2ba0f Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Thu, 14 Jan 2021 12:31:05 +0100 Subject: [PATCH 26/33] people -> user --- manifest.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index 4202e1a..27b6e0c 100644 --- a/manifest.json +++ b/manifest.json @@ -50,8 +50,8 @@ "fr": "Est-ce une application publique ?" }, "help": { - "en": "If enabled, Mattermost will be accessible by people without a Yunohost account. This can be changed later via the webadmin.", - "fr": "Si cette case est cochée, Mattermost sera accessible aux personnes sans compte Yunohost. Vous pourrez changer ceci plus tard via l’interface d’administration." + "en": "If enabled, Mattermost will be accessible by the user without a YunoHost account. This can be changed later via the webadmin.", + "fr": "Si cette case est cochée, Mattermost sera accessible par l'utilisateur sans compte YunoHost. Vous pourrez changer ceci plus tard via l’interface d’administration." }, "default": true }, From 5785cd0a3741fdfd6a038bd6759bd6026290cf3e Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Fri, 15 Jan 2021 19:05:34 +0100 Subject: [PATCH 27/33] Upgrade to version 5.31.0 --- README.md | 2 +- README_fr.md | 2 +- conf/arm.src | 6 +++--- conf/arm64.src | 6 +++--- conf/config.json | 2 ++ conf/enterprise.src | 6 +++--- conf/x86-64.src | 6 +++--- manifest.json | 2 +- 8 files changed, 17 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index e3fe100..4e33c74 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in ## Overview Mattermost is a self-hosted, open source instant messaging and service software. It's designed as an internal chat for organizations and businesses, and it's touted as an alternative to Slack. -**Shipped version:** 5.30.1 +**Shipped version:** 5.31.0 ## Screenshots diff --git a/README_fr.md b/README_fr.md index a59104e..f1b18f7 100644 --- a/README_fr.md +++ b/README_fr.md @@ -11,7 +11,7 @@ Si vous n'avez pas YunoHost, consultez [le guide](https://yunohost.org/#/install ## Vue d'ensemble Mattermost est un logiciel et un service de messagerie instantanée libre auto-hébergeable. Il est conçu comme un chat interne pour les organisations et les entreprises, et il est présenté comme une alternative à Slack. -**Version incluse :** 5.30.1 +**Version incluse :** 5.31.0 ## Captures d'écran diff --git a/conf/arm.src b/conf/arm.src index 54444f7..97ad461 100644 --- a/conf/arm.src +++ b/conf/arm.src @@ -1,6 +1,6 @@ -SOURCE_URL=https://github.com/SmartHoneybee/ubiquitous-memory/releases/download/v5.30.1/mattermost-v5.30.1-linux-arm.tar.gz -SOURCE_SUM=2292157939eb5be0ac5e1d58bc690d8f359040f1ae55f37f1f90cab422d11e2d +SOURCE_URL=https://github.com/SmartHoneybee/ubiquitous-memory/releases/download/v5.31.0/mattermost-v5.31.0-linux-arm.tar.gz +SOURCE_SUM=15af0f4757fe1db9f6322fd9d5551aacbfe1c4082ad543dc4641d0a541133b5f SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true -SOURCE_FILENAME=mattermost-v5.30.1-linux-arm.tar.gz +SOURCE_FILENAME=mattermost-v5.31.0-linux-arm.tar.gz diff --git a/conf/arm64.src b/conf/arm64.src index bd34361..7a6412f 100644 --- a/conf/arm64.src +++ b/conf/arm64.src @@ -1,6 +1,6 @@ -SOURCE_URL=https://github.com/SmartHoneybee/ubiquitous-memory/releases/download/v5.30.1/mattermost-v5.30.1-linux-arm64.tar.gz -SOURCE_SUM=cbd150100947686c2d177db6067e98a36859e7da2fe4c173b89925a2fd1415d1 +SOURCE_URL=https://github.com/SmartHoneybee/ubiquitous-memory/releases/download/v5.31.0/mattermost-v5.31.0-linux-arm64.tar.gz +SOURCE_SUM=5bc29121ea13f7be21231bc3d18a030a062d407daf53b89b8af99c2bd554d214 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true -SOURCE_FILENAME=mattermost-v5.30.1-linux-arm64.tar.gz +SOURCE_FILENAME=mattermost-v5.31.0-linux-arm64.tar.gz diff --git a/conf/config.json b/conf/config.json index 9adf518..4da146c 100644 --- a/conf/config.json +++ b/conf/config.json @@ -98,6 +98,7 @@ "FeatureFlagSyncIntervalSeconds": 30, "DebugSplit": false, "ThreadAutoFollow": true, + "CollapsedThreads": "disabled", "ManagedResourcePaths": "" }, "TeamSettings": { @@ -539,6 +540,7 @@ }, "FeatureFlags": { "TestFeature": "off", + "TestBoolFeature": false, "CloudDelinquentEmailJobsEnabled": false } } \ No newline at end of file diff --git a/conf/enterprise.src b/conf/enterprise.src index 5226b55..812761c 100644 --- a/conf/enterprise.src +++ b/conf/enterprise.src @@ -1,6 +1,6 @@ -SOURCE_URL=https://releases.mattermost.com/5.30.1/mattermost-5.30.1-linux-amd64.tar.gz -SOURCE_SUM=14018addf86c040200515cb0141308a6d213f149f8afe425dd171347be516401 +SOURCE_URL=https://releases.mattermost.com/5.31.0/mattermost-5.31.0-linux-amd64.tar.gz +SOURCE_SUM=05e4631a1c755925981838a331addf9575e5ff16f5c4ade2354ef66325f3d06d SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true -SOURCE_FILENAME=mattermost-5.30.1-linux-amd64.tar.gz +SOURCE_FILENAME=mattermost-5.31.0-linux-amd64.tar.gz diff --git a/conf/x86-64.src b/conf/x86-64.src index cc4b71f..695c2b7 100644 --- a/conf/x86-64.src +++ b/conf/x86-64.src @@ -1,6 +1,6 @@ -SOURCE_URL=https://releases.mattermost.com/5.30.1/mattermost-team-5.30.1-linux-amd64.tar.gz -SOURCE_SUM=3c4165d7ea240ad49dba8e486d9fd7de83eea7cac2cb9a355d891dd605b3fa52 +SOURCE_URL=https://releases.mattermost.com/5.31.0/mattermost-team-5.31.0-linux-amd64.tar.gz +SOURCE_SUM=3c9e862df1166000566772876f38713cf1eb8b64b675bcef3819fb9cc255d7bc SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true -SOURCE_FILENAME=mattermost-team-5.30.1-linux-amd64.tar.gz +SOURCE_FILENAME=mattermost-team-5.31.0-linux-amd64.tar.gz diff --git a/manifest.json b/manifest.json index 27b6e0c..3090293 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Open source collaboration platform built for developers", "fr": "Plateforme de collaboration open source conçue pour les développeurs" }, - "version": "5.30.1~ynh1", + "version": "5.31.0~ynh1", "url": "http://www.mattermost.org/", "license": "GPL-3.0-only", "maintainer": { From ef36b4ad0f170d9c1395bb695630dba3be3b27e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 15 Jan 2021 19:49:55 +0100 Subject: [PATCH 28/33] Update README.md Co-authored-by: Pierre de La Morinerie --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4e33c74..53da9e6 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ Mattermost Mobile and Desktop Apps are available [here](https://mattermost.com/d ## Limitations -* Any known limitations. +* LDAP integration is not supported (see #58) ## Additional information From 6da9363749ad019063c34429d7e7fe5045537ccd Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 17 Jan 2021 19:41:16 +0100 Subject: [PATCH 29/33] Create change_url --- scripts/change_url | 156 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 156 insertions(+) create mode 100644 scripts/change_url diff --git a/scripts/change_url b/scripts/change_url new file mode 100644 index 0000000..8d024d8 --- /dev/null +++ b/scripts/change_url @@ -0,0 +1,156 @@ +#!/bin/bash + +#================================================= +# GENERIC STARTING +#================================================= +# IMPORT GENERIC HELPERS +#================================================= + +source _common.sh +source /usr/share/yunohost/helpers + +#================================================= +# RETRIEVE ARGUMENTS +#================================================= + +old_domain=$YNH_APP_OLD_DOMAIN +old_path=$YNH_APP_OLD_PATH + +new_domain=$YNH_APP_NEW_DOMAIN +new_path=$YNH_APP_NEW_PATH + +app=$YNH_APP_INSTANCE_NAME + +#================================================= +# LOAD SETTINGS +#================================================= +ynh_script_progression --message="Loading installation settings..." --weight=1 + +# Needed for helper "ynh_add_nginx_config" +final_path=$(ynh_app_setting_get --app=$app --key=final_path) +port=$(ynh_app_setting_get --app=$app --key=port) +language=$(ynh_app_setting_get --app=$app --key=language) + +# 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) + +#================================================= +# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +#================================================= +ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1 + +# 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 +#================================================= + +change_domain=0 +if [ "$old_domain" != "$new_domain" ] +then + change_domain=1 +fi + +change_path=0 +if [ "$old_path" != "$new_path" ] +then + change_path=1 +fi + +#================================================= +# STANDARD MODIFICATIONS +#================================================= +# STOP SYSTEMD SERVICE +#================================================= +ynh_script_progression --message="Stopping a systemd service..." --weight=4 + +ynh_systemd_action --service_name=$app --action=stop --log_path="/var/log/$app/$app.log" + +#================================================= +# MODIFY URL IN NGINX CONF +#================================================= +ynh_script_progression --message="Updating NGINX web server configuration..." --weight=2 + +nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf + +# Change the path in the NGINX config file +if [ $change_path -eq 1 ] +then + # Make a backup of the original NGINX config file if modified + ynh_backup_if_checksum_is_different --file="$nginx_conf_path" + # Set global variables for NGINX helper + domain="$old_domain" + path_url="$new_path" + # Create a dedicated NGINX config + ynh_add_nginx_config +fi + +# Change the domain for NGINX +if [ $change_domain -eq 1 ] +then + # Delete file checksum for the old conf file location + ynh_delete_file_checksum --file="$nginx_conf_path" + mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf + # Store file checksum for the new config file location + ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" +fi + +#================================================= +# EDIT MATTERMOST CONFIG +#================================================= +# MODIFY A CONFIG FILE +#================================================= +ynh_script_progression --message="Modifying a config file..." --weight=3 + +logs_path="/var/log/$app" +data_path="/home/yunohost.app/$app" +cp ../conf/config.json $final_path/config/config.json + +# Main config File +ynh_replace_string --match_string="__URL__" --replace_string="https://$new_domain$new_path" --target_file="$final_path/config/config.json" +ynh_replace_string --match_string="__PORT__" --replace_string="127.0.0.1:$port" --target_file="$final_path/config/config.json" +ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$final_path/config/config.json" +ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_user" --target_file="$final_path/config/config.json" +ynh_replace_string --match_string="__DB_PASS__" --replace_string="$db_pwd" --target_file="$final_path/config/config.json" +ynh_replace_string --match_string="__DATA__" --replace_string="$data_path" --target_file="$final_path/config/config.json" +ynh_replace_string --match_string="__FEEDBACK__" --replace_string="no-reply@${new_domain}" --target_file="$final_path/config/config.json" +ynh_replace_string --match_string="__USER_PW__" --replace_string="$(ynh_string_random --length=24)" --target_file="$final_path/config/config.json" +ynh_replace_string --match_string="__LOG__" --replace_string="$logs_path" --target_file="$final_path/config/config.json" +ynh_replace_string --match_string="__LANGUAGE__" --replace_string="$language" --target_file="$final_path/config/config.json" + +ynh_store_file_checksum --file="$final_path/config/config.json" + +#================================================= +# GENERIC FINALISATION +#================================================= +# START SYSTEMD SERVICE +#================================================= +ynh_script_progression --message="Starting a systemd service..." --weight=2 + +# Start a systemd service +ynh_systemd_action --service_name=$app --action=start --log_path="systemd" --line_match="Started Mattermost" + +#================================================= +# RELOAD NGINX +#================================================= +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 + +ynh_systemd_action --service_name=nginx --action=reload + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_script_progression --message="Change of URL completed for $app" --last From d7e2d02438fe512b2cad9ffbe8806829e16d3e9f Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 17 Jan 2021 19:42:20 +0100 Subject: [PATCH 30/33] Update check_process --- check_process | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/check_process b/check_process index 33881a6..c29a250 100644 --- a/check_process +++ b/check_process @@ -23,7 +23,7 @@ backup_restore=1 multi_instance=1 port_already_use=0 - change_url=0 + change_url=1 ;; Test with Team Edition ; Manifest domain="domain.tld" (DOMAIN) From 9f72ea137ca48ea3d0224f5d3742bf688c83d63b Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 17 Jan 2021 23:34:03 +0100 Subject: [PATCH 31/33] Update change_url --- scripts/change_url | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/change_url b/scripts/change_url index 8d024d8..205d5e7 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -34,7 +34,7 @@ language=$(ynh_app_setting_get --app=$app --key=language) # 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) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP From 39490457467cd68bab83c2652a75fbd8db8ea712 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 17 Jan 2021 23:47:36 +0100 Subject: [PATCH 32/33] Update change_url --- scripts/change_url | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/change_url b/scripts/change_url index 205d5e7..be48478 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -34,7 +34,7 @@ language=$(ynh_app_setting_get --app=$app --key=language) # 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=psqlpwd) +db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP From ccf9375210c9bbf9a16a4c6fce35598b46c3846a Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 18 Jan 2021 13:28:22 +0100 Subject: [PATCH 33/33] Update change_url --- scripts/change_url | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index be48478..12fa15a 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -29,12 +29,6 @@ ynh_script_progression --message="Loading installation settings..." --weight=1 # Needed for helper "ynh_add_nginx_config" final_path=$(ynh_app_setting_get --app=$app --key=final_path) port=$(ynh_app_setting_get --app=$app --key=port) -language=$(ynh_app_setting_get --app=$app --key=language) - -# 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=mysqlpwd) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP @@ -114,21 +108,9 @@ fi #================================================= ynh_script_progression --message="Modifying a config file..." --weight=3 -logs_path="/var/log/$app" -data_path="/home/yunohost.app/$app" -cp ../conf/config.json $final_path/config/config.json - # Main config File -ynh_replace_string --match_string="__URL__" --replace_string="https://$new_domain$new_path" --target_file="$final_path/config/config.json" -ynh_replace_string --match_string="__PORT__" --replace_string="127.0.0.1:$port" --target_file="$final_path/config/config.json" -ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$final_path/config/config.json" -ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_user" --target_file="$final_path/config/config.json" -ynh_replace_string --match_string="__DB_PASS__" --replace_string="$db_pwd" --target_file="$final_path/config/config.json" -ynh_replace_string --match_string="__DATA__" --replace_string="$data_path" --target_file="$final_path/config/config.json" -ynh_replace_string --match_string="__FEEDBACK__" --replace_string="no-reply@${new_domain}" --target_file="$final_path/config/config.json" -ynh_replace_string --match_string="__USER_PW__" --replace_string="$(ynh_string_random --length=24)" --target_file="$final_path/config/config.json" -ynh_replace_string --match_string="__LOG__" --replace_string="$logs_path" --target_file="$final_path/config/config.json" -ynh_replace_string --match_string="__LANGUAGE__" --replace_string="$language" --target_file="$final_path/config/config.json" +ynh_replace_string --match_string="\"SiteURL\": \".*\"" --replace_string="\"SiteURL\": \"https://${new_domain}${new_path}\"" --target_file="$final_path/config/config.json" +ynh_replace_string --match_string="\"FeedbackEmail\": \".*\"" --replace_string="\"FeedbackEmail\": \"no-reply@${new_domain}\"" --target_file="$final_path/config/config.json" ynh_store_file_checksum --file="$final_path/config/config.json"