Refactor: NodeBB (#6419)

This commit is contained in:
Slaviša Arežina
2025-08-01 07:25:00 +02:00
committed by GitHub
parent f80c7008a8
commit da217bb3e0
2 changed files with 11 additions and 15 deletions

View File

@@ -24,7 +24,7 @@ msg_ok "Installed Dependencies"
setup_mongodb
NODE_VERSION="22" setup_nodejs
msg_info "Configure MongoDB"
msg_info "Configuring MongoDB"
MONGO_ADMIN_USER="admin"
MONGO_ADMIN_PWD="$(openssl rand -base64 18 | cut -c1-13)"
NODEBB_USER="nodebb"
@@ -63,14 +63,11 @@ sed -i 's/bindIp: 127.0.0.1/bindIp: 0.0.0.0/' /etc/mongod.conf
sed -i '/security:/d' /etc/mongod.conf
bash -c 'echo -e "\nsecurity:\n authorization: enabled" >> /etc/mongod.conf'
systemctl restart mongod
msg_ok "MongoDB successfully configurated"
msg_ok "MongoDB configured"
msg_info "Install NodeBB"
cd /opt
RELEASE=$(curl -fsSL https://api.github.com/repos/NodeBB/NodeBB/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
curl -fsSL "https://github.com/NodeBB/NodeBB/archive/refs/tags/v${RELEASE}.zip" -o "/opt/v${RELEASE}.zip"
$STD unzip v${RELEASE}.zip
mv NodeBB-${RELEASE} /opt/nodebb
fetch_and_deploy_gh_release "nodebb" "NodeBB/NodeBB" "tarball"
msg_info "Configuring NodeBB"
cd /opt/nodebb
touch pidfile
expect <<EOF >/dev/null 2>&1
@@ -107,8 +104,7 @@ expect "Confirm Password" {
}
expect eof
EOF
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
msg_ok "Installed NodeBB"
msg_ok "Configured NodeBB"
msg_info "Creating Services"
cat <<EOF >/etc/systemd/system/nodebb.service
@@ -136,7 +132,6 @@ motd_ssh
customize
msg_info "Cleaning up"
rm -R /opt/v${RELEASE}.zip
$STD apt-get -y autoremove
$STD apt-get -y autoclean
msg_ok "Cleaned"