mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-06-20 14:31:18 +02:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 67ab393789 |
@@ -0,0 +1,6 @@
|
||||
____ __
|
||||
/ __ \/ /___ _____ ___
|
||||
/ /_/ / / __ `/ __ \/ _ \
|
||||
/ ____/ / /_/ / / / / __/
|
||||
/_/ /_/\__,_/_/ /_/\___/
|
||||
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
#!/usr/bin/env bash
|
||||
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
|
||||
# Copyright (c) 2021-2026 community-scripts ORG
|
||||
# Author: onionrings29
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://plane.so | GitHub: https://github.com/makeplane/plane
|
||||
|
||||
APP="Plane"
|
||||
var_tags="${var_tags:-project-management}"
|
||||
var_cpu="${var_cpu:-4}"
|
||||
var_ram="${var_ram:-6144}"
|
||||
var_disk="${var_disk:-8}"
|
||||
var_os="${var_os:-debian}"
|
||||
var_version="${var_version:-13}"
|
||||
var_arm64="${var_arm64:-no}"
|
||||
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/plane ]]; then
|
||||
msg_error "No Plane Installation Found!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if check_for_gh_release "plane" "makeplane/plane"; then
|
||||
msg_info "Stopping Services"
|
||||
systemctl stop plane-api plane-worker plane-beat plane-live plane-space
|
||||
msg_ok "Stopped Services"
|
||||
|
||||
create_backup /opt/plane/.env \
|
||||
/opt/plane/apps/admin/.env \
|
||||
/opt/plane/apps/api/.env \
|
||||
/opt/plane/apps/space/.env \
|
||||
/opt/plane/apps/web/.env
|
||||
|
||||
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "plane" "makeplane/plane" "tarball"
|
||||
|
||||
restore_backup
|
||||
|
||||
msg_info "Rebuilding Frontend (Patience)"
|
||||
cd /opt/plane
|
||||
export NODE_OPTIONS="--max-old-space-size=4096"
|
||||
export COREPACK_ENABLE_DOWNLOAD_PROMPT=0
|
||||
$STD corepack enable pnpm
|
||||
$STD pnpm install --frozen-lockfile
|
||||
$STD pnpm turbo run build --filter=web --filter=admin --filter=space --filter=live
|
||||
msg_ok "Rebuilt Frontend"
|
||||
|
||||
msg_info "Updating Python Dependencies"
|
||||
cd /opt/plane/apps/api
|
||||
export VIRTUAL_ENV=/opt/plane-venv
|
||||
$STD uv pip install --upgrade -r requirements/production.txt
|
||||
msg_ok "Updated Python Dependencies"
|
||||
|
||||
msg_info "Running Migrations"
|
||||
cd /opt/plane/apps/api
|
||||
set -a
|
||||
source /opt/plane/apps/api/.env
|
||||
set +a
|
||||
$STD /opt/plane-venv/bin/python manage.py migrate
|
||||
$STD /opt/plane-venv/bin/python manage.py collectstatic --noinput
|
||||
$STD /opt/plane-venv/bin/python manage.py configure_instance
|
||||
msg_ok "Ran Migrations"
|
||||
|
||||
msg_info "Starting Services"
|
||||
systemctl start plane-api plane-worker plane-beat plane-live plane-space
|
||||
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 "${TAB}${GATEWAY}${BGN}http://${IP}${CL}"
|
||||
@@ -0,0 +1,386 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2026 community-scripts ORG
|
||||
# Author: onionrings29
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://plane.so
|
||||
|
||||
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 \
|
||||
build-essential \
|
||||
libpq-dev \
|
||||
libxml2-dev \
|
||||
libxslt1-dev \
|
||||
libxmlsec1-dev \
|
||||
libxmlsec1-openssl \
|
||||
pkg-config \
|
||||
python3-dev \
|
||||
python3-venv \
|
||||
redis-server \
|
||||
erlang-base \
|
||||
erlang-{asn1,crypto,eldap,ftp,inets,mnesia,os-mon,parsetools} \
|
||||
erlang-{public-key,runtime-tools,snmp,ssl,syntax-tools,tftp,tools,xmerl} \
|
||||
rabbitmq-server
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
NODE_VERSION="24" setup_nodejs
|
||||
PG_VERSION="16" setup_postgresql
|
||||
PG_DB_NAME="plane" PG_DB_USER="plane" setup_postgresql_db
|
||||
|
||||
msg_info "Configuring RabbitMQ"
|
||||
RABBITMQ_PASS=$(openssl rand -base64 24 | tr -dc 'a-zA-Z0-9' | head -c16)
|
||||
$STD rabbitmqctl add_vhost plane
|
||||
$STD rabbitmqctl add_user plane "${RABBITMQ_PASS}"
|
||||
$STD rabbitmqctl set_permissions -p plane plane ".*" ".*" ".*"
|
||||
msg_ok "Configured RabbitMQ"
|
||||
|
||||
msg_info "Installing MinIO"
|
||||
curl -fsSL https://dl.min.io/server/minio/release/linux-amd64/minio -o /usr/local/bin/minio
|
||||
chmod +x /usr/local/bin/minio
|
||||
mkdir -p /opt/minio/data
|
||||
MINIO_ACCESS_KEY=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c16)
|
||||
MINIO_SECRET_KEY=$(openssl rand -base64 36 | tr -dc 'a-zA-Z0-9' | head -c32)
|
||||
cat <<EOF >/etc/default/minio
|
||||
MINIO_ROOT_USER="${MINIO_ACCESS_KEY}"
|
||||
MINIO_ROOT_PASSWORD="${MINIO_SECRET_KEY}"
|
||||
MINIO_VOLUMES="/opt/minio/data"
|
||||
EOF
|
||||
cat <<EOF >/etc/systemd/system/minio.service
|
||||
[Unit]
|
||||
Description=MinIO Object Storage
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
EnvironmentFile=/etc/default/minio
|
||||
ExecStart=/usr/local/bin/minio server \$MINIO_VOLUMES --console-address ":9090"
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl enable -q --now minio
|
||||
msg_ok "Installed MinIO"
|
||||
|
||||
fetch_and_deploy_gh_release "plane" "makeplane/plane" "tarball"
|
||||
|
||||
msg_info "Building Frontend Apps (Patience)"
|
||||
cd /opt/plane
|
||||
FRONTEND_ENV="VITE_API_BASE_URL=http://${LOCAL_IP}
|
||||
VITE_WEB_BASE_URL=http://${LOCAL_IP}
|
||||
VITE_ADMIN_BASE_URL=http://${LOCAL_IP}
|
||||
VITE_ADMIN_BASE_PATH=/god-mode
|
||||
VITE_SPACE_BASE_URL=http://${LOCAL_IP}
|
||||
VITE_SPACE_BASE_PATH=/spaces
|
||||
VITE_LIVE_BASE_URL=http://${LOCAL_IP}
|
||||
VITE_LIVE_BASE_PATH=/live"
|
||||
# Each Vite app needs its own .env for the build
|
||||
for app in web admin space; do
|
||||
echo "$FRONTEND_ENV" >/opt/plane/apps/${app}/.env
|
||||
done
|
||||
export NODE_OPTIONS="--max-old-space-size=4096"
|
||||
export COREPACK_ENABLE_DOWNLOAD_PROMPT=0
|
||||
$STD corepack enable pnpm
|
||||
$STD pnpm install --frozen-lockfile
|
||||
$STD pnpm turbo run build --filter=web --filter=admin --filter=space --filter=live
|
||||
msg_ok "Built Frontend Apps"
|
||||
|
||||
msg_info "Setting up Python API"
|
||||
setup_uv
|
||||
$STD uv venv /opt/plane-venv
|
||||
export VIRTUAL_ENV=/opt/plane-venv
|
||||
$STD uv pip install -r /opt/plane/apps/api/requirements/production.txt
|
||||
msg_ok "Set up Python API"
|
||||
|
||||
msg_info "Configuring Plane"
|
||||
SECRET_KEY=$(openssl rand -hex 32)
|
||||
MACHINE_SIG=$(echo -n "$(hostname)-$(date +%s)" | sha256sum | head -c64)
|
||||
LIVE_SECRET=$(openssl rand -hex 16)
|
||||
cat <<EOF >/opt/plane/apps/api/.env
|
||||
DEBUG=0
|
||||
CORS_ALLOWED_ORIGINS=http://${LOCAL_IP}
|
||||
|
||||
POSTGRES_USER=plane
|
||||
POSTGRES_PASSWORD=${PG_DB_PASS}
|
||||
POSTGRES_HOST=localhost
|
||||
POSTGRES_DB=plane
|
||||
POSTGRES_PORT=5432
|
||||
DATABASE_URL=postgresql://plane:${PG_DB_PASS}@localhost:5432/plane
|
||||
|
||||
REDIS_HOST=localhost
|
||||
REDIS_PORT=6379
|
||||
REDIS_URL=redis://localhost:6379/
|
||||
|
||||
RABBITMQ_HOST=localhost
|
||||
RABBITMQ_PORT=5672
|
||||
RABBITMQ_USER=plane
|
||||
RABBITMQ_PASSWORD=${RABBITMQ_PASS}
|
||||
RABBITMQ_VHOST=plane
|
||||
AMQP_URL=amqp://plane:${RABBITMQ_PASS}@localhost:5672/plane
|
||||
|
||||
AWS_REGION=us-east-1
|
||||
AWS_ACCESS_KEY_ID=${MINIO_ACCESS_KEY}
|
||||
AWS_SECRET_ACCESS_KEY=${MINIO_SECRET_KEY}
|
||||
AWS_S3_ENDPOINT_URL=http://localhost:9000
|
||||
AWS_S3_BUCKET_NAME=uploads
|
||||
FILE_SIZE_LIMIT=104857600
|
||||
|
||||
USE_MINIO=1
|
||||
MINIO_ENDPOINT_SSL=0
|
||||
SECRET_KEY=${SECRET_KEY}
|
||||
MACHINE_SIGNATURE=${MACHINE_SIG}
|
||||
|
||||
WEB_URL=http://${LOCAL_IP}
|
||||
ADMIN_BASE_URL=http://${LOCAL_IP}
|
||||
ADMIN_BASE_PATH=/god-mode
|
||||
SPACE_BASE_URL=http://${LOCAL_IP}
|
||||
SPACE_BASE_PATH=/spaces
|
||||
APP_BASE_URL=http://${LOCAL_IP}
|
||||
APP_BASE_PATH=
|
||||
LIVE_BASE_URL=http://${LOCAL_IP}
|
||||
LIVE_BASE_PATH=/live
|
||||
|
||||
GUNICORN_WORKERS=2
|
||||
LIVE_SERVER_SECRET_KEY=${LIVE_SECRET}
|
||||
API_KEY_RATE_LIMIT=60/minute
|
||||
EOF
|
||||
cat <<EOF >/opt/plane/.env
|
||||
API_BASE_URL=http://localhost:8000
|
||||
LIVE_SERVER_SECRET_KEY=${LIVE_SECRET}
|
||||
REDIS_HOST=localhost
|
||||
REDIS_PORT=6379
|
||||
REDIS_URL=redis://localhost:6379/
|
||||
PORT=3100
|
||||
EOF
|
||||
msg_ok "Configured Plane"
|
||||
|
||||
msg_info "Running Database Migrations"
|
||||
cd /opt/plane/apps/api
|
||||
set -a
|
||||
source /opt/plane/apps/api/.env
|
||||
set +a
|
||||
$STD /opt/plane-venv/bin/python manage.py migrate
|
||||
$STD /opt/plane-venv/bin/python manage.py collectstatic --noinput
|
||||
$STD /opt/plane-venv/bin/python manage.py configure_instance
|
||||
$STD /opt/plane-venv/bin/python manage.py register_instance "${MACHINE_SIG}"
|
||||
msg_ok "Ran Database Migrations"
|
||||
|
||||
msg_info "Creating Services and MinIO Bucket"
|
||||
curl -fsSL https://dl.min.io/client/mc/release/linux-amd64/mc -o /usr/local/bin/mcli
|
||||
chmod +x /usr/local/bin/mcli
|
||||
$STD /usr/local/bin/mcli alias set plane http://localhost:9000 "${MINIO_ACCESS_KEY}" "${MINIO_SECRET_KEY}"
|
||||
$STD /usr/local/bin/mcli mb plane/uploads --ignore-existing
|
||||
$STD /usr/local/bin/mcli anonymous set download plane/uploads
|
||||
|
||||
cat <<EOF >/etc/systemd/system/plane-api.service
|
||||
[Unit]
|
||||
Description=Plane API
|
||||
After=network.target postgresql.service redis-server.service rabbitmq-server.service minio.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
WorkingDirectory=/opt/plane/apps/api
|
||||
EnvironmentFile=/opt/plane/apps/api/.env
|
||||
ExecStart=/opt/plane-venv/bin/gunicorn -w 2 -k uvicorn.workers.UvicornWorker plane.asgi:application --bind 0.0.0.0:8000 --max-requests 1200 --max-requests-jitter 1000 --access-logfile -
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
cat <<EOF >/etc/systemd/system/plane-worker.service
|
||||
[Unit]
|
||||
Description=Plane Celery Worker
|
||||
After=plane-api.service
|
||||
Requires=plane-api.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
WorkingDirectory=/opt/plane/apps/api
|
||||
EnvironmentFile=/opt/plane/apps/api/.env
|
||||
ExecStart=/opt/plane-venv/bin/celery -A plane worker -l info
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
cat <<EOF >/etc/systemd/system/plane-beat.service
|
||||
[Unit]
|
||||
Description=Plane Celery Beat
|
||||
After=plane-api.service
|
||||
Requires=plane-api.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
WorkingDirectory=/opt/plane/apps/api
|
||||
EnvironmentFile=/opt/plane/apps/api/.env
|
||||
ExecStart=/opt/plane-venv/bin/celery -A plane beat -l info
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
cat <<EOF >/etc/systemd/system/plane-live.service
|
||||
[Unit]
|
||||
Description=Plane Live Server
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
WorkingDirectory=/opt/plane
|
||||
EnvironmentFile=/opt/plane/.env
|
||||
ExecStart=/usr/bin/node apps/live/dist/start.mjs
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
cat <<EOF >/etc/systemd/system/plane-space.service
|
||||
[Unit]
|
||||
Description=Plane Space Server
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
WorkingDirectory=/opt/plane/apps/space
|
||||
Environment=PORT=3002
|
||||
Environment=NODE_ENV=production
|
||||
ExecStart=/opt/plane/apps/space/node_modules/.bin/react-router-serve ./build/server/index.js
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl daemon-reload
|
||||
systemctl enable -q --now plane-api plane-worker plane-beat plane-live plane-space
|
||||
{
|
||||
echo "RabbitMQ User: plane"
|
||||
echo "RabbitMQ Password: ${RABBITMQ_PASS}"
|
||||
echo "MinIO Access Key: ${MINIO_ACCESS_KEY}"
|
||||
echo "MinIO Secret Key: ${MINIO_SECRET_KEY}"
|
||||
echo "Secret Key: ${SECRET_KEY}"
|
||||
echo "Config: /opt/plane/apps/api/.env"
|
||||
} >>~/plane.creds
|
||||
msg_ok "Created Services and MinIO Bucket"
|
||||
|
||||
msg_info "Configuring Nginx"
|
||||
cat <<'EOF' >/etc/nginx/sites-available/plane.conf
|
||||
upstream plane-api {
|
||||
server 127.0.0.1:8000;
|
||||
}
|
||||
|
||||
upstream plane-live {
|
||||
server 127.0.0.1:3100;
|
||||
}
|
||||
|
||||
upstream plane-space {
|
||||
server 127.0.0.1:3002;
|
||||
}
|
||||
|
||||
upstream plane-minio {
|
||||
server 127.0.0.1:9000;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80 default_server;
|
||||
server_name _;
|
||||
client_max_body_size 100M;
|
||||
|
||||
location /api/ {
|
||||
proxy_pass http://plane-api;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
location /auth/ {
|
||||
proxy_pass http://plane-api;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
location /static/ {
|
||||
alias /opt/plane/apps/api/plane/static-assets/collected-static/;
|
||||
}
|
||||
|
||||
location /live/ {
|
||||
proxy_pass http://plane-live;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
location = /uploads {
|
||||
proxy_pass http://plane-minio;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
|
||||
location /uploads/ {
|
||||
proxy_pass http://plane-minio;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
|
||||
location /spaces/ {
|
||||
proxy_pass http://plane-space;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
location /spaces {
|
||||
return 301 /spaces/;
|
||||
}
|
||||
|
||||
location /god-mode/ {
|
||||
alias /opt/plane/apps/admin/build/client/;
|
||||
try_files $uri $uri/ /god-mode/index.html;
|
||||
}
|
||||
|
||||
location /god-mode {
|
||||
return 301 /god-mode/;
|
||||
}
|
||||
|
||||
location / {
|
||||
root /opt/plane/apps/web/build/client;
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
}
|
||||
EOF
|
||||
ln -sf /etc/nginx/sites-available/plane.conf /etc/nginx/sites-enabled/plane.conf
|
||||
rm -f /etc/nginx/sites-enabled/default
|
||||
$STD systemctl reload nginx
|
||||
msg_ok "Configured Nginx"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
cleanup_lxc
|
||||
+5
-100
@@ -1075,7 +1075,7 @@ load_vars_file() {
|
||||
var_gateway var_hostname var_ipv6_method var_mac var_mknod var_mount_fs var_mtu
|
||||
var_net var_nesting var_ns var_os var_protection var_pw var_ram var_tags var_timezone var_tun var_unprivileged
|
||||
var_verbose var_version var_vlan var_ssh var_ssh_authorized_key var_container_storage var_template_storage var_searchdomain
|
||||
var_post_install var_vzdump_after_install var_vzdump_storage
|
||||
var_post_install
|
||||
)
|
||||
|
||||
# Whitelist check helper
|
||||
@@ -1250,20 +1250,6 @@ load_vars_file() {
|
||||
continue
|
||||
fi
|
||||
;;
|
||||
var_vzdump_after_install)
|
||||
if [[ "$var_val" != "yes" && "$var_val" != "no" ]]; then
|
||||
msg_warn "Invalid vzdump_after_install '$var_val' in $file (must be yes/no), ignoring"
|
||||
continue
|
||||
fi
|
||||
;;
|
||||
var_vzdump_storage)
|
||||
local _vz_storage_status
|
||||
_vz_storage_status=$(pvesm status 2>/dev/null | awk -v s="$var_val" '$1 == s { print $3 }')
|
||||
if [[ -n "$var_val" && -z "$_vz_storage_status" ]]; then
|
||||
msg_warn "Storage '$var_val' from $file not found on this node, ignoring"
|
||||
continue
|
||||
fi
|
||||
;;
|
||||
var_container_storage | var_template_storage)
|
||||
# Validate that the storage exists and is active on the current node
|
||||
local _storage_status
|
||||
@@ -1307,7 +1293,7 @@ default_var_settings() {
|
||||
var_gateway var_hostname var_ipv6_method var_mac var_mknod var_mount_fs var_mtu
|
||||
var_net var_nesting var_ns var_os var_protection var_pw var_ram var_tags var_timezone var_tun var_unprivileged
|
||||
var_verbose var_version var_vlan var_ssh var_ssh_authorized_key var_container_storage var_template_storage
|
||||
var_post_install var_vzdump_after_install var_vzdump_storage
|
||||
var_post_install
|
||||
)
|
||||
|
||||
# Snapshot: environment variables (highest precedence)
|
||||
@@ -1408,10 +1394,6 @@ var_verbose=no
|
||||
# Runs ON THE HOST after the container is fully provisioned.
|
||||
# Available env vars: APP, NSAPP, CTID, IP, HN, STORAGE, BRG
|
||||
# var_post_install=/opt/post-install/myhook.sh
|
||||
|
||||
# Optional vzdump backup after successful install (Proxmox host)
|
||||
# var_vzdump_after_install=yes
|
||||
# var_vzdump_storage=local
|
||||
EOF
|
||||
|
||||
# Now choose storages (always prompt unless just one exists)
|
||||
@@ -1490,7 +1472,7 @@ if ! declare -p VAR_WHITELIST >/dev/null 2>&1; then
|
||||
var_gateway var_hostname var_ipv6_method var_mac var_mknod var_mount_fs var_mtu
|
||||
var_net var_nesting var_ns var_os var_protection var_pw var_ram var_tags var_timezone var_tun var_unprivileged
|
||||
var_verbose var_version var_vlan var_ssh var_ssh_authorized_key var_container_storage var_template_storage var_searchdomain
|
||||
var_post_install var_vzdump_after_install var_vzdump_storage
|
||||
var_post_install
|
||||
)
|
||||
fi
|
||||
|
||||
@@ -1704,8 +1686,6 @@ _build_current_app_vars_tmp() {
|
||||
[ -n "$_tpl_storage" ] && echo "var_template_storage=$(_sanitize_value "$_tpl_storage")"
|
||||
[ -n "$_ct_storage" ] && echo "var_container_storage=$(_sanitize_value "$_ct_storage")"
|
||||
[ -n "${var_post_install:-}" ] && echo "var_post_install=$(_sanitize_value "${var_post_install}")"
|
||||
[ -n "${var_vzdump_after_install:-}" ] && echo "var_vzdump_after_install=$(_sanitize_value "${var_vzdump_after_install}")"
|
||||
[ -n "${var_vzdump_storage:-}" ] && echo "var_vzdump_storage=$(_sanitize_value "${var_vzdump_storage}")"
|
||||
} >"$tmpf"
|
||||
|
||||
echo "$tmpf"
|
||||
@@ -1850,7 +1830,7 @@ advanced_settings() {
|
||||
TAGS="community-script${var_tags:+;${var_tags}}"
|
||||
fi
|
||||
local STEP=1
|
||||
local MAX_STEP=30
|
||||
local MAX_STEP=29
|
||||
|
||||
# Store values for back navigation - inherit from var_* app defaults
|
||||
local _ct_type="${var_unprivileged:-1}"
|
||||
@@ -1885,8 +1865,6 @@ advanced_settings() {
|
||||
local _mount_fs="${var_mount_fs:-}"
|
||||
local _protect_ct="${var_protection:-no}"
|
||||
local _post_install="${var_post_install:-}"
|
||||
local _vzdump="${var_vzdump_after_install:-no}"
|
||||
local _vzdump_storage="${var_vzdump_storage:-}"
|
||||
|
||||
# Detect host timezone for default (if not set via var_timezone)
|
||||
local _host_timezone=""
|
||||
@@ -2796,58 +2774,9 @@ Leave empty to skip."
|
||||
;;
|
||||
|
||||
# ═══════════════════════════════════════════════════════════════════════════
|
||||
# STEP 29: Optional vzdump backup after install
|
||||
# STEP 29: Verbose Mode & Confirmation
|
||||
# ═══════════════════════════════════════════════════════════════════════════
|
||||
29)
|
||||
local vzdump_default_flag="--defaultno"
|
||||
[[ "$_vzdump" == "yes" ]] && vzdump_default_flag=""
|
||||
|
||||
if whiptail --backtitle "Proxmox VE Helper Scripts [Step $STEP/$MAX_STEP]" \
|
||||
--title "POST-INSTALL VZDUMP" \
|
||||
--ok-button "Next" --cancel-button "Back" \
|
||||
$vzdump_default_flag \
|
||||
--yesno "\nCreate a vzdump backup after successful install?\n\nRuns on the Proxmox host once the container is ready.\n\n(App default: ${var_vzdump_after_install:-no})" 14 62; then
|
||||
_vzdump="yes"
|
||||
local _storages _menu_items=() _s
|
||||
_storages=$(awk '
|
||||
/^[a-z]+:/ { if (name != "") { if (has_backup || (!has_content && type == "dir")) print name }
|
||||
split($0,a,":"); type=a[1]; name=a[2]; gsub(/^[ \t]+|[ \t]+$/, "", name); has_content=0; has_backup=0 }
|
||||
/^[ \t]*content/ { has_content=1; if ($0 ~ /backup/) has_backup=1 }
|
||||
END { if (name != "") { if (has_backup || (!has_content && type == "dir")) print name } }
|
||||
' /etc/pve/storage.cfg 2>/dev/null)
|
||||
if [[ -n "$_storages" ]]; then
|
||||
while IFS= read -r _s; do
|
||||
[[ -n "$_s" ]] && _menu_items+=("$_s" " ")
|
||||
done <<<"$_storages"
|
||||
if result=$(whiptail --backtitle "Proxmox VE Helper Scripts [Step $STEP/$MAX_STEP]" \
|
||||
--title "VZDUMP STORAGE" \
|
||||
--ok-button "Next" --cancel-button "Back" \
|
||||
--menu "\nSelect backup storage:" 16 58 8 \
|
||||
"${_menu_items[@]}" \
|
||||
3>&1 1>&2 2>&3); then
|
||||
_vzdump_storage="$result"
|
||||
fi
|
||||
else
|
||||
whiptail --msgbox "No backup-capable storage found.\n\nConfigure storage with 'backup' content in Proxmox first." 10 58
|
||||
_vzdump="no"
|
||||
_vzdump_storage=""
|
||||
fi
|
||||
else
|
||||
if [ $? -eq 1 ]; then
|
||||
_vzdump="no"
|
||||
_vzdump_storage=""
|
||||
else
|
||||
((STEP--))
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
((STEP++))
|
||||
;;
|
||||
|
||||
# ═══════════════════════════════════════════════════════════════════════════
|
||||
# STEP 30: Verbose Mode & Confirmation
|
||||
# ═══════════════════════════════════════════════════════════════════════════
|
||||
30)
|
||||
local verbose_default_flag="--defaultno"
|
||||
[[ "$_verbose" == "yes" ]] && verbose_default_flag=""
|
||||
|
||||
@@ -2949,8 +2878,6 @@ Advanced:
|
||||
APT_CACHER_IP="$_apt_cacher_ip"
|
||||
VERBOSE="$_verbose"
|
||||
var_post_install="$_post_install"
|
||||
var_vzdump_after_install="$_vzdump"
|
||||
var_vzdump_storage="$_vzdump_storage"
|
||||
|
||||
# Update var_* based on user choice (for functions that check these)
|
||||
var_gpu="$_enable_gpu"
|
||||
@@ -6658,26 +6585,6 @@ create_lxc_container() {
|
||||
# SECTION 9: POST-INSTALLATION & FINALIZATION
|
||||
# ==============================================================================
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# _run_post_install_vzdump()
|
||||
#
|
||||
# - Optional vzdump on the Proxmox host after a successful install
|
||||
# - Controlled by var_vzdump_after_install / var_vzdump_storage
|
||||
# ------------------------------------------------------------------------------
|
||||
_run_post_install_vzdump() {
|
||||
[[ "${var_vzdump_after_install:-no}" != "yes" ]] && return 0
|
||||
[[ -z "${CTID:-}" ]] && return 0
|
||||
|
||||
local storage="${var_vzdump_storage:-${CONTAINER_STORAGE:-local}}"
|
||||
msg_info "Creating post-install vzdump backup (CT ${CTID} → ${storage})"
|
||||
if vzdump "$CTID" --mode snapshot --compress zstd --storage "$storage" \
|
||||
--notes-template "community-scripts post-install - ${APP:-LXC}" >>"${BUILD_LOG:-/dev/null}" 2>&1; then
|
||||
msg_ok "Post-install vzdump created on ${storage}"
|
||||
else
|
||||
msg_warn "Post-install vzdump failed (storage: ${storage})"
|
||||
fi
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# description()
|
||||
#
|
||||
@@ -6776,8 +6683,6 @@ EOF
|
||||
fi
|
||||
fi
|
||||
|
||||
_run_post_install_vzdump
|
||||
|
||||
INSTALL_COMPLETE=true
|
||||
post_update_to_api "done" "none"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user