Files
ProxmoxVE/docs/contribution/CONTRIBUTING.md
CanbiZ (MickLesk) cb939861b8 github: extend docs / contribution / templates (#10921)
* 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.
2026-02-05 16:45:41 +01:00

7.3 KiB

Community Scripts Contribution Guide

Welcome to the communty-scripts Repository!

📜 These documents outline the essential coding standards for all our scripts and JSON files. Adhering to these standards ensures that our codebase remains consistent, readable, and maintainable. By following these guidelines, we can improve collaboration, reduce errors, and enhance the overall quality of our project.

Why Coding Standards Matter

Coding standards are crucial for several reasons:

  1. Consistency: Consistent code is easier to read, understand, and maintain. It helps new team members quickly get up to speed and reduces the learning curve.
  2. Readability: Clear and well-structured code is easier to debug and extend. It allows developers to quickly identify and fix issues.
  3. Maintainability: Code that follows a standard structure is easier to refactor and update. It ensures that changes can be made with minimal risk of introducing new bugs.
  4. Collaboration: When everyone follows the same standards, it becomes easier to collaborate on code. It reduces friction and misunderstandings during code reviews and merges.

Scope of These Documents

These documents cover the coding standards for the following types of files in our project:

  • install/$AppName-install.sh Scripts: These scripts are responsible for the installation of applications.
  • ct/$AppName.sh Scripts: These scripts handle the creation and updating of containers.
  • json/$AppName.json: These files store structured data and are used for the website.

Each section provides detailed guidelines on various aspects of coding, including shebang usage, comments, variable naming, function naming, indentation, error handling, command substitution, quoting, script structure, and logging. Additionally, examples are provided to illustrate the application of these standards.

By following the coding standards outlined in this document, we ensure that our scripts and JSON files are of high quality, making our project more robust and easier to manage. Please refer to this guide whenever you create or update scripts and JSON files to maintain a high standard of code quality across the project. 📚🔍

Let's work together to keep our codebase clean, efficient, and maintainable! 💪🚀

Getting Started

Before contributing, please ensure that you have the following setup:

  1. Visual Studio Code (recommended for script development)
  2. Recommended VS Code Extensions:

Important Notes


🚀 The Application Script (ct/AppName.sh)

  • You can find all coding standards, as well as the structure for this file here.
  • These scripts are responsible for container creation, setting the necessary variables and handling the update of the application once installed.

🛠 The Installation Script (install/AppName-install.sh)

  • You can find all coding standards, as well as the structure for this file here.
  • These scripts are responsible for the installation of the application.

🚀 Building Your Own Scripts

Start with the template script


🤝 Contribution Process

1. Fork the repository

Fork to your GitHub account

2. Clone your fork on your local environment

git clone https://github.com/yourUserName/ForkName

3. Create a new branch

git switch -c your-feature-branch

4. Run setup-fork.sh to auto-configure your fork

bash docs/contribution/setup-fork.sh --full

This script automatically:

  • Detects your GitHub username
  • Updates ALL curl URLs to point to your fork (for testing)
  • Creates .git-setup-info with your config
  • Backs up all modified files (*.backup)

IMPORTANT: This modifies 600+ files! Use cherry-pick when submitting your PR (see below).

5. Commit ONLY your new application files

git commit -m "Your commit message"

5. Push to your fork

git push origin your-feature-branch

6. Cherry-Pick: Submit Only Your Files for PR

⚠️ IMPORTANT: setup-fork.sh modified 600+ files. You MUST only submit your 3 new files!

See README.md - Cherry-Pick Guide for step-by-step instructions.

Quick version:

# Create clean branch from upstream
git fetch upstream
git checkout -b submit/myapp upstream/main

# Copy only your files
cp ../your-work-branch/ct/myapp.sh ct/myapp.sh
cp ../your-work-branch/install/myapp-install.sh install/myapp-install.sh
cp ../your-work-branch/frontend/public/json/myapp.json frontend/public/json/myapp.json

# Commit and verify
git add ct/myapp.sh install/myapp-install.sh frontend/public/json/myapp.json
git commit -m "feat: add MyApp"
git diff upstream/main --name-only  # Should show ONLY your 3 files

# Push and create PR
git push origin submit/myapp

7. Create a Pull Request

Open a Pull Request from submit/myappcommunity-scripts/ProxmoxVE/main.

Verify the PR shows ONLY these 3 files:

  • ct/myapp.sh
  • install/myapp-install.sh
  • frontend/public/json/myapp.json

🛠️ Developer Mode & Debugging

When building or testing scripts, you can use the dev_mode variable to enable powerful debugging features. These flags can be combined (comma-separated).

Usage:

# Example: Run with trace and keep the container even if it fails
dev_mode="trace,keep" bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/myapp.sh)"

Available Flags:

Flag Description
trace Enables set -x for maximum verbosity during execution.
keep Prevents the container from being deleted if the build fails.
pause Pauses execution at key points (e.g., before customization).
breakpoint Allows hardcoded breakpoint calls in scripts to drop to a shell.
logs Saves detailed build logs to /var/log/community-scripts/.
dryrun Bypasses actual container creation (limited support).
motd Forces an update of the Message of the Day (MOTD).

📚 Pages