* Enhance setup-fork.sh with --full mode and misc/ targeting Added a new --full flag to setup-fork.sh to allow updating all files, not just those in misc/. Updated documentation and usage examples to clarify the new behavior. Improved file search and replacement logic for broader compatibility and flexibility. * add AI.md * fix links in AI.md * Update contribution docs and templates for best practices Refreshed AI.md with new reference scripts, expanded checklist, and improved AI assistant tips. Updated container and install script templates for modern defaults (Debian 13, larger disk, two tags), clarified helper function usage, and improved update/backup patterns. Enhanced JSON template with realistic metadata, new fields, and example notes. * Update fetch_and_deploy_gh_release usage in docs and templates Standardize the usage of fetch_and_deploy_gh_release by specifying all arguments, including mode, version, and target directory, in AI.md and template scripts. This clarifies the function's usage and ensures consistency across documentation and install/update templates. * Revise contribution docs and update CT template Expanded and clarified contribution documentation for forking, local development, cherry-picking, and AI-assisted code generation. Improved explanations for setup-fork.sh, local testing, and PR submission. Enhanced the container script template with detailed comments, clearer update_script structure, and step-by-step guidance for maintainers and contributors. * Update fork and release instructions in contribution docs Replaced placeholder GitHub repo references with 'YourUsername/YourRepo' throughout documentation for clarity. Expanded explanations in FORK_SETUP.md and README.md to clarify the difference between development and production script execution, and emphasized the importance of cherry-picking only relevant files for PRs. Updated install script template examples to use the new repo placeholder. * Update GitHub repo placeholders in docs and templates Replaced 'YourUsername/YourRepo' with 'owner/repo' in documentation and template scripts for consistency and clarity. This change standardizes example usage and reduces confusion for contributors. * Move user submitted guides to guides directory Renamed USER_SUBMITTED_GUIDES.md from docs/contribution to docs/guides for improved documentation organization. * Update contribution docs for improved workflow and clarity Revised multiple documentation files to clarify the recommended development workflow: contributors must test scripts via curl from their GitHub fork (not local bash), use setup-fork.sh for URL rewriting, and submit only new files using cherry-pick. Expanded and modernized install and JSON metadata template guides, emphasizing use of helper functions, resource requirements, and the JSON generator tool. Added detailed step-by-step instructions, best practices, and updated examples throughout. * Update contribution docs for new file structure Updated documentation to reflect the migration of install scripts from install_scripts/ to install/, and JSON metadata from config/ to frontend/public/json/. Adjusted all relevant paths, instructions, and examples to match the new directory structure for improved clarity and consistency. * Update contribution docs for fork setup and metadata Revised documentation to standardize use of 'bash docs/contribution/setup-fork.sh --full' for fork configuration, clarified install script execution flow, and updated JSON metadata template and field references. Improved helper function docs, resource requirements, and category lists. Updated references and instructions throughout for consistency and accuracy. * Docs: add GPU/TUN, update endpoints & tool refs Documentation updates across guides and function references: - Added var_gpu and var_tun configuration entries to CONFIGURATION_REFERENCE (GPU passthrough and TUN/TAP support), including features and prerequisites. - Fixed repository URLs throughout UNATTENDED_DEPLOYMENTS and examples: replaced community-scripts/ProxmoxVED with community-scripts/ProxmoxVE and updated curl usage to the new paths. - Added an "Advanced Configuration Variables" table and examples (var_os, var_version, var_gpu, var_tun, var_nesting) to UNATTENDED_DEPLOYMENTS; adjusted sample apps, hostnames, and container mappings in batch examples. - Switched API endpoints in API_FUNCTIONS_REFERENCE and API_USAGE_EXAMPLES from http://api.community-scripts.org to https://api.community-scripts.org. - Expanded BUILD_FUNC_FUNCTIONS_REFERENCE with container resource/ID management helper descriptions (validate_container_id, get_valid_container_id, maxkeys_check, get_current_ip, update_motd_ip). - Large edits to TOOLS_FUNC_FUNCTIONS_REFERENCE: renamed/refactored helper signatures and docs (pkg_install -> install_packages_with_retry, pkg_update -> upgrade_packages_with_retry), added new tooling functions (fetch_and_deploy_gh_release, check_for_gh_release, prepare_repository_setup, verify_tool_version) and updated examples and feature notes. - Updated vm/README.md to list additional VM scripts (new and reorganized examples). These are documentation-only changes to clarify configuration options, correct links and endpoints, and expand the reference material for tooling and build helpers. * Docs: expand developer/debugging and tools references Add extensive documentation and examples across contribution, guides, templates and tools references. Key changes: - Introduce a Developer Mode & Debugging section (dev_mode flags: trace, keep, pause, breakpoint, logs, dryrun, motd) in CONTRIBUTING.md with usage example. - Provide a standard update_script() pattern and BookStack example in GUIDE.md to clarify update flow (stop services, backup, deploy, restore, migrate, restart). - Add new helper entries (BookLore, KaraKeep) and advanced repository helpers (setup_deb822_repo, prepare_repository_setup, cleanup_tool_keyrings) plus utilities (setup_meilisearch, verify_tool_version) in HELPER_FUNCTIONS.md. - Update install template to suggest PNPM, Java 21 and Meilisearch; update example DB setup notes in AppName-install.sh. - Add var_diagnostics option and switch var_fuse to boolean/toggle wording in CONFIGURATION_REFERENCE.md; clarify privacy and defaults. - Adjust example container definitions in UNATTENDED_DEPLOYMENTS.md (container entries and resource values). - Change storage and flag variables and examples in BUILD_FUNC_USAGE_EXAMPLES.md (ssd-storage, var_fuse/var_tun, etc.). - Expand TOOLS_FUNC_FUNCTIONS_REFERENCE.md with many setup_* function signatures, environment vars, clarified fetch_and_deploy_gh_release modes/parameters, and additional tool docs (nodejs, php, mariadb_db, postgresql_db, java, uv, yq, meilisearch, composer, build tools). These updates improve onboarding, debugging guidance, and operational clarity for contributors and maintainers.
9.9 KiB
Install Scripts - Quick Reference
Warning
This is legacy documentation. Refer to the modern template at templates_install/AppName-install.sh for best practices.
Current templates use:
tools.funchelpers (setup_nodejs, setup_uv, setup_postgresql_db, etc.)- Automatic dependency installation via build.func
- Standardized environment variable patterns
Before Creating a Script
-
Copy the Modern Template:
cp templates_install/AppName-install.sh install/MyApp-install.sh # Edit install/MyApp-install.sh -
Key Pattern:
- CT scripts source build.func and call the install script
- Install scripts use sourced FUNCTIONS_FILE_PATH (via build.func)
- Both scripts work together in the container
-
Test via GitHub:
# Push your changes to your fork first git push origin feature/my-awesome-app # Test the CT script via curl (it will call the install script) bash -c "$(curl -fsSL https://raw.githubusercontent.com/YOUR_USERNAME/ProxmoxVE/main/ct/MyApp.sh)" # ⏱️ Wait 10-30 seconds after pushing - GitHub takes time to update
Template Structure
Header
#!/usr/bin/env bash
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/install.func)
# (setup-fork.sh modifies this URL to point to YOUR fork during development)
Dependencies (App-Specific Only)
# Don't add: ca-certificates, curl, gnupg, wget, git, jq
# These are handled by build.func
msg_info "Installing dependencies"
$STD apt-get install -y app-specific-deps
msg_ok "Installed dependencies"
Runtime Setup
Use tools.func helpers instead of manual installation:
# ✅ NEW (use tools.func):
NODE_VERSION="20"
setup_nodejs
# OR
PYTHON_VERSION="3.12"
setup_uv
# OR
PG_DB_NAME="myapp_db"
PG_DB_USER="myapp"
setup_postgresql_db
Service Configuration
# Create .env file
msg_info "Configuring MyApp"
cat << EOF > /opt/myapp/.env
DEBUG=false
PORT=8080
DATABASE_URL=postgresql://...
EOF
msg_ok "Configuration complete"
# Create systemd service
msg_info "Creating systemd service"
cat << EOF > /etc/systemd/system/myapp.service
[Unit]
Description=MyApp
[Service]
ExecStart=/usr/bin/node /opt/myapp/app.js
[Install]
WantedBy=multi-user.target
EOF
msg_ok "Service created"
Finalization
msg_info "Finalizing MyApp installation"
systemctl enable --now myapp
motd_ssh
customize
msg_ok "MyApp installation complete"
cleanup_lxc
Key Patterns
Avoid Manual Version Checking
❌ OLD (manual):
RELEASE=$(curl -fsSL https://api.github.com/repos/app/repo/releases/latest | grep tag_name)
wget https://github.com/app/repo/releases/download/$RELEASE/app.tar.gz
✅ NEW (use tools.func via CT script's fetch_and_deploy_gh_release):
# In CT script, not install script:
fetch_and_deploy_gh_release "myapp" "app/repo" "app.tar.gz" "latest" "/opt/myapp"
Database Setup
# Use setup_postgresql_db, setup_mysql_db, etc.
PG_DB_NAME="myapp"
PG_DB_USER="myapp"
setup_postgresql_db
Node.js Setup
NODE_VERSION="20"
setup_nodejs
npm install --no-save
Best Practices
-
Only add app-specific dependencies
- Don't add: ca-certificates, curl, gnupg, wget, git, jq
- These are handled by build.func
-
Use tools.func helpers
- setup_nodejs, setup_python, setup_uv, setup_postgresql_db, setup_mysql_db, etc.
-
Don't do version checks in install script
- Version checking happens in CT script's update_script()
- Install script just installs the latest
-
Structure:
- Dependencies
- Runtime setup (tools.func)
- Deployment (fetch from CT script)
- Configuration files
- Systemd service
- Finalization
Reference Scripts
See working examples:
Need Help?
- Modern Template - Start here
- CT Template - How CT scripts work
- README.md - Full contribution workflow
- AI.md - AI-generated script guidelines
1.2 Comments
- Add clear comments for script metadata, including author, copyright, and license information.
- Use meaningful inline comments to explain complex commands or logic.
Example:
# Copyright (c) 2021-2026 community-scripts ORG
# Author: [YourUserName]
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: [SOURCE_URL]
[!NOTE]:
- Add your username
- When updating/reworking scripts, add "| Co-Author [YourUserName]"
1.3 Variables and function import
- This sections adds the support for all needed functions and variables.
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
2. Variable naming and management
2.1 Naming conventions
- Use uppercase names for constants and environment variables.
- Use lowercase names for local script variables.
Example:
DB_NAME=snipeit_db # Environment-like variable (constant)
db_user="snipeit" # Local variable
3. Dependencies
3.1 Install all at once
- Install all dependencies with a single command if possible
Example:
$STD apt-get install -y \
curl \
composer \
git \
sudo \
mc \
nginx
3.2 Collapse dependencies
Collapse dependencies to keep the code readable.
Example: Use
php8.2-{bcmath,common,ctype}
instead of
php8.2-bcmath php8.2-common php8.2-ctype
4. Paths to application files
If possible install the app and all necessary files in /opt/
5. Version management
5.1 Install the latest release
- Always try and install the latest release
- Do not hardcode any version if not absolutely necessary
Example for a git release:
RELEASE=$(curl -fsSL https://api.github.com/repos/snipe/snipe-it/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
curl -fsSL "https://github.com/snipe/snipe-it/archive/refs/tags/v${RELEASE}.zip"
5.2 Save the version for update checks
- Write the installed version into a file.
- This is used for the update function in AppName.sh to check for if a Update is needed.
Example:
echo "${RELEASE}" >"/opt/AppName_version.txt"
6. Input and output management
6.1 User feedback
- Use standard functions like
msg_info,msg_okormsg_errorto print status messages. - Each
msg_infomust be followed with amsg_okbefore any other output is made. - Display meaningful progress messages at key stages.
Example:
msg_info "Installing Dependencies"
$STD apt-get install -y ...
msg_ok "Installed Dependencies"
6.2 Verbosity
- Use the appropiate flag (-q in the examples) for a command to suppres its output Example:
curl -fsSL
unzip -q
- If a command dose not come with such a functionality use
$STD(a custom standard redirection variable) for managing output verbosity.
Example:
$STD apt-get install -y nginx
7. String/File Manipulation
7.1 File Manipulation
- Use
sedto replace placeholder values in configuration files.
Example:
sed -i -e "s|^DB_DATABASE=.*|DB_DATABASE=$DB_NAME|" \
-e "s|^DB_USERNAME=.*|DB_USERNAME=$DB_USER|" \
-e "s|^DB_PASSWORD=.*|DB_PASSWORD=$DB_PASS|" .env
8. Security practices
8.1 Password generation
- Use
opensslto generate random passwords. - Use only alphanumeric values to not introduce unknown behaviour.
Example:
DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
8.2 File permissions
Explicitly set secure ownership and permissions for sensitive files.
Example:
chown -R www-data: /opt/snipe-it
chmod -R 755 /opt/snipe-it
9. Service Configuration
9.1 Configuration files
Use cat <<EOF to write configuration files in a clean and readable way.
Example:
cat <<EOF >/etc/nginx/conf.d/snipeit.conf
server {
listen 80;
root /opt/snipe-it/public;
index index.php;
}
EOF
9.2 Credential management
Store the generated credentials in a file.
Example:
USERNAME=username
PASSWORD=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
{
echo "Application-Credentials"
echo "Username: $USERNAME"
echo "Password: $PASSWORD"
} >> ~/application.creds
9.3 Enviroment files
Use cat <<EOF to write enviromental files in a clean and readable way.
Example:
cat <<EOF >/path/to/.env
VARIABLE="value"
PORT=3000
DB_NAME="${DB_NAME}"
EOF
9.4 Services
Enable affected services after configuration changes and start them right away.
Example:
systemctl enable -q --now nginx
10. Cleanup
10.1 Remove temporary files
Remove temporary files and downloads after use.
Example:
rm -rf /opt/v${RELEASE}.zip
10.2 Autoremove and autoclean
Remove unused dependencies to reduce disk space usage.
Example:
apt-get -y autoremove
apt-get -y autoclean
11. Best Practices Checklist
- Shebang is correctly set (
#!/usr/bin/env bash). - Metadata (author, license) is included at the top.
- Variables follow naming conventions.
- Sensitive values are dynamically generated.
- Files and services have proper permissions.
- Script cleans up temporary files.
Example: High-Level Script Flow
- Dependencies installation
- Database setup
- Download and configure application
- Service configuration
- Final cleanup