mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2025-11-07 11:52:49 +00:00
Refactor MongoDB install script to use setup_mongodb
Replaces inline MongoDB installation logic with a call to setup_mongodb, passing the selected version via MONGO_VERSION. Updates messaging to use the new variable and removes redundant code.
This commit is contained in:
@@ -15,25 +15,12 @@ update_os
|
|||||||
|
|
||||||
read -p "${TAB3}Do you want to install MongoDB 8.0 instead of 7.0? [y/N]: " install_mongodb_8
|
read -p "${TAB3}Do you want to install MongoDB 8.0 instead of 7.0? [y/N]: " install_mongodb_8
|
||||||
if [[ "$install_mongodb_8" =~ ^[Yy]$ ]]; then
|
if [[ "$install_mongodb_8" =~ ^[Yy]$ ]]; then
|
||||||
MONGODB_VERSION="8.0"
|
MONGO_VERSION="8.0" setup_mongodb
|
||||||
else
|
else
|
||||||
MONGODB_VERSION="7.0"
|
MONGO_VERSION="7.0" setup_mongodb
|
||||||
fi
|
fi
|
||||||
|
|
||||||
msg_info "Installing MongoDB $MONGODB_VERSION"
|
|
||||||
curl -fsSL "https://www.mongodb.org/static/pgp/server-${MONGODB_VERSION}.asc" | gpg --dearmor >/usr/share/keyrings/mongodb-server-${MONGODB_VERSION}.gpg
|
|
||||||
cat <<EOF >/etc/apt/sources.list.d/mongodb-org-${MONGODB_VERSION}.sources
|
|
||||||
Types: deb
|
|
||||||
URIs: http://repo.mongodb.org/apt/debian
|
|
||||||
Suites: $(grep '^VERSION_CODENAME=' /etc/os-release | cut -d'=' -f2)/mongodb-org/${MONGODB_VERSION}
|
|
||||||
Components: main
|
|
||||||
Signed-By: /usr/share/keyrings/mongodb-server-${MONGODB_VERSION}.gpg
|
|
||||||
EOF
|
|
||||||
$STD apt update
|
|
||||||
$STD apt install -y mongodb-org
|
|
||||||
sed -i 's/bindIp: 127.0.0.1/bindIp: 0.0.0.0/' /etc/mongod.conf
|
sed -i 's/bindIp: 127.0.0.1/bindIp: 0.0.0.0/' /etc/mongod.conf
|
||||||
systemctl enable -q --now mongod
|
msg_ok "Installed MongoDB $MONGO_VERSION"
|
||||||
msg_ok "Installed MongoDB $MONGODB_VERSION"
|
|
||||||
|
|
||||||
motd_ssh
|
motd_ssh
|
||||||
customize
|
customize
|
||||||
|
|||||||
Reference in New Issue
Block a user