Skip to content

Commit 7f2481e

Browse files
DracentisMickLeskmichelroegl-brunner
authored
New Script: Mattermost (#1856)
* Create mattermost.sh, mattermost-install.sh, and mattermost.json * Change paths in build.func install.func and mattermost.sh This commit is for testing purposes and will be reverted before creating the pull request. * Fixed OS in mattermost.sh and mattermost.json * Change paths in all files Points all files to my fork for testing. * Added tags and fixed missing variable definition * Fixed mattermost-install.sh * Fixed sed command in mattermost-install.sh * Fixed sed command in mattermost-install.sh * Fixed broken config in mattermost-install.sh * Revert "Change paths in all files" This reverts commit 2f93e39. * Revert "Change paths in build.func install.func and mattermost.sh" This reverts commit 084c71f. * Fixed date in mattermost.json * Update install/mattermost-install.sh Co-authored-by: Michel Roegl-Brunner <[email protected]> * Update mattermost.json --------- Co-authored-by: CanbiZ <[email protected]> Co-authored-by: Michel Roegl-Brunner <[email protected]>
1 parent 05f114e commit 7f2481e

File tree

3 files changed

+143
-0
lines changed

3 files changed

+143
-0
lines changed

ct/mattermost.sh

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/usr/bin/env bash
2+
source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: Kaedon Cleland-Host (dracentis)
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://mattermost.com/
7+
8+
# App Default Values
9+
APP="Mattermost"
10+
var_tags="collaboration"
11+
var_cpu="1"
12+
var_ram="2048"
13+
var_disk="8"
14+
var_os="ubuntu"
15+
var_version="24.04"
16+
var_unprivileged="1"
17+
18+
# App Output & Base Settings
19+
header_info "$APP"
20+
base_settings
21+
22+
# Core
23+
variables
24+
color
25+
catch_errors
26+
27+
function update_script() {
28+
header_info
29+
check_container_storage
30+
check_container_resources
31+
if [[ ! -f /etc/apt/sources.list.d/mattermost.list ]]; then
32+
msg_error "No ${APP} Installation Found!"
33+
exit
34+
fi
35+
msg_info "Updating ${APP} LXC"
36+
apt-get update &>/dev/null
37+
apt-get -y upgrade &>/dev/null
38+
msg_ok "Updated Successfully"
39+
exit
40+
}
41+
42+
start
43+
build_container
44+
description
45+
46+
msg_ok "Completed Successfully!\n"
47+
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
48+
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
49+
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:8065${CL}"

install/mattermost-install.sh

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: Kaedon Cleland-Host (dracentis)
5+
# License: MIT
6+
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
7+
8+
source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
9+
color
10+
verb_ip6
11+
catch_errors
12+
setting_up_container
13+
network_check
14+
update_os
15+
16+
msg_info "Installing Dependencies"
17+
$STD apt-get install -y \
18+
curl \
19+
sudo \
20+
mc \
21+
gpg \
22+
postgresql
23+
msg_ok "Installed Dependencies"
24+
25+
msg_info "Setting up PostgreSQL"
26+
DB_NAME=mattermost
27+
DB_USER=mmuser
28+
DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
29+
$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME;"
30+
$STD sudo -u postgres psql -c "CREATE USER $DB_USER WITH PASSWORD '$DB_PASS';"
31+
$STD sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE $DB_NAME to $DB_USER;"
32+
$STD sudo -u postgres psql -c "ALTER DATABASE $DB_NAME OWNER TO $DB_USER;"
33+
$STD sudo -u postgres psql -c "GRANT USAGE, CREATE ON SCHEMA PUBLIC TO $DB_USER;"
34+
{
35+
echo "Mattermost Credentials"
36+
echo "Database User: $DB_USER"
37+
echo "Database Password: $DB_PASS"
38+
echo "Database Name: $DB_NAME"
39+
} >> ~/mattermost.creds
40+
msg_ok "Set up PostgreSQL"
41+
42+
msg_info "Installing Mattermost"
43+
IPADDRESS=$(hostname -I | awk '{print $1}')
44+
curl -sL -o- /usr/share/keyrings/mattermost-archive-keyring.gpg https://deb.packages.mattermost.com/pubkey.gpg
45+
sh -c 'curl -o- https://deb.packages.mattermost.com/repo-setup.sh | sudo bash -s mattermost'
46+
$STD apt-get update
47+
$STD apt-get install -y mattermost
48+
$STD install -C -m 600 -o mattermost -g mattermost /opt/mattermost/config/config.defaults.json /opt/mattermost/config/config.json
49+
sed -i -e "/DataSource/c\ \"DataSource\": \"postgres://$DB_USER:$DB_PASS@localhost:5432/$DB_NAME?sslmode=disable&connect_timeout=10\"," \
50+
-e "/SiteURL/c\ \"SiteURL\": \"http://$IPADDRESS:8065\"," /opt/mattermost/config/config.json
51+
systemctl enable -q --now mattermost.service
52+
msg_ok "Installed Mattermost"
53+
54+
motd_ssh
55+
customize
56+
57+
msg_info "Cleaning up"
58+
$STD apt-get -y autoremove
59+
$STD apt-get -y autoclean
60+
msg_ok "Cleaned"

json/mattermost.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"name": "Mattermost",
3+
"slug": "mattermost",
4+
"categories": [
5+
25
6+
],
7+
"date_created": "2025-01-30",
8+
"type": "ct",
9+
"updateable": false,
10+
"privileged": false,
11+
"interface_port": 8065,
12+
"documentation": null,
13+
"website": "https://mattermost.com/",
14+
"logo": "https://avatars.githubusercontent.com/u/9828093?s=200&v=4",
15+
"description": "Mattermost is an open source platform for secure collaboration across the entire software development lifecycle. It's written in Go and React and runs as a single Linux binary with MySQL or PostgreSQL. It has a slimilar interface and features to Slack or Discord.",
16+
"install_methods": [
17+
{
18+
"type": "default",
19+
"script": "ct/mattermost.sh",
20+
"resources": {
21+
"cpu": 1,
22+
"ram": 2048,
23+
"hdd": 8,
24+
"os": "ubuntu",
25+
"version": "24.04"
26+
}
27+
}
28+
],
29+
"default_credentials": {
30+
"username": null,
31+
"password": null
32+
},
33+
"notes": []
34+
}

0 commit comments

Comments
 (0)