mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-11-30 20:19:48 +01:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3976d8b2d1 |
No files matched your search
+1
-9
@@ -594,11 +594,7 @@ Exercise vigilance regarding copycat or coat-tailing sites that seek to exploit
|
||||
|
||||
### 🆕 New Scripts
|
||||
|
||||
- Warpgate [@MickLesk](https://github.com/MickLesk) ([#19218](https://github.com/community-scripts/ProxmoxVE/pull/19218))
|
||||
- Obico [@a55uka](https://github.com/a55uka) ([#19217](https://github.com/community-scripts/ProxmoxVE/pull/19217))
|
||||
- agentgateway [@andy-vdg](https://github.com/andy-vdg) ([#19216](https://github.com/community-scripts/ProxmoxVE/pull/19216))
|
||||
- Roundcube [@MickLesk](https://github.com/MickLesk) ([#19214](https://github.com/community-scripts/ProxmoxVE/pull/19214))
|
||||
- Langfuse [@steveonjava](https://github.com/steveonjava) ([#19144](https://github.com/community-scripts/ProxmoxVE/pull/19144))
|
||||
- Langfuse [@steveonjava](https://github.com/steveonjava) ([#19144](https://github.com/community-scripts/ProxmoxVE/pull/19144))
|
||||
|
||||
### 🚀 Updated Scripts
|
||||
|
||||
@@ -612,10 +608,6 @@ Exercise vigilance regarding copycat or coat-tailing sites that seek to exploit
|
||||
- nocobase: bump Node.js from 22 to 24 [@github-actions[bot]](https://github.com/github-actions[bot]) ([#19194](https://github.com/community-scripts/ProxmoxVE/pull/19194))
|
||||
- formbricks: bump Node.js from 24 to 26 [@github-actions[bot]](https://github.com/github-actions[bot]) ([#19193](https://github.com/community-scripts/ProxmoxVE/pull/19193))
|
||||
|
||||
- #### 🔧 Refactor
|
||||
|
||||
- Frigate: install without the Intel media driver when Intel's repository is unreachable [@MickLesk](https://github.com/MickLesk) ([#19063](https://github.com/community-scripts/ProxmoxVE/pull/19063))
|
||||
|
||||
### 💾 Core
|
||||
|
||||
- vm_alloc_efi_disk: pass a failed qm set on | Let Proxmox allocate and initialize the VM EFI disk [@MickLesk](https://github.com/MickLesk) ([core#327](https://github.com/community-scripts/core/pull/327))
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
_cs_boot="${COMMUNITY_SCRIPTS_CORE_DIR:-$(dirname "${BASH_SOURCE[0]}")/../../core}/core/build.func"
|
||||
source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/build.func")
|
||||
|
||||
# Copyright (c) 2021-2026 community-scripts ORG
|
||||
# Author: andy-vdg
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://agentgateway.dev/
|
||||
|
||||
APP="agentgateway"
|
||||
var_tags="${var_tags:-ai;proxy;mcp}"
|
||||
var_cpu="${var_cpu:-1}"
|
||||
var_ram="${var_ram:-512}"
|
||||
var_disk="${var_disk:-2}"
|
||||
var_os="${var_os:-debian}"
|
||||
var_version="${var_version:-13}"
|
||||
var_arm64="${var_arm64:-yes}"
|
||||
var_unprivileged="${var_unprivileged:-1}"
|
||||
|
||||
header_info "$APP"
|
||||
variables
|
||||
color
|
||||
catch_errors
|
||||
|
||||
function update_script() {
|
||||
header_info
|
||||
check_container_storage
|
||||
check_container_resources
|
||||
|
||||
if [[ ! -f /etc/agentgateway/config.yaml ]]; then
|
||||
msg_error "No agentgateway Installation Found!"
|
||||
exit
|
||||
fi
|
||||
|
||||
if check_for_gh_release "agentgateway" "agentgateway/agentgateway"; then
|
||||
msg_info "Stopping Service"
|
||||
systemctl stop agentgateway
|
||||
msg_ok "Stopped Service"
|
||||
|
||||
create_backup /etc/agentgateway /opt/agentgateway_data
|
||||
|
||||
fetch_and_deploy_gh_release "agentgateway" "agentgateway/agentgateway" "singlefile" "latest" "/opt/agentgateway" "agentgateway-linux-$(arch_resolve "amd64" "arm64")"
|
||||
|
||||
restore_backup
|
||||
|
||||
msg_info "Starting Service"
|
||||
systemctl start agentgateway
|
||||
msg_ok "Started Service"
|
||||
msg_ok "Updated successfully!"
|
||||
fi
|
||||
exit
|
||||
}
|
||||
|
||||
start
|
||||
build_container
|
||||
description
|
||||
|
||||
msg_ok "Completed Successfully!\n"
|
||||
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
|
||||
echo -e "${INFO}${YW}Access it using the following URL:${CL}"
|
||||
echo -e "${GATEWAY}${BGN}http://${IP}:4000/ui${CL}"
|
||||
-92
@@ -1,92 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
_cs_boot="${COMMUNITY_SCRIPTS_CORE_DIR:-$(dirname "${BASH_SOURCE[0]}")/../../core}/core/build.func"
|
||||
source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/build.func")
|
||||
# Copyright (c) 2021-2026 community-scripts ORG
|
||||
# Author: a55uka (a55uka)
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://github.com/TheSpaghettiDetective/obico-server
|
||||
|
||||
APP="Obico"
|
||||
var_tags="${var_tags:-3d-printing;monitoring;ai}"
|
||||
var_cpu="${var_cpu:-4}"
|
||||
var_ram="${var_ram:-4096}"
|
||||
var_disk="${var_disk:-15}"
|
||||
var_os="${var_os:-debian}"
|
||||
var_version="${var_version:-13}"
|
||||
var_arm64="${var_arm64:-yes}" # arm64 verified: CI install + health check passed
|
||||
var_unprivileged="${var_unprivileged:-1}"
|
||||
|
||||
header_info "$APP"
|
||||
variables
|
||||
color
|
||||
catch_errors
|
||||
|
||||
function update_script() {
|
||||
header_info
|
||||
check_container_storage
|
||||
check_container_resources
|
||||
|
||||
if [[ ! -d /opt/obico ]]; then
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
fi
|
||||
|
||||
if check_for_gh_branch "obico" "TheSpaghettiDetective/obico-server" "release"; then
|
||||
msg_info "Stopping Services"
|
||||
systemctl stop obico-tasks obico-web obico-ml-api
|
||||
msg_ok "Stopped Services"
|
||||
|
||||
create_backup /opt/obico/.env
|
||||
|
||||
fetch_and_deploy_gh_branch "obico" "TheSpaghettiDetective/obico-server" "release" "/opt/obico"
|
||||
sed -i "s/^VERSION=.*/VERSION=$(cat ~/.obico)/" /opt/obico/.env
|
||||
|
||||
MOONRAKER_SHA=$(grep -oP 'checkout \K[a-f0-9]{40}' /opt/obico/backend/Dockerfile.base)
|
||||
if [[ -n "$MOONRAKER_SHA" && "$(git -C /opt/moonraker rev-parse HEAD 2>/dev/null)" != "$MOONRAKER_SHA" ]]; then
|
||||
msg_info "Updating Moonraker Metadata Library"
|
||||
[[ -d /opt/moonraker/.git ]] || $STD git clone https://github.com/Arksine/moonraker.git /opt/moonraker
|
||||
$STD git -C /opt/moonraker fetch --depth 1 origin "$MOONRAKER_SHA"
|
||||
$STD git -C /opt/moonraker checkout "$MOONRAKER_SHA"
|
||||
msg_ok "Updated Moonraker Metadata Library"
|
||||
fi
|
||||
|
||||
IMPORTLIB_METADATA_PIN=$(grep -oP 'importlib_metadata==\K[0-9.]+' /opt/obico/backend/Dockerfile.base)
|
||||
msg_info "Updating Python Environments"
|
||||
cd /opt/obico/backend
|
||||
$STD uv pip install -p .venv/bin/python -r requirements.txt
|
||||
$STD uv pip install -p .venv/bin/python "importlib_metadata==${IMPORTLIB_METADATA_PIN}"
|
||||
cd /opt/obico/ml_api
|
||||
$STD uv pip install -p .venv/bin/python -r requirements.txt onnxruntime opencv-python-headless
|
||||
msg_ok "Updated Python Environments"
|
||||
|
||||
if [[ "$(tr -d '\r' </opt/obico/ml_api/model/model-weights.onnx.sha256)" != "$(sha256sum /model_cache/ml_api/onnx/model-weights.onnx | cut -d' ' -f1)" ]]; then
|
||||
msg_info "Downloading Failure Detection Model"
|
||||
bash /opt/obico/ml_api/scripts/fetch_verified.sh "$(tr -d '\r' </opt/obico/ml_api/model/model-weights.onnx.url)" /model_cache/ml_api/onnx/model-weights.onnx 50000000 "$(tr -d '\r' </opt/obico/ml_api/model/model-weights.onnx.sha256)"
|
||||
msg_ok "Downloaded Failure Detection Model"
|
||||
fi
|
||||
|
||||
msg_info "Running Database Migrations"
|
||||
set -a
|
||||
source /opt/obico/.env
|
||||
set +a
|
||||
cd /opt/obico/backend
|
||||
$STD .venv/bin/python manage.py migrate --noinput
|
||||
$STD .venv/bin/python manage.py collectstatic --noinput
|
||||
msg_ok "Ran Database Migrations"
|
||||
|
||||
msg_info "Starting Services"
|
||||
systemctl start obico-ml-api obico-web obico-tasks
|
||||
msg_ok "Started Services"
|
||||
msg_ok "Updated successfully!"
|
||||
fi
|
||||
exit
|
||||
}
|
||||
|
||||
start
|
||||
build_container
|
||||
description
|
||||
|
||||
msg_ok "Completed successfully!\n"
|
||||
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
|
||||
echo -e "${INFO}${YW}Access it using the following URL:${CL}"
|
||||
echo -e "${GATEWAY}${BGN}http://${IP}:3334${CL}"
|
||||
@@ -1,65 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
_cs_boot="${COMMUNITY_SCRIPTS_CORE_DIR:-$(dirname "${BASH_SOURCE[0]}")/../../core}/core/build.func"
|
||||
source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/build.func")
|
||||
# Copyright (c) 2021-2026 community-scripts ORG
|
||||
# Author: MickLesk (CanbiZ)
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://github.com/roundcube/roundcubemail
|
||||
|
||||
APP="Roundcube"
|
||||
var_tags="${var_tags:-mail;webmail}"
|
||||
var_cpu="${var_cpu:-1}"
|
||||
var_ram="${var_ram:-512}"
|
||||
var_disk="${var_disk:-4}"
|
||||
var_os="${var_os:-debian}"
|
||||
var_version="${var_version:-13}"
|
||||
var_arm64="${var_arm64:-yes}"
|
||||
var_unprivileged="${var_unprivileged:-1}"
|
||||
|
||||
export var_imap_host="${var_imap_host:-}"
|
||||
export var_smtp_host="${var_smtp_host:-}"
|
||||
|
||||
header_info "$APP"
|
||||
variables
|
||||
color
|
||||
catch_errors
|
||||
|
||||
function update_script() {
|
||||
header_info
|
||||
check_container_storage
|
||||
check_container_resources
|
||||
|
||||
if [[ ! -d /opt/roundcube ]]; then
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
fi
|
||||
|
||||
if check_for_gh_release "roundcube" "roundcube/roundcubemail"; then
|
||||
msg_info "Stopping Roundcube"
|
||||
systemctl stop nginx
|
||||
msg_ok "Stopped Roundcube"
|
||||
|
||||
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "roundcube" "roundcube/roundcubemail" "prebuild" "latest" "/opt/roundcube_update" "roundcubemail-*-complete.tar.gz"
|
||||
|
||||
msg_info "Updating Roundcube"
|
||||
$STD php /opt/roundcube_update/bin/installto.sh -y /opt/roundcube
|
||||
rm -rf /opt/roundcube_update
|
||||
chown -R www-data:www-data /opt/roundcube /opt/roundcube_data
|
||||
msg_ok "Updated Roundcube"
|
||||
|
||||
msg_info "Starting Roundcube"
|
||||
systemctl start nginx
|
||||
msg_ok "Started Roundcube"
|
||||
msg_ok "Updated successfully!"
|
||||
fi
|
||||
exit
|
||||
}
|
||||
|
||||
start
|
||||
build_container
|
||||
description
|
||||
|
||||
msg_ok "Completed Successfully!\n"
|
||||
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
|
||||
echo -e "${INFO}${YW}Access it using the following URL:${CL}"
|
||||
echo -e "${GATEWAY}${BGN}http://${IP}${CL}"
|
||||
@@ -1,59 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
_cs_boot="${COMMUNITY_SCRIPTS_CORE_DIR:-$(dirname "${BASH_SOURCE[0]}")/../../core}/core/build.func"
|
||||
source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/build.func")
|
||||
# Copyright (c) 2021-2026 community-scripts ORG
|
||||
# Author: MickLesk (CanbiZ)
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://github.com/warp-tech/warpgate
|
||||
|
||||
APP="Warpgate"
|
||||
var_tags="${var_tags:-bastion;ssh;security}"
|
||||
var_cpu="${var_cpu:-1}"
|
||||
var_ram="${var_ram:-512}"
|
||||
var_disk="${var_disk:-4}"
|
||||
var_os="${var_os:-debian}"
|
||||
var_version="${var_version:-13}"
|
||||
var_arm64="${var_arm64:-yes}"
|
||||
var_unprivileged="${var_unprivileged:-1}"
|
||||
|
||||
export var_admin_pass="${var_admin_pass:-}"
|
||||
|
||||
header_info "$APP"
|
||||
variables
|
||||
color
|
||||
catch_errors
|
||||
|
||||
function update_script() {
|
||||
header_info
|
||||
check_container_storage
|
||||
check_container_resources
|
||||
|
||||
if [[ ! -f /opt/warpgate/warpgate ]]; then
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
fi
|
||||
|
||||
if check_for_gh_release "warpgate" "warp-tech/warpgate"; then
|
||||
msg_info "Stopping Warpgate"
|
||||
systemctl stop warpgate
|
||||
msg_ok "Stopped Warpgate"
|
||||
|
||||
fetch_and_deploy_gh_release "warpgate" "warp-tech/warpgate" "singlefile" "latest" "/opt/warpgate" "warpgate-v*-$(arch_resolve "x86_64" "arm64")-linux"
|
||||
|
||||
msg_info "Starting Warpgate"
|
||||
systemctl start warpgate
|
||||
msg_ok "Started Warpgate"
|
||||
msg_ok "Updated successfully!"
|
||||
fi
|
||||
exit
|
||||
}
|
||||
|
||||
start
|
||||
build_container
|
||||
description
|
||||
|
||||
msg_ok "Completed Successfully!\n"
|
||||
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
|
||||
echo -e "${INFO}${YW}Access it using the following URL:${CL}"
|
||||
echo -e "${GATEWAY}${BGN}https://${IP}:8888/@warpgate${CL}"
|
||||
echo -e "${INFO}${YW}Admin login: admin, password in /opt/warpgate_data/.env (inside the container)${CL}"
|
||||
@@ -1,59 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2026 community-scripts ORG
|
||||
# Author: andy-vdg
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://agentgateway.dev/
|
||||
|
||||
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
||||
color
|
||||
verb_ip6
|
||||
catch_errors
|
||||
setting_up_container
|
||||
network_check
|
||||
update_os
|
||||
|
||||
fetch_and_deploy_gh_release "agentgateway" "agentgateway/agentgateway" "singlefile" "latest" "/opt/agentgateway" "agentgateway-linux-$(arch_resolve "amd64" "arm64")"
|
||||
|
||||
msg_info "Configuring agentgateway"
|
||||
mkdir -p /etc/agentgateway /opt/agentgateway_data
|
||||
cat <<EOF >/etc/agentgateway/config.yaml
|
||||
# yaml-language-server: \$schema=https://agentgateway.dev/schema/config
|
||||
# The config agentgateway bootstraps on first run: traffic and the UI on port 4000,
|
||||
# state in SQLite. The UI has no login until you add policies:
|
||||
# https://agentgateway.dev/docs/standalone/latest/documentation/setup/ui/secure-ui/
|
||||
config:
|
||||
database:
|
||||
url: sqlite:///opt/agentgateway_data/data.db
|
||||
gateways:
|
||||
default:
|
||||
port: 4000
|
||||
ui:
|
||||
gateways: default
|
||||
EOF
|
||||
chmod 600 /etc/agentgateway/config.yaml
|
||||
msg_ok "Configured agentgateway"
|
||||
|
||||
msg_info "Creating Service"
|
||||
cat <<EOF >/etc/systemd/system/agentgateway.service
|
||||
[Unit]
|
||||
Description=agentgateway
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=root
|
||||
ExecStart=/opt/agentgateway/agentgateway -f /etc/agentgateway/config.yaml
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl enable -q --now agentgateway
|
||||
msg_ok "Created Service"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
cleanup_lxc
|
||||
@@ -124,18 +124,15 @@ msg_ok "Built SQLite Extensions"
|
||||
|
||||
if [[ "$(arch_resolve)" == "amd64" ]]; then
|
||||
msg_info "Building Intel Media Driver (Patience)"
|
||||
if download_gpg_key "https://repositories.intel.com/gpu/intel-graphics.key" "/usr/share/keyrings/intel-graphics.gpg" "dearmor"; then
|
||||
sed -i '/intel-graphics.key/d' /opt/frigate/docker/main/build_intel_media_driver.sh
|
||||
$STD bash /opt/frigate/docker/main/build_intel_media_driver.sh
|
||||
cp -a /rootfs/. /
|
||||
rm -rf /rootfs
|
||||
rm -f /etc/apt/sources.list.d/intel-gpu-jammy.list /usr/share/keyrings/intel-graphics.gpg
|
||||
apt_update_safe
|
||||
ldconfig
|
||||
msg_ok "Built Intel Media Driver"
|
||||
else
|
||||
msg_warn "Intel's package repository cannot be reached from this network; Frigate is installed without the Intel media driver"
|
||||
fi
|
||||
download_gpg_key "https://repositories.intel.com/gpu/intel-graphics.key" "/usr/share/keyrings/intel-graphics.gpg" "dearmor"
|
||||
sed -i '/intel-graphics.key/d' /opt/frigate/docker/main/build_intel_media_driver.sh
|
||||
$STD bash /opt/frigate/docker/main/build_intel_media_driver.sh
|
||||
cp -a /rootfs/. /
|
||||
rm -rf /rootfs
|
||||
rm -f /etc/apt/sources.list.d/intel-gpu-jammy.list /usr/share/keyrings/intel-graphics.gpg
|
||||
apt_update_safe
|
||||
ldconfig
|
||||
msg_ok "Built Intel Media Driver"
|
||||
fi
|
||||
|
||||
fetch_and_deploy_gh_release "go2rtc" "AlexxIT/go2rtc" "singlefile" "v1.9.14" "/usr/local/go2rtc/bin" "go2rtc_linux_$(arch_resolve)"
|
||||
|
||||
@@ -1,150 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2026 community-scripts ORG
|
||||
# Author: a55uka (a55uka)
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://github.com/TheSpaghettiDetective/obico-server
|
||||
|
||||
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
||||
color
|
||||
verb_ip6
|
||||
catch_errors
|
||||
setting_up_container
|
||||
network_check
|
||||
update_os
|
||||
|
||||
msg_info "Installing Dependencies"
|
||||
$STD apt install -y \
|
||||
libmagic1 \
|
||||
redis-server
|
||||
systemctl enable -q --now redis-server
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
setup_ffmpeg
|
||||
|
||||
fetch_and_deploy_gh_branch "obico" "TheSpaghettiDetective/obico-server" "release" "/opt/obico"
|
||||
PYTHON_VERSION="3.12" setup_uv
|
||||
|
||||
msg_info "Setting up Python Environments"
|
||||
IMPORTLIB_METADATA_PIN=$(grep -oP 'importlib_metadata==\K[0-9.]+' /opt/obico/backend/Dockerfile.base) # tracked from upstream's Dockerfile.base
|
||||
cd /opt/obico/backend
|
||||
$STD uv venv --python 3.12 .venv
|
||||
$STD uv pip install -p .venv/bin/python -r requirements.txt
|
||||
$STD uv pip install -p .venv/bin/python "importlib_metadata==${IMPORTLIB_METADATA_PIN}"
|
||||
cd /opt/obico/ml_api
|
||||
$STD uv venv --python 3.12 .venv
|
||||
$STD uv pip install -p .venv/bin/python -r requirements.txt onnxruntime opencv-python-headless
|
||||
msg_ok "Set up Python Environments"
|
||||
|
||||
msg_info "Installing Moonraker Metadata Library"
|
||||
MOONRAKER_SHA=$(grep -oP 'checkout \K[a-f0-9]{40}' /opt/obico/backend/Dockerfile.base) # pinned clone as in backend/Dockerfile.base, imported via PYTHONPATH
|
||||
$STD git clone https://github.com/Arksine/moonraker.git /opt/moonraker
|
||||
$STD git -C /opt/moonraker checkout "$MOONRAKER_SHA"
|
||||
msg_ok "Installed Moonraker Metadata Library"
|
||||
|
||||
msg_info "Downloading Failure Detection Model"
|
||||
mkdir -p /model_cache/ml_api/onnx
|
||||
bash /opt/obico/ml_api/scripts/fetch_verified.sh "$(tr -d '\r' </opt/obico/ml_api/model/model-weights.onnx.url)" /model_cache/ml_api/onnx/model-weights.onnx 50000000 "$(tr -d '\r' </opt/obico/ml_api/model/model-weights.onnx.sha256)" # upstream's checksum-verifying downloader, URL and sha256 from sidecar files
|
||||
msg_ok "Downloaded Failure Detection Model"
|
||||
|
||||
msg_info "Configuring Obico"
|
||||
DJANGO_SECRET_KEY=$(cd /opt/obico/backend && .venv/bin/python -c 'import secrets; print(secrets.token_urlsafe())' 2>/dev/null)
|
||||
ML_API_TOKEN=$(random_password 32)
|
||||
cat <<EOF >/opt/obico/.env
|
||||
DJANGO_SECRET_KEY=${DJANGO_SECRET_KEY}
|
||||
REDIS_URL=redis://127.0.0.1:6379
|
||||
DATABASE_URL=sqlite:////opt/obico/backend/db.sqlite3
|
||||
INTERNAL_MEDIA_HOST=http://127.0.0.1:3334
|
||||
ML_API_HOST=http://127.0.0.1:3333
|
||||
ML_API_TOKEN=${ML_API_TOKEN}
|
||||
OCTOPRINT_TUNNEL_PORT_RANGE=0-0
|
||||
VERSION=$(cat ~/.obico)
|
||||
PYTHONPATH=/opt/moonraker
|
||||
EOF
|
||||
chmod 600 /opt/obico/.env
|
||||
msg_ok "Configured Obico"
|
||||
|
||||
msg_info "Initializing Database"
|
||||
set -a
|
||||
source /opt/obico/.env
|
||||
set +a
|
||||
cd /opt/obico/backend
|
||||
$STD .venv/bin/python manage.py migrate --noinput
|
||||
$STD .venv/bin/python manage.py collectstatic --noinput
|
||||
$STD .venv/bin/python manage.py site --add "${LOCAL_IP}:3334"
|
||||
msg_ok "Initialized Database"
|
||||
|
||||
msg_info "Creating Services"
|
||||
cat <<EOF >/etc/systemd/system/obico-ml-api.service
|
||||
[Unit]
|
||||
Description=Obico ML API
|
||||
Wants=network-online.target
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=root
|
||||
WorkingDirectory=/opt/obico/ml_api
|
||||
EnvironmentFile=/opt/obico/.env
|
||||
ExecStart=/opt/obico/ml_api/.venv/bin/gunicorn --bind 0.0.0.0:3333 --workers 1 --timeout 120 wsgi # 0.0.0.0 for external clients (e.g. Bambuddy); ML_API_TOKEN gates everything but the health check
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
cat <<EOF >/etc/systemd/system/obico-web.service
|
||||
[Unit]
|
||||
Description=Obico Web Server
|
||||
Wants=network-online.target obico-ml-api.service
|
||||
After=network-online.target redis-server.service obico-ml-api.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=root
|
||||
WorkingDirectory=/opt/obico/backend
|
||||
EnvironmentFile=/opt/obico/.env
|
||||
ExecStart=/opt/obico/backend/.venv/bin/daphne -b 0.0.0.0 -p 3334 config.routing:application
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
cat <<EOF >/etc/systemd/system/obico-tasks.service
|
||||
[Unit]
|
||||
Description=Obico Celery Worker
|
||||
Wants=network-online.target
|
||||
After=network-online.target redis-server.service obico-web.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=root
|
||||
WorkingDirectory=/opt/obico/backend
|
||||
EnvironmentFile=/opt/obico/.env
|
||||
ExecStart=/opt/obico/backend/.venv/bin/celery -A config worker --beat -l info -c 2 -Q realtime,celery
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl enable -q --now obico-ml-api obico-web obico-tasks
|
||||
msg_ok "Created Services"
|
||||
|
||||
msg_info "Waiting for Obico to start"
|
||||
for ((i = 1; i <= 45; i++)); do
|
||||
curl -fsS http://127.0.0.1:3334/hc/ >/dev/null 2>&1 && break
|
||||
sleep 2
|
||||
done
|
||||
if ! curl -fsS http://127.0.0.1:3334/hc/ >/dev/null 2>&1; then
|
||||
msg_error "Obico did not respond within 90s. Check 'journalctl -u obico-web -u obico-ml-api -u obico-tasks'"
|
||||
exit 150
|
||||
fi
|
||||
msg_ok "Obico is running"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
cleanup_lxc
|
||||
@@ -1,83 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2026 community-scripts ORG
|
||||
# Author: MickLesk (CanbiZ)
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://github.com/roundcube/roundcubemail
|
||||
|
||||
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
||||
color
|
||||
verb_ip6
|
||||
catch_errors
|
||||
setting_up_container
|
||||
network_check
|
||||
update_os
|
||||
|
||||
msg_info "Installing Dependencies"
|
||||
$STD apt install -y nginx rsync
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
PHP_VERSION="8.4" PHP_FPM="YES" PHP_MODULE="ldap" setup_php
|
||||
fetch_and_deploy_gh_release "roundcube" "roundcube/roundcubemail" "prebuild" "latest" "/opt/roundcube" "roundcubemail-*-complete.tar.gz"
|
||||
|
||||
msg_info "Configuring Roundcube"
|
||||
mkdir -p /opt/roundcube_data
|
||||
cat <<EOF >/opt/roundcube/config/config.inc.php
|
||||
<?php
|
||||
\$config = [];
|
||||
\$config['db_dsnw'] = 'sqlite:////opt/roundcube_data/roundcube.db?mode=0640';
|
||||
\$config['imap_host'] = '${var_imap_host:-}';
|
||||
\$config['smtp_host'] = '${var_smtp_host:-%h:587}';
|
||||
\$config['smtp_user'] = '%u';
|
||||
\$config['smtp_pass'] = '%p';
|
||||
\$config['product_name'] = 'Roundcube Webmail';
|
||||
\$config['des_key'] = '$(random_password 24)';
|
||||
\$config['plugins'] = ['archive', 'zipdownload'];
|
||||
\$config['skin'] = 'elastic';
|
||||
EOF
|
||||
rm -rf /opt/roundcube/installer
|
||||
chown -R www-data:www-data /opt/roundcube /opt/roundcube_data
|
||||
chmod 640 /opt/roundcube/config/config.inc.php
|
||||
cd /opt/roundcube
|
||||
$STD runuser -u www-data -- php bin/initdb.sh --dir=SQL --update
|
||||
msg_ok "Configured Roundcube"
|
||||
|
||||
msg_info "Configuring Nginx"
|
||||
PHP_SOCK=$(get_php_fpm_socket)
|
||||
cat <<EOF >/etc/nginx/sites-available/roundcube
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name _;
|
||||
|
||||
root /opt/roundcube/public_html;
|
||||
index index.php;
|
||||
|
||||
client_max_body_size 128M;
|
||||
|
||||
location = /favicon.ico {
|
||||
rewrite ^ /static.php/skins/elastic/images/favicon.ico last;
|
||||
}
|
||||
location / {
|
||||
try_files \$uri \$uri/ /index.php\$is_args\$args;
|
||||
}
|
||||
location ~ \.php(/|\$) {
|
||||
fastcgi_split_path_info ^(.+?\.php)(/.*)\$;
|
||||
set \$path_info \$fastcgi_path_info;
|
||||
try_files \$fastcgi_script_name =404;
|
||||
include fastcgi_params;
|
||||
fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
|
||||
fastcgi_param PATH_INFO \$path_info;
|
||||
fastcgi_pass unix:${PHP_SOCK};
|
||||
}
|
||||
location ~ /\. {
|
||||
deny all;
|
||||
}
|
||||
}
|
||||
EOF
|
||||
nginx_enable_site "roundcube"
|
||||
msg_ok "Configured Nginx"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
cleanup_lxc
|
||||
@@ -1,59 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2026 community-scripts ORG
|
||||
# Author: MickLesk (CanbiZ)
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://github.com/warp-tech/warpgate
|
||||
|
||||
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
||||
color
|
||||
verb_ip6
|
||||
catch_errors
|
||||
setting_up_container
|
||||
network_check
|
||||
update_os
|
||||
|
||||
fetch_and_deploy_gh_release "warpgate" "warp-tech/warpgate" "singlefile" "latest" "/opt/warpgate" "warpgate-v*-$(arch_resolve "x86_64" "arm64")-linux"
|
||||
|
||||
msg_info "Configuring Warpgate"
|
||||
ADMIN_PASS="${var_admin_pass:-$(random_password)}"
|
||||
mkdir -p /opt/warpgate_data
|
||||
cat <<EOF >/opt/warpgate_data/.env
|
||||
WARPGATE_ADMIN_USER=admin
|
||||
WARPGATE_ADMIN_PASSWORD=${ADMIN_PASS}
|
||||
EOF
|
||||
chmod 600 /opt/warpgate_data/.env
|
||||
WARPGATE_ADMIN_PASSWORD="$ADMIN_PASS" $STD /opt/warpgate/warpgate --config /opt/warpgate_data/warpgate.yaml unattended-setup \
|
||||
--data-path /opt/warpgate_data \
|
||||
--http-port 8888 \
|
||||
--ssh-port 2222 \
|
||||
--mysql-port 33306 \
|
||||
--postgres-port 55432 \
|
||||
--kubernetes-port 8443 \
|
||||
--record-sessions
|
||||
# A host kernel booted without IPv6 cannot bind [::]
|
||||
[[ -d /proc/sys/net/ipv6 ]] || sed -i "s/'\[::\]:/'0.0.0.0:/" /opt/warpgate_data/warpgate.yaml
|
||||
msg_ok "Configured Warpgate"
|
||||
|
||||
msg_info "Creating Service"
|
||||
cat <<EOF >/etc/systemd/system/warpgate.service
|
||||
[Unit]
|
||||
Description=Warpgate
|
||||
After=network.target
|
||||
StartLimitIntervalSec=0
|
||||
|
||||
[Service]
|
||||
Type=notify
|
||||
ExecStart=/opt/warpgate/warpgate --config /opt/warpgate_data/warpgate.yaml run
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl enable -q --now warpgate
|
||||
msg_ok "Created Service"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
cleanup_lxc
|
||||
@@ -0,0 +1,442 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2026 community-scripts ORG
|
||||
# Author: MickLesk (CanbiZ)
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://netbird.io
|
||||
|
||||
COMMUNITY_SCRIPTS_URL="${COMMUNITY_SCRIPTS_URL:-https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main}"
|
||||
source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/pve/vm-core.func")
|
||||
load_functions
|
||||
|
||||
APP="NetBird Server"
|
||||
APP_TYPE="vm"
|
||||
NSAPP="netbird-server"
|
||||
var_os="debian"
|
||||
var_version="13"
|
||||
GEN_MAC=02:$(openssl rand -hex 5 | awk '{print toupper($0)}' | sed 's/\(..\)/\1:/g; s/.$//')
|
||||
RANDOM_UUID="$(cat /proc/sys/kernel/random/uuid)"
|
||||
METHOD=""
|
||||
USE_CLOUD_INIT="no"
|
||||
OS_TYPE="debian"
|
||||
OS_VERSION="13"
|
||||
OS_CODENAME="trixie"
|
||||
OS_DISPLAY="Debian 13 (Trixie)"
|
||||
THIN="discard=on,ssd=1,"
|
||||
NETBIRD_DOMAIN_INPUT=""
|
||||
NETBIRD_PROXY_TYPE_INPUT="0"
|
||||
NETBIRD_EMAIL_INPUT=""
|
||||
DOCKER_PREINSTALLED="no"
|
||||
DOCKER_INSTALL_MARKER=""
|
||||
NETBIRD_SETUP_MARKER=""
|
||||
|
||||
header_info
|
||||
echo -e "\n Loading..."
|
||||
|
||||
set -Eeo pipefail
|
||||
shopt -s inherit_errexit
|
||||
trap 'error_handler $LINENO "$BASH_COMMAND"' ERR
|
||||
trap cleanup EXIT
|
||||
trap 'post_update_to_api "failed" "130"' SIGINT
|
||||
trap 'post_update_to_api "failed" "143"' SIGTERM
|
||||
trap 'post_update_to_api "failed" "129"; exit 129' SIGHUP
|
||||
|
||||
TEMP_DIR=$(mktemp -d)
|
||||
pushd "$TEMP_DIR" >/dev/null
|
||||
|
||||
vm_preflight
|
||||
vm_require_tools virt-customize jq
|
||||
|
||||
function configure_netbird_setup() {
|
||||
if [[ "${VM_UNATTENDED:-0}" == "1" ]]; then
|
||||
if [[ -z "${VM_NETBIRD_DOMAIN:-}" ]]; then
|
||||
msg_error "An unattended NetBird Server install needs VM_NETBIRD_DOMAIN"
|
||||
msg_error "Set it to the public domain whose DNS A record points at this VM, e.g. VM_NETBIRD_DOMAIN=netbird.my-domain.com"
|
||||
exit 1
|
||||
fi
|
||||
NETBIRD_DOMAIN_INPUT="$VM_NETBIRD_DOMAIN"
|
||||
NETBIRD_PROXY_TYPE_INPUT="${VM_NETBIRD_PROXY_TYPE:-0}"
|
||||
NETBIRD_EMAIL_INPUT="${VM_NETBIRD_EMAIL:-admin@${NETBIRD_DOMAIN_INPUT}}"
|
||||
echo -e "${INFO}${BOLD}${DGN}NetBird Domain: ${BGN}${NETBIRD_DOMAIN_INPUT}${CL}"
|
||||
echo -e "${INFO}${BOLD}${DGN}Reverse Proxy: ${BGN}${NETBIRD_PROXY_TYPE_INPUT}${CL}"
|
||||
echo -e "${INFO}${BOLD}${DGN}Let's Encrypt Email: ${BGN}${NETBIRD_EMAIL_INPUT}${CL}"
|
||||
return
|
||||
fi
|
||||
|
||||
while true; do
|
||||
if vm_dialog inputbox "NETBIRD DOMAIN" \
|
||||
"Enter the public domain for your NetBird server.\n(DNS A record must point to this VM's public IP)\n\ne.g. netbird.my-domain.com" \
|
||||
11 65 "" --cancel-button Exit-Script; then
|
||||
NETBIRD_DOMAIN_INPUT="$VM_DIALOG_RESULT"
|
||||
if [[ -z "$NETBIRD_DOMAIN_INPUT" ]] || [[ "$NETBIRD_DOMAIN_INPUT" == "netbird.example.com" ]]; then
|
||||
vm_dialog msgbox "INVALID DOMAIN" "Please enter a valid domain name." 8 50
|
||||
continue
|
||||
fi
|
||||
echo -e "${INFO}${BOLD}${DGN}NetBird Domain: ${BGN}${NETBIRD_DOMAIN_INPUT}${CL}"
|
||||
break
|
||||
else
|
||||
exit_script
|
||||
fi
|
||||
done
|
||||
|
||||
if vm_dialog radiolist "REVERSE PROXY" \
|
||||
"Select the reverse proxy for NetBird" 14 70 4 \
|
||||
"0" "Traefik (recommended, built-in with auto TLS)" ON \
|
||||
"2" "Nginx (generates config template)" OFF \
|
||||
"3" "Nginx Proxy Manager" OFF \
|
||||
"5" "Other/Manual" OFF; then
|
||||
NETBIRD_PROXY_TYPE_INPUT="$VM_DIALOG_RESULT"
|
||||
echo -e "${INFO}${BOLD}${DGN}Reverse Proxy: ${BGN}${NETBIRD_PROXY_TYPE_INPUT}${CL}"
|
||||
else
|
||||
exit_script
|
||||
fi
|
||||
|
||||
if [[ "$NETBIRD_PROXY_TYPE_INPUT" == "0" ]]; then
|
||||
while true; do
|
||||
if vm_dialog inputbox "LETSENCRYPT EMAIL" \
|
||||
"Enter your email for Let's Encrypt certificates:" 8 65 "" --cancel-button Exit-Script; then
|
||||
NETBIRD_EMAIL_INPUT="$VM_DIALOG_RESULT"
|
||||
if [[ -z "$NETBIRD_EMAIL_INPUT" ]]; then
|
||||
vm_dialog msgbox "INVALID EMAIL" "Email is required for Let's Encrypt." 8 50
|
||||
continue
|
||||
fi
|
||||
echo -e "${INFO}${BOLD}${DGN}Let's Encrypt Email: ${BGN}${NETBIRD_EMAIL_INPUT}${CL}"
|
||||
break
|
||||
else
|
||||
exit_script
|
||||
fi
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
function select_os() {
|
||||
if [[ -n "${1:-}" ]]; then
|
||||
OS_CHOICE="$1"
|
||||
elif [[ "${VM_UNATTENDED:-0}" == "1" ]]; then
|
||||
OS_CHOICE="${VM_OS_VERSION:-debian13}"
|
||||
elif vm_dialog radiolist "SELECT OS" \
|
||||
"Choose Operating System for NetBird Server VM" 15 68 4 \
|
||||
"debian13" "Debian 13 (Trixie) - Latest" ON \
|
||||
"debian12" "Debian 12 (Bookworm) - Stable" OFF \
|
||||
"ubuntu2604" "Ubuntu 26.04 LTS (Resolute)" OFF \
|
||||
"ubuntu2404" "Ubuntu 24.04 LTS (Noble)" OFF; then
|
||||
OS_CHOICE="$VM_DIALOG_RESULT"
|
||||
else
|
||||
exit_script
|
||||
fi
|
||||
|
||||
case $OS_CHOICE in
|
||||
debian13)
|
||||
OS_TYPE="debian"
|
||||
OS_VERSION="13"
|
||||
OS_CODENAME="trixie"
|
||||
OS_DISPLAY="Debian 13 (Trixie)"
|
||||
;;
|
||||
debian12)
|
||||
OS_TYPE="debian"
|
||||
OS_VERSION="12"
|
||||
OS_CODENAME="bookworm"
|
||||
OS_DISPLAY="Debian 12 (Bookworm)"
|
||||
;;
|
||||
ubuntu2604)
|
||||
OS_TYPE="ubuntu"
|
||||
OS_VERSION="26.04"
|
||||
OS_CODENAME="resolute"
|
||||
OS_DISPLAY="Ubuntu 26.04 LTS"
|
||||
;;
|
||||
ubuntu2404)
|
||||
OS_TYPE="ubuntu"
|
||||
OS_VERSION="24.04"
|
||||
OS_CODENAME="noble"
|
||||
OS_DISPLAY="Ubuntu 24.04 LTS"
|
||||
;;
|
||||
*)
|
||||
msg_error "Unsupported OS '${OS_CHOICE}' (expected debian13, debian12, ubuntu2604 or ubuntu2404)"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
var_os="$OS_TYPE"
|
||||
var_version="$OS_VERSION"
|
||||
echo -e "${OS}${BOLD}${DGN}Operating System: ${BGN}${OS_DISPLAY}${CL}"
|
||||
}
|
||||
|
||||
function select_cloud_init() {
|
||||
VM_CLOUD_INIT="${VM_CLOUD_INIT:-yes}"
|
||||
CLOUDINIT_REQUIRED=0
|
||||
if [[ "$OS_TYPE" == "ubuntu" ]]; then
|
||||
CLOUDINIT_REQUIRED=1
|
||||
fi
|
||||
vm_prompt_cloud_init "$OS_TYPE"
|
||||
}
|
||||
|
||||
function get_image_url() {
|
||||
local arch
|
||||
arch=$(vm_arch_resolve amd64 arm64)
|
||||
case $OS_TYPE in
|
||||
debian)
|
||||
if [[ "$USE_CLOUD_INIT" == "yes" ]]; then
|
||||
echo "https://cloud.debian.org/images/cloud/${OS_CODENAME}/latest/debian-${OS_VERSION}-generic-${arch}.qcow2"
|
||||
else
|
||||
echo "https://cloud.debian.org/images/cloud/${OS_CODENAME}/latest/debian-${OS_VERSION}-nocloud-${arch}.qcow2"
|
||||
fi
|
||||
;;
|
||||
ubuntu)
|
||||
echo "https://cloud-images.ubuntu.com/${OS_CODENAME}/current/${OS_CODENAME}-server-cloudimg-${arch}.img"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function default_settings() {
|
||||
select_os "${VM_OS_VERSION:-}"
|
||||
vm_apply_machine_type "q35"
|
||||
VMID=$(get_valid_nextid)
|
||||
DISK_SIZE="10G"
|
||||
DISK_CACHE=""
|
||||
HN="netbird"
|
||||
CPU_TYPE=" -cpu host"
|
||||
CORE_COUNT="2"
|
||||
RAM_SIZE="2048"
|
||||
BRG="vmbr0"
|
||||
MAC="$GEN_MAC"
|
||||
VLAN=""
|
||||
MTU=""
|
||||
START_VM="yes"
|
||||
METHOD="default"
|
||||
vm_echo_default_settings
|
||||
}
|
||||
|
||||
function advanced_settings() {
|
||||
METHOD="advanced"
|
||||
select_os
|
||||
vm_prompt_vmid "${VMID:-$(get_valid_nextid)}"
|
||||
vm_prompt_machine_type "q35"
|
||||
vm_prompt_disk_size "10G"
|
||||
vm_prompt_disk_cache "none"
|
||||
vm_prompt_hostname "netbird"
|
||||
vm_prompt_cpu_model "host"
|
||||
vm_prompt_cpu_cores "2"
|
||||
vm_prompt_ram "2048"
|
||||
vm_prompt_bridge "vmbr0"
|
||||
vm_prompt_mac "$GEN_MAC"
|
||||
vm_prompt_vlan
|
||||
vm_prompt_mtu
|
||||
vm_prompt_keyboard
|
||||
vm_prompt_verbose "no"
|
||||
vm_prompt_start_vm "yes"
|
||||
|
||||
if vm_confirm_advanced_settings "Ready to create a NetBird Server VM?"; then
|
||||
echo -e "${CREATING}${BOLD}${DGN}Creating a NetBird Server VM using the above advanced settings${CL}"
|
||||
else
|
||||
header_info
|
||||
echo -e "${ADVANCED}${BOLD}${RD}Using Advanced Settings${CL}"
|
||||
advanced_settings
|
||||
fi
|
||||
}
|
||||
|
||||
vm_start_script "Use Default Settings?\n\nDefaults:\n• 2 CPU Cores\n• 2 GB RAM\n• 10 GB Disk\n• Cloud-Init enabled" 14 58
|
||||
select_cloud_init
|
||||
configure_netbird_setup
|
||||
post_to_api_vm
|
||||
|
||||
vm_select_storage "$HN"
|
||||
vm_define_disk_references 2
|
||||
|
||||
msg_info "Retrieving the URL for the ${OS_DISPLAY} Disk Image"
|
||||
URL=$(get_image_url)
|
||||
CACHE_FILE="$(vm_image_cache_path "$URL")"
|
||||
msg_ok "${CL}${BL}${URL}${CL}"
|
||||
|
||||
MIN_IMAGE_BYTES=$((100 * 1024 * 1024))
|
||||
vm_fetch_image "$URL" "$CACHE_FILE" --cache --min-bytes "$MIN_IMAGE_BYTES" || exit 115
|
||||
|
||||
WORK_FILE="$TEMP_DIR/netbird.qcow2"
|
||||
cp "$CACHE_FILE" "$WORK_FILE"
|
||||
|
||||
if [[ "${USE_CLOUD_INIT:-no}" != "yes" ]]; then
|
||||
msg_info "Expanding the root filesystem to ${DISK_SIZE}"
|
||||
vm_expand_image "$WORK_FILE" "$DISK_SIZE" || true
|
||||
fi
|
||||
|
||||
export LIBGUESTFS_BACKEND_SETTINGS=dns=8.8.8.8,1.1.1.1
|
||||
|
||||
msg_info "Installing base packages"
|
||||
if vm_customize "NetBird base packages" "$WORK_FILE" --install qemu-guest-agent,curl,ca-certificates,jq; then
|
||||
msg_ok "Installed base packages"
|
||||
|
||||
msg_info "Installing Docker"
|
||||
if vm_customize "Docker" "$WORK_FILE" \
|
||||
--run-command 'bash -o pipefail -c "curl -fsSL https://get.docker.com | sh"' \
|
||||
--run-command 'systemctl enable docker'; then
|
||||
DOCKER_PREINSTALLED="yes"
|
||||
msg_ok "Installed Docker"
|
||||
|
||||
DOCKER_DAEMON_TMP="$TEMP_DIR/docker-daemon.json"
|
||||
cat >"$DOCKER_DAEMON_TMP" <<'JSON'
|
||||
{
|
||||
"storage-driver": "overlay2",
|
||||
"log-driver": "json-file",
|
||||
"log-opts": {
|
||||
"max-size": "10m",
|
||||
"max-file": "3"
|
||||
}
|
||||
}
|
||||
JSON
|
||||
vm_customize "Docker daemon" "$WORK_FILE" \
|
||||
--mkdir /etc/docker \
|
||||
--upload "${DOCKER_DAEMON_TMP}:/etc/docker/daemon.json" || msg_warn "Docker daemon tuning failed; continuing with Docker defaults"
|
||||
else
|
||||
msg_warn "Docker pre-install failed; installation is pending on first boot."
|
||||
fi
|
||||
else
|
||||
msg_warn "Package pre-install failed; Docker installation is pending on first boot."
|
||||
fi
|
||||
|
||||
NETBIRD_ENV_TMP="$TEMP_DIR/netbird.env"
|
||||
cat >"$NETBIRD_ENV_TMP" <<ENVEOF
|
||||
NETBIRD_NON_INTERACTIVE="true"
|
||||
NETBIRD_DOMAIN="${NETBIRD_DOMAIN_INPUT}"
|
||||
NETBIRD_REVERSE_PROXY_TYPE="${NETBIRD_PROXY_TYPE_INPUT}"
|
||||
NETBIRD_LETSENCRYPT_EMAIL="${NETBIRD_EMAIL_INPUT}"
|
||||
NETBIRD_ENABLE_PROXY="false"
|
||||
NETBIRD_ENABLE_CROWDSEC="false"
|
||||
NETBIRD_BIND_LOCALHOST_ONLY="false"
|
||||
ENVEOF
|
||||
vm_customize "NetBird configuration" "$WORK_FILE" \
|
||||
--upload "${NETBIRD_ENV_TMP}:/root/netbird.env" || exit 1
|
||||
|
||||
NETBIRD_SETUP_TMP="$TEMP_DIR/netbird-setup.sh"
|
||||
cat >"$NETBIRD_SETUP_TMP" <<'SETUPEOF'
|
||||
#!/usr/bin/env bash
|
||||
set -Eeuo pipefail
|
||||
exec > /var/log/netbird-setup.log 2>&1
|
||||
|
||||
echo "[$(date)] Starting NetBird automated setup"
|
||||
|
||||
for _ in {1..60}; do
|
||||
docker info >/dev/null 2>&1 && break
|
||||
sleep 5
|
||||
done
|
||||
docker info >/dev/null 2>&1 || {
|
||||
echo "[$(date)] ERROR: Docker not ready after 5 min"
|
||||
exit 1
|
||||
}
|
||||
|
||||
set -a
|
||||
source /root/netbird.env
|
||||
set +a
|
||||
|
||||
curl -fsSL https://github.com/netbirdio/netbird/releases/latest/download/getting-started.sh \
|
||||
-o /root/getting-started.sh
|
||||
|
||||
echo "[$(date)] Running NetBird getting-started.sh"
|
||||
bash /root/getting-started.sh
|
||||
echo "[$(date)] NetBird setup completed"
|
||||
SETUPEOF
|
||||
|
||||
vm_prepare_cloud_image "$WORK_FILE" "$HN" || true
|
||||
|
||||
if [[ "$DOCKER_PREINSTALLED" == "no" ]]; then
|
||||
DOCKER_INSTALL_TMP="$TEMP_DIR/install-docker.sh"
|
||||
cat >"$DOCKER_INSTALL_TMP" <<'DOCKEREOF'
|
||||
#!/usr/bin/env bash
|
||||
set -Eeuo pipefail
|
||||
export DEBIAN_FRONTEND=noninteractive NEEDRESTART_MODE=a
|
||||
exec > /var/log/install-docker.log 2>&1
|
||||
|
||||
echo "[$(date)] Starting Docker installation"
|
||||
for _ in {1..30}; do
|
||||
ping -c 1 8.8.8.8 >/dev/null 2>&1 && break
|
||||
sleep 2
|
||||
done
|
||||
|
||||
apt-get update
|
||||
apt-get install -y qemu-guest-agent curl ca-certificates jq
|
||||
bash -o pipefail -c "curl -fsSL https://get.docker.com | sh"
|
||||
systemctl enable docker
|
||||
install -d /etc/docker
|
||||
cat > /etc/docker/daemon.json <<'JSON'
|
||||
{
|
||||
"storage-driver": "overlay2",
|
||||
"log-driver": "json-file",
|
||||
"log-opts": {
|
||||
"max-size": "10m",
|
||||
"max-file": "3"
|
||||
}
|
||||
}
|
||||
JSON
|
||||
systemctl start docker
|
||||
echo "[$(date)] Docker installation completed"
|
||||
DOCKEREOF
|
||||
|
||||
vm_firstboot_unit "$WORK_FILE" install-docker "$DOCKER_INSTALL_TMP" \
|
||||
--description "Install Docker on first boot" \
|
||||
--cloud-init "$USE_CLOUD_INIT" || exit 1
|
||||
DOCKER_INSTALL_MARKER="$VM_FIRSTBOOT_MARKER"
|
||||
fi
|
||||
|
||||
NETBIRD_AFTER=(--after docker.service)
|
||||
if [[ "$DOCKER_PREINSTALLED" == "no" ]]; then
|
||||
NETBIRD_AFTER+=(--after install-docker.service)
|
||||
fi
|
||||
vm_firstboot_unit "$WORK_FILE" netbird-setup "$NETBIRD_SETUP_TMP" \
|
||||
--description "NetBird initial setup" \
|
||||
"${NETBIRD_AFTER[@]}" \
|
||||
--cloud-init "$USE_CLOUD_INIT" || exit 1
|
||||
NETBIRD_SETUP_MARKER="$VM_FIRSTBOOT_MARKER"
|
||||
|
||||
vm_claim_vmid
|
||||
msg_info "Creating NetBird Server VM shell"
|
||||
qm create "$VMID" -agent 1${MACHINE} -tablet 0 -bios ovmf${CPU_TYPE} -cores "$CORE_COUNT" -memory "$RAM_SIZE" \
|
||||
-name "$HN" -tags community-script -net0 "virtio,bridge=$BRG,macaddr=$MAC$VLAN$MTU" -onboot 1 -ostype l26 -scsihw virtio-scsi-pci >/dev/null
|
||||
vm_mark_created
|
||||
msg_ok "Created VM shell"
|
||||
|
||||
vm_alloc_efi_disk "$DISK0"
|
||||
vm_import_disk "$VMID" "$WORK_FILE" "$STORAGE"
|
||||
|
||||
DISK_OPTIONS="${DISK_CACHE}${THIN}"
|
||||
DISK_OPTIONS="${DISK_OPTIONS%,}"
|
||||
ROOT_DISK="$VM_IMPORTED_DISK"
|
||||
[[ -n "$DISK_OPTIONS" ]] && ROOT_DISK="${ROOT_DISK},${DISK_OPTIONS}"
|
||||
|
||||
msg_info "Attaching EFI and root disk"
|
||||
qm set "$VMID" \
|
||||
--efidisk0 "${DISK0_REF}${FORMAT}" \
|
||||
--scsi0 "$ROOT_DISK" \
|
||||
--boot order=scsi0 \
|
||||
--serial0 socket >/dev/null
|
||||
msg_ok "Attached EFI and root disk"
|
||||
|
||||
vm_resize_disk "scsi0" "$DISK_SIZE"
|
||||
set_description
|
||||
|
||||
vm_provision "$VMID"
|
||||
if [[ "$USE_CLOUD_INIT" == "yes" && -n "${CLOUDINIT_SSH_KEYS:-}" ]]; then
|
||||
$STD qm set "$VMID" --sshkeys "$CLOUDINIT_SSH_KEYS"
|
||||
fi
|
||||
|
||||
vm_start_vm "NetBird Server VM"
|
||||
vm_wait_for_ip 180 || true
|
||||
|
||||
if [[ "$USE_CLOUD_INIT" == "yes" ]]; then
|
||||
display_cloud_init_info "$VMID" "$HN"
|
||||
else
|
||||
msg_warn "Debian nocloud console login: root, no password. Set one before exposing the VM."
|
||||
fi
|
||||
|
||||
DOCKER_STATUS="Pre-installed"
|
||||
if [[ "$DOCKER_PREINSTALLED" == "no" ]]; then
|
||||
DOCKER_STATUS="First-boot unit install-docker.service${DOCKER_INSTALL_MARKER:+ (${DOCKER_INSTALL_MARKER})}"
|
||||
fi
|
||||
|
||||
vm_print_summary \
|
||||
"OS=${OS_DISPLAY}" \
|
||||
"Domain=https://${NETBIRD_DOMAIN_INPUT}" \
|
||||
"Docker=${DOCKER_STATUS}" \
|
||||
"NetBird unit=netbird-setup.service" \
|
||||
"Setup marker=${NETBIRD_SETUP_MARKER}"
|
||||
vm_next_steps \
|
||||
"NetBird installation continues in the VM on first boot." \
|
||||
"Monitor setup with: tail -f /var/log/netbird-setup.log (Docker install: /var/log/install-docker.log)" \
|
||||
"Keep ports open: 80/tcp, 443/tcp, 3478/udp."
|
||||
vm_finish "VM created. NetBird installation continues in the VM on first boot."
|
||||
Reference in new issue
Block a user