mirror of
https://github.com/YunoHost-Apps/mattermost_ynh.git
synced 2024-09-03 19:36:29 +02:00
First version
This commit is contained in:
commit
9d56b71ee4
8 changed files with 278 additions and 0 deletions
27
README.md
Normal file
27
README.md
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
## Description
|
||||||
|
|
||||||
|
A Yunohost package for [Mattermost](https://sdelements.github.io/lets-chat/), an open-source, self-hosted alternative to Slack.
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
Mattermost requires:
|
||||||
|
|
||||||
|
* A x86_64 system (check with `uname -m`),
|
||||||
|
* MySQL 5.6 or higher (check with `mysql --version`).
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
You can either :
|
||||||
|
|
||||||
|
* Install from the Admin web interface, by providing this URL: `https://github.com/kemenaran/yunohost-mattermost`
|
||||||
|
* Install from the command-line: `yunohost app install https://github.com/kemenaran/yunohost-mattermost`
|
||||||
|
|
||||||
|
## What works
|
||||||
|
|
||||||
|
* Installation on domain's root
|
||||||
|
|
||||||
|
## TODO
|
||||||
|
|
||||||
|
* Allow installation in sub-directory (only root-domains work for now)
|
||||||
|
* LDAP intergation
|
||||||
|
|
92
conf/config.json
Normal file
92
conf/config.json
Normal file
|
@ -0,0 +1,92 @@
|
||||||
|
{
|
||||||
|
"ServiceSettings": {
|
||||||
|
"ListenAddress": ":8065",
|
||||||
|
"MaximumLoginAttempts": 10,
|
||||||
|
"SegmentDeveloperKey": "",
|
||||||
|
"GoogleDeveloperKey": "",
|
||||||
|
"EnableOAuthServiceProvider": false,
|
||||||
|
"EnableIncomingWebhooks": true,
|
||||||
|
"EnablePostUsernameOverride": false,
|
||||||
|
"EnablePostIconOverride": false,
|
||||||
|
"EnableTesting": false,
|
||||||
|
"EnableSecurityFixAlert": true
|
||||||
|
},
|
||||||
|
"TeamSettings": {
|
||||||
|
"SiteName": "Mattermost",
|
||||||
|
"MaxUsersPerTeam": 50,
|
||||||
|
"EnableTeamCreation": true,
|
||||||
|
"EnableUserCreation": true,
|
||||||
|
"RestrictCreationToDomains": ""
|
||||||
|
},
|
||||||
|
"SqlSettings": {
|
||||||
|
"DriverName": "mysql",
|
||||||
|
"DataSource": "mmuser:mmuser_password@tcp(127.0.0.1:3306)/mattermost?charset=utf8mb4,utf8",
|
||||||
|
"DataSourceReplicas": [],
|
||||||
|
"MaxIdleConns": 10,
|
||||||
|
"MaxOpenConns": 10,
|
||||||
|
"Trace": false,
|
||||||
|
"AtRestEncryptKey": "7rAh6iwQCkV4cA1Gsg3fgGOXJAQ43QVg"
|
||||||
|
},
|
||||||
|
"LogSettings": {
|
||||||
|
"EnableConsole": true,
|
||||||
|
"ConsoleLevel": "DEBUG",
|
||||||
|
"EnableFile": true,
|
||||||
|
"FileLevel": "INFO",
|
||||||
|
"FileFormat": "",
|
||||||
|
"FileLocation": ""
|
||||||
|
},
|
||||||
|
"FileSettings": {
|
||||||
|
"DriverName": "local",
|
||||||
|
"Directory": "./data/",
|
||||||
|
"EnablePublicLink": true,
|
||||||
|
"PublicLinkSalt": "A705AklYF8MFDOfcwh3I488G8vtLlVip",
|
||||||
|
"ThumbnailWidth": 120,
|
||||||
|
"ThumbnailHeight": 100,
|
||||||
|
"PreviewWidth": 1024,
|
||||||
|
"PreviewHeight": 0,
|
||||||
|
"ProfileWidth": 128,
|
||||||
|
"ProfileHeight": 128,
|
||||||
|
"InitialFont": "luximbi.ttf",
|
||||||
|
"AmazonS3AccessKeyId": "",
|
||||||
|
"AmazonS3SecretAccessKey": "",
|
||||||
|
"AmazonS3Bucket": "",
|
||||||
|
"AmazonS3Region": ""
|
||||||
|
},
|
||||||
|
"EmailSettings": {
|
||||||
|
"EnableSignUpWithEmail": true,
|
||||||
|
"SendEmailNotifications": false,
|
||||||
|
"RequireEmailVerification": false,
|
||||||
|
"FeedbackName": "",
|
||||||
|
"FeedbackEmail": "",
|
||||||
|
"SMTPUsername": "",
|
||||||
|
"SMTPPassword": "",
|
||||||
|
"SMTPServer": "",
|
||||||
|
"SMTPPort": "",
|
||||||
|
"ConnectionSecurity": "",
|
||||||
|
"InviteSalt": "bjlSR4QqkXFBr7TP4oDzlfZmcNuH9YoS",
|
||||||
|
"PasswordResetSalt": "vZ4DcKyVVRlKHHJpexcuXzojkE5PZ5eL",
|
||||||
|
"ApplePushServer": "",
|
||||||
|
"ApplePushCertPublic": "",
|
||||||
|
"ApplePushCertPrivate": ""
|
||||||
|
},
|
||||||
|
"RateLimitSettings": {
|
||||||
|
"EnableRateLimiter": true,
|
||||||
|
"PerSec": 10,
|
||||||
|
"MemoryStoreSize": 10000,
|
||||||
|
"VaryByRemoteAddr": true,
|
||||||
|
"VaryByHeader": ""
|
||||||
|
},
|
||||||
|
"PrivacySettings": {
|
||||||
|
"ShowEmailAddress": true,
|
||||||
|
"ShowFullName": true
|
||||||
|
},
|
||||||
|
"GitLabSettings": {
|
||||||
|
"Enable": false,
|
||||||
|
"Secret": "",
|
||||||
|
"Id": "",
|
||||||
|
"Scope": "",
|
||||||
|
"AuthEndpoint": "",
|
||||||
|
"TokenEndpoint": "",
|
||||||
|
"UserApiEndpoint": ""
|
||||||
|
}
|
||||||
|
}
|
14
conf/nginx.conf-nosub
Normal file
14
conf/nginx.conf-nosub
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
location / {
|
||||||
|
proxy_pass http://localhost:8065/;
|
||||||
|
proxy_set_header Host $http_host;
|
||||||
|
proxy_buffering off;
|
||||||
|
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
|
||||||
|
# Web-socket headers
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection "upgrade";
|
||||||
|
}
|
7
conf/supervisor.conf
Normal file
7
conf/supervisor.conf
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
[program:mattermost]
|
||||||
|
directory=/var/www/mattermost
|
||||||
|
command=/var/www/mattermost/bin/platform
|
||||||
|
user=www
|
||||||
|
autorestart=true
|
||||||
|
redirect_stderr=true
|
||||||
|
stdout_logfile=/var/log/mattermost.log
|
35
manifest.json
Normal file
35
manifest.json
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
{
|
||||||
|
"name": "Mattermost",
|
||||||
|
"id": "mattermost",
|
||||||
|
"description": {
|
||||||
|
"en": "An open-source, self-hosted alternative to Slack",
|
||||||
|
"fr": "Une alternative open-source et self-hostée à Slack"
|
||||||
|
},
|
||||||
|
"license": "free",
|
||||||
|
"developer": {
|
||||||
|
"name": "pmorinerie",
|
||||||
|
"email": "kemenaran@gmail.com"
|
||||||
|
},
|
||||||
|
"multi_instance": "false",
|
||||||
|
"arguments": {
|
||||||
|
"install" : [
|
||||||
|
{
|
||||||
|
"name": "domain",
|
||||||
|
"ask": {
|
||||||
|
"en": "Choose a domain for Mattermost",
|
||||||
|
"fr": "Choisissez un domaine pour Mattermost"
|
||||||
|
},
|
||||||
|
"example": "domain.org"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "public_site",
|
||||||
|
"ask": {
|
||||||
|
"en": "Can guest users access this chat?",
|
||||||
|
"fr": "Les utilisateurs non-enregistrés peuvent-ils accéder à ce chat ?"
|
||||||
|
},
|
||||||
|
"choices": ["Yes", "No"],
|
||||||
|
"default": "Yes"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
56
scripts/install
Normal file
56
scripts/install
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -e # Exit on error
|
||||||
|
|
||||||
|
# Retrieve arguments
|
||||||
|
domain=$1
|
||||||
|
is_public=$2
|
||||||
|
path=""
|
||||||
|
|
||||||
|
# Check domain availability
|
||||||
|
sudo yunohost app checkurl $domain$path -a mattermost
|
||||||
|
if [[ ! $? -eq 0 ]]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# TODO: check 64 bits support
|
||||||
|
|
||||||
|
# TODO: check for MySQL 5.6
|
||||||
|
|
||||||
|
# Install dependencies
|
||||||
|
sudo apt-get install -y supervisor
|
||||||
|
|
||||||
|
# Initialize database and store mysql password for upgrade
|
||||||
|
db_user="mmuser"
|
||||||
|
db_password="mmuser_password" # TODO: stronger password
|
||||||
|
sudo yunohost app initdb $db_user -p $db_password -d mattermost
|
||||||
|
|
||||||
|
# Save specific settings
|
||||||
|
sudo yunohost app setting mattermost is_public -v $is_public
|
||||||
|
sudo yunohost app setting mattermost mysqlpwd -v $db_password
|
||||||
|
if [ "$is_public" = "Yes" ];
|
||||||
|
then
|
||||||
|
sudo yunohost app setting mattermost unprotected_uris -v "/"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Install sources
|
||||||
|
root_path=$(pwd)/..
|
||||||
|
final_path=/var/www/mattermost
|
||||||
|
sudo mkdir -p $final_path
|
||||||
|
sudo cp -af $root_path/sources/. $final_path
|
||||||
|
sudo cp $root_path/conf/config.json $final_path/config/config.json
|
||||||
|
|
||||||
|
# Set permissions to app directory
|
||||||
|
sudo chown -R www-data: $final_path
|
||||||
|
|
||||||
|
# Modify Nginx configuration file and copy it to Nginx conf directory
|
||||||
|
sudo cp $root_path/conf/nginx.conf-nosub /etc/nginx/conf.d/$domain.d/mattermost.conf
|
||||||
|
|
||||||
|
# Copy supervisor script
|
||||||
|
sudo cp $root_path/conf/supervisor.conf /etc/supervisor/conf.d/mattermost.conf
|
||||||
|
|
||||||
|
# Reload Nginx and regenerate SSOwat conf
|
||||||
|
sudo service nginx reload
|
||||||
|
sudo yunohost app ssowatconf
|
||||||
|
|
||||||
|
# Start app
|
||||||
|
sudo supervisorctl start mattermost
|
20
scripts/remove
Executable file
20
scripts/remove
Executable file
|
@ -0,0 +1,20 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -e # Exit on error
|
||||||
|
|
||||||
|
domain=$(sudo yunohost app setting mattermost domain)
|
||||||
|
db_name="mattermost"
|
||||||
|
db_user="mmuser"
|
||||||
|
db_root_pwd=$(sudo cat /etc/yunohost/mysql)
|
||||||
|
|
||||||
|
# Stop service
|
||||||
|
sudo supervisorctl stop mattermost
|
||||||
|
|
||||||
|
# Remove sources
|
||||||
|
sudo rm -rf /var/www/mattermost
|
||||||
|
|
||||||
|
# Remove database
|
||||||
|
mysql -u root -p$db_root_pwd -e "DROP DATABASE $db_name ; DROP USER $db_user@localhost ;"
|
||||||
|
|
||||||
|
# Remove configuration files
|
||||||
|
sudo rm -f /etc/nginx/conf.d/$domain.d/mattermost.conf
|
||||||
|
sudo rm /etc/supervisor/conf.d/mattermost.conf
|
27
scripts/upgrade-sources
Executable file
27
scripts/upgrade-sources
Executable file
|
@ -0,0 +1,27 @@
|
||||||
|
#!/bin/bash -ex
|
||||||
|
# Pull most recent Let's Chat sources.
|
||||||
|
|
||||||
|
root_dir=$(dirname "$0")/..
|
||||||
|
sources_dir=$root_dir/sources
|
||||||
|
|
||||||
|
rm -rf $sources_dir/lets-chat
|
||||||
|
rm -rf $sources_dir/lets-chat-ldap
|
||||||
|
|
||||||
|
git clone git@github.com:sdelements/lets-chat.git $sources_dir/lets-chat
|
||||||
|
git clone git@github.com:sdelements/lets-chat-ldap.git $sources_dir/lets-chat-ldap
|
||||||
|
|
||||||
|
# Pre-install node modules
|
||||||
|
cd $sources_dir/lets-chat
|
||||||
|
npm cache clear
|
||||||
|
npm install --production
|
||||||
|
npm install --production lets-chat-ldap
|
||||||
|
|
||||||
|
# Stage changes
|
||||||
|
# (git forbids to add a `.git` directory in a subdirectory (except when using submodules); remove them)
|
||||||
|
cd $root_dir
|
||||||
|
rm -rf $sources_dir/lets-chat/.git
|
||||||
|
rm -rf $sources_dir/lets-chat-ldap/.git
|
||||||
|
git add $sources_dir/*
|
||||||
|
git add -f $sources_dir/lets-chat/node_modules/
|
||||||
|
|
||||||
|
echo "Let's Chat sources pulled. Now commit the changes."
|
Loading…
Reference in a new issue