Refactor: NodeBB (#6419)
This commit is contained in:
parent
f80c7008a8
commit
da217bb3e0
@ -32,7 +32,7 @@ function update_script() {
|
||||
fi
|
||||
|
||||
RELEASE=$(curl -fsSL https://api.github.com/repos/NodeBB/NodeBB/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||
if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
|
||||
if [[ "${RELEASE}" != "$(cat ~/.nodebb)" ]] || [[ ! -f ~/.nodebb ]]; then
|
||||
msg_info "Stopping ${APP}"
|
||||
systemctl stop nodebb
|
||||
msg_ok "Stopped ${APP}"
|
||||
@ -40,13 +40,14 @@ function update_script() {
|
||||
msg_info "Updating ${APP} to v${RELEASE}"
|
||||
cd /opt/nodebb
|
||||
$STD ./nodebb upgrade
|
||||
echo "${RELEASE}" >/opt/${APP}_version.txt
|
||||
echo "${RELEASE}" > ~/.nodebb
|
||||
msg_ok "Updated ${APP} to v${RELEASE}"
|
||||
|
||||
msg_info "Starting ${APP}"
|
||||
systemctl start nodebb
|
||||
msg_ok "Started ${APP}"
|
||||
msg_ok "Updated Successfully"
|
||||
|
||||
msg_ok "Updated Successfully\n"
|
||||
else
|
||||
msg_ok "No update required. ${APP} is already at v${RELEASE}."
|
||||
fi
|
||||
|
@ -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"
|
||||
|
Loading…
x
Reference in New Issue
Block a user