1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/mattermost_ynh.git synced 2024-09-03 19:36:29 +02:00

Packaging format v2 (#406)

* backup script for PostgreSQL (#376)

Inspired from https://github.com/YunoHost-Apps/moodle_ynh/blob/master/scripts/backup

* Adapt to PostgreSQL (#375)

Question: in https://docs.mattermost.com/install/install-debian.html#install-postgresql-database-server, I see `BindsTo=postgresql.service` while in the original file here I find `Requires=mysql.service`. I don't know which one makes sense, so I keep the orinigal Yunohost version (Requires)

* config.json for PostgreSQL (#374)

Inspired from the original MySQL config.json and from Mattermost documentation https://docs.mattermost.com/install/install-debian.html#install-postgresql-database-server

* Install with PostgreSQL (#373)

I took inspiration from https://github.com/YunoHost-Apps/commento_ynh/blob/master/scripts/install

* install postgresql

* Reordering

* reset config file

* Update _common.sh

* Update config.json

* Fix

* Migration (#382)

* add migration

* Update upgrade

* Update upgrade

* Update upgrade

* Update upgrade

* Update upgrade

* Update upgrade

* Update upgrade

* Update upgrade

* Update upgrade

* Update upgrade

* Update upgrade

* Update upgrade

* Update upgrade

* Fix

* Fix

* Fix

* Update install

* Update upgrade

* Fix

* Update install

* Update upgrade

* Update upgrade

* Update upgrade

* Update upgrade

* Update upgrade

* Update upgrade

* Update upgrade

* Update upgrade

* Update upgrade

* Update upgrade

* Update upgrade

* Update upgrade

* Update upgrade

* Update upgrade

* Update upgrade

* Update install

* Fix

* Fix

* Fix

* Update upgrade

* Cleaning up

* Update upgrade

* Update _common.sh

* Update check_process

* Update _common.sh

* Fix

* Update mysql-to-pg.conf

* Update upgrade

* Update systemd.service

* Cleaning

* Update _common.sh

* Fix

* Update upgrade

* Update _common.sh

* Update upgrade

* Update backup

* Fix

* Fix

* Update upgrade

* Update upgrade

* Update systemd.service

* Update _common.sh

* Revert "Update _common.sh"

This reverts commit d880150af9.

* Cleaning

* Fix

* Update check_process

* Fix

* Update _common.sh

* Fix

* Update _common.sh

* Fix

* Update manifest.json

* Update install

* Update _common.sh

* Update upgrade

* Fix

* Update _common.sh

* Update _common.sh

* Update _common.sh

* Update _common.sh

* Update _common.sh

* Update _common.sh

* Update _common.sh

* Update _common.sh

* Auto-update README

* Update _common.sh

* Upgrade to v7.4.0

* Auto-update README

* Upgrade to v7.5.2

* Auto-update README

* Update config.json

* [fix] mariadb to postgres migration

* Auto-update README

* [fix] Update manifest requirements

* Update manifest.json

* Update config.json

* upgrade config to upstream

* Fix linter

* Update _common.sh

* v2

* Fix

* Auto-update README

* Fix

* Auto-update README

* Update upgrade

* Fix

* Cleaning

* add apt

* Auto-update README

* cleaning

* fix data path var

* fix

* Auto-update README

* Update backup

* add more apt

* Update manifest.toml

* Update tests.toml

* Fix

* Update _common.sh

* Update upgrade

* Update restore

* Update remove

* cleaning

* Update install

* Update upgrade

* Update upgrade

* Update upgrade

* Update upgrade

* Update manifest.toml

* 7.7.1

* Update manifest.json

* Auto-update README

* Update config.json

* Auto-update README

* cleaning

* Auto-update README

* Update ADMIN.md

* Update ADMIN_fr.md

* fix

* Delete check_process

* 7.8.1

* Auto-update README

* Auto-update README

* Update manifest.toml

* Auto-update README

* fix migration from 7.3.0

* Update manifest.toml

* fix migration from 7.3.0

* cleaning

* Update manifest.toml

* src

* Update upgrade

* Update upgrade

* Update tests.toml

* remove src

* 7.9.1

* Auto-update README

* Update config.json

* Update doc/DESCRIPTION.md

Co-authored-by: Pierre de La Morinerie <kemenaran@gmail.com>

* Auto-update README

* Update tests.toml

Co-authored-by: Pierre de La Morinerie <kemenaran@gmail.com>

* Update manifest.toml

Co-authored-by: Pierre de La Morinerie <kemenaran@gmail.com>

* Update manifest.toml

Co-authored-by: Pierre de La Morinerie <kemenaran@gmail.com>

* Update upgrade

* Update install

* Update DESCRIPTION_fr.md

* Auto-update README

* Update _common.sh

* Update manifest.toml

* Update manifest.toml

* Auto-update README

* Update manifest.toml

* Update upgrade

* Update manifest.toml

* Auto-update README

* cleaning

* Auto-update README

* Update nginx.conf

* Update manifest.toml

* Auto-update README

* cleaning

* Update doc/ADMIN.md

Co-authored-by: Alexandre Aubin <alex.aubin@mailoo.org>

* Update doc/ADMIN_fr.md

Co-authored-by: Alexandre Aubin <alex.aubin@mailoo.org>

* 8.0.0

* Auto-update README

* Update manifest.toml

* Auto-update README

* 8.1.0

* Auto-update README

* Update upgrade

* Update tests.toml

* Update tests.toml

* Update _common.sh

* Update manifest.toml

Co-authored-by: Pierre de La Morinerie <kemenaran@gmail.com>

* Update manifest.toml

Co-authored-by: Pierre de La Morinerie <kemenaran@gmail.com>

* Update manifest.toml

Co-authored-by: Pierre de La Morinerie <kemenaran@gmail.com>

* Update tests.toml

Co-authored-by: Pierre de La Morinerie <kemenaran@gmail.com>

* Update manifest.toml

* DEBUG: see if other migrations pass (#430)

* Update manifest.toml

* Auto-update README

* Revert "DEBUG: see if other migrations pass (#430)"

This reverts commit 8532bd3ba2.

* Update tests.toml

* scripts: fix MySQL migration

The PostgreSQL database has already been created,
no need to create it manually.

* scripts: improve DB migration comment

* Update config.json

* Update tests.toml

* Fix v2 database deletion on error (#434)

* scripts: improve comments

* scripts: manually remove MariaDB database if needed

---------

Co-authored-by: biva <biva@users.noreply.github.com>
Co-authored-by: yunohost-bot <yunohost@yunohost.org>
Co-authored-by: yunohost-bot <yunohost-bot@users.noreply.github.com>
Co-authored-by: ljf <ljf+git@grimaud.me>
Co-authored-by: Kay0u <pierre@kayou.io>
Co-authored-by: Pierre de La Morinerie <kemenaran@gmail.com>
Co-authored-by: Alexandre Aubin <alex.aubin@mailoo.org>
This commit is contained in:
eric_G 2023-09-11 10:48:35 +02:00 committed by GitHub
parent 9d84e31c77
commit 08e8dd7ab7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 333 additions and 1128 deletions

View file

@ -1,159 +0,0 @@
#!/bin/bash
#=================================================
# PACKAGE UPDATING HELPER
#=================================================
# This script is meant to be run by GitHub Actions
# The YunoHost-Apps organisation offers a template Action to run this script periodically
# Since each app is different, maintainers can adapt its contents so as to perform
# automatic actions when a new upstream release is detected.
# Remove this exit command when you are ready to run this Action
#exit 1
#=================================================
# FETCHING LATEST RELEASE AND ITS ASSETS
#=================================================
# Fetching information
current_version=$(cat manifest.json | jq -j '.version|split("~")[0]')
repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]')
# Some jq magic is needed, because the latest upstream release is not always the latest version (e.g. security patches for older versions)
version=$(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '.[] | select( .prerelease != true ) | .tag_name' | sort -V | tail -1)
if [[ ${version:0:1} == "v" || ${version:0:1} == "V" ]]; then
version=${version:1}
fi
# x86-64 team, x86-64 enterprise, ARM64 team and ARM64 enterprise assets are hosted on Mattermost's servers.
assets=()
assets+=("https://releases.mattermost.com/$version/mattermost-team-$version-linux-amd64.tar.gz")
assets+=("https://releases.mattermost.com/$version/mattermost-enterprise-$version-linux-amd64.tar.gz")
assets+=("https://releases.mattermost.com/$version/mattermost-team-$version-linux-arm64.tar.gz")
assets+=("https://releases.mattermost.com/$version/mattermost-enterprise-$version-linux-arm64.tar.gz")
# ARM and ARM64 are published in another repository (with a leading "v" for version tags)
other_repo="SmartHoneybee/ubiquitous-memory"
other_assets=($(curl --silent "https://api.github.com/repos/$other_repo/releases" | jq -r '[ .[] | select(.tag_name=="'v$version'").assets[].browser_download_url ] | join(" ") | @sh' | tr -d "'"))
# Setting up the environment variables
echo "Current version: $current_version"
echo "Latest release from upstream: $version"
echo "VERSION=$version" >> $GITHUB_ENV
# For the time being, let's assume the script will fail
echo "PROCEED=false" >> $GITHUB_ENV
# Proceed only if the retrieved version is greater than the current one
if ! dpkg --compare-versions "$current_version" "lt" "$version" ; then
echo "::warning ::No new version available"
exit 0
# Proceed only if a PR for this new version does not already exist
elif git ls-remote -q --exit-code --heads https://github.com/$GITHUB_REPOSITORY.git ci-auto-update-v$version ; then
echo "::warning ::A branch already exists for this update"
exit 0
fi
# Proceed only if all the binaries have been found
if (( ${#other_assets[@]} == 0 )); then
echo "::warning ::$other_repo has not released anything for v$version"
exit 0
else
assets+=( ${other_assets[@]} )
fi
# Each release can hold multiple assets (e.g. binaries for different architectures, source code, etc.)
echo "${#assets[@]} available asset(s)"
#=================================================
# UPDATE SOURCE FILES
#=================================================
# Here we use the $assets variable to get the resources published in the upstream release.
# Here is an example for Grav, it has to be adapted in accordance with how the upstream releases look like.
# Let's loop over the array of assets URLs
for asset_url in ${assets[@]}; do
echo "Handling asset at $asset_url"
# Assign the asset to a source file in conf/ directory
# Here we base the source file name upon a unique keyword in the assets url (admin vs. update)
# Leave $src empty to ignore the asset
case $asset_url in
*"mattermost-"*"-linux-arm.tar.gz")
src="team_armhf"
;;
*"mattermost-team-"*"-linux-arm64.tar.gz")
src="team_arm64"
;;
*"mattermost-enterprise-"*"-linux-amd64.tar.gz")
src="enterprise_amd64"
;;
*"mattermost-team-"*"-linux-amd64.tar.gz")
src="team_amd64"
;;
*"mattermost-enterprise-"*"-linux-amd64.tar.gz")
src="enterprise_amd64"
;;
*)
src=""
;;
esac
# If $src is not empty, let's process the asset
if [ ! -z "$src" ]; then
# Create the temporary directory
tempdir="$(mktemp -d)"
# Download sources and calculate checksum
filename=${asset_url##*/}
curl --silent -4 -L $asset_url -o "$tempdir/$filename"
checksum=$(sha256sum "$tempdir/$filename" | head -c 64)
# Delete temporary directory
rm -rf $tempdir
# Get extension
if [[ $filename == *.tar.gz ]]; then
extension=tar.gz
else
extension=${filename##*.}
fi
# Rewrite source file
cat <<EOT > conf/$src.src
SOURCE_URL=$asset_url
SOURCE_SUM=$checksum
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=$extension
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=mattermost.tar.gz
EOT
echo "... conf/$src.src updated"
else
echo "... asset ignored"
fi
done
#=================================================
# SPECIFIC UPDATE STEPS
#=================================================
# Any action on the app's source code can be done.
# The GitHub Action workflow takes care of committing all changes after this script ends.
#=================================================
# GENERIC FINALIZATION
#=================================================
# Replace new version in manifest
echo "$(jq -s --indent 4 ".[] | .version = \"$version~ynh1\"" manifest.json)" > manifest.json
# No need to update the README, yunohost-bot takes care of it
# The Action will proceed only if the PROCEED environment variable is set to true
echo "PROCEED=true" >> $GITHUB_ENV
exit 0

View file

@ -1,49 +0,0 @@
# This workflow allows GitHub Actions to automagically update your app whenever a new upstream release is detected.
# You need to enable Actions in your repository settings, and fetch this Action from the YunoHost-Apps organization.
# This file should be enough by itself, but feel free to tune it to your needs.
# It calls updater.sh, which is where you should put the app-specific update steps.
name: Check for new upstream releases
on:
# Allow to manually trigger the workflow
workflow_dispatch:
# Run it every day at 6:00 UTC
schedule:
- cron: '0 6 * * *'
jobs:
updater:
runs-on: ubuntu-latest
steps:
- name: Fetch the source code
uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Run the updater script
id: run_updater
run: |
# Setting up Git user
git config --global user.name 'yunohost-bot'
git config --global user.email 'yunohost-bot@users.noreply.github.com'
# Run the updater script
/bin/bash .github/workflows/updater.sh
- name: Commit changes
id: commit
if: ${{ env.PROCEED == 'true' }}
run: |
git commit -am "Upgrade to v$VERSION"
- name: Create Pull Request
id: cpr
if: ${{ env.PROCEED == 'true' }}
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Update to version ${{ env.VERSION }}
committer: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
author: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
signoff: false
branch: ci-auto-update-v${{ env.VERSION }}
base: testing
delete-branch: true
title: 'Upgrade to version ${{ env.VERSION }}'
body: |
Upgrade to v${{ env.VERSION }}
draft: false

View file

@ -17,11 +17,19 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
## Overview
## Mattermost Team Edition
A free-to-use, open source, self-hosted alternative to proprietary SaaS messaging. Team Edition is your open source “virtual office”, offering all the core productivity benefits of competing SaaS solutions. It deploys as a single Linux binary with MySQL under an MIT license.
A free-to-use, open source, self-hosted alternative to proprietary SaaS messaging. Team Edition is your open source “virtual office”, offering all the core productivity benefits of competing SaaS solutions. It deploys as a single Linux binary with PosgreSQL under an MIT license.
## Mattermost Enterprise Edition
To explore the benefits of Mattermosts enterprise features, you can replace the Mattermost Team Edition binary with a Mattermost Enterprise Edition binary. This version supports upgrading to Mattermost Enterprise Edition E10 or E20.
## 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/)
## Features include:
- One-to-one and group messaging, file sharing, and unlimited search history
@ -33,7 +41,6 @@ To explore the benefits of Mattermosts enterprise features, you can replace t
- Extensive integration support via webhooks, APIs, drivers, and third-party extensions
- Easily scalable to dozens of users per team
- Runtime profiling data and system monitoring reports
- New features and improvements released regularly
**Shipped version:** 8.1.1~ynh1
@ -42,27 +49,6 @@ To explore the benefits of Mattermosts enterprise features, you can replace t
![Screenshot of Mattermost](./doc/screenshots/screenshot.png)
## Disclaimers / important information
## Configuration
* How to configure this app: From an admin panel, a plain file with SSH.
* How to change from edition version to another (Team<->Enterprise): Modify the `settings.yml` in the apps directory `/etc/yunohost/apps/mattermost_instance/settings.yml` and replace the version to wich you whant: Team or Enterprise. Update your apps and verify the *About* on your Mattermost
## 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/)
## Limitations
* LDAP integration is not supported (see [#58](https://github.com/YunoHost-Apps/mattermost_ynh/issues/58))
## Additional information
* This package can by installed on `ARM`, `ARM64` and `x86-64` architecture (only `x86-64` and `ARM64` if you choose to install the *Entreprise Edition*).
## Documentation and resources
* Official app website: <http://www.mattermost.org/>

View file

@ -17,12 +17,19 @@ Si vous navez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po
## Vue densemble
## Mattermost Team Edition
Une alternative gratuite, open source et auto-hébergée à la messagerie SaaS propriétaire. Team Edition est votre « bureau virtuel » open source, offrant tous les principaux avantages de productivité des solutions SaaS concurrentes.
## Mattermost Entreprise Edition
Pour explorer les avantages des fonctionnalités d'entreprise de Mattermost, vous pouvez remplacer le binaire Mattermost Team Edition par un binaire Mattermost Enterprise Edition. Cette version prend en charge la mise à niveau vers Mattermost Enterprise Edition E10 ou E20.
## Les fonctionnalités incluent:
## 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).
## Les fonctionnalités incluent :
- Messagerie individuelle et de groupe, partage de fichiers et historique de recherche illimité
- Messagerie, emoji et emoji personnalisés
@ -33,7 +40,6 @@ Pour explorer les avantages des fonctionnalités d'entreprise de Mattermost, vou
- Prise en charge étendue de l'intégration via des webhooks, des API, des pilotes et des extensions tierces
- Facilement évolutif à des dizaines d'utilisateurs par équipe
- Données de profilage d'exécution et rapports de surveillance du système
- Nouvelles fonctionnalités et améliorations publiées régulièrement
**Version incluse :** 8.1.1~ynh1
@ -42,25 +48,6 @@ Pour explorer les avantages des fonctionnalités d'entreprise de Mattermost, vou
![Capture décran de Mattermost](./doc/screenshots/screenshot.png)
## Avertissements / informations importantes
## Configuration
* Comment configurer cette application : via le panneau d'administration, un fichier brut en SSH.
* Comment changer d'une version à une autre (Team<->Enterprise) : Modifiez le `settings.yml` dans le répertoire de l'application `/etc/yunohost/apps/mattermost_instance/settings.yml` et remplacez la version avec celle que vous voulez : Team ou Enterprise. Mettez à jour votre application et vérifiez dans le *À Propos* sur la console système de votre application.
## 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).
## Limitations
* L'intégration LDAP n'est pas gérée (see [#58](https://github.com/YunoHost-Apps/mattermost_ynh/issues/58))
## Informations additionnelles
Ce paquet peut être installé sur les architectures `ARM`, `ARM64` et `x86-64` (mais uniquement `x86-64` et `ARM64` si vous choisissez d'installer la version *Enterprise Edition*).
## Documentations et ressources
* Site officiel de lapp : <http://www.mattermost.org/>

View file

@ -1,61 +0,0 @@
;; Test with Enterprise Edition
; Manifest
domain="domain.tld"
path="/path"
admin="john"
email="john@gmail.com"
admin_email="john@gmail.com"
password="admin!42"
admin_password="admin!42"
language="fr"
version="Enterprise"
team_display_name="Mon équipe"
is_public=1
; Checks
pkg_linter=1
setup_sub_dir=1
setup_root=1
setup_nourl=0
setup_private=1
setup_public=1
upgrade=1
# 7.2.0
upgrade=1 from_commit=738ba505f581ddd72889c889dcb34406250fea35
# 7.3.0
upgrade=1 from_commit=1677cb9fa9d95ab788a6acd5b310b09c7d2ab7df
backup_restore=1
multi_instance=1
port_already_use=0
change_url=1
;; Test with Team Edition
; Manifest
domain="domain.tld"
path="/path"
admin="john"
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
; Checks
setup_sub_dir=1
setup_root=1
setup_private=1
setup_public=1
upgrade=1
# 7.2.0
upgrade=1 from_commit=738ba505f581ddd72889c889dcb34406250fea35
# 7.3.0
upgrade=1 from_commit=1677cb9fa9d95ab788a6acd5b310b09c7d2ab7df
;;; Options
Email=kemenaran@gmail.com
Notification=none
;;; Upgrade options
; commit=738ba505f581ddd72889c889dcb34406250fea35
name=7.2.0
; commit=1677cb9fa9d95ab788a6acd5b310b09c7d2ab7df
name=7.3.0

View file

@ -61,6 +61,7 @@
"EnableGifPicker": true,
"GfycatAPIKey": "2_KtH_W5",
"GfycatAPISecret": "3wLVZPiswc3DnaiaFoLkDvB4X0IV6CpMkj4tf2inJRsBY6-FnkT08zGmppWFgeof",
"GiphySdkKey": "",
"EnableCustomEmoji": true,
"EnableEmojiPicker": true,
"PostEditTimeLimit": -1,
@ -89,7 +90,12 @@
"EnableSVGs": false,
"EnableLatex": false,
"EnableInlineLatex": true,
"PostPriority": false,
"PostPriority": true,
"AllowPersistentNotifications": true,
"AllowPersistentNotificationsForGuests": false,
"PersistentNotificationIntervalMinutes": 5,
"PersistentNotificationMaxCount": 6,
"PersistentNotificationMaxRecipients": 5,
"EnableAPIChannelDeletion": false,
"EnableLocalMode": true,
"LocalModeSocketLocation": "/var/run/__APP__/mattermost_local.socket",
@ -148,7 +154,8 @@
"QueryTimeout": 30,
"DisableDatabaseSearch": false,
"MigrationsStatementTimeoutSeconds": 100000,
"ReplicaLagSettings": []
"ReplicaLagSettings": [],
"ReplicaMonitorIntervalSeconds": 5
},
"LogSettings": {
"EnableConsole": true,
@ -163,6 +170,7 @@
"EnableDiagnostics": true,
"VerboseDiagnostics": false,
"EnableSentry": true,
"AdvancedLoggingJSON": {},
"AdvancedLoggingConfig": ""
},
"ExperimentalAuditSettings": {
@ -173,6 +181,7 @@
"FileMaxBackups": 0,
"FileCompress": false,
"FileMaxQueueSize": 1000,
"AdvancedLoggingJSON": {},
"AdvancedLoggingConfig": ""
},
"NotificationLogSettings": {
@ -184,6 +193,7 @@
"FileLevel": "INFO",
"FileJson": true,
"FileLocation": "/var/log/__APP__",
"AdvancedLoggingJSON": {},
"AdvancedLoggingConfig": ""
},
"PasswordSettings": {
@ -191,7 +201,8 @@
"Lowercase": false,
"Number": false,
"Uppercase": false,
"Symbol": false
"Symbol": false,
"EnableForgotLink": true
},
"FileSettings": {
"EnableFileAttachments": true,
@ -201,7 +212,7 @@
"MaxImageResolution": 33177600,
"MaxImageDecoderConcurrency": -1,
"DriverName": "local",
"Directory": "__DATA_PATH__",
"Directory": "__DATA_DIR__",
"EnablePublicLink": false,
"ExtractContent": false,
"ArchiveRecursion": false,
@ -217,7 +228,22 @@
"AmazonS3SignV2": false,
"AmazonS3SSE": false,
"AmazonS3Trace": false,
"AmazonS3RequestTimeoutMilliseconds": 30000
"AmazonS3RequestTimeoutMilliseconds": 30000,
"DedicatedExportStore": false,
"ExportDriverName": "local",
"ExportDirectory": "./data/",
"ExportAmazonS3AccessKeyId": "",
"ExportAmazonS3SecretAccessKey": "",
"ExportAmazonS3Bucket": "",
"ExportAmazonS3PathPrefix": "",
"ExportAmazonS3Region": "",
"ExportAmazonS3Endpoint": "s3.amazonaws.com",
"ExportAmazonS3SSL": true,
"ExportAmazonS3SignV2": false,
"ExportAmazonS3SSE": false,
"ExportAmazonS3Trace": false,
"ExportAmazonS3RequestTimeoutMilliseconds": 30000,
"ExportAmazonS3PresignExpiresSeconds": 21600
},
"EmailSettings": {
"EnableSignUpWithEmail": true,
@ -249,8 +275,7 @@
"EmailNotificationContentsType": "full",
"LoginButtonColor": "#0000",
"LoginButtonBorderColor": "#2389D7",
"LoginButtonTextColor": "#2389D7",
"EnableInactivityEmail": true
"LoginButtonTextColor": "#2389D7"
},
"RateLimitSettings": {
"Enable": false,
@ -266,11 +291,12 @@
"ShowFullName": true
},
"SupportSettings": {
"TermsOfServiceLink": "https://mattermost.com/terms-of-use/",
"PrivacyPolicyLink": "https://mattermost.com/privacy-policy/",
"AboutLink": "https://docs.mattermost.com/about/product.html/",
"HelpLink": "https://mattermost.com/default-help/",
"ReportAProblemLink": "https://mattermost.com/default-report-a-problem/",
"TermsOfServiceLink": "https://mattermost.com/pl/terms-of-use/",
"PrivacyPolicyLink": "https://mattermost.com/pl/privacy-policy/",
"AboutLink": "https://mattermost.com/pl/about-mattermomst",
"HelpLink": "https://mattermost.com/pl/help/",
"ReportAProblemLink": "https://mattermost.com/pl/report-a-bug",
"ForgotPasswordLink": "",
"SupportEmail": "",
"CustomTermsOfServiceEnabled": false,
"CustomTermsOfServiceReAcceptancePeriod": 365,
@ -430,9 +456,9 @@
"mmauth://",
"mmauthbeta://"
],
"AppDownloadLink": "https://mattermost.com/download/#mattermostApps",
"AndroidAppDownloadLink": "https://mattermost.com/mattermost-android-app/",
"IosAppDownloadLink": "https://mattermost.com/mattermost-ios-app/"
"AppDownloadLink": "https://mattermost.com/pl/download-apps",
"AndroidAppDownloadLink": "https://mattermost.com/pl/android-app/",
"IosAppDownloadLink": "https://mattermost.com/pl/ios-app/"
},
"ClusterSettings": {
"Enable": false,
@ -464,8 +490,9 @@
"UseNewSAMLLibrary": false,
"EnableSharedChannels": false,
"EnableRemoteClusterService": false,
"EnableAppBar": false,
"PatchPluginsReactDOM": false
"DisableAppBar": false,
"DisableRefetchingOnBrowserFocus": false,
"DelayChannelAutocomplete": false
},
"AnalyticsSettings": {
"MaxUsersForStatistics": 2500
@ -491,7 +518,11 @@
"BatchSize": 10000,
"RequestTimeoutSeconds": 30,
"SkipTLSVerification": false,
"Trace": ""
"CA": "",
"ClientCert": "",
"ClientKey": "",
"Trace": "",
"IgnoredPurgeIndexes": ""
},
"BleveSettings": {
"IndexDir": "",
@ -508,7 +539,8 @@
"FileRetentionDays": 365,
"BoardsRetentionDays": 365,
"DeletionJobStartTime": "02:00",
"BatchSize": 3000
"BatchSize": 3000,
"TimeBetweenBatchesMilliseconds": 100
},
"MessageExportSettings": {
"EnableExport": false,
@ -531,9 +563,7 @@
"CleanupJobsThresholdDays": -1,
"CleanupConfigThresholdDays": -1
},
"ProductSettings": {
"EnablePublicSharedBoards": false
},
"ProductSettings": {},
"PluginSettings": {
"Enable": true,
"EnableUploads": false,
@ -543,18 +573,12 @@
"ClientDirectory": "./client/plugins",
"Plugins": {},
"PluginStates": {
"com.mattermost.apps": {
"Enable": true
},
"com.mattermost.calls": {
"Enable": true
},
"com.mattermost.nps": {
"Enable": true
},
"focalboard": {
"Enable": true
},
"playbooks": {
"Enable": true
}
@ -573,6 +597,7 @@
},
"GuestAccountsSettings": {
"Enable": false,
"HideTags": false,
"AllowEmailAccounts": true,
"EnforceMultifactorAuthentication": false,
"RestrictCreationToDomains": ""
@ -584,8 +609,9 @@
"RemoteImageProxyOptions": ""
},
"CloudSettings": {
"CWSURL": "https://customers.mattermost.com",
"CWSAPIURL": "https://portal.internal.prod.cloud.mattermost.com"
"CWSURL": "https://portal.test.cloud.mattermost.com",
"CWSAPIURL": "https://api.internal.test.cloud.mattermost.com",
"CWSMock": false
},
"FeatureFlags": {
"TestFeature": "off",
@ -596,25 +622,26 @@
"PluginApps": "",
"PluginFocalboard": "",
"PluginCalls": "",
"PermalinkPreviews": true,
"PermalinkPreviews": false,
"CallsEnabled": true,
"BoardsFeatureFlags": "",
"BoardsDataRetention": false,
"NormalizeLdapDNs": false,
"EnableInactivityCheckJob": true,
"UseCaseOnboarding": true,
"GraphQL": false,
"InsightsEnabled": true,
"InsightsEnabled": false,
"CommandPalette": false,
"BoardsProduct": false,
"SendWelcomePost": true,
"WorkTemplate": false,
"PostPriority": true,
"PostPriority": false,
"WysiwygEditor": false,
"PeopleProduct": false,
"AnnualSubscription": false,
"ReduceOnBoardingTaskList": false,
"OnboardingAutoShowLinkedBoard": false,
"ThreadsEverywhere": false,
"GlobalDrafts": true
"GlobalDrafts": true,
"OnboardingTourTips": true,
"DeprecateCloudFree": false,
"CloudReverseTrial": false,
"EnableExportDirectDownload": false,
"DataRetentionConcurrencyEnabled": true
},
"ImportSettings": {
"Directory": "./import",

View file

@ -1,6 +0,0 @@
SOURCE_URL=https://releases.mattermost.com/8.1.1/mattermost-enterprise-8.1.1-linux-amd64.tar.gz
SOURCE_SUM=5ce9090089601c5c7746768c9799cda8069b6116468d0377d603cd9116810911
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=mattermost.tar.gz

View file

@ -1,6 +0,0 @@
SOURCE_URL=https://releases.mattermost.com/8.1.1/mattermost-enterprise-8.1.1-linux-arm64.tar.gz
SOURCE_SUM=bca0bb54f257680fadbd3d568d870d6c1cd1352744dda419d71a07be82b7d2ca
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=mattermost.tar.gz

View file

@ -1,5 +1,5 @@
[Unit]
Description=Mattermost
Description=Mattermost: collaboration platform
After=network.target
Requires=postgresql.service
@ -7,11 +7,11 @@ Requires=postgresql.service
Type=notify
User=__APP__
Group=__APP__
ExecStart=__FINALPATH__/bin/mattermost
ExecStart=__INSTALL_DIR__/bin/mattermost
TimeoutStartSec=3600
Restart=always
RestartSec=10
WorkingDirectory=__FINALPATH__
WorkingDirectory=__INSTALL_DIR__
RuntimeDirectory=__APP__
LimitNOFILE=49152

View file

@ -1,6 +0,0 @@
SOURCE_URL=https://releases.mattermost.com/8.1.1/mattermost-team-8.1.1-linux-amd64.tar.gz
SOURCE_SUM=1ca6b77cc34be7bd2cea57f9dfa064e19c5556ab59c5e24e93dfdf6d0dc39603
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=mattermost.tar.gz

View file

@ -1,6 +0,0 @@
SOURCE_URL=https://releases.mattermost.com/8.1.1/mattermost-team-8.1.1-linux-arm64.tar.gz
SOURCE_SUM=0ca10276b140e814e352e7f5538de2de9545e11b4b2f3281159c5390f16c2f34
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=mattermost.tar.gz

View file

@ -1,6 +0,0 @@
SOURCE_URL=https://github.com/SmartHoneybee/ubiquitous-memory/releases/download/v7.5.2/mattermost-v7.5.2-linux-arm.tar.gz
SOURCE_SUM=b26a4b676ee92ac848fa2993aa67559238ba7d8c1d0e6f7ffdd79ad8fb4942f3
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=mattermost.tar.gz

1
doc/ADMIN.md Normal file
View file

@ -0,0 +1 @@
You can change the istalled edition (Team <-> Enterprise) by modifying the setting file `__DATA_DIR__/__APP__/settings.yml` and replace the version to wich you want: Team or Enterprise. Update your apps and verify the *About* on your Mattermost

1
doc/ADMIN_fr.md Normal file
View file

@ -0,0 +1 @@
Vous pouvez changer l'édition installée (Team <-> Enterprise) en éditant le fichier de configuration `__DATA_DIR__/__APP__/settings.yml` et remplacez la version avec celle que vous voulez : Team ou Enterprise. Mettez à jour votre application et vérifiez dans le *À Propos* sur la console système de votre application.

View file

@ -1,9 +1,17 @@
## Mattermost Team Edition
A free-to-use, open source, self-hosted alternative to proprietary SaaS messaging. Team Edition is your open source “virtual office”, offering all the core productivity benefits of competing SaaS solutions. It deploys as a single Linux binary with MySQL under an MIT license.
A free-to-use, open source, self-hosted alternative to proprietary SaaS messaging. Team Edition is your open source “virtual office”, offering all the core productivity benefits of competing SaaS solutions. It deploys as a single Linux binary with PosgreSQL under an MIT license.
## Mattermost Enterprise Edition
To explore the benefits of Mattermosts enterprise features, you can replace the Mattermost Team Edition binary with a Mattermost Enterprise Edition binary. This version supports upgrading to Mattermost Enterprise Edition E10 or E20.
## 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/)
## Features include:
- One-to-one and group messaging, file sharing, and unlimited search history
@ -15,4 +23,3 @@ To explore the benefits of Mattermosts enterprise features, you can replace t
- Extensive integration support via webhooks, APIs, drivers, and third-party extensions
- Easily scalable to dozens of users per team
- Runtime profiling data and system monitoring reports
- New features and improvements released regularly

View file

@ -1,10 +1,17 @@
## Mattermost Team Edition
Une alternative gratuite, open source et auto-hébergée à la messagerie SaaS propriétaire. Team Edition est votre « bureau virtuel » open source, offrant tous les principaux avantages de productivité des solutions SaaS concurrentes.
## Mattermost Entreprise Edition
Pour explorer les avantages des fonctionnalités d'entreprise de Mattermost, vous pouvez remplacer le binaire Mattermost Team Edition par un binaire Mattermost Enterprise Edition. Cette version prend en charge la mise à niveau vers Mattermost Enterprise Edition E10 ou E20.
## Les fonctionnalités incluent:
## 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).
## Les fonctionnalités incluent :
- Messagerie individuelle et de groupe, partage de fichiers et historique de recherche illimité
- Messagerie, emoji et emoji personnalisés
@ -15,4 +22,3 @@ Pour explorer les avantages des fonctionnalités d'entreprise de Mattermost, vou
- Prise en charge étendue de l'intégration via des webhooks, des API, des pilotes et des extensions tierces
- Facilement évolutif à des dizaines d'utilisateurs par équipe
- Données de profilage d'exécution et rapports de surveillance du système
- Nouvelles fonctionnalités et améliorations publiées régulièrement

View file

@ -1,18 +0,0 @@
## Configuration
* How to configure this app: From an admin panel, a plain file with SSH.
* How to change from edition version to another (Team<->Enterprise): Modify the `settings.yml` in the apps directory `/etc/yunohost/apps/mattermost_instance/settings.yml` and replace the version to wich you whant: Team or Enterprise. Update your apps and verify the *About* on your Mattermost
## 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/)
## Limitations
* LDAP integration is not supported (see [#58](https://github.com/YunoHost-Apps/mattermost_ynh/issues/58))
## Additional information
* This package can by installed on `ARM`, `ARM64` and `x86-64` architecture (only `x86-64` and `ARM64` if you choose to install the *Entreprise Edition*).

View file

@ -1,16 +0,0 @@
## Configuration
* Comment configurer cette application : via le panneau d'administration, un fichier brut en SSH.
* Comment changer d'une version à une autre (Team<->Enterprise) : Modifiez le `settings.yml` dans le répertoire de l'application `/etc/yunohost/apps/mattermost_instance/settings.yml` et remplacez la version avec celle que vous voulez : Team ou Enterprise. Mettez à jour votre application et vérifiez dans le *À Propos* sur la console système de votre application.
## 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).
## Limitations
* L'intégration LDAP n'est pas gérée (see [#58](https://github.com/YunoHost-Apps/mattermost_ynh/issues/58))
## Informations additionnelles
Ce paquet peut être installé sur les architectures `ARM`, `ARM64` et `x86-64` (mais uniquement `x86-64` et `ARM64` si vous choisissez d'installer la version *Enterprise Edition*).

View file

@ -1,107 +0,0 @@
{
"name": "Mattermost",
"id": "mattermost",
"packaging_format": 1,
"description": {
"en": "Open source collaboration platform built for developers",
"fr": "Plateforme de collaboration open source conçue pour les développeurs"
},
"version": "8.1.1~ynh1",
"url": "http://www.mattermost.org/",
"upstream": {
"license": "GPL-3.0-only",
"website": "http://www.mattermost.org/",
"admindoc": "https://docs.mattermost.com/guides/deployment.html",
"userdoc": "https://docs.mattermost.com/guides/messaging.html",
"code": "https://github.com/mattermost/mattermost-server",
"cpe": "cpe:2.3:a:mattermost:mattermost"
},
"license": "GPL-3.0-only",
"maintainer": {
"name": "pmorinerie",
"email": "kemenaran@gmail.com"
},
"multi_instance": true,
"services": [
"nginx",
"mysql"
],
"requirements": {
"yunohost": ">= 11.1.6"
},
"arguments": {
"install": [
{
"name": "domain",
"type": "domain"
},
{
"name": "path",
"type": "path",
"example": "/mattermost",
"default": "/mattermost"
},
{
"name": "is_public",
"type": "boolean",
"help": {
"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 linterface dadministration."
},
"default": true
},
{
"name": "admin",
"type": "user"
},
{
"name": "password",
"type": "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",
"ask": {
"en": "Choose the language of the chat for the admin",
"fr": "Choissisez la langue utilisée pour l'administrateur"
},
"choices": [
"de",
"en",
"es",
"fr",
"it",
"pt"
],
"default": "en"
},
{
"name": "team_display_name",
"type": "string",
"ask": {
"en": "Choose a Team name",
"fr": "Choisissez le nom de léquipe"
},
"example": "Team",
"default": "Team"
}
]
}
}

104
manifest.toml Normal file
View file

@ -0,0 +1,104 @@
packaging_format = 2
id = "mattermost"
name = "Mattermost"
description.en = "Open source collaboration platform built for developers"
description.fr = "Plateforme de collaboration open source conçue pour les développeurs"
version = "8.1.1~ynh1"
maintainers = ["pmorinerie"]
[upstream]
license = "GPL-3.0-only"
website = "http://www.mattermost.org/"
admindoc = "https://docs.mattermost.com/guides/deployment.html"
userdoc = "https://docs.mattermost.com/guides/messaging.html"
code = "https://github.com/mattermost/mattermost-server"
[integration]
yunohost = ">= 11.2"
architectures = ["amd64", "armhf", "arm64"]
multi_instance = true
ldap = false
sso = false
disk = "50M"
ram.build = "350M"
ram.runtime = "50M"
[install]
[install.domain]
type = "domain"
[install.path]
type = "path"
default = "/mattermost"
[install.init_main_permission]
help.en = "If visitors selected, Mattermost will be accessible by users without a YunoHost account. This can be changed later via the webadmin."
help.fr = "Si « Visiteurs » est sélectionné, Mattermost sera accessible même par les utilisateurs nayant pas de compte YunoHost. Vous pourrez changer ce réglage plus tard dans linterface dadministration."
type = "group"
default = "visitors"
[install.admin]
type = "user"
[install.password]
type = "password"
[install.version]
ask.en = "Choose the version you want to install"
ask.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 and ARM64 support)"
help.fr = "Utilisez Team Edition pour la version open-source (prise en charge ARM, ARM64 et x86-64) ou Édition Enterprise si vous souhaitez utiliser une licence (prise en charge x86-64 et ARM64)"
type = "select"
choices = ["Enterprise", "Team"]
default = "Team"
[install.language]
ask.en = "Choose the language of the chat for the admin"
ask.fr = "Choissisez la langue utilisée par le compte administrateur"
type = "select"
choices = ["de", "en", "es", "fr", "it", "pt"]
default = "en"
[install.team_display_name]
ask.en = "Choose a Team name"
ask.fr = "Choisissez le nom de léquipe"
type = "string"
example = "Team"
default = "Team"
[resources]
[resources.sources]
[resources.sources.main]
amd64.url = "https://releases.mattermost.com/8.1.1/mattermost-team-8.1.1-linux-amd64.tar.gz"
amd64.sha256 = "1ca6b77cc34be7bd2cea57f9dfa064e19c5556ab59c5e24e93dfdf6d0dc39603"
arm64.url = "https://releases.mattermost.com/8.1.1/mattermost-team-8.1.1-linux-arm64.tar.gz"
arm64.sha256 = "0ca10276b140e814e352e7f5538de2de9545e11b4b2f3281159c5390f16c2f34"
armhf.url = "https://github.com/SmartHoneybee/ubiquitous-memory/releases/download/v7.5.2/mattermost-v7.5.2-linux-arm.tar.gz"
armhf.sha256 = "b26a4b676ee92ac848fa2993aa67559238ba7d8c1d0e6f7ffdd79ad8fb4942f3"
[resources.sources.enterprise]
amd64.url = "https://releases.mattermost.com/8.1.1/mattermost-enterprise-8.1.1-linux-amd64.tar.gz"
amd64.sha256 = "5ce9090089601c5c7746768c9799cda8069b6116468d0377d603cd9116810911"
arm64.url = "https://releases.mattermost.com/8.1.1/mattermost-enterprise-8.1.1-linux-arm64.tar.gz"
arm64.sha256 = "bca0bb54f257680fadbd3d568d870d6c1cd1352744dda419d71a07be82b7d2ca"
[resources.system_user]
[resources.install_dir]
[resources.data_dir]
[resources.ports]
[resources.permissions]
main.url = "/"
[resources.apt]
packages = "postgresql, pgloader"
[resources.database]
type = "postgresql"

View file

@ -4,9 +4,6 @@
# COMMON VARIABLES
#=================================================
# dependencies used by the app
pkg_dependencies="postgresql postgresql-contrib pgloader"
#=================================================
# PERSONAL HELPERS
#=================================================
@ -15,27 +12,24 @@ mariadb-to-pg() {
ynh_print_info --message="Migrating to PostgreSQL database..."
# Retrieve MySQL user and password
mysqlpwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
# In old instance db_user is `mmuser`
mysql_db_user="$db_user"
if ynh_mysql_connect_as --user="mmuser" --password="$mysqlpwd" 2> /dev/null <<< ";"; then
# On old instances db_user is `mmuser`
mysql_db_user="mmuser"
fi
# Initialize PostgreSQL database
ynh_psql_test_if_first_run
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$mysqlpwd
psqlpwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
# Configure the new database and run Mattermost in order to create tables
ynh_write_var_in_file --file="$final_path/config/config.json" --key="DriverName" --value="postgres" --after="SqlSettings"
ynh_write_var_in_file --file="$final_path/config/config.json" --key="DataSource" --value="postgres://$db_user:$psqlpwd@localhost:5432/$db_name?sslmode=disable&connect_timeout=10" --after="SqlSettings"
cat "$final_path/config/config.json"
pushd $final_path
# The PostgreSQL database has already been created by Yunohost before running the script.
# Configure the new database and run Mattermost in order to create tables.
ynh_write_var_in_file --file="$install_dir/config/config.json" --key="DriverName" --value="postgres" --after="SqlSettings"
ynh_write_var_in_file --file="$install_dir/config/config.json" --key="DataSource" --value="postgres://$db_user:$db_pwd@localhost:5432/$db_name?sslmode=disable&connect_timeout=10" --after="SqlSettings"
cat "$install_dir/config/config.json"
pushd $install_dir
ynh_systemd_action --service_name="$app" --action="stop"
set +e
sudo -u mattermost timeout --preserve-status 300 "./bin/mattermost"
sudo -u $app timeout --preserve-status 300 "./bin/mattermost"
if [ "$?" != "0" ] && [ "$?" != "143" ] ; then
ynh_die --message="Failed to run Mattermost to create PostgreSQL database tables" --ret_code=1
fi
@ -63,7 +57,7 @@ mariadb-to-pg() {
cat <<EOT > $tmpdir/commands.load
LOAD DATABASE
FROM mysql://$mysql_db_user:$mysqlpwd@127.0.0.1:3306/$db_name
INTO postgresql://$db_user:$psqlpwd@127.0.0.1:5432/$db_name
INTO postgresql://$db_user:$db_pwd@127.0.0.1:5432/$db_name
WITH include no drop, truncate, create no tables,
create no indexes, preserve index names, no foreign keys,
@ -85,16 +79,15 @@ EOT
ynh_psql_execute_as_root --sql='CREATE INDEX idx_fileinfo_content_txt ON public.fileinfo USING gin (to_tsvector('\''english'\''::regconfig, content))' --database=$db_name
ynh_psql_execute_as_root --sql='CREATE INDEX idx_posts_message_txt ON public.posts USING gin (to_tsvector('\''english'\''::regconfig, (message)::text));' --database=$db_name
if ynh_compare_current_package_version --comparison eq --version 7.3.0~ynh1
then
# There is a problem with version 7.3.0 and the database migration.
# More information here: https://forum.mattermost.com/t/migrating-from-mariadb-to-postgresql-db/14194/6
ynh_psql_execute_as_root --sql="DELETE FROM db_migrations WHERE version=92;" --database=$db_name
fi
# Remove the MariaDB database
ynh_mysql_remove_db --db_user=$mysql_db_user --db_name=$db_name
}
#=================================================

View file

@ -6,28 +6,6 @@
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=$(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)
data_path=$(ynh_app_setting_get --app=$app --key=data_path)
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
@ -37,13 +15,13 @@ ynh_print_info --message="Declaring files to be backed up..."
# BACKUP THE APP MAIN DIR
#=================================================
ynh_backup --src_path="$final_path"
ynh_backup --src_path="$install_dir"
#=================================================
# BACKUP THE APP DATA
#=================================================
ynh_backup --src_path="$data_path" --is_big
ynh_backup --src_path="$data_dir" --is_big
#=================================================
# BACKUP THE NGINX CONFIGURATION

View file

@ -9,60 +9,6 @@
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)
#=================================================
# 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
#=================================================
@ -70,36 +16,14 @@ fi
#=================================================
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"
ynh_systemd_action --service_name=$app --action=stop --log_path="systemd"
#=================================================
# 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
ynh_change_url_nginx_config
#=================================================
# EDIT MATTERMOST CONFIG
@ -109,10 +33,10 @@ fi
ynh_script_progression --message="Modifying a config file..." --weight=3
# Main config File
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_replace_string --match_string="\"SiteURL\": \".*\"" --replace_string="\"SiteURL\": \"https://${new_domain}${new_path}\"" --target_file="$install_dir/config/config.json"
ynh_replace_string --match_string="\"FeedbackEmail\": \".*\"" --replace_string="\"FeedbackEmail\": \"no-reply@${new_domain}\"" --target_file="$install_dir/config/config.json"
ynh_store_file_checksum --file="$final_path/config/config.json"
ynh_store_file_checksum --file="$install_dir/config/config.json"
#=================================================
# GENERIC FINALISATION
@ -124,13 +48,6 @@ 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
#=================================================

View file

@ -9,136 +9,22 @@
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
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
is_public=$YNH_APP_ARG_IS_PUBLIC
admin=$YNH_APP_ARG_ADMIN
email=$(ynh_user_get_info --username=$admin --key=mail)
password=$YNH_APP_ARG_PASSWORD
language=$YNH_APP_ARG_LANGUAGE
team_display_name=$YNH_APP_ARG_TEAM_DISPLAY_NAME
version=$YNH_APP_ARG_VERSION
app=$YNH_APP_INSTANCE_NAME
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
ynh_script_progression --message="Validating installation parameters..." --weight=1
final_path=/var/www/$app
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
# Register (book) web path
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=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
#=================================================
# FIND AN AVAILABLE PORT
#=================================================
ynh_script_progression --message="Finding an available port..." --weight=3
# Find an available port
port=$(ynh_find_port --port=8065)
ynh_app_setting_set --app=$app --key=port --value=$port
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing dependencies..." --weight=10
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..." --weight=3
# Create a system user
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# CREATE A DATABASE
#=================================================
ynh_script_progression --message="Creating a database..." --weight=10
db_name=$(ynh_sanitize_dbid --db_name=$app)
db_user=$db_name
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
ynh_psql_test_if_first_run
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
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
if [ "$version" = "Enterprise" ]; then
# Get Enterprise binary path
ynh_setup_source --dest_dir="$final_path" --source_id="enterprise_$YNH_ARCH"
ynh_setup_source --dest_dir="$install_dir" --source_id="enterprise"
elif [ "$version" = "Team" ]; then
# Get Team binary path
ynh_setup_source --dest_dir="$final_path" --source_id="team_$YNH_ARCH"
ynh_setup_source --dest_dir="$install_dir" --source_id="main"
fi
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# CREATE DIRECTORY FOR DATA
#=================================================
ynh_script_progression --message="Creating the data directory..." --weight=1
data_path=/home/yunohost.app/$app
ynh_app_setting_set --app=$app --key=data_path --value=$data_path
mkdir -p $data_path
chmod 750 "$data_path"
chmod -R o-rwx "$data_path"
chown -R $app:www-data "$data_path"
#=================================================
# HANDLE LOG FILES AND LOGROTATE
#=================================================
ynh_script_progression --message="Configuring log rotation..." --weight=1
# Create log directory
mkdir -p /var/log/$app
chown $app -R "/var/log/$app"
# Setup logrotate
ynh_use_logrotate
chown -R $app:www-data "$install_dir"
#=================================================
# EDIT MATTERMOST CONFIG
@ -148,34 +34,30 @@ ynh_use_logrotate
ynh_script_progression --message="Modifying a config file..." --weight=3
smtp_user_pwd=$(ynh_string_random --length=24)
url=https://$domain$path_url
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
url=https://$domain$path
ynh_add_config --template="../conf/config.json" --destination="$final_path/config/config.json"
ynh_add_config --template="../conf/config.json" --destination="$install_dir/config/config.json"
#=================================================
# NGINX CONFIGURATION
# SYSTEM CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=2
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Configuring a systemd service..." --weight=2
# Create a dedicated systemd config
ynh_add_systemd_config
#=================================================
# 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"
# Create log directory
mkdir -p /var/log/$app
chown $app -R "/var/log/$app"
# Setup logrotate
ynh_use_logrotate
#=================================================
# START SYSTEMD SERVICE
#=================================================
@ -190,39 +72,20 @@ ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_
ynh_script_progression --message="Create the first administrator and team..." --weight=1
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)
bin_mmctl="$final_path/bin/mmctl"
bin_mmctl="$install_dir/bin/mmctl"
email=$(ynh_user_get_info --username=$admin --key=mail)
# mmctl is not packaged with ARM versions yet
if [[ -f "$bin_mmctl" ]]; then
export MMCTL_LOCAL=true
export MMCTL_LOCAL_SOCKET_PATH="/var/run/${app}/mattermost_local.socket"
export MMCTL_LOCAL=true
export MMCTL_LOCAL_SOCKET_PATH="/var/run/${app}/mattermost_local.socket"
ynh_exec_warn_less sudo --preserve-env -u $app "$bin_mmctl" user create --username "$admin" --email "$email" --password "$password" --locale "$language" --email-verified --system-admin
ynh_exec_warn_less sudo --preserve-env -u $app "$bin_mmctl" team create --name "$team_name" --display_name "$team_display_name" --email "$email"
ynh_exec_warn_less sudo --preserve-env -u $app "$bin_mmctl" team users add "$team_name" "$admin"
fi
ynh_exec_warn_less sudo --preserve-env -u $app "$bin_mmctl" user create --username "$admin" --email "$email" --password "$password" --locale "$language" --email-verified --system-admin
ynh_exec_warn_less sudo --preserve-env -u $app "$bin_mmctl" team create --name "$team_name" --display_name "$team_display_name" --email "$email"
ynh_exec_warn_less sudo --preserve-env -u $app "$bin_mmctl" team users add "$team_name" "$admin"
# Disable mmctl passwordless access
ynh_replace_string '"EnableLocalMode": true' '"EnableLocalMode": false' "$final_path/config/config.json"
ynh_replace_string '"EnableLocalMode": true' '"EnableLocalMode": false' "$install_dir/config/config.json"
ynh_systemd_action --service_name=$app --action=restart --log_path=systemd --line_match="Started Mattermost"
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Configuring permissions..." --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
#=================================================

View file

@ -10,23 +10,11 @@ source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
# REMOVE SYSTEM CONFIGURATIONS
#=================================================
app=$YNH_APP_INSTANCE_NAME
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)
data_path=$(ynh_app_setting_get --app=$app --key=data_path)
#=================================================
# STANDARD REMOVE
#=================================================
# REMOVE SERVICE FROM ADMIN PANEL
# REMOVE SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
if ynh_exec_warn_less yunohost service status $app >/dev/null
@ -35,80 +23,27 @@ then
yunohost service remove $app
fi
#=================================================
# STOP AND REMOVE SERVICE
#=================================================
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1
# Remove the dedicated systemd config
# Stop the server, and remove the dedicated systemd config
ynh_remove_systemd_config
#=================================================
# REMOVE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Removing logrotate configuration..." --weight=1
# Remove the app-specific logrotate config
ynh_remove_logrotate
#=================================================
# REMOVE THE DATABASE
#=================================================
ynh_script_progression --message="Removing the database..." --weight=2
# Remove a database if it exists, along with the associated user
ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..." --weight=3
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#=================================================
# REMOVE APP MAIN DIR
#=================================================
ynh_script_progression --message="Removing $app main directory..." --weight=6
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
#=================================================
# REMOVE DATA DIR
#=================================================
# Remove the data directory if --purge option is used
if [ "${YNH_APP_PURGE:-0}" -eq 1 ]
then
ynh_script_progression --message="Removing app data directory..." --weight=1
ynh_secure_remove --file="$data_path"
fi
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=5
# Remove the dedicated NGINX config
ynh_remove_nginx_config
#=================================================
# SPECIFIC REMOVE
#=================================================
# REMOVE VARIOUS FILES
#=================================================
ynh_script_progression --message="Removing various files..." --weight=1
# Remove the log file
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 --username=$app
# If the user attempted to upgrade from an older MariaDB-based version, but the upgrade failed,
# the 'remove' action will automatically remove the PostgreSQL database but doesn't know
# that a MariaDB database is still lying around.
# In that case, remove the MariaDB database manually.
if mysqlshow | grep -q "^| $db_name "
then
ynh_script_progression --message="Removing MariaDB database..." --weight=1
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
fi
#=================================================
# END OF SCRIPT

View file

@ -9,141 +9,55 @@
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=$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
data_path=$(ynh_app_setting_get --app=$app --key=data_path)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
ynh_script_progression --message="Validating restoration parameters..." --weight=1
test ! -d $final_path \
|| ynh_die --message="There is already a directory: $final_path "
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# 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 --home_dir="$final_path"
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=2
ynh_restore_file --origin_path="$final_path"
ynh_restore_file --origin_path="$install_dir"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
chown -R $app:www-data "$install_dir"
#=================================================
# RESTORE THE DATA DIRECTORY
#=================================================
ynh_script_progression --message="Restoring the data directory..." --weight=4
ynh_restore_file --origin_path="$data_path" --not_mandatory
ynh_restore_file --origin_path="$data_dir" --not_mandatory
mkdir -p $data_path
chmod 750 "$data_path"
chmod -R o-rwx "$data_path"
chown -R $app:www-data "$data_path"
chown -R $app:www-data "$data_dir"
#=================================================
# REINSTALL DEPENDENCIES
# RESTORE SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=10
# Define and install dependencies
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
# RESTORE THE DATABASE
#=================================================
ynh_script_progression --message="Restoring the database..." --weight=6
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
ynh_psql_test_if_first_run
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name
#=================================================
# RESTORE USER RIGHTS
#=================================================
logs_path="/var/log/$app"
mkdir -p $logs_path
chown -R $app: $logs_path
#=================================================
# SPECIFIC RESTORATION
#=================================================
# RESTORE SYSTEMD
#=================================================
ynh_restore_file "/etc/systemd/system/$app.service"
systemctl enable $app.service --quiet
#=================================================
# ADVERTISE SERVICE IN ADMIN PANEL
#=================================================
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
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
# Start a systemd service
ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="Started Mattermost"
ynh_systemd_action --service_name=nginx --action=reload

View file

@ -9,110 +9,35 @@
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=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
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)
version=$(ynh_app_setting_get --app=$app --key=version)
data_path=$(ynh_app_setting_get --app=$app --key=data_path)
team_display_name=$(ynh_app_setting_get --app=$app --key=team_display_name)
admin=$(ynh_app_setting_get --app=$app --key=admin)
password=$(ynh_app_setting_get --app=$app --key=password)
email=$(ynh_user_get_info --username=$admin --key=mail)
db_name=$(ynh_sanitize_dbid --db_name=$app)
db_user=$db_name
#=================================================
# CHECK VERSION
#=================================================
ynh_script_progression --message="Checking version..." --weight=1
previous_upstream_version="$(ynh_app_upstream_version --manifest="/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json")"
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# 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 () {
# Remove the PostgreSQL db in case of error during the migration.
if [ -n "$remove_psql_in_case_of_error" ]; then
ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
fi
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
# Save the port used if not present
if [ -z "$port" ]; then
port=8065
ynh_app_setting_set --app=$app --key=port --value=$port
fi
# Save the language used if not present
if [ -z "$language" ]; then
if [ -z "${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"
if [ -z "${version:-}" ]; then
version="Team"
ynh_app_setting_set --app=$app --key=version --value=$version
fi
if [ -z "$db_name" ]; then
db_name="$app"
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
fi
# If final_path doesn't exist, create it
if [ -z "$data_path" ]; then
data_path="/home/yunohost.app/$app"
ynh_app_setting_set --app=$app --key=data_path --value=$data_path
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
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..." --weight=10
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
#=================================================
# MIGRATING DATABASE
#=================================================
@ -120,8 +45,8 @@ ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
# Check if using MariaDB
# This migration should be done before the upgrade
if mysqlshow | grep -q "^| $db_name "; then
# Mattermost only support MySQL and PostgreSQL (not MariaDB...)
# Migrate the database from MariaDB to PostgreSQL
# Mattermost recommands PostgreSQL over MySQL (and doesn't support MariaDB at all)
# Migrate the database from MySQL/MariaDB to PostgreSQL
remove_psql_in_case_of_error=1
mariadb-to-pg
fi
@ -133,15 +58,7 @@ fi
#=================================================
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"
#=================================================
# 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 --home_dir="$final_path"
ynh_systemd_action --service_name=$app --action=stop --log_path=systemd
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
@ -155,51 +72,50 @@ then
tmpdir="$(mktemp -d)"
# Backup the config file and local plugins in the temp dir
cp -a "$final_path/config/config.json" "$tmpdir/config.json"
cp -ar "$final_path/plugins" "$tmpdir/plugins"
cp -a "$install_dir/config/config.json" "$tmpdir/config.json"
cp -ar "$install_dir/plugins" "$tmpdir/plugins"
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
ynh_secure_remove --file="$install_dir"
if [ "$version" = "Enterprise" ]; then
ynh_setup_source --dest_dir="$final_path" --source_id="enterprise_$YNH_ARCH"
ynh_setup_source --dest_dir="$install_dir" --source_id="enterprise"
elif [ "$version" = "Team" ]; then
ynh_setup_source --dest_dir="$final_path" --source_id="team_$YNH_ARCH"
ynh_setup_source --dest_dir="$install_dir" --source_id="main"
fi
# Copy the admin saved settings and plugins from tmp directory to final path
cp -a "$tmpdir/config.json" "$final_path/config/config.json"
cp -ar --no-clobber "$tmpdir/plugins" "$final_path/"
cp -a "$tmpdir/config.json" "$install_dir/config/config.json"
cp -ar --no-clobber "$tmpdir/plugins" "$install_dir/"
# Remove the tmp directory securely
ynh_secure_remove --file="$tmpdir"
fi
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
#=================================================
# NGINX CONFIGURATION
# REAPPLY SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=5
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=3
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Upgrading systemd configuration..." --weight=2
# Create a dedicated systemd config
ynh_add_systemd_config
yunohost service add $app --description="Collaboration platform built for developers" --log="/var/log/$app/$app.log"
# Use logrotate to manage app-specific logfile(s)
ynh_use_logrotate --non-append
#=================================================
# Fix old migrations
#=================================================
# Crazy fix for old unupgraded version
# IMPORTANT: THIS fix should be done after setup new sources and running mattermost
# IMPORTANT: THIS fix should be done after setup new sources and running Mattermost
if ynh_compare_current_package_version --comparison lt --version 5.37.1~ynh1
then
read -r -d '' fix_old_version_sql << EOM
@ -214,27 +130,13 @@ UPDATE SidebarCategories SET muted=False where muted IS NULL;
UPDATE SidebarCategories set sorting = 'manual' where sorting='';
UPDATE SidebarCategories set sorting = 'manual' where sorting IS NULL;
EOM
ynh_psql_execute_as_root --sql="$fix_old_version_sql" --database=$db_name
# Note: it's possible that some instances need other fixes
# If nothing is displayed in the sidebar it may be needed to change the Id of SidebarCategories...
fi
#=================================================
# 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
#=================================================
@ -243,13 +145,6 @@ 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
#=================================================

31
tests.toml Normal file
View file

@ -0,0 +1,31 @@
test_format = 1.0
[default]
# -------------------------------
# Default args to use for install
# -------------------------------
args.email = "john@gmail.com"
args.admin_password = "admin!42"
args.version = "Team"
args.team_display_name = "Mon équipe"
# -------------------------------
# Commits to test upgrade from
# -------------------------------
test_upgrade_from.4530e34.name = "Upgrade from 7.2.0"
test_upgrade_from.c88d6ea7.name = "Upgrade from 7.5.2"
test_upgrade_from.a67ddf1f.name = "Upgrade from 7.8.1"
["Test-with-Enterprise-Edition"]
only = ["install.subdir", "backup_restore", "upgrade" ]
args.email = "john@gmail.com"
args.admin_password = "admin!42"
args.version = "Enterprise"
args.team_display_name = "Mon équipe"
test_upgrade_from.c88d6ea7.name = "Upgrade from 7.5.2"