Skip to content

Commit a776752

Browse files
authored
Merge pull request #2314 from william-aqn/feat/rocketchat
feat: add Rocket.Chat LXC script
2 parents e8c25eb + 67b8229 commit a776752

3 files changed

Lines changed: 265 additions & 0 deletions

File tree

‎ct/rocketchat.sh‎

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#!/usr/bin/env bash
2+
# Engine comes from community-scripts/core; this repo only ships the scripts.
3+
# A local core checkout wins (COMMUNITY_SCRIPTS_CORE_DIR, else a sibling ../core),
4+
# so a fork or branch of core can be tested without editing this file.
5+
_cs_boot="${COMMUNITY_SCRIPTS_CORE_DIR:-$(dirname "${BASH_SOURCE[0]}")/../../core}/core/build.func"
6+
source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/build.func")
7+
# Copyright (c) 2021-2026 community-scripts ORG
8+
# Author: william-aqn
9+
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
10+
# Source: https://www.rocket.chat/
11+
12+
APP="Rocket.Chat"
13+
var_tags="${var_tags:-chat;messaging}"
14+
var_cpu="${var_cpu:-2}"
15+
var_ram="${var_ram:-4096}"
16+
var_disk="${var_disk:-20}"
17+
var_os="${var_os:-debian}"
18+
var_version="${var_version:-13}"
19+
var_arm64="${var_arm64:-yes}"
20+
var_unprivileged="${var_unprivileged:-1}"
21+
22+
export var_admin_email="${var_admin_email:-}"
23+
24+
header_info "$APP"
25+
variables
26+
NSAPP="rocketchat"
27+
var_install="${NSAPP}-install"
28+
color
29+
catch_errors
30+
31+
function update_script() {
32+
header_info
33+
check_container_storage
34+
check_container_resources
35+
36+
if [[ ! -d /opt/rocketchat ]]; then
37+
msg_error "No ${APP} Installation Found!"
38+
exit
39+
fi
40+
41+
RELEASE=$(curl -fsSL https://releases.rocket.chat/latest/info | jq -r '.tag')
42+
if [[ "${RELEASE}" != "$(cat ~/.rocketchat 2>/dev/null)" ]]; then
43+
msg_info "Stopping Service"
44+
systemctl stop rocketchat
45+
msg_ok "Stopped Service"
46+
47+
CLEAN_INSTALL=1 fetch_and_deploy_from_url "https://releases.rocket.chat/${RELEASE}/download" "/opt/rocketchat"
48+
echo "${RELEASE}" >~/.rocketchat
49+
50+
msg_info "Building Rocket.Chat ${RELEASE} (Patience)"
51+
cd /opt/rocketchat/programs/server
52+
$STD npm install
53+
msg_ok "Built Rocket.Chat ${RELEASE}"
54+
55+
msg_info "Starting Service"
56+
systemctl start rocketchat
57+
msg_ok "Started Service"
58+
msg_ok "Updated Successfully!"
59+
else
60+
msg_ok "No update required. Rocket.Chat is already at ${RELEASE}"
61+
fi
62+
exit
63+
}
64+
65+
start
66+
build_container
67+
description
68+
69+
msg_ok "Completed Successfully!\n"
70+
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
71+
echo -e "${INFO}${YW}Access it using the following URL:${CL}"
72+
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:3000${CL}"
73+
echo -e "${INFO}${YW}Admin credentials: ~/rocketchat.creds (inside the container)${CL}"

‎install/rocketchat-install.sh‎

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2021-2026 community-scripts ORG
4+
# Author: william-aqn
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
6+
# Source: https://www.rocket.chat/
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+
if [[ -z "${var_admin_email:-}" ]]; then
17+
# unattended runs have no tty: read returns 1 on EOF
18+
read -r -p "${TAB3}Admin email address: " var_admin_email || true
19+
fi
20+
var_admin_email="${var_admin_email//[[:space:]]/}"
21+
var_admin_email="${var_admin_email:-admin@example.com}"
22+
if [[ ! "$var_admin_email" =~ ^[^@[:space:]]+@[^@[:space:]]+\.[^@[:space:]]+$ ]]; then
23+
msg_warn "Invalid email '${var_admin_email}', falling back to admin@example.com"
24+
var_admin_email="admin@example.com"
25+
fi
26+
27+
msg_info "Installing Dependencies"
28+
$STD apt install -y \
29+
build-essential \
30+
python3 \
31+
graphicsmagick \
32+
jq
33+
msg_ok "Installed Dependencies"
34+
35+
MONGO_VERSION="8.0" setup_mongodb
36+
37+
# npm 12 cannot install this bundle
38+
NODE_VERSION="22" NPM_VERSION="10" setup_nodejs
39+
40+
msg_info "Configuring MongoDB Replica Set"
41+
if ! grep -q "^replication:" /etc/mongod.conf; then
42+
cat <<EOF >>/etc/mongod.conf
43+
replication:
44+
replSetName: rs0
45+
EOF
46+
fi
47+
systemctl restart mongod
48+
for _ in {1..60}; do
49+
mongosh --quiet --eval "db.adminCommand('ping')" &>/dev/null && break
50+
sleep 1
51+
done
52+
if ! mongosh --quiet --eval "rs.status().ok" &>/dev/null; then
53+
$STD mongosh --quiet --eval 'rs.initiate({ _id: "rs0", members: [{ _id: 0, host: "127.0.0.1:27017" }] })'
54+
fi
55+
for _ in {1..60}; do
56+
[[ "$(mongosh --quiet --eval "db.hello().isWritablePrimary" 2>/dev/null)" == "true" ]] && break
57+
sleep 1
58+
done
59+
msg_ok "Configured MongoDB Replica Set"
60+
61+
RELEASE=$(curl -fsSL https://releases.rocket.chat/latest/info | jq -r '.tag')
62+
fetch_and_deploy_from_url "https://releases.rocket.chat/${RELEASE}/download" "/opt/rocketchat"
63+
echo "${RELEASE}" >~/.rocketchat
64+
65+
msg_info "Building Rocket.Chat ${RELEASE} (Patience)"
66+
cd /opt/rocketchat/programs/server
67+
$STD npm install
68+
msg_ok "Built Rocket.Chat ${RELEASE}"
69+
70+
msg_info "Creating Configuration"
71+
ADMIN_PASS=$(openssl rand -base64 24 | tr -dc 'a-zA-Z0-9' | cut -c1-24)
72+
mkdir -p /etc/rocketchat
73+
cat <<EOF >/etc/rocketchat/rocketchat.env
74+
NODE_ENV=production
75+
PORT=3000
76+
ROOT_URL=http://${LOCAL_IP}:3000
77+
MONGO_URL=mongodb://127.0.0.1:27017/rocketchat?replicaSet=rs0
78+
ADMIN_USERNAME=admin
79+
ADMIN_NAME=Administrator
80+
ADMIN_EMAIL=${var_admin_email}
81+
ADMIN_PASS=${ADMIN_PASS}
82+
OVERWRITE_SETTING_Show_Setup_Wizard=completed
83+
EOF
84+
chmod 600 /etc/rocketchat/rocketchat.env
85+
{
86+
echo "Rocket.Chat Admin"
87+
echo "Username: admin"
88+
echo "Password: ${ADMIN_PASS}"
89+
echo "Email: ${var_admin_email}"
90+
} >~/rocketchat.creds
91+
chmod 600 ~/rocketchat.creds
92+
msg_ok "Created Configuration"
93+
94+
msg_info "Creating Service"
95+
cat <<EOF >/etc/systemd/system/rocketchat.service
96+
[Unit]
97+
Description=Rocket.Chat Server
98+
After=network.target mongod.service
99+
Requires=mongod.service
100+
101+
[Service]
102+
Type=simple
103+
User=root
104+
WorkingDirectory=/opt/rocketchat
105+
EnvironmentFile=/etc/rocketchat/rocketchat.env
106+
ExecStart=/usr/bin/node /opt/rocketchat/main.js
107+
Restart=on-failure
108+
RestartSec=10
109+
110+
[Install]
111+
WantedBy=multi-user.target
112+
EOF
113+
systemctl enable -q --now rocketchat
114+
msg_ok "Created Service"
115+
116+
motd_ssh
117+
customize
118+
cleanup_lxc

‎json/rocketchat.json‎

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
{
2+
"name": "Rocket.Chat",
3+
"slug": "rocketchat",
4+
"categories": [
5+
22
6+
],
7+
"date_created": "2026-09-09",
8+
"type": "ct",
9+
"updateable": true,
10+
"privileged": false,
11+
"architectures": [
12+
"amd64",
13+
"arm64"
14+
],
15+
"interface_port": 3000,
16+
"documentation": "https://docs.rocket.chat/docs/deploy-rocketchat",
17+
"website": "https://www.rocket.chat/",
18+
"repository": "https://github.com/RocketChat/Rocket.Chat",
19+
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@main/webp/rocket-chat.webp",
20+
"description": "Rocket.Chat is an open-source communications platform for team chat, channels, direct messages, file sharing, voice and video calls, and omnichannel customer support. This script performs a manual (non-Docker) install of the official prebuilt Meteor server bundle, backed by a local MongoDB.",
21+
"install_methods": [
22+
{
23+
"type": "default",
24+
"script": "ct/rocketchat.sh",
25+
"config_path": "/etc/rocketchat/rocketchat.env",
26+
"resources": {
27+
"cpu": 2,
28+
"ram": 4096,
29+
"hdd": 20,
30+
"os": "Debian",
31+
"version": "13"
32+
}
33+
}
34+
],
35+
"default_credentials": {
36+
"username": "admin",
37+
"password": null
38+
},
39+
"app_vars": [
40+
{
41+
"name": "var_admin_email",
42+
"label": "Admin Email",
43+
"type": "text",
44+
"default": "admin@example.com",
45+
"help": "Email address for the generated admin account. Rocket.Chat needs a valid address here; it is not used to send mail unless you configure SMTP."
46+
}
47+
],
48+
"notes": [
49+
{
50+
"text": "Log in at http://IP:3000 as `admin`; the generated password is in `~/rocketchat.creds` inside the container. The setup wizard is skipped deliberately: its final step mails a confirmation code, and a fresh install has no mail server configured, so the wizard cannot be completed and would lock you out of the admin account it just created.",
51+
"type": "info"
52+
},
53+
{
54+
"text": "The admin password is generated, not chosen. Change it, and review the admin email, before real use. If you kept the default admin@example.com, set a real address in Admin > Users.",
55+
"type": "warning"
56+
},
57+
{
58+
"text": "The install downloads the official prebuilt server bundle (~250 MB) and compiles native npm modules, so it takes several minutes. The service needs roughly 20-30 seconds after start before the web UI answers.",
59+
"type": "info"
60+
},
61+
{
62+
"text": "ROOT_URL in /etc/rocketchat/rocketchat.env is set to the container IP. Change it to the public URL and restart with `systemctl restart rocketchat` before putting Rocket.Chat behind a reverse proxy or domain, otherwise logins, uploads and OAuth redirects break.",
63+
"type": "warning"
64+
},
65+
{
66+
"text": "MongoDB runs as a single-node replica set (rs0), which Rocket.Chat 8.x requires: it dropped oplog tailing in 8.0 and relies on change streams and multi-document transactions. Do not convert mongod back to standalone.",
67+
"type": "warning"
68+
},
69+
{
70+
"text": "All chat data lives in the local MongoDB (database `rocketchat`, files in /var/lib/mongodb). Back that up together with /etc/rocketchat/rocketchat.env.",
71+
"type": "warning"
72+
}
73+
]
74+
}

0 commit comments

Comments
 (0)