2025-11-02 23:49:54 -08:00
|
|
|
#!/usr/bin/env bash
|
2025-04-01 10:25:46 +02:00
|
|
|
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
|
2026-01-06 13:28:12 +01:00
|
|
|
# Copyright (c) 2021-2026 community-scripts ORG
|
2024-11-18 21:35:51 +01:00
|
|
|
# Author: bvdberg01
|
2024-12-16 12:42:51 +01:00
|
|
|
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
|
|
|
|
# Source: https://netboxlabs.com/
|
2024-11-18 21:35:51 +01:00
|
|
|
|
|
|
|
|
APP="NetBox"
|
2025-04-10 11:56:52 +02:00
|
|
|
var_tags="${var_tags:-network}"
|
|
|
|
|
var_cpu="${var_cpu:-2}"
|
|
|
|
|
var_ram="${var_ram:-2048}"
|
|
|
|
|
var_disk="${var_disk:-4}"
|
|
|
|
|
var_os="${var_os:-debian}"
|
2025-10-15 22:29:48 +02:00
|
|
|
var_version="${var_version:-13}"
|
2025-04-10 11:56:52 +02:00
|
|
|
var_unprivileged="${var_unprivileged:-1}"
|
2024-12-16 12:42:51 +01:00
|
|
|
|
|
|
|
|
header_info "$APP"
|
2024-11-18 21:35:51 +01:00
|
|
|
variables
|
|
|
|
|
color
|
|
|
|
|
catch_errors
|
|
|
|
|
|
|
|
|
|
function update_script() {
|
2024-12-16 12:42:51 +01:00
|
|
|
header_info
|
|
|
|
|
check_container_storage
|
|
|
|
|
check_container_resources
|
|
|
|
|
if [[ ! -f /etc/systemd/system/netbox.service ]]; then
|
|
|
|
|
msg_error "No ${APP} Installation Found!"
|
|
|
|
|
exit
|
|
|
|
|
fi
|
2024-11-18 21:35:51 +01:00
|
|
|
|
2026-01-24 17:14:55 -05:00
|
|
|
if check_for_gh_release "netbox" "netbox-community/netbox"; then
|
|
|
|
|
msg_info "Stopping Services"
|
2024-12-16 12:42:51 +01:00
|
|
|
systemctl stop netbox netbox-rq
|
2026-01-24 17:14:55 -05:00
|
|
|
msg_ok "Stopped Services"
|
2024-11-18 21:35:51 +01:00
|
|
|
|
2026-01-24 17:14:55 -05:00
|
|
|
msg_info "Backing up NetBox configurations"
|
2024-12-16 12:42:51 +01:00
|
|
|
mv /opt/netbox/ /opt/netbox-backup
|
2026-01-24 17:14:55 -05:00
|
|
|
msg_ok "Backed up NetBox configurations"
|
|
|
|
|
|
|
|
|
|
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "netbox" "netbox-community/netbox" "tarball"
|
2024-11-18 21:35:51 +01:00
|
|
|
|
2024-12-16 12:42:51 +01:00
|
|
|
cp -r /opt/netbox-backup/netbox/netbox/configuration.py /opt/netbox/netbox/netbox/
|
2026-01-24 17:14:55 -05:00
|
|
|
cp -r /opt/netbox-backup/netbox/{media,scripts,reports}/ /opt/netbox/netbox/
|
2024-12-16 12:42:51 +01:00
|
|
|
cp -r /opt/netbox-backup/gunicorn.py /opt/netbox/
|
2026-01-24 17:14:55 -05:00
|
|
|
[[ -f /opt/netbox-backup/local_requirements.txt ]] && cp -r /opt/netbox-backup/local_requirements.txt /opt/netbox/
|
|
|
|
|
[[ -f /opt/netbox-backup/netbox/netbox/ldap_config.py ]] && cp -r /opt/netbox-backup/netbox/netbox/ldap_config.py /opt/netbox/netbox/netbox/
|
2024-11-18 21:35:51 +01:00
|
|
|
|
2025-02-24 12:49:16 +01:00
|
|
|
$STD /opt/netbox/upgrade.sh
|
2025-11-22 16:41:22 +01:00
|
|
|
rm -r /opt/netbox-backup
|
2024-12-16 12:42:51 +01:00
|
|
|
|
2026-01-24 17:14:55 -05:00
|
|
|
msg_info "Starting Services"
|
2024-12-16 12:42:51 +01:00
|
|
|
systemctl start netbox netbox-rq
|
2026-01-24 17:14:55 -05:00
|
|
|
msg_ok "Started Services"
|
2025-10-30 09:24:16 -07:00
|
|
|
msg_ok "Updated successfully!"
|
2024-12-16 12:42:51 +01:00
|
|
|
fi
|
|
|
|
|
exit
|
2024-11-18 21:35:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
start
|
|
|
|
|
build_container
|
|
|
|
|
description
|
|
|
|
|
|
2026-01-06 22:57:40 +01:00
|
|
|
msg_ok "Completed successfully!\n"
|
2024-12-16 12:42:51 +01:00
|
|
|
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
|
|
|
|
|
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
|
2025-04-01 10:51:52 +02:00
|
|
|
echo -e "${TAB}${GATEWAY}${BGN}https://${IP}${CL}"
|