Replies: 1 comment 2 replies
-
|
var_dns_domain var_dns_server? im guessing var_gateway and var_ns? var_gpu_passthrough |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Defaults System Guide
🎯 Overview
The community-scripts for Proxmox VE feature a powerful three-tier defaults system that replaces the old config file approach with a more flexible, secure, and user-friendly configuration management system.
What You Can Do
✅ Save global defaults for all containers
✅ Create app-specific configurations that persist across deployments
✅ Override any setting via environment variables on-the-fly
✅ Automate container deployments with zero interaction
✅ Compare configurations before updating with built-in diff view
✅ Secure variable handling - no arbitrary code execution
✅ Whitelist validation - only allowed variables can be saved
Why Use This System?
source(security risk)Table of Contents
Quick Start
Your First Container (Interactive)
bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/debian.sh)"You'll see this menu:
What each option does:
Default Settings 🚀
Advanced Settings ⚙️
User Defaults 👤
/usr/local/community-scripts/default.varsApp Defaults 📱
/usr/local/community-scripts/defaults/pihole.varsSettings Menu 🛠️
Save Your First Defaults
Step-by-step walkthrough:
Run any script:
bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/pihole.sh)"Select "Advanced Settings"
Configure through the wizard:
Review summary:
At the end, you'll see:
Select "Yes" - Settings saved to
/usr/local/community-scripts/defaults/pihole.varsNext time: Run the script again → Select "App Defaults" → Instant deployment!
Interactive Workflow
Visual Guide
graph TD Start([Run Script]) --> SelectMode[Select Mode] SelectMode --> DefSet[Def. Set.] SelectMode --> AdvSet[Adv. Set.] SelectMode --> UserDef[User Def.] SelectMode --> AppDef[App Def.] SelectMode --> SetMenu[Set. Menu] AdvSet --> Wizard[19-Step Wizard with BACK] Wizard --> Summary[Show Summary] Summary --> Confirm{Confirm?} Confirm -- Yes --> CreateCT[Create CT] CreateCT --> SaveDefaults{Save Defaults?} SaveDefaults -- Yes --> FileExists{Check if file exists} FileExists -- No --> Save[Save] FileExists -- Yes --> ShowDiff[Show Diff] ShowDiff --> FileAction[Update/Keep/View]The 19-Step Advanced Configuration Wizard
Each step allows you to configure a specific aspect:
Navigation:
Understanding the Priority System
The system follows a clear hierarchy when determining values:
How It Works - Example
Scenario: Deploying a PiHole container
Built-in defaults (in pihole.sh script):
User global defaults (/usr/local/community-scripts/default.vars):
App defaults (/usr/local/community-scripts/defaults/pihole.vars):
Environment variable:
var_cpu=8 bash -c "$(curl .../pihole.sh)"Result:
Visual Example
Practical Examples
Example 1: Empty system
Example 2: Global defaults only
Example 3: App defaults override
Example 4: One-off override
Global User Defaults
Global defaults apply to all containers unless overridden by app-specific settings.
Location
Creating Global Defaults
Method 1: Automatic Creation
The file is automatically created on first script run with sensible defaults:
Method 2: Manual Creation
Example: Set Your Preferred Defaults
# Edit global defaults nano /usr/local/community-scripts/default.varsCommon Settings:
Now every container will use these values by default!
App-Specific Defaults
App defaults override global defaults for specific applications.
Location
Examples:
/usr/local/community-scripts/defaults/pihole.vars/usr/local/community-scripts/defaults/docker.vars/usr/local/community-scripts/defaults/homeassistant.varsCreating App Defaults
Method 1: Interactive (Recommended)
Run your desired app script:
bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/pihole.sh)"Select Advanced Settings
Configure all parameters:
When prompted: "Save as App Defaults for PiHole?"
Done! File saved to
/usr/local/community-scripts/defaults/pihole.varsMethod 2: Manual Creation
Updating Existing App Defaults
Environment Variable Overrides
Override any setting on-the-fly without changing saved defaults.
Basic Syntax
Single Override Examples
Override CPU:
var_cpu=8 bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/debian.sh)"Override Hostname:
var_hostname=myserver bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/debian.sh)"Override Network:
var_net=dhcp bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/docker.sh)"Multiple Overrides
var_cpu=4 var_ram=4096 var_disk=30 var_hostname=production-server \ bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/debian.sh)"Complete Override Example
var_unprivileged=1 \ var_cpu=6 \ var_ram=8192 \ var_disk=50 \ var_hostname=homeassistant-prod \ var_brg=vmbr1 \ var_net=dhcp \ var_ipv6_method=disable \ var_ssh=yes \ var_nesting=1 \ var_tags=production,ha,automation \ bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/homeassistant.sh)"Unattended Deployments
Fully automated container creation with zero interaction.
Method 1: Using App Defaults
Step 1: Create App Defaults (once)
Step 2: Automated Deployment
Method 2: Environment Variables Only
Make executable and run:
Method 3: Ansible Automation
Method 4: Batch Deployment Script
Advanced Use Cases
1. Development vs Production Environments
Development defaults:
# /usr/local/community-scripts/defaults/docker-dev.vars var_cpu=2 var_ram=2048 var_disk=20 var_hostname=docker-dev var_tags=development,testingProduction defaults:
# /usr/local/community-scripts/defaults/docker-prod.vars var_cpu=8 var_ram=16384 var_disk=100 var_hostname=docker-prod var_tags=production,critical var_protection=yesDeploy with:
2. Multi-Node Deployment with Different Networks
3. SSH Key Deployment
Single key:
Multiple keys in global defaults:
# /usr/local/community-scripts/default.vars var_ssh=yes var_ssh_authorized_key=ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQ... admin@workstation4. Storage Selection
Specify storage:
var_container_storage=local-zfs \ var_template_storage=local \ bash -c "$(curl -fsSL .../debian.sh)"5. IPv6 Configuration Options
6. Container Features
File Format & Syntax
Basic Rules
Example: Complete Default.vars File
Example: App-Specific Defaults
Syntax Validation
The system automatically validates:
$(...), backticks, semicolons)Rejected patterns:
Available Variables
🔧 Resources
var_cpuvar_cpu=4var_ramvar_ram=4096var_diskvar_disk=30var_unprivilegedvar_unprivileged=1🌐 Network Configuration
var_netdhcporstaticvar_net=dhcpvar_brgvar_brg=vmbr1var_gatewayvar_gateway=192.168.1.1var_ipv6_methodauto,dhcp,static,none,disablevar_ipv6_method=disablevar_vlanvar_vlan=100var_mtuvar_mtu=9000var_macvar_mac=02:00:00:00:00:01var_nsvar_ns=8.8.8.8🏷️ Identity & Metadata
var_hostnamevar_hostname=myservervar_pwvar_pw=SecurePass123!var_tagsvar_tags=production,web🔐 SSH Access
var_sshvar_ssh=yesvar_ssh_authorized_keyvar_ssh_authorized_key=ssh-rsa AAAA...⚙️ Container Features
var_nestingvar_nesting=1var_fusevar_fuse=1var_keyctlvar_keyctl=1var_mknodvar_mknod=1var_mount_fsvar_mount_fs=nfs,cifsvar_protectionvar_protection=yes🖥️ System Configuration
var_timezonevar_timezone=Europe/Berlinvar_verbosevar_verbose=yesvar_apt_cachervar_apt_cacher=yesvar_apt_cacher_ipvar_apt_cacher_ip=192.168.1.10💾 Storage Selection
var_container_storagevar_container_storage=local-zfsvar_template_storagevar_template_storage=localCommon mistakes:
Migration from Config File
What Changed?
/opt/community-scripts/.settings/usr/local/community-scripts/default.vars+ app-specific filesCT_ID=100var_ctidENV override)var_os=debian+var_version=12CT_TYPE=1var_unprivileged=1PW=passwordvar_pw=passwordHN=hostnamevar_hostname=hostnameDISK_SIZE=25var_disk=25CORE_COUNT=4var_cpu=4RAM_SIZE=4096var_ram=4096BRG=vmbr0var_brg=vmbr0NET=192.168.0.1/24var_net=static(IP configured in advanced settings)GATE=192.168.0.254var_gateway=192.168.0.254APT_CACHER_IP=192.168.0.2var_apt_cacher=yes+var_apt_cacher_ip=192.168.0.2DISABLEIP6=yesvar_ipv6_method=disableMTU=1500var_mtu=1500SD=example.comNS=192.168.0.100var_ns=192.168.0.100MAC=00:00:00:00:00:00var_mac=00:00:00:00:00:00VLAN=100var_vlan=100TAGS=dev;testingvar_tags=dev,testing(comma-separated now)SSH=yesvar_ssh=yesSSH_AUTHORIZED_KEY=keyvar_ssh_authorized_key=keyVERB=yesvar_verbose=yesConverting Your Old Config
Old config file:
New default.vars:
# /usr/local/community-scripts/default.vars var_disk=25 var_cpu=4 var_ram=4500 var_hostname=TEST var_brg=vmbr1 var_net=static var_gateway=10.10.10.254 var_vlan=100 var_ssh=yes var_tags=dev,testing var_ssh_authorized_key=ssh-rsa AAAA...Key Improvements
✅ No more manual file path entry - Standard location
✅ Per-app configurations - Different settings per application
✅ Environment variable overrides - One-off changes without editing files
✅ Diff view - See what changes before updating
✅ Validation - Prevents invalid values
✅ No code execution - Secure parsing instead of
sourceSecurity Features
Why the New System is More Secure
1. No Source/Eval
Old system (dangerous):
New system (safe):
2. Variable Whitelisting
Only explicitly allowed variables can be saved:
Attempt to save unlisted variable:
3. Value Sanitization
All values are checked for dangerous patterns:
Examples:
4. File Permissions
Defaults files are readable only by root:
5. Safe Defaults
Secure by default:
Troubleshooting
Issue: Defaults Not Loading
Check if file exists:
Verify syntax:
cat /usr/local/community-scripts/default.vars # Look for syntax errors (spaces around =, special characters)Fix permissions:
Issue: Variable Not Applied
Check variable name:
var_Check syntax:
Issue: App Defaults Not Found
List available app defaults:
Create directory if missing:
Issue: Environment Variable Not Overriding
Check priority:
Environment variables have highest priority and should always override.
Verify syntax:
Debug Mode
Enable verbose output:
var_verbose=yes bash -c "$(curl -fsSL .../debian.sh)"This shows:
Best Practices
Start with Global Defaults
Use App Defaults for Repeat Deployments
Use Environment Variables for Overrides
Version Control Your Defaults
# Backup defaults tar -czf defaults-backup.tar.gz /usr/local/community-scripts/Document Custom Configurations
Test Before Production
Use Protection for Critical Containers
var_protection=yes # Prevents accidental deletionExamples Repository
Minimal Container
var_cpu=1 var_ram=512 var_disk=4 \ bash -c "$(curl -fsSL .../debian.sh)"High-Performance Container
var_cpu=16 var_ram=32768 var_disk=200 var_unprivileged=0 \ bash -c "$(curl -fsSL .../debian.sh)"Secure Web Server
Development Environment
var_hostname=dev-environment \ var_cpu=4 \ var_ram=8192 \ var_nesting=1 \ var_fuse=1 \ var_tags=development,testing \ bash -c "$(curl -fsSL .../docker.sh)"Beta Was this translation helpful? Give feedback.
All reactions