mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-05-16 21:55:03 +00:00
cleanup: remove docs/, update README & CONTRIBUTING, fix repo config (#13770)
This commit is contained in:
committed by
GitHub
parent
b2c0d7646e
commit
997e05dfb1
@@ -1,868 +0,0 @@
|
||||
# 🤖 AI Contribution Guidelines for ProxmoxVE
|
||||
|
||||
> **This documentation is intended for all AI assistants (GitHub Copilot, Claude, ChatGPT, etc.) contributing to this project.**
|
||||
|
||||
## 🎯 Core Principles
|
||||
|
||||
### 1. **Maximum Use of `tools.func` Functions**
|
||||
|
||||
We have an extensive library of helper functions. **NEVER** implement your own solutions when a function already exists!
|
||||
|
||||
### 2. **No Pointless Variables**
|
||||
|
||||
Only create variables when they:
|
||||
|
||||
- Are used multiple times
|
||||
- Improve readability
|
||||
- Are intended for configuration
|
||||
|
||||
### 3. **Consistent Script Structure**
|
||||
|
||||
All scripts follow an identical structure. Deviations are not acceptable.
|
||||
|
||||
### 4. **Bare-Metal Installation**
|
||||
|
||||
We do **NOT use Docker** for our installation scripts. All applications are installed directly on the system.
|
||||
|
||||
---
|
||||
|
||||
## 📁 Script Types and Their Structure
|
||||
|
||||
### CT Script (`ct/AppName.sh`)
|
||||
|
||||
```bash
|
||||
#!/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: AuthorName (GitHubUsername)
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://application-url.com
|
||||
|
||||
APP="AppName"
|
||||
var_tags="${var_tags:-tag1;tag2;tag3}"
|
||||
var_cpu="${var_cpu:-2}"
|
||||
var_ram="${var_ram:-2048}"
|
||||
var_disk="${var_disk:-8}"
|
||||
var_os="${var_os:-debian}"
|
||||
var_version="${var_version:-13}"
|
||||
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/appname ]]; then
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
fi
|
||||
|
||||
if check_for_gh_release "appname" "YourUsername/YourRepo"; then
|
||||
msg_info "Stopping Service"
|
||||
systemctl stop appname
|
||||
msg_ok "Stopped Service"
|
||||
|
||||
msg_info "Backing up Data"
|
||||
cp -r /opt/appname/data /opt/appname_data_backup
|
||||
msg_ok "Backed up Data"
|
||||
|
||||
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "appname" "owner/repo" "tarball" "latest" "/opt/appname"
|
||||
|
||||
# Build steps...
|
||||
|
||||
msg_info "Restoring Data"
|
||||
cp -r /opt/appname_data_backup/. /opt/appname/data
|
||||
rm -rf /opt/appname_data_backup
|
||||
msg_ok "Restored Data"
|
||||
|
||||
msg_info "Starting Service"
|
||||
systemctl start appname
|
||||
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 "${TAB}${GATEWAY}${BGN}http://${IP}:PORT${CL}"
|
||||
```
|
||||
|
||||
### Install Script (`install/AppName-install.sh`)
|
||||
|
||||
```bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2026 community-scripts ORG
|
||||
# Author: AuthorName (GitHubUsername)
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://application-url.com
|
||||
|
||||
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
||||
color
|
||||
verb_ip6
|
||||
catch_errors
|
||||
setting_up_container
|
||||
network_check
|
||||
update_os
|
||||
|
||||
msg_info "Installing Dependencies"
|
||||
$STD apt-get install -y \
|
||||
dependency1 \
|
||||
dependency2
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
# Runtime Setup (ALWAYS use our functions!)
|
||||
NODE_VERSION="22" setup_nodejs
|
||||
# or
|
||||
PG_VERSION="16" setup_postgresql
|
||||
# or
|
||||
setup_uv
|
||||
# etc.
|
||||
|
||||
fetch_and_deploy_gh_release "appname" "owner/repo" "tarball" "latest" "/opt/appname"
|
||||
|
||||
msg_info "Setting up Application"
|
||||
cd /opt/appname
|
||||
# Build/Setup Schritte...
|
||||
msg_ok "Set up Application"
|
||||
|
||||
msg_info "Creating Service"
|
||||
cat <<EOF >/etc/systemd/system/appname.service
|
||||
[Unit]
|
||||
Description=AppName Service
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=root
|
||||
WorkingDirectory=/opt/appname
|
||||
ExecStart=/path/to/executable
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl enable -q --now appname
|
||||
msg_ok "Created Service"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
cleanup_lxc
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔧 Available Helper Functions
|
||||
|
||||
### Release Management
|
||||
|
||||
| Function | Description | Example |
|
||||
| ----------------------------- | ----------------------------------- | ------------------------------------------------------------- |
|
||||
| `fetch_and_deploy_gh_release` | Fetches and installs GitHub Release | `fetch_and_deploy_gh_release "app" "owner/repo"` |
|
||||
| `check_for_gh_release` | Checks for new version | `if check_for_gh_release "app" "YourUsername/YourRepo"; then` |
|
||||
|
||||
**Modes for `fetch_and_deploy_gh_release`:**
|
||||
|
||||
```bash
|
||||
# Tarball/Source (Standard)
|
||||
fetch_and_deploy_gh_release "appname" "owner/repo"
|
||||
|
||||
# Binary (.deb)
|
||||
fetch_and_deploy_gh_release "appname" "owner/repo" "binary"
|
||||
|
||||
# Prebuilt Archive
|
||||
fetch_and_deploy_gh_release "appname" "owner/repo" "prebuild" "latest" "/opt/appname" "filename.tar.gz"
|
||||
|
||||
# Single Binary
|
||||
fetch_and_deploy_gh_release "appname" "owner/repo" "singlefile" "latest" "/opt/appname" "binary-linux-amd64"
|
||||
```
|
||||
|
||||
**Clean Install Flag:**
|
||||
|
||||
```bash
|
||||
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "appname" "owner/repo"
|
||||
```
|
||||
|
||||
### Runtime/Language Setup
|
||||
|
||||
| Function | Variable(s) | Example |
|
||||
| -------------- | ----------------------------- | ---------------------------------------------------- |
|
||||
| `setup_nodejs` | `NODE_VERSION`, `NODE_MODULE` | `NODE_VERSION="22" setup_nodejs` |
|
||||
| `setup_uv` | `PYTHON_VERSION` | `PYTHON_VERSION="3.12" setup_uv` |
|
||||
| `setup_go` | `GO_VERSION` | `GO_VERSION="1.22" setup_go` |
|
||||
| `setup_rust` | `RUST_VERSION`, `RUST_CRATES` | `RUST_CRATES="monolith" setup_rust` |
|
||||
| `setup_ruby` | `RUBY_VERSION` | `RUBY_VERSION="3.3" setup_ruby` |
|
||||
| `setup_java` | `JAVA_VERSION` | `JAVA_VERSION="21" setup_java` |
|
||||
| `setup_php` | `PHP_VERSION`, `PHP_MODULES` | `PHP_VERSION="8.3" PHP_MODULES="redis,gd" setup_php` |
|
||||
|
||||
### Database Setup
|
||||
|
||||
| Function | Variable(s) | Example |
|
||||
| --------------------- | ------------------------------------ | ----------------------------------------------------------- |
|
||||
| `setup_postgresql` | `PG_VERSION`, `PG_MODULES` | `PG_VERSION="16" setup_postgresql` |
|
||||
| `setup_postgresql_db` | `PG_DB_NAME`, `PG_DB_USER` | `PG_DB_NAME="mydb" PG_DB_USER="myuser" setup_postgresql_db` |
|
||||
| `setup_mariadb_db` | `MARIADB_DB_NAME`, `MARIADB_DB_USER` | `MARIADB_DB_NAME="mydb" setup_mariadb_db` |
|
||||
| `setup_mysql` | `MYSQL_VERSION` | `setup_mysql` |
|
||||
| `setup_mongodb` | `MONGO_VERSION` | `setup_mongodb` |
|
||||
| `setup_clickhouse` | - | `setup_clickhouse` |
|
||||
|
||||
### Tools & Utilities
|
||||
|
||||
| Function | Description |
|
||||
| ------------------- | ---------------------------------- |
|
||||
| `setup_adminer` | Installs Adminer for DB management |
|
||||
| `setup_composer` | Install PHP Composer |
|
||||
| `setup_ffmpeg` | Install FFmpeg |
|
||||
| `setup_imagemagick` | Install ImageMagick |
|
||||
| `setup_gs` | Install Ghostscript |
|
||||
| `setup_hwaccel` | Configure hardware acceleration |
|
||||
|
||||
### Helper Utilities
|
||||
|
||||
| Function | Description | Example |
|
||||
| ----------------------------- | ---------------------------- | ----------------------------------------- |
|
||||
| `import_local_ip` | Sets `$LOCAL_IP` variable | `import_local_ip` |
|
||||
| `ensure_dependencies` | Checks/installs dependencies | `ensure_dependencies curl jq` |
|
||||
| `install_packages_with_retry` | APT install with retry | `install_packages_with_retry nginx redis` |
|
||||
|
||||
---
|
||||
|
||||
## ❌ Anti-Patterns (NEVER use!)
|
||||
|
||||
### 1. Pointless Variables
|
||||
|
||||
```bash
|
||||
# ❌ WRONG - unnecessary variables
|
||||
APP_NAME="myapp"
|
||||
APP_DIR="/opt/${APP_NAME}"
|
||||
APP_USER="root"
|
||||
APP_PORT="3000"
|
||||
cd $APP_DIR
|
||||
|
||||
# ✅ CORRECT - use directly
|
||||
cd /opt/myapp
|
||||
```
|
||||
|
||||
### 2. Custom Download Logic
|
||||
|
||||
```bash
|
||||
# ❌ WRONG - custom wget/curl logic
|
||||
RELEASE=$(curl -s https://api.github.com/repos/YourUsername/YourRepo/releases/latest | jq -r '.tag_name')
|
||||
wget https://github.com/YourUsername/YourRepo/archive/${RELEASE}.tar.gz
|
||||
tar -xzf ${RELEASE}.tar.gz
|
||||
mv repo-${RELEASE} /opt/myapp
|
||||
|
||||
# ✅ CORRECT - use our function
|
||||
fetch_and_deploy_gh_release "myapp" "YourUsername/YourRepo" "tarball" "latest" "/opt/myapp"
|
||||
```
|
||||
|
||||
### 3. Custom Version-Check Logic
|
||||
|
||||
```bash
|
||||
# ❌ WRONG - custom version check
|
||||
CURRENT=$(cat /opt/myapp/version.txt)
|
||||
LATEST=$(curl -s https://api.github.com/repos/YourUsername/YourRepo/releases/latest | jq -r '.tag_name')
|
||||
if [[ "$CURRENT" != "$LATEST" ]]; then
|
||||
# update...
|
||||
fi
|
||||
|
||||
# ✅ CORRECT - use our function
|
||||
if check_for_gh_release "myapp" "YourUsername/YourRepo"; then
|
||||
# update...
|
||||
fi
|
||||
```
|
||||
|
||||
### 4. Docker-based Installation
|
||||
|
||||
```bash
|
||||
# ❌ WRONG - using Docker
|
||||
docker pull myapp/myapp:latest
|
||||
docker run -d --name myapp myapp/myapp:latest
|
||||
|
||||
# ✅ CORRECT - Bare-Metal Installation
|
||||
fetch_and_deploy_gh_release "myapp" "YourUsername/YourRepo"
|
||||
npm install && npm run build
|
||||
```
|
||||
|
||||
### 5. Custom Runtime Installation
|
||||
|
||||
```bash
|
||||
# ❌ WRONG - custom Node.js installation
|
||||
curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
|
||||
apt install -y nodejs
|
||||
|
||||
# ✅ CORRECT - use our function
|
||||
NODE_VERSION="22" setup_nodejs
|
||||
```
|
||||
|
||||
### 6. Redundant echo Statements
|
||||
|
||||
```bash
|
||||
# ❌ WRONG - custom logging messages
|
||||
echo "Installing dependencies..."
|
||||
apt install -y curl
|
||||
echo "Done!"
|
||||
|
||||
# ✅ CORRECT - use msg_info/msg_ok
|
||||
msg_info "Installing Dependencies"
|
||||
$STD apt install -y curl
|
||||
msg_ok "Installed Dependencies"
|
||||
```
|
||||
|
||||
### 7. Missing $STD Usage
|
||||
|
||||
```bash
|
||||
# ❌ WRONG - apt without $STD
|
||||
apt install -y nginx
|
||||
|
||||
# ✅ CORRECT - with $STD for silent output
|
||||
$STD apt install -y nginx
|
||||
```
|
||||
|
||||
### 8. Wrapping `tools.func` Functions in msg Blocks
|
||||
|
||||
```bash
|
||||
# ❌ WRONG - tools.func functions have their own msg_info/msg_ok!
|
||||
msg_info "Installing Node.js"
|
||||
NODE_VERSION="22" setup_nodejs
|
||||
msg_ok "Installed Node.js"
|
||||
|
||||
msg_info "Updating Application"
|
||||
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "appname" "owner/repo" "tarball" "latest" "/opt/appname"
|
||||
msg_ok "Updated Application"
|
||||
|
||||
# ✅ CORRECT - call directly without msg wrapper
|
||||
NODE_VERSION="22" setup_nodejs
|
||||
|
||||
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "appname" "owner/repo" "tarball" "latest" "/opt/appname"
|
||||
```
|
||||
|
||||
**Functions with built-in messages (NEVER wrap in msg blocks):**
|
||||
|
||||
- `fetch_and_deploy_gh_release`
|
||||
- `check_for_gh_release`
|
||||
- `setup_nodejs`
|
||||
- `setup_postgresql` / `setup_postgresql_db`
|
||||
- `setup_mariadb` / `setup_mariadb_db`
|
||||
- `setup_mongodb`
|
||||
- `setup_mysql`
|
||||
- `setup_ruby`
|
||||
- `setup_go`
|
||||
- `setup_java`
|
||||
- `setup_php`
|
||||
- `setup_uv`
|
||||
- `setup_rust`
|
||||
- `setup_composer`
|
||||
- `setup_ffmpeg`
|
||||
- `setup_imagemagick`
|
||||
- `setup_gs`
|
||||
- `setup_adminer`
|
||||
- `setup_hwaccel`
|
||||
|
||||
### 9. Creating Unnecessary System Users
|
||||
|
||||
```bash
|
||||
# ❌ WRONG - LXC containers run as root, no separate user needed
|
||||
useradd -m -s /usr/bin/bash appuser
|
||||
chown -R appuser:appuser /opt/appname
|
||||
sudo -u appuser npm install
|
||||
|
||||
# ✅ CORRECT - run directly as root
|
||||
cd /opt/appname
|
||||
$STD npm install
|
||||
```
|
||||
|
||||
### 10. Using `export` in .env Files
|
||||
|
||||
```bash
|
||||
# ❌ WRONG - export is unnecessary in .env files
|
||||
cat <<EOF >/opt/appname/.env
|
||||
export DATABASE_URL=postgres://...
|
||||
export SECRET_KEY=abc123
|
||||
export NODE_ENV=production
|
||||
EOF
|
||||
|
||||
# ✅ CORRECT - simple KEY=VALUE format (files are sourced with set -a)
|
||||
cat <<EOF >/opt/appname/.env
|
||||
DATABASE_URL=postgres://...
|
||||
SECRET_KEY=abc123
|
||||
NODE_ENV=production
|
||||
EOF
|
||||
```
|
||||
|
||||
### 11. Using External Shell Scripts
|
||||
|
||||
```bash
|
||||
# ❌ WRONG - external script that gets executed
|
||||
cat <<'EOF' >/opt/appname/install_script.sh
|
||||
#!/bin/bash
|
||||
cd /opt/appname
|
||||
npm install
|
||||
npm run build
|
||||
EOF
|
||||
chmod +x /opt/appname/install_script.sh
|
||||
$STD bash /opt/appname/install_script.sh
|
||||
rm -f /opt/appname/install_script.sh
|
||||
|
||||
# ✅ CORRECT - run commands directly
|
||||
cd /opt/appname
|
||||
$STD npm install
|
||||
$STD npm run build
|
||||
```
|
||||
|
||||
### 12. Using `sudo` in LXC Containers
|
||||
|
||||
```bash
|
||||
# ❌ WRONG - sudo is unnecessary in LXC (already root)
|
||||
sudo -u postgres psql -c "CREATE DATABASE mydb;"
|
||||
sudo -u appuser npm install
|
||||
|
||||
# ✅ CORRECT - use functions or run directly as root
|
||||
PG_DB_NAME="mydb" PG_DB_USER="myuser" setup_postgresql_db
|
||||
|
||||
cd /opt/appname
|
||||
$STD npm install
|
||||
```
|
||||
|
||||
### 13. Unnecessary `systemctl daemon-reload`
|
||||
|
||||
```bash
|
||||
# ❌ WRONG - daemon-reload is only needed when MODIFYING existing services
|
||||
cat <<EOF >/etc/systemd/system/appname.service
|
||||
# ... service config ...
|
||||
EOF
|
||||
systemctl daemon-reload # Unnecessary for new services!
|
||||
systemctl enable -q --now appname
|
||||
|
||||
# ✅ CORRECT - new services don't need daemon-reload
|
||||
cat <<EOF >/etc/systemd/system/appname.service
|
||||
# ... service config ...
|
||||
EOF
|
||||
systemctl enable -q --now appname
|
||||
```
|
||||
|
||||
### 14. Creating Custom Credentials Files
|
||||
|
||||
```bash
|
||||
# ❌ WRONG - custom credentials file is not part of the standard template
|
||||
msg_info "Saving Credentials"
|
||||
cat <<EOF >~/appname.creds
|
||||
Database User: ${DB_USER}
|
||||
Database Pass: ${DB_PASS}
|
||||
EOF
|
||||
msg_ok "Saved Credentials"
|
||||
|
||||
# ✅ CORRECT - credentials are stored in .env or shown in final message only
|
||||
# If you use setup_postgresql_db / setup_mariadb_db, a standard ~/[appname].creds is created automatically
|
||||
```
|
||||
|
||||
### 15. Wrong Footer Pattern
|
||||
|
||||
```bash
|
||||
# ❌ WRONG - old cleanup pattern with msg blocks
|
||||
motd_ssh
|
||||
customize
|
||||
|
||||
msg_info "Cleaning up"
|
||||
$STD apt-get -y autoremove
|
||||
$STD apt-get -y autoclean
|
||||
msg_ok "Cleaned"
|
||||
|
||||
# ✅ CORRECT - use cleanup_lxc function
|
||||
motd_ssh
|
||||
customize
|
||||
cleanup_lxc
|
||||
```
|
||||
|
||||
### 16. Manual Database Creation Instead of Functions
|
||||
|
||||
```bash
|
||||
# ❌ WRONG - manual database creation
|
||||
DB_USER="myuser"
|
||||
DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13)
|
||||
$STD sudo -u postgres psql -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS';"
|
||||
$STD sudo -u postgres psql -c "CREATE DATABASE mydb WITH OWNER $DB_USER;"
|
||||
$STD sudo -u postgres psql -d mydb -c "CREATE EXTENSION IF NOT EXISTS postgis;"
|
||||
|
||||
# ✅ CORRECT - use setup_postgresql_db function
|
||||
# This sets PG_DB_USER, PG_DB_PASS, PG_DB_NAME automatically
|
||||
PG_DB_NAME="mydb" PG_DB_USER="myuser" PG_DB_EXTENSIONS="postgis" setup_postgresql_db
|
||||
```
|
||||
|
||||
### 17. Writing Files Without Heredocs
|
||||
|
||||
```bash
|
||||
# ❌ WRONG - echo / printf / tee
|
||||
echo "# Config" > /opt/app/config.yml
|
||||
echo "port: 3000" >> /opt/app/config.yml
|
||||
|
||||
printf "# Config\nport: 3000\n" > /opt/app/config.yml
|
||||
cat config.yml | tee /opt/app/config.yml
|
||||
```
|
||||
|
||||
```bash
|
||||
# ✅ CORRECT - always use a single heredoc
|
||||
cat <<EOF >/opt/app/config.yml
|
||||
# Config
|
||||
port: 3000
|
||||
EOF
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📝 Important Rules
|
||||
|
||||
### Variable Declarations (CT Script)
|
||||
|
||||
```bash
|
||||
# Standard declarations (ALWAYS present)
|
||||
APP="AppName"
|
||||
var_tags="${var_tags:-tag1;tag2}"
|
||||
var_cpu="${var_cpu:-2}"
|
||||
var_ram="${var_ram:-2048}"
|
||||
var_disk="${var_disk:-8}"
|
||||
var_os="${var_os:-debian}"
|
||||
var_version="${var_version:-13}"
|
||||
var_unprivileged="${var_unprivileged:-1}"
|
||||
```
|
||||
|
||||
### Update-Script Pattern
|
||||
|
||||
```bash
|
||||
function update_script() {
|
||||
header_info
|
||||
check_container_storage
|
||||
check_container_resources
|
||||
|
||||
# 1. Check if installation exists
|
||||
if [[ ! -d /opt/appname ]]; then
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
fi
|
||||
|
||||
# 2. Check for update
|
||||
if check_for_gh_release "appname" "YourUsername/YourRepo"; then
|
||||
# 3. Stop service
|
||||
msg_info "Stopping Service"
|
||||
systemctl stop appname
|
||||
msg_ok "Stopped Service"
|
||||
|
||||
# 4. Backup data (if present)
|
||||
msg_info "Backing up Data"
|
||||
cp -r /opt/appname/data /opt/appname_data_backup
|
||||
msg_ok "Backed up Data"
|
||||
|
||||
# 5. Perform clean install
|
||||
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "appname" "owner/repo" "tarball" "latest" "/opt/appname"
|
||||
|
||||
# 6. Rebuild (if needed)
|
||||
cd /opt/appname
|
||||
$STD npm install
|
||||
$STD npm run build
|
||||
|
||||
# 7. Restore data
|
||||
msg_info "Restoring Data"
|
||||
cp -r /opt/appname_data_backup/. /opt/appname/data
|
||||
rm -rf /opt/appname_data_backup
|
||||
msg_ok "Restored Data"
|
||||
|
||||
# 8. Start service
|
||||
msg_info "Starting Service"
|
||||
systemctl start appname
|
||||
msg_ok "Started Service"
|
||||
msg_ok "Updated successfully!"
|
||||
fi
|
||||
exit # IMPORTANT: Always end with exit!
|
||||
}
|
||||
```
|
||||
|
||||
### Systemd Service Pattern
|
||||
|
||||
```bash
|
||||
msg_info "Creating Service"
|
||||
cat <<EOF >/etc/systemd/system/appname.service
|
||||
[Unit]
|
||||
Description=AppName Service
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=root
|
||||
WorkingDirectory=/opt/appname
|
||||
Environment=NODE_ENV=production
|
||||
ExecStart=/usr/bin/node /opt/appname/server.js
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl enable -q --now appname
|
||||
msg_ok "Created Service"
|
||||
```
|
||||
|
||||
### Installation Script Footer
|
||||
|
||||
```bash
|
||||
# ALWAYS at the end of the install script:
|
||||
motd_ssh
|
||||
customize
|
||||
cleanup_lxc
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📖 Reference: Good Example Scripts
|
||||
|
||||
Look at these recent well-implemented applications as reference:
|
||||
|
||||
### Container Scripts (Latest 10)
|
||||
|
||||
- [ct/thingsboard.sh](../ct/thingsboard.sh) - IoT platform with proper update_script
|
||||
- [ct/unifi-os-server.sh](../ct/unifi-os-server.sh) - Complex setup with podman
|
||||
- [ct/trip.sh](../ct/trip.sh) - Simple Ruby app
|
||||
- [ct/fladder.sh](../ct/fladder.sh) - Media app with database
|
||||
- [ct/qui.sh](../ct/qui.sh) - Lightweight utility
|
||||
- [ct/kutt.sh](../ct/kutt.sh) - Node.js with PostgreSQL
|
||||
- [ct/flatnotes.sh](../ct/flatnotes.sh) - Python notes app
|
||||
- [ct/investbrain.sh](../ct/investbrain.sh) - Finance app
|
||||
- [ct/gwn-manager.sh](../ct/gwn-manager.sh) - Network management
|
||||
- [ct/sportarr.sh](../ct/sportarr.sh) - Specialized \*Arr variant
|
||||
|
||||
### Install Scripts (Latest)
|
||||
|
||||
- [install/unifi-os-server-install.sh](../install/unifi-os-server-install.sh) - Complex setup with API integration
|
||||
- [install/trip-install.sh](../install/trip-install.sh) - Rails application setup
|
||||
- [install/mail-archiver-install.sh](../install/mail-archiver-install.sh) - Email-related service
|
||||
|
||||
**Key things to notice:**
|
||||
|
||||
- Proper error handling with `catch_errors`
|
||||
- Use of `check_for_gh_release` and `fetch_and_deploy_gh_release`
|
||||
- Correct backup/restore patterns in `update_script`
|
||||
- Footer always ends with `motd_ssh`, `customize`, `cleanup_lxc`
|
||||
- Website metadata requested via the website (Report issue on script page) if needed
|
||||
|
||||
---
|
||||
|
||||
## Website Metadata (Reference)
|
||||
|
||||
Website metadata (name, slug, description, logo, categories, etc.) is **not** added as files in the repo. Contributors request or update it via the **website**: go to the script's page and use the **Report issue** button; the flow will guide you. The structure below is a **reference** for what metadata exists (e.g. for the form or when describing what you need).
|
||||
|
||||
### JSON Structure (Reference)
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "AppName",
|
||||
"slug": "appname",
|
||||
"categories": [1],
|
||||
"date_created": "2026-01-16",
|
||||
"type": "ct",
|
||||
"updateable": true,
|
||||
"privileged": false,
|
||||
"interface_port": 3000,
|
||||
"documentation": "https://docs.appname.com/",
|
||||
"website": "https://appname.com/",
|
||||
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@main/webp/appname.webp",
|
||||
"config_path": "/opt/appname/.env",
|
||||
"description": "Short description of the application and its purpose.",
|
||||
"install_methods": [
|
||||
{
|
||||
"type": "default",
|
||||
"script": "ct/appname.sh",
|
||||
"resources": {
|
||||
"cpu": 2,
|
||||
"ram": 2048,
|
||||
"hdd": 8,
|
||||
"os": "Debian",
|
||||
"version": "13"
|
||||
}
|
||||
}
|
||||
],
|
||||
"default_credentials": {
|
||||
"username": null,
|
||||
"password": null
|
||||
},
|
||||
"notes": []
|
||||
}
|
||||
```
|
||||
|
||||
### Required Fields
|
||||
|
||||
| Field | Type | Description |
|
||||
| --------------------- | ------- | -------------------------------------------------- |
|
||||
| `name` | string | Display name of the application |
|
||||
| `slug` | string | Lowercase, no spaces, used for filenames |
|
||||
| `categories` | array | Category ID(s) - see category list below |
|
||||
| `date_created` | string | Creation date (YYYY-MM-DD) |
|
||||
| `type` | string | `ct` for container, `vm` for virtual machine |
|
||||
| `updateable` | boolean | Whether update_script is implemented |
|
||||
| `privileged` | boolean | Whether container needs privileged mode |
|
||||
| `interface_port` | number | Primary web interface port (or `null`) |
|
||||
| `documentation` | string | Link to official docs |
|
||||
| `website` | string | Link to official website |
|
||||
| `logo` | string | URL to application logo (preferably selfhst icons) |
|
||||
| `config_path` | string | Path to main config file (or empty string) |
|
||||
| `description` | string | Brief description of the application |
|
||||
| `install_methods` | array | Installation configurations |
|
||||
| `default_credentials` | object | Default username/password (or null) |
|
||||
| `notes` | array | Additional notes/warnings |
|
||||
|
||||
### Categories
|
||||
|
||||
| ID | Category |
|
||||
| --- | ------------------------- |
|
||||
| 0 | Miscellaneous |
|
||||
| 1 | Proxmox & Virtualization |
|
||||
| 2 | Operating Systems |
|
||||
| 3 | Containers & Docker |
|
||||
| 4 | Network & Firewall |
|
||||
| 5 | Adblock & DNS |
|
||||
| 6 | Authentication & Security |
|
||||
| 7 | Backup & Recovery |
|
||||
| 8 | Databases |
|
||||
| 9 | Monitoring & Analytics |
|
||||
| 10 | Dashboards & Frontends |
|
||||
| 11 | Files & Downloads |
|
||||
| 12 | Documents & Notes |
|
||||
| 13 | Media & Streaming |
|
||||
| 14 | \*Arr Suite |
|
||||
| 15 | NVR & Cameras |
|
||||
| 16 | IoT & Smart Home |
|
||||
| 17 | ZigBee, Z-Wave & Matter |
|
||||
| 18 | MQTT & Messaging |
|
||||
| 19 | Automation & Scheduling |
|
||||
| 20 | AI / Coding & Dev-Tools |
|
||||
| 21 | Webservers & Proxies |
|
||||
| 22 | Bots & ChatOps |
|
||||
| 23 | Finance & Budgeting |
|
||||
| 24 | Gaming & Leisure |
|
||||
| 25 | Business & ERP |
|
||||
|
||||
### Notes Format
|
||||
|
||||
```json
|
||||
"notes": [
|
||||
{
|
||||
"text": "Change the default password after first login!",
|
||||
"type": "warning"
|
||||
},
|
||||
{
|
||||
"text": "Requires at least 4GB RAM for optimal performance.",
|
||||
"type": "info"
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
**Note types:** `info`, `warning`, `error`
|
||||
|
||||
### Examples with Credentials
|
||||
|
||||
```json
|
||||
"default_credentials": {
|
||||
"username": "admin",
|
||||
"password": "admin"
|
||||
}
|
||||
```
|
||||
|
||||
Or no credentials:
|
||||
|
||||
```json
|
||||
"default_credentials": {
|
||||
"username": null,
|
||||
"password": null
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔍 Checklist Before PR Creation
|
||||
|
||||
- [ ] No Docker installation used
|
||||
- [ ] `fetch_and_deploy_gh_release` used for GitHub releases
|
||||
- [ ] `check_for_gh_release` used for update checks
|
||||
- [ ] `setup_*` functions used for runtimes (nodejs, postgresql, etc.)
|
||||
- [ ] **`tools.func` functions NOT wrapped in msg_info/msg_ok blocks**
|
||||
- [ ] No redundant variables (only when used multiple times)
|
||||
- [ ] `$STD` before all apt/npm/build commands
|
||||
- [ ] `msg_info`/`msg_ok`/`msg_error` for logging (only for custom code)
|
||||
- [ ] Correct script structure followed (see templates)
|
||||
- [ ] Update function present and functional (CT scripts)
|
||||
- [ ] Data backup implemented in update function (if applicable)
|
||||
- [ ] `motd_ssh`, `customize`, `cleanup_lxc` at the end of install scripts
|
||||
- [ ] No custom download/version-check logic
|
||||
- [ ] All links point to `community-scripts/ProxmoxVE` (not `ProxmoxVED`!)
|
||||
- [ ] Website metadata requested via the website (Report issue) if needed
|
||||
- [ ] Category IDs are valid (0-25)
|
||||
- [ ] Default OS version is Debian 13 or newer (unless special requirement)
|
||||
- [ ] Default resources are reasonable for the application
|
||||
|
||||
---
|
||||
|
||||
## 💡 Tips for AI Assistants
|
||||
|
||||
1. **ALWAYS search `tools.func` first** before implementing custom solutions
|
||||
2. **Use recent scripts as reference** (Thingsboard, UniFi OS, Trip, Flatnotes, etc.)
|
||||
3. **Ask when uncertain** instead of introducing wrong patterns
|
||||
4. **Test via GitHub** - push to your fork and test with curl (not local bash)
|
||||
```bash
|
||||
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 files
|
||||
```
|
||||
5. **Consistency > Creativity** - follow established patterns strictly
|
||||
6. **Check the templates** - they show the correct structure
|
||||
7. **Don't wrap tools.func functions** - they handle their own msg_info/msg_ok output
|
||||
8. **Minimal variables** - only create variables that are truly reused multiple times
|
||||
9. **Always use $STD** - ensures silent/non-interactive execution
|
||||
10. **Reference good examples** - look at recent additions in each category
|
||||
|
||||
---
|
||||
|
||||
## 🍒 Important: Cherry-Picking Your Files for PR Submission
|
||||
|
||||
⚠️ **CRITICAL**: When you submit your PR, you must use git cherry-pick to send ONLY your 2 files!
|
||||
|
||||
Why? Because `setup-fork.sh` modifies 600+ files to update links. If you commit all changes, your PR will be impossible to merge.
|
||||
|
||||
**See**: [README.md - Cherry-Pick Section](README.md#-cherry-pick-submitting-only-your-changes) for complete instructions on:
|
||||
|
||||
- Creating a clean submission branch
|
||||
- Cherry-picking only your files (ct/myapp.sh, install/myapp-install.sh)
|
||||
- Verifying your PR has only 2 file changes (not 600+)
|
||||
|
||||
**Quick reference**:
|
||||
|
||||
```bash
|
||||
# Create clean branch from upstream
|
||||
git fetch upstream
|
||||
git checkout -b submit/myapp upstream/main
|
||||
|
||||
# Cherry-pick your commit(s) or manually add your 2 files
|
||||
# Then push to your fork and create PR
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📚 Further Documentation
|
||||
|
||||
- [CONTRIBUTING.md](CONTRIBUTING.md) - General contribution guidelines
|
||||
- [GUIDE.md](GUIDE.md) - Detailed developer documentation
|
||||
- [HELPER_FUNCTIONS.md](HELPER_FUNCTIONS.md) - Complete tools.func reference
|
||||
- [README.md](README.md) - Cherry-pick guide and workflow instructions
|
||||
- [../TECHNICAL_REFERENCE.md](../TECHNICAL_REFERENCE.md) - Technical deep dive
|
||||
- [../EXIT_CODES.md](../EXIT_CODES.md) - Exit code reference
|
||||
- [templates_ct/](templates_ct/) - CT script templates
|
||||
- [templates_install/](templates_install/) - Install script templates
|
||||
- [templates_json/](templates_json/) - Metadata structure reference; submit via website
|
||||
@@ -1,41 +0,0 @@
|
||||
# 🧪 Code Audit: LXC Script Flow
|
||||
|
||||
This guide explains the current execution flow and what to verify during reviews.
|
||||
|
||||
## Execution Flow (CT + Install)
|
||||
|
||||
1. `ct/appname.sh` runs on the Proxmox host and sources `misc/build.func`.
|
||||
2. `build.func` orchestrates prompts, container creation, and invokes the install script.
|
||||
3. Inside the container, `misc/install.func` exposes helper functions via `$FUNCTIONS_FILE_PATH`.
|
||||
4. `install/appname-install.sh` performs the application install.
|
||||
5. The CT script prints the completion message.
|
||||
|
||||
## Audit Checklist
|
||||
|
||||
### CT Script (ct/)
|
||||
|
||||
- Sources `misc/build.func` from `community-scripts/ProxmoxVE/main` (setup-fork.sh updates for forks).
|
||||
- Uses `check_for_gh_release` + `fetch_and_deploy_gh_release` for updates.
|
||||
- No Docker-based installs.
|
||||
|
||||
### Install Script (install/)
|
||||
|
||||
- Sources `$FUNCTIONS_FILE_PATH`.
|
||||
- Uses `tools.func` helpers (setup\_\*).
|
||||
- Ends with `motd_ssh`, `customize`, `cleanup_lxc`.
|
||||
|
||||
### Website Metadata
|
||||
|
||||
- Website metadata for new/updated scripts is requested via the website (Report issue on script page) where applicable.
|
||||
|
||||
### Testing
|
||||
|
||||
- Test via curl from your fork (CT script only).
|
||||
- Wait 10-30 seconds after push.
|
||||
|
||||
## References
|
||||
|
||||
- `docs/contribution/templates_ct/AppName.sh`
|
||||
- `docs/contribution/templates_install/AppName-install.sh`
|
||||
- `docs/contribution/templates_json/AppName.json`
|
||||
- `docs/contribution/GUIDE.md`
|
||||
@@ -1,176 +0,0 @@
|
||||
# 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.
|
||||
- **Website metadata**: Display data (name, description, logo, etc.) is requested via the website (Report issue on the script page), not via files in the repo.
|
||||
|
||||
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:**
|
||||
- [Shell Syntax](https://marketplace.visualstudio.com/items?itemName=bmalehorn.shell-syntax)
|
||||
- [ShellCheck](https://marketplace.visualstudio.com/items?itemName=timonwong.shellcheck)
|
||||
- [Shell Format](https://marketplace.visualstudio.com/items?itemName=foxundermoon.shell-format)
|
||||
|
||||
### Important Notes
|
||||
|
||||
- Use [AppName.sh](https://github.com/community-scripts/ProxmoxVE/blob/main/docs/contribution/templates_ct/AppName.sh) and [AppName-install.sh](https://github.com/community-scripts/ProxmoxVE/blob/main/docs/contribution/templates_install/AppName-install.sh) as templates when creating new scripts.
|
||||
|
||||
---
|
||||
|
||||
# 🚀 The Application Script (ct/AppName.sh)
|
||||
|
||||
- You can find all coding standards, as well as the structure for this file [here](https://github.com/community-scripts/ProxmoxVE/blob/main/docs/contribution/templates_ct/AppName.md).
|
||||
- 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](https://github.com/community-scripts/ProxmoxVE/blob/main/docs/contribution/templates_install/AppName-install.md).
|
||||
- These scripts are responsible for the installation of the application.
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Building Your Own Scripts
|
||||
|
||||
Start with the [template script](https://github.com/community-scripts/ProxmoxVE/blob/main/docs/contribution/templates_install/AppName-install.sh)
|
||||
|
||||
---
|
||||
|
||||
## 🤝 Contribution Process
|
||||
|
||||
### 1. Fork the repository
|
||||
|
||||
Fork to your GitHub account
|
||||
|
||||
### 2. Clone your fork on your local environment
|
||||
|
||||
```bash
|
||||
git clone https://github.com/yourUserName/ForkName
|
||||
```
|
||||
|
||||
### 3. Create a new branch
|
||||
|
||||
```bash
|
||||
git switch -c your-feature-branch
|
||||
```
|
||||
|
||||
### 4. Run setup-fork.sh to auto-configure your fork
|
||||
|
||||
```bash
|
||||
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
|
||||
|
||||
```bash
|
||||
git commit -m "Your commit message"
|
||||
```
|
||||
|
||||
### 5. Push to your fork
|
||||
|
||||
```bash
|
||||
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 2 new files!
|
||||
|
||||
See [README.md - Cherry-Pick Guide](README.md#-cherry-pick-submitting-only-your-changes) for step-by-step instructions.
|
||||
|
||||
Quick version:
|
||||
|
||||
```bash
|
||||
# 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
|
||||
|
||||
# Commit and verify
|
||||
git add ct/myapp.sh install/myapp-install.sh
|
||||
git commit -m "feat: add MyApp"
|
||||
git diff upstream/main --name-only # Should show ONLY your 2 files
|
||||
|
||||
# Push and create PR
|
||||
git push origin submit/myapp
|
||||
```
|
||||
|
||||
### 7. Create a Pull Request
|
||||
|
||||
Open a Pull Request from `submit/myapp` → `community-scripts/ProxmoxVE/main`.
|
||||
|
||||
Verify the PR shows ONLY these 2 files:
|
||||
|
||||
- `ct/myapp.sh`
|
||||
- `install/myapp-install.sh`
|
||||
|
||||
---
|
||||
|
||||
# 🛠️ 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**:
|
||||
```bash
|
||||
# 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
|
||||
|
||||
- [CT Template: AppName.sh](https://github.com/community-scripts/ProxmoxVE/blob/main/docs/contribution/templates_ct/AppName.sh)
|
||||
- [Install Template: AppName-install.sh](https://github.com/community-scripts/ProxmoxVE/blob/main/docs/contribution/templates_install/AppName-install.sh)
|
||||
- [JSON Template: AppName.json](https://github.com/community-scripts/ProxmoxVE/blob/main/docs/contribution/templates_json/AppName.json) — metadata structure reference; submit via the website (Report issue on script page)
|
||||
@@ -1,231 +0,0 @@
|
||||
# 🍴 Fork Setup Guide
|
||||
|
||||
**Just forked ProxmoxVE? Run this first!**
|
||||
|
||||
## Quick Start
|
||||
|
||||
```bash
|
||||
# Clone your fork
|
||||
git clone https://github.com/YOUR_USERNAME/ProxmoxVE.git
|
||||
cd ProxmoxVE
|
||||
|
||||
# Run setup script (auto-detects your username from git)
|
||||
bash docs/contribution/setup-fork.sh --full
|
||||
```
|
||||
|
||||
That's it! ✅
|
||||
|
||||
---
|
||||
|
||||
## What Does It Do?
|
||||
|
||||
The `setup-fork.sh` script automatically:
|
||||
|
||||
1. **Detects** your GitHub username from git config
|
||||
2. **Updates ALL hardcoded links** to point to your fork:
|
||||
- Documentation links pointing to `community-scripts/ProxmoxVE`
|
||||
- **Curl download URLs** in scripts (e.g., `curl ... github.com/community-scripts/ProxmoxVE/main/...`)
|
||||
3. **Creates** `.git-setup-info` with your configuration details
|
||||
4. **Backs up** all modified files (\*.backup for safety)
|
||||
|
||||
### Why Updating Curl Links Matters
|
||||
|
||||
Your scripts contain `curl` commands that download dependencies from GitHub (build.func, tools.func, etc.):
|
||||
|
||||
```bash
|
||||
# First line of ct/myapp.sh
|
||||
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
|
||||
```
|
||||
|
||||
**WITHOUT setup-fork.sh:**
|
||||
|
||||
- Script URLs still point to `community-scripts/ProxmoxVE/main`
|
||||
- If you test locally with `bash ct/myapp.sh`, you're testing local files, but the script's curl commands would download from **upstream** repo
|
||||
- Your modifications aren't actually being tested via the curl commands! ❌
|
||||
|
||||
**AFTER setup-fork.sh:**
|
||||
|
||||
- Script URLs are updated to `YourUsername/ProxmoxVE/main`
|
||||
- When you test via curl from GitHub: `bash -c "$(curl ... YOUR_USERNAME/ProxmoxVE/main/ct/myapp.sh)"`, it downloads from **your fork**
|
||||
- The script's curl commands also point to your fork, so you're actually testing your changes! ✅
|
||||
- ⏱️ **Important:** GitHub takes 10-30 seconds to recognize pushed files - wait before testing!
|
||||
|
||||
```bash
|
||||
# Example: What setup-fork.sh changes
|
||||
|
||||
# BEFORE (points to upstream):
|
||||
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
|
||||
|
||||
# AFTER (points to your fork):
|
||||
source <(curl -fsSL https://raw.githubusercontent.com/john/ProxmoxVE/main/misc/build.func)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Usage
|
||||
|
||||
### Auto-Detect (Recommended)
|
||||
|
||||
```bash
|
||||
bash docs/contribution/setup-fork.sh --full
|
||||
```
|
||||
|
||||
Automatically reads your GitHub username from `git remote origin url`
|
||||
|
||||
### Specify Username
|
||||
|
||||
```bash
|
||||
bash docs/contribution/setup-fork.sh --full john
|
||||
```
|
||||
|
||||
Updates links to `github.com/john/ProxmoxVE`
|
||||
|
||||
### Custom Repository Name
|
||||
|
||||
```bash
|
||||
bash docs/contribution/setup-fork.sh --full john my-fork
|
||||
```
|
||||
|
||||
Updates links to `github.com/john/my-fork`
|
||||
|
||||
---
|
||||
|
||||
## What Gets Updated?
|
||||
|
||||
The script updates hardcoded links in these areas when using `--full`:
|
||||
|
||||
- `ct/`, `install/`, `vm/` scripts
|
||||
- `misc/` function libraries
|
||||
- `docs/` (including `docs/contribution/`)
|
||||
- Code examples in documentation
|
||||
|
||||
---
|
||||
|
||||
## After Setup
|
||||
|
||||
1. **Review changes**
|
||||
|
||||
```bash
|
||||
git diff docs/
|
||||
```
|
||||
|
||||
2. **Read git workflow tips**
|
||||
|
||||
```bash
|
||||
cat .git-setup-info
|
||||
```
|
||||
|
||||
3. **Start contributing**
|
||||
|
||||
```bash
|
||||
git checkout -b feature/my-app
|
||||
# Make your changes...
|
||||
git commit -m "feat: add my awesome app"
|
||||
```
|
||||
|
||||
4. **Follow the guide**
|
||||
```bash
|
||||
cat docs/contribution/GUIDE.md
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Common Workflows
|
||||
|
||||
### Keep Your Fork Updated
|
||||
|
||||
```bash
|
||||
# Add upstream if you haven't already
|
||||
git remote add upstream https://github.com/community-scripts/ProxmoxVE.git
|
||||
|
||||
# Get latest from upstream
|
||||
git fetch upstream
|
||||
git rebase upstream/main
|
||||
git push origin main
|
||||
```
|
||||
|
||||
### Create a Feature Branch
|
||||
|
||||
```bash
|
||||
git checkout -b feature/docker-improvements
|
||||
# Make changes...
|
||||
git push origin feature/docker-improvements
|
||||
# Then create PR on GitHub
|
||||
```
|
||||
|
||||
### Sync Before Contributing
|
||||
|
||||
```bash
|
||||
git fetch upstream
|
||||
git rebase upstream/main
|
||||
git push -f origin main # Update your fork's main
|
||||
git checkout -b feature/my-feature
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### "Git is not installed" or "not a git repository"
|
||||
|
||||
```bash
|
||||
# Make sure you cloned the repo first
|
||||
git clone https://github.com/YOUR_USERNAME/ProxmoxVE.git
|
||||
cd ProxmoxVE
|
||||
bash docs/contribution/setup-fork.sh --full
|
||||
```
|
||||
|
||||
### "Could not auto-detect GitHub username"
|
||||
|
||||
```bash
|
||||
# Your git origin URL isn't set up correctly
|
||||
git remote -v
|
||||
# Should show your fork URL, not community-scripts
|
||||
|
||||
# Fix it:
|
||||
git remote set-url origin https://github.com/YOUR_USERNAME/ProxmoxVE.git
|
||||
bash docs/contribution/setup-fork.sh --full
|
||||
```
|
||||
|
||||
### "Permission denied"
|
||||
|
||||
```bash
|
||||
# Make script executable
|
||||
chmod +x docs/contribution/setup-fork.sh
|
||||
bash docs/contribution/setup-fork.sh --full
|
||||
```
|
||||
|
||||
### Reverted Changes by Accident?
|
||||
|
||||
```bash
|
||||
# Backups are created automatically
|
||||
git checkout docs/*.backup
|
||||
# Or just re-run setup-fork.sh
|
||||
bash docs/contribution/setup-fork.sh --full
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Next Steps
|
||||
|
||||
1. ✅ Run `bash docs/contribution/setup-fork.sh --full`
|
||||
2. 📖 Read [docs/contribution/GUIDE.md](GUIDE.md)
|
||||
3. 🍴 Choose your contribution path:
|
||||
- **Containers** → [docs/ct/README.md](docs/ct/README.md)
|
||||
- **Installation** → [docs/install/README.md](docs/install/README.md)
|
||||
- **VMs** → [docs/vm/README.md](docs/vm/README.md)
|
||||
- **Tools** → [docs/tools/README.md](docs/tools/README.md)
|
||||
4. 💻 Create your feature branch and contribute!
|
||||
|
||||
---
|
||||
|
||||
## Questions?
|
||||
|
||||
- **Fork Setup Issues?** → See [Troubleshooting](#troubleshooting) above
|
||||
- **How to Contribute?** → [docs/contribution/GUIDE.md](GUIDE.md)
|
||||
- **Git Workflows?** → `cat .git-setup-info`
|
||||
- **Project Structure?** → [docs/README.md](docs/README.md)
|
||||
|
||||
---
|
||||
|
||||
## Happy Contributing! 🚀
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,753 +0,0 @@
|
||||
# 🛠️ Helper Functions Reference
|
||||
|
||||
**Quick reference for all helper functions available in `tools.func`**
|
||||
|
||||
> These functions are automatically available in install scripts via `$FUNCTIONS_FILE_PATH`
|
||||
|
||||
---
|
||||
|
||||
## 📋 Table of Contents
|
||||
|
||||
- [Scripts to Watch](#scripts-to-watch)
|
||||
- [Runtime & Language Setup](#runtime--language-setup)
|
||||
- [Database Setup](#database-setup)
|
||||
- [GitHub Release Helpers](#github-release-helpers)
|
||||
- [Tools & Utilities](#tools--utilities)
|
||||
- [SSL/TLS](#ssltls)
|
||||
- [Utility Functions](#utility-functions)
|
||||
- [Package Management](#package-management)
|
||||
|
||||
---
|
||||
|
||||
## 📚 Scripts to Watch
|
||||
|
||||
**Learn from real, well-implemented scripts. Each app requires TWO files that work together:**
|
||||
|
||||
| File | Location | Purpose |
|
||||
| ------------------ | ---------------------------- | ------------------------------------------------------------------------ |
|
||||
| **CT Script** | `ct/appname.sh` | Runs on **Proxmox host** - creates container, contains `update_script()` |
|
||||
| **Install Script** | `install/appname-install.sh` | Runs **inside container** - installs and configures the app |
|
||||
|
||||
> ⚠️ **Both files are ALWAYS required!** The CT script calls the install script automatically during container creation.
|
||||
|
||||
Install scripts are **not** run directly by users; they are invoked by the CT script inside the container.
|
||||
|
||||
### Node.js + PostgreSQL
|
||||
|
||||
**Koel** - Music streaming with PHP + Node.js + PostgreSQL
|
||||
| File | Link |
|
||||
| ----------------- | -------------------------------------------------------- |
|
||||
| CT (update logic) | [ct/koel.sh](../../ct/koel.sh) |
|
||||
| Install | [install/koel-install.sh](../../install/koel-install.sh) |
|
||||
|
||||
**Actual Budget** - Finance app with npm global install
|
||||
| File | Link |
|
||||
| ----------------- | ------------------------------------------------------------------------ |
|
||||
| CT (update logic) | [ct/actualbudget.sh](../../ct/actualbudget.sh) |
|
||||
| Install | [install/actualbudget-install.sh](../../install/actualbudget-install.sh) |
|
||||
|
||||
### Python + uv
|
||||
|
||||
**MeTube** - YouTube downloader with Python uv + Node.js + Deno
|
||||
| File | Link |
|
||||
| ----------------- | ------------------------------------------------------------ |
|
||||
| CT (update logic) | [ct/metube.sh](../../ct/metube.sh) |
|
||||
| Install | [install/metube-install.sh](../../install/metube-install.sh) |
|
||||
|
||||
**Endurain** - Fitness tracker with Python uv + PostgreSQL/PostGIS
|
||||
| File | Link |
|
||||
| ----------------- | ---------------------------------------------------------------- |
|
||||
| CT (update logic) | [ct/endurain.sh](../../ct/endurain.sh) |
|
||||
| Install | [install/endurain-install.sh](../../install/endurain-install.sh) |
|
||||
|
||||
### Java + Gradle
|
||||
|
||||
**BookLore** - Book management with Java 21 + Gradle + MariaDB + Nginx
|
||||
| File | Link |
|
||||
| ----------------- | -------------------------------------------------------------- |
|
||||
| CT (update logic) | [ct/booklore.sh](../../ct/booklore.sh) |
|
||||
| Install | [install/booklore-install.sh](../../install/booklore-install.sh) |
|
||||
|
||||
### Pnpm + Meilisearch
|
||||
|
||||
**KaraKeep** - Bookmark manager with Pnpm + Meilisearch + Puppeteer
|
||||
| File | Link |
|
||||
| ----------------- | -------------------------------------------------------------- |
|
||||
| CT (update logic) | [ct/karakeep.sh](../../ct/karakeep.sh) |
|
||||
| Install | [install/karakeep-install.sh](../../install/karakeep-install.sh) |
|
||||
|
||||
### PHP + MariaDB/MySQL
|
||||
|
||||
**Wallabag** - Read-it-later with PHP + MariaDB + Redis + Nginx
|
||||
| File | Link |
|
||||
| ----------------- | ---------------------------------------------------------------- |
|
||||
| CT (update logic) | [ct/wallabag.sh](../../ct/wallabag.sh) |
|
||||
| Install | [install/wallabag-install.sh](../../install/wallabag-install.sh) |
|
||||
|
||||
**InvoiceNinja** - Invoicing with PHP + MariaDB + Supervisor
|
||||
| File | Link |
|
||||
| ----------------- | ------------------------------------------------------------------------ |
|
||||
| CT (update logic) | [ct/invoiceninja.sh](../../ct/invoiceninja.sh) |
|
||||
| Install | [install/invoiceninja-install.sh](../../install/invoiceninja-install.sh) |
|
||||
|
||||
**BookStack** - Wiki/Docs with PHP + MariaDB + Apache
|
||||
| File | Link |
|
||||
| ----------------- | ------------------------------------------------------------------ |
|
||||
| CT (update logic) | [ct/bookstack.sh](../../ct/bookstack.sh) |
|
||||
| Install | [install/bookstack-install.sh](../../install/bookstack-install.sh) |
|
||||
|
||||
### PHP + SQLite (Simple)
|
||||
|
||||
**Speedtest Tracker** - Speedtest with PHP + SQLite + Nginx
|
||||
| File | Link |
|
||||
| ----------------- | ---------------------------------------------------------------------------------- |
|
||||
| CT (update logic) | [ct/speedtest-tracker.sh](../../ct/speedtest-tracker.sh) |
|
||||
| Install | [install/speedtest-tracker-install.sh](../../install/speedtest-tracker-install.sh) |
|
||||
|
||||
---
|
||||
|
||||
## Runtime & Language Setup
|
||||
|
||||
### `setup_nodejs`
|
||||
|
||||
Install Node.js from NodeSource repository.
|
||||
|
||||
```bash
|
||||
# Default (Node.js 24)
|
||||
setup_nodejs
|
||||
|
||||
# Specific version
|
||||
NODE_VERSION="20" setup_nodejs
|
||||
NODE_VERSION="22" setup_nodejs
|
||||
NODE_VERSION="24" setup_nodejs
|
||||
```
|
||||
|
||||
### `setup_go`
|
||||
|
||||
Install Go programming language (latest stable).
|
||||
|
||||
```bash
|
||||
setup_go
|
||||
|
||||
# Use in script
|
||||
setup_go
|
||||
cd /opt/myapp
|
||||
$STD go build -o myapp .
|
||||
```
|
||||
|
||||
### `setup_rust`
|
||||
|
||||
Install Rust via rustup.
|
||||
|
||||
```bash
|
||||
setup_rust
|
||||
|
||||
# Use in script
|
||||
setup_rust
|
||||
source "$HOME/.cargo/env"
|
||||
$STD cargo build --release
|
||||
```
|
||||
|
||||
### `setup_uv`
|
||||
|
||||
Install Python uv package manager (fast pip/venv replacement).
|
||||
|
||||
```bash
|
||||
# Default
|
||||
setup_uv
|
||||
|
||||
# Install a specific Python version
|
||||
PYTHON_VERSION="3.12" setup_uv
|
||||
|
||||
# Use in script
|
||||
setup_uv
|
||||
cd /opt/myapp
|
||||
$STD uv sync --locked
|
||||
```
|
||||
|
||||
### `setup_ruby`
|
||||
|
||||
Install Ruby from official repositories.
|
||||
|
||||
```bash
|
||||
setup_ruby
|
||||
```
|
||||
|
||||
### `setup_php`
|
||||
|
||||
Install PHP with configurable modules and FPM/Apache support.
|
||||
|
||||
```bash
|
||||
# Basic PHP
|
||||
setup_php
|
||||
|
||||
# Full configuration
|
||||
PHP_VERSION="8.4" \
|
||||
PHP_MODULE="mysqli,gd,curl,mbstring,xml,zip,ldap" \
|
||||
PHP_FPM="YES" \
|
||||
PHP_APACHE="YES" \
|
||||
setup_php
|
||||
```
|
||||
|
||||
**Environment Variables:**
|
||||
| Variable | Default | Description |
|
||||
| ------------- | ------- | ------------------------------- |
|
||||
| `PHP_VERSION` | `8.4` | PHP version to install |
|
||||
| `PHP_MODULE` | `""` | Comma-separated list of modules |
|
||||
| `PHP_FPM` | `NO` | Install PHP-FPM |
|
||||
| `PHP_APACHE` | `NO` | Install Apache module |
|
||||
|
||||
### `setup_composer`
|
||||
|
||||
Install PHP Composer package manager.
|
||||
|
||||
```bash
|
||||
setup_php
|
||||
setup_composer
|
||||
|
||||
# Use in script
|
||||
$STD composer install --no-dev
|
||||
```
|
||||
|
||||
### `setup_java`
|
||||
|
||||
Install Java (OpenJDK).
|
||||
|
||||
```bash
|
||||
# Default (Java 21)
|
||||
setup_java
|
||||
|
||||
# Specific version
|
||||
JAVA_VERSION="17" setup_java
|
||||
JAVA_VERSION="21" setup_java
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Database Setup
|
||||
|
||||
### `setup_mariadb`
|
||||
|
||||
Install MariaDB server.
|
||||
|
||||
```bash
|
||||
setup_mariadb
|
||||
```
|
||||
|
||||
### `setup_mariadb_db`
|
||||
|
||||
Create a MariaDB database and user. Sets `$MARIADB_DB_PASS` with the generated password.
|
||||
|
||||
```bash
|
||||
setup_mariadb
|
||||
MARIADB_DB_NAME="myapp_db" MARIADB_DB_USER="myapp_user" setup_mariadb_db
|
||||
|
||||
# After calling, these variables are available:
|
||||
# $MARIADB_DB_NAME - Database name
|
||||
# $MARIADB_DB_USER - Database user
|
||||
# $MARIADB_DB_PASS - Generated password (saved to ~/[appname].creds)
|
||||
```
|
||||
|
||||
### `setup_mysql`
|
||||
|
||||
Install MySQL server.
|
||||
|
||||
```bash
|
||||
setup_mysql
|
||||
```
|
||||
|
||||
### `setup_postgresql`
|
||||
|
||||
Install PostgreSQL server.
|
||||
|
||||
```bash
|
||||
# Default (PostgreSQL 16)
|
||||
setup_postgresql
|
||||
|
||||
# Specific version
|
||||
PG_VERSION="16" setup_postgresql
|
||||
PG_VERSION="16" setup_postgresql
|
||||
```
|
||||
|
||||
### `setup_postgresql_db`
|
||||
|
||||
Create a PostgreSQL database and user. Sets `$PG_DB_PASS` with the generated password.
|
||||
|
||||
```bash
|
||||
PG_VERSION="17" setup_postgresql
|
||||
PG_DB_NAME="myapp_db" PG_DB_USER="myapp_user" setup_postgresql_db
|
||||
|
||||
# After calling, these variables are available:
|
||||
# $PG_DB_NAME - Database name
|
||||
# $PG_DB_USER - Database user
|
||||
# $PG_DB_PASS - Generated password (saved to ~/[appname].creds)
|
||||
```
|
||||
|
||||
### `setup_mongodb`
|
||||
|
||||
Install MongoDB server.
|
||||
|
||||
```bash
|
||||
setup_mongodb
|
||||
```
|
||||
|
||||
### `setup_clickhouse`
|
||||
|
||||
Install ClickHouse analytics database.
|
||||
|
||||
```bash
|
||||
setup_clickhouse
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Advanced Repository Management
|
||||
|
||||
### `setup_deb822_repo`
|
||||
|
||||
The modern standard (Debian 12+) for adding external repositories. Automatically handles GPG keys and sources.
|
||||
|
||||
```bash
|
||||
setup_deb822_repo \
|
||||
"nodejs" \
|
||||
"https://deb.nodesource.com/gpgkey/nodesource.gpg.key" \
|
||||
"https://deb.nodesource.com/node_22.x" \
|
||||
"bookworm" \
|
||||
"main"
|
||||
```
|
||||
|
||||
### `prepare_repository_setup`
|
||||
|
||||
A high-level helper that performs three critical tasks before adding a new repo:
|
||||
1. Cleans up old repo files matching the names provided.
|
||||
2. Removes old GPG keyrings from all standard locations.
|
||||
3. Ensures APT is in a working state (fixes locks, runs update).
|
||||
|
||||
```bash
|
||||
# Clean up old mysql/mariadb artifacts before setup
|
||||
prepare_repository_setup "mariadb" "mysql"
|
||||
```
|
||||
|
||||
### `cleanup_tool_keyrings`
|
||||
|
||||
Force-removes GPG keys for specific tools from `/usr/share/keyrings/`, `/etc/apt/keyrings/`, and `/etc/apt/trusted.gpg.d/`.
|
||||
|
||||
```bash
|
||||
cleanup_tool_keyrings "docker" "kubernetes"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## GitHub Release Helpers
|
||||
|
||||
> **Note**: `fetch_and_deploy_gh_release` is the **preferred method** for downloading GitHub releases. It handles version tracking automatically. Only use `get_latest_github_release` if you need the version number separately.
|
||||
|
||||
### `fetch_and_deploy_gh_release`
|
||||
|
||||
**Primary method** for downloading and extracting GitHub releases. Handles version tracking automatically.
|
||||
|
||||
```bash
|
||||
# Basic usage - downloads tarball to /opt/appname
|
||||
fetch_and_deploy_gh_release "appname" "owner/repo"
|
||||
|
||||
# With explicit parameters
|
||||
fetch_and_deploy_gh_release "appname" "owner/repo" "tarball" "latest" "/opt/appname"
|
||||
|
||||
# Pre-built release with specific asset pattern
|
||||
fetch_and_deploy_gh_release "koel" "koel/koel" "prebuild" "latest" "/opt/koel" "koel-*.tar.gz"
|
||||
|
||||
# Clean install (removes old directory first) - used in update_script
|
||||
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "appname" "owner/repo" "tarball" "latest" "/opt/appname"
|
||||
```
|
||||
|
||||
**Parameters:**
|
||||
| Parameter | Default | Description |
|
||||
| --------------- | ------------- | ----------------------------------------------------------------- |
|
||||
| `name` | required | App name (for version tracking) |
|
||||
| `repo` | required | GitHub repo (`owner/repo`) |
|
||||
| `type` | `tarball` | Release type: `tarball`, `zipball`, `prebuild`, `binary` |
|
||||
| `version` | `latest` | Version tag or `latest` |
|
||||
| `dest` | `/opt/[name]` | Destination directory |
|
||||
| `asset_pattern` | `""` | For `prebuild`: glob pattern to match asset (e.g. `app-*.tar.gz`) |
|
||||
|
||||
**Environment Variables:**
|
||||
| Variable | Description |
|
||||
| ----------------- | ------------------------------------------------------------ |
|
||||
| `CLEAN_INSTALL=1` | Remove destination directory before extracting (for updates) |
|
||||
|
||||
### `check_for_gh_release`
|
||||
|
||||
Check if a newer version is available. Returns 0 if update needed, 1 if already at latest. **Use in `update_script()` function.**
|
||||
|
||||
```bash
|
||||
# In update_script() function in ct/appname.sh
|
||||
if check_for_gh_release "appname" "owner/repo"; then
|
||||
msg_info "Updating..."
|
||||
# Stop services, backup, update, restore, start
|
||||
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "appname" "owner/repo"
|
||||
msg_ok "Updated successfully!"
|
||||
fi
|
||||
```
|
||||
|
||||
### `get_latest_github_release`
|
||||
|
||||
Get the latest release version from a GitHub repository. **Only use if you need the version number separately** (e.g., for manual download or display).
|
||||
|
||||
```bash
|
||||
RELEASE=$(get_latest_github_release "owner/repo")
|
||||
echo "Latest version: $RELEASE"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Tools & Utilities
|
||||
|
||||
### `setup_meilisearch`
|
||||
|
||||
Install Meilisearch, a lightning-fast search engine.
|
||||
|
||||
```bash
|
||||
setup_meilisearch
|
||||
|
||||
# Use in script
|
||||
$STD php artisan scout:sync-index-settings
|
||||
```
|
||||
|
||||
### `setup_yq`
|
||||
|
||||
Install yq YAML processor.
|
||||
|
||||
```bash
|
||||
setup_yq
|
||||
|
||||
# Use in script
|
||||
yq '.server.port = 8080' -i config.yaml
|
||||
````
|
||||
|
||||
### `setup_ffmpeg`
|
||||
|
||||
Install FFmpeg with common codecs.
|
||||
|
||||
```bash
|
||||
setup_ffmpeg
|
||||
```
|
||||
|
||||
### `setup_hwaccel`
|
||||
|
||||
Setup GPU hardware acceleration (Intel/AMD/NVIDIA).
|
||||
|
||||
```bash
|
||||
# Only runs if GPU passthrough is detected (/dev/dri, /dev/nvidia0, /dev/kfd)
|
||||
setup_hwaccel
|
||||
```
|
||||
|
||||
### `setup_imagemagick`
|
||||
|
||||
Install ImageMagick 7 from source.
|
||||
|
||||
```bash
|
||||
setup_imagemagick
|
||||
```
|
||||
|
||||
### `setup_docker`
|
||||
|
||||
Install Docker Engine.
|
||||
|
||||
```bash
|
||||
setup_docker
|
||||
```
|
||||
|
||||
### `setup_adminer`
|
||||
|
||||
Install Adminer for database management.
|
||||
|
||||
```bash
|
||||
setup_mariadb
|
||||
setup_adminer
|
||||
|
||||
# Access at http://IP/adminer
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## SSL/TLS
|
||||
|
||||
### `create_self_signed_cert`
|
||||
|
||||
Create a self-signed SSL certificate.
|
||||
|
||||
```bash
|
||||
create_self_signed_cert
|
||||
|
||||
# Creates files at:
|
||||
# /etc/ssl/[appname]/[appname].key
|
||||
# /etc/ssl/[appname]/[appname].crt
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Utility Functions
|
||||
|
||||
### `verify_tool_version`
|
||||
|
||||
Validate that the installed major version matches the expected version. Useful during upgrades or troubleshooting.
|
||||
|
||||
```bash
|
||||
# Verify Node.js is version 22
|
||||
verify_tool_version "nodejs" "22" "$(node -v | grep -oP '^v\K[0-9]+')"
|
||||
```
|
||||
|
||||
### `get_lxc_ip`
|
||||
|
||||
Set the `$LOCAL_IP` variable with the container's IP address.
|
||||
|
||||
```bash
|
||||
get_lxc_ip
|
||||
echo "Container IP: $LOCAL_IP"
|
||||
|
||||
# Use in config files
|
||||
sed -i "s/localhost/$LOCAL_IP/g" /opt/myapp/config.yaml
|
||||
```
|
||||
|
||||
### `ensure_dependencies`
|
||||
|
||||
Ensure packages are installed (installs if missing).
|
||||
|
||||
```bash
|
||||
ensure_dependencies "jq" "unzip" "curl"
|
||||
```
|
||||
|
||||
### `msg_info` / `msg_ok` / `msg_error` / `msg_warn`
|
||||
|
||||
Display formatted messages.
|
||||
|
||||
```bash
|
||||
msg_info "Installing application..."
|
||||
# ... do work ...
|
||||
msg_ok "Installation complete"
|
||||
|
||||
msg_warn "Optional feature not available"
|
||||
msg_error "Installation failed"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Package Management
|
||||
|
||||
### `cleanup_lxc`
|
||||
|
||||
Final cleanup function - call at end of install script.
|
||||
|
||||
```bash
|
||||
# At the end of your install script
|
||||
motd_ssh
|
||||
customize
|
||||
cleanup_lxc # Handles autoremove, autoclean, cache cleanup
|
||||
```
|
||||
|
||||
### `install_packages_with_retry`
|
||||
|
||||
Install packages with automatic retry on failure.
|
||||
|
||||
```bash
|
||||
install_packages_with_retry "package1" "package2" "package3"
|
||||
```
|
||||
|
||||
### `prepare_repository_setup`
|
||||
|
||||
Prepare system for adding new repositories (cleanup old repos, keyrings).
|
||||
|
||||
```bash
|
||||
prepare_repository_setup "mariadb" "mysql"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Complete Examples
|
||||
|
||||
### Example 1: Node.js App with PostgreSQL (install script)
|
||||
|
||||
```bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2026 community-scripts ORG
|
||||
# Author: YourUsername
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://github.com/example/myapp
|
||||
|
||||
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
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
# Setup runtimes and databases FIRST
|
||||
NODE_VERSION="22" setup_nodejs
|
||||
PG_VERSION="16" setup_postgresql
|
||||
PG_DB_NAME="myapp" PG_DB_USER="myapp" setup_postgresql_db
|
||||
get_lxc_ip
|
||||
|
||||
# Download app using fetch_and_deploy (handles version tracking)
|
||||
fetch_and_deploy_gh_release "myapp" "example/myapp" "tarball" "latest" "/opt/myapp"
|
||||
|
||||
msg_info "Setting up MyApp"
|
||||
cd /opt/myapp
|
||||
$STD npm ci --production
|
||||
msg_ok "Setup MyApp"
|
||||
|
||||
msg_info "Configuring MyApp"
|
||||
cat <<EOF >/opt/myapp/.env
|
||||
DATABASE_URL=postgresql://${PG_DB_USER}:${PG_DB_PASS}@localhost/${PG_DB_NAME}
|
||||
HOST=${LOCAL_IP}
|
||||
PORT=3000
|
||||
EOF
|
||||
msg_ok "Configured MyApp"
|
||||
|
||||
msg_info "Creating Service"
|
||||
cat <<EOF >/etc/systemd/system/myapp.service
|
||||
[Unit]
|
||||
Description=MyApp
|
||||
After=network.target postgresql.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
WorkingDirectory=/opt/myapp
|
||||
ExecStart=/usr/bin/node /opt/myapp/server.js
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl enable -q --now myapp
|
||||
msg_ok "Created Service"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
cleanup_lxc
|
||||
```
|
||||
|
||||
### Example 2: Matching Container Script (ct script)
|
||||
|
||||
```bash
|
||||
#!/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: YourUsername
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://github.com/example/myapp
|
||||
|
||||
APP="MyApp"
|
||||
var_tags="${var_tags:-webapp}"
|
||||
var_cpu="${var_cpu:-2}"
|
||||
var_ram="${var_ram:-2048}"
|
||||
var_disk="${var_disk:-6}"
|
||||
var_os="${var_os:-debian}"
|
||||
var_version="${var_version:-12}"
|
||||
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/myapp ]]; then
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
fi
|
||||
|
||||
# check_for_gh_release returns true if update available
|
||||
if check_for_gh_release "myapp" "example/myapp"; then
|
||||
msg_info "Stopping Service"
|
||||
systemctl stop myapp
|
||||
msg_ok "Stopped Service"
|
||||
|
||||
msg_info "Creating Backup"
|
||||
cp /opt/myapp/.env /tmp/myapp_env.bak
|
||||
msg_ok "Created Backup"
|
||||
|
||||
# CLEAN_INSTALL=1 removes old dir before extracting
|
||||
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "myapp" "example/myapp" "tarball" "latest" "/opt/myapp"
|
||||
|
||||
msg_info "Restoring Config & Rebuilding"
|
||||
cp /tmp/myapp_env.bak /opt/myapp/.env
|
||||
rm /tmp/myapp_env.bak
|
||||
cd /opt/myapp
|
||||
$STD npm ci --production
|
||||
msg_ok "Restored Config & Rebuilt"
|
||||
|
||||
msg_info "Starting Service"
|
||||
systemctl start myapp
|
||||
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 "${TAB}${GATEWAY}${BGN}http://${IP}:3000${CL}"
|
||||
```
|
||||
|
||||
### Example 3: PHP App with MariaDB (install script)
|
||||
|
||||
```bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
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
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
# PHP with FPM and common modules
|
||||
PHP_VERSION="8.4" PHP_FPM="YES" PHP_MODULE="bcmath,curl,gd,intl,mbstring,mysql,xml,zip" setup_php
|
||||
setup_composer
|
||||
setup_mariadb
|
||||
MARIADB_DB_NAME="myapp" MARIADB_DB_USER="myapp" setup_mariadb_db
|
||||
get_lxc_ip
|
||||
|
||||
# Download pre-built release (with asset pattern)
|
||||
fetch_and_deploy_gh_release "myapp" "example/myapp" "prebuild" "latest" "/opt/myapp" "myapp-*.tar.gz"
|
||||
|
||||
msg_info "Configuring MyApp"
|
||||
cd /opt/myapp
|
||||
cp .env.example .env
|
||||
sed -i "s|APP_URL=.*|APP_URL=http://${LOCAL_IP}|" .env
|
||||
sed -i "s|DB_DATABASE=.*|DB_DATABASE=${MARIADB_DB_NAME}|" .env
|
||||
sed -i "s|DB_USERNAME=.*|DB_USERNAME=${MARIADB_DB_USER}|" .env
|
||||
sed -i "s|DB_PASSWORD=.*|DB_PASSWORD=${MARIADB_DB_PASS}|" .env
|
||||
$STD composer install --no-dev --no-interaction
|
||||
$STD php artisan key:generate --force
|
||||
$STD php artisan migrate --force
|
||||
chown -R www-data:www-data /opt/myapp
|
||||
msg_ok "Configured MyApp"
|
||||
|
||||
# ... nginx config, service creation ...
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
cleanup_lxc
|
||||
```
|
||||
@@ -1,654 +0,0 @@
|
||||
# 🤝 Contributing to ProxmoxVE
|
||||
|
||||
Complete guide to contributing to the ProxmoxVE project - from your first fork to submitting your pull request.
|
||||
|
||||
---
|
||||
|
||||
## 📋 Table of Contents
|
||||
|
||||
- [Quick Start](#quick-start)
|
||||
- [Setting Up Your Fork](#setting-up-your-fork)
|
||||
- [Coding Standards](#coding-standards)
|
||||
- [Code Audit](#code-audit)
|
||||
- [Guides & Resources](#guides--resources)
|
||||
- [FAQ](#faq)
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Quick Start
|
||||
|
||||
### 60 Seconds to Contributing (Development)
|
||||
|
||||
When developing and testing **in your fork**:
|
||||
|
||||
```bash
|
||||
# 1. Fork on GitHub
|
||||
# Visit: https://github.com/community-scripts/ProxmoxVE → Fork (top right)
|
||||
|
||||
# 2. Clone your fork
|
||||
git clone https://github.com/YOUR_USERNAME/ProxmoxVE.git
|
||||
cd ProxmoxVE
|
||||
|
||||
# 3. Auto-configure your fork (IMPORTANT - updates all links!)
|
||||
bash docs/contribution/setup-fork.sh --full
|
||||
|
||||
# 4. Create a feature branch
|
||||
git checkout -b feature/my-awesome-app
|
||||
|
||||
# 5. Read the guides
|
||||
cat docs/README.md # Documentation overview
|
||||
cat docs/ct/DETAILED_GUIDE.md # For container scripts
|
||||
cat docs/install/DETAILED_GUIDE.md # For install scripts
|
||||
|
||||
# 6. Create your contribution
|
||||
cp docs/contribution/templates_ct/AppName.sh ct/myapp.sh
|
||||
cp docs/contribution/templates_install/AppName-install.sh install/myapp-install.sh
|
||||
# ... edit files ...
|
||||
|
||||
# 7. Push to your fork and test via GitHub
|
||||
git push origin feature/my-awesome-app
|
||||
bash -c "$(curl -fsSL https://raw.githubusercontent.com/YOUR_USERNAME/ProxmoxVE/main/ct/myapp.sh)"
|
||||
# ⏱️ GitHub may take 10-30 seconds to update files - be patient!
|
||||
|
||||
# 8. Request website metadata via the website
|
||||
# Go to the script's page on the website, use the "Report issue" button — it will guide you.
|
||||
|
||||
# 9. No direct install-script test
|
||||
# Install scripts are executed by the CT script inside the container
|
||||
|
||||
# 10. Commit ONLY your new files (see Cherry-Pick section below!)
|
||||
git add ct/myapp.sh install/myapp-install.sh
|
||||
git commit -m "feat: add MyApp container and install scripts"
|
||||
git push origin feature/my-awesome-app
|
||||
|
||||
# 11. Create Pull Request on GitHub
|
||||
```
|
||||
|
||||
⚠️ **IMPORTANT: After setup-fork.sh, many files are modified!**
|
||||
|
||||
See the **Cherry-Pick: Submitting Only Your Changes** section below to learn how to push ONLY your 2 files instead of 600+ modified files!
|
||||
|
||||
### How Users Run Scripts (After Merged)
|
||||
|
||||
Once your script is merged to the main repository, users download and run it from GitHub like this:
|
||||
|
||||
```bash
|
||||
# ✅ Users run from GitHub (normal usage after PR merged)
|
||||
bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/myapp.sh)"
|
||||
|
||||
# Install scripts are called by the CT script and are not run directly by users
|
||||
```
|
||||
|
||||
### Development vs. Production Execution
|
||||
|
||||
**During Development (you, in your fork):**
|
||||
|
||||
```bash
|
||||
# You MUST test via curl from your GitHub fork (not local files!)
|
||||
bash -c "$(curl -fsSL https://raw.githubusercontent.com/YOUR_USERNAME/ProxmoxVE/main/ct/myapp.sh)"
|
||||
|
||||
# The script's curl commands are updated by setup-fork.sh to point to YOUR fork
|
||||
# This ensures you're testing your actual changes
|
||||
# ⏱️ Wait 10-30 seconds after pushing - GitHub updates slowly
|
||||
```
|
||||
|
||||
**After Merge (users, from GitHub):**
|
||||
|
||||
```bash
|
||||
# Users download the script from upstream via curl
|
||||
bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/myapp.sh)"
|
||||
|
||||
# The script's curl commands now point back to upstream (community-scripts)
|
||||
# This is the stable, tested version
|
||||
```
|
||||
|
||||
**Summary:**
|
||||
|
||||
- **Development**: Push to fork, test via curl → setup-fork.sh changes curl URLs to your fork
|
||||
- **Production**: curl | bash from upstream → curl URLs point to community-scripts repo
|
||||
|
||||
---
|
||||
|
||||
## 🍴 Setting Up Your Fork
|
||||
|
||||
### Automatic Setup (Recommended)
|
||||
|
||||
When you clone your fork, run the setup script to automatically configure everything:
|
||||
|
||||
```bash
|
||||
bash docs/contribution/setup-fork.sh --full
|
||||
```
|
||||
|
||||
**What it does:**
|
||||
|
||||
- Auto-detects your GitHub username from git config
|
||||
- Auto-detects your fork repository name
|
||||
- Updates **ALL** hardcoded links to point to your fork instead of the main repo (`--full`)
|
||||
- Creates `.git-setup-info` with your configuration
|
||||
- Allows you to develop and test independently in your fork
|
||||
|
||||
**Why this matters:**
|
||||
|
||||
Without running this script, all links in your fork will still point to the upstream repository (community-scripts). This is a problem when testing because:
|
||||
|
||||
- Installation links will pull from upstream, not your fork
|
||||
- Updates will target the wrong repository
|
||||
- Your contributions won't be properly tested
|
||||
|
||||
**After running setup-fork.sh:**
|
||||
|
||||
Your fork is fully configured and ready to develop. You can:
|
||||
|
||||
- Push changes to your fork
|
||||
- Test via curl: `bash -c "$(curl -fsSL https://raw.githubusercontent.com/YOUR_USERNAME/ProxmoxVE/main/ct/myapp.sh)"`
|
||||
- All links will reference your fork for development
|
||||
- ⏱️ Wait 10-30 seconds after pushing - GitHub takes time to update
|
||||
- Commit and push with confidence
|
||||
- Create a PR to merge into upstream
|
||||
|
||||
**See**: [FORK_SETUP.md](FORK_SETUP.md) for detailed instructions
|
||||
|
||||
### Manual Setup
|
||||
|
||||
If the script doesn't work, manually configure:
|
||||
|
||||
```bash
|
||||
# Set git user
|
||||
git config user.name "Your Name"
|
||||
git config user.email "your.email@example.com"
|
||||
|
||||
# Add upstream remote for syncing with main repo
|
||||
git remote add upstream https://github.com/community-scripts/ProxmoxVE.git
|
||||
|
||||
# Verify remotes
|
||||
git remote -v
|
||||
# Should show: origin (your fork) and upstream (main repo)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📖 Coding Standards
|
||||
|
||||
All scripts and configurations must follow our coding standards to ensure consistency and quality.
|
||||
|
||||
### Available Guides
|
||||
|
||||
- **[CONTRIBUTING.md](CONTRIBUTING.md)** - Essential coding standards and best practices
|
||||
- **[CODE-AUDIT.md](CODE-AUDIT.md)** - Code review checklist and audit procedures
|
||||
- **[GUIDE.md](GUIDE.md)** - Comprehensive contribution guide
|
||||
- **[HELPER_FUNCTIONS.md](HELPER_FUNCTIONS.md)** - Reference for all tools.func helper functions
|
||||
- **Container Scripts** - `/ct/` templates and guidelines
|
||||
- **Install Scripts** - `/install/` templates and guidelines
|
||||
- **Website metadata** – Request via the website (Report issue on the script page); see [templates_json/AppName.md](templates_json/AppName.md)
|
||||
|
||||
### Quick Checklist
|
||||
|
||||
- ✅ Use `/ct/example.sh` as template for container scripts
|
||||
- ✅ Use `/install/example-install.sh` as template for install scripts
|
||||
- ✅ Follow naming conventions: `appname.sh` and `appname-install.sh`
|
||||
- ✅ Include proper shebang: `#!/usr/bin/env bash`
|
||||
- ✅ Add copyright header with author
|
||||
- ✅ Handle errors properly with `msg_error`, `msg_ok`, etc.
|
||||
- ✅ Test before submitting PR (via curl from your fork, not local bash)
|
||||
- ✅ Update documentation if needed
|
||||
|
||||
---
|
||||
|
||||
## 🔍 Code Audit
|
||||
|
||||
Before submitting a pull request, ensure your code passes our audit:
|
||||
|
||||
**See**: [CODE_AUDIT.md](CODE_AUDIT.md) for complete audit checklist
|
||||
|
||||
Key points:
|
||||
|
||||
- Code consistency with existing scripts
|
||||
- Proper error handling
|
||||
- Correct variable naming
|
||||
- Adequate comments and documentation
|
||||
- Security best practices
|
||||
|
||||
---
|
||||
|
||||
## 🍒 Cherry-Pick: Submitting Only Your Changes
|
||||
|
||||
**Problem**: `setup-fork.sh` modifies 600+ files to update links. You don't want to submit all of those changes - only your new 2 files!
|
||||
|
||||
**Solution**: Use git cherry-pick to select only YOUR files.
|
||||
|
||||
### Step-by-Step Cherry-Pick Guide
|
||||
|
||||
#### 1. Check what changed
|
||||
|
||||
```bash
|
||||
# See all modified files
|
||||
git status
|
||||
|
||||
# Verify your files are there
|
||||
git status | grep -E "ct/myapp|install/myapp"
|
||||
```
|
||||
|
||||
#### 2. Create a clean feature branch for submission
|
||||
|
||||
```bash
|
||||
# Go back to upstream main (clean slate)
|
||||
git fetch upstream
|
||||
git checkout -b submit/myapp upstream/main
|
||||
|
||||
# Don't use your modified main branch!
|
||||
```
|
||||
|
||||
#### 3. Cherry-pick ONLY your files
|
||||
|
||||
Cherry-picking extracts specific changes from commits:
|
||||
|
||||
```bash
|
||||
# Option A: Cherry-pick commits that added your files
|
||||
# (if you committed your files separately)
|
||||
git cherry-pick <commit-hash-of-your-files>
|
||||
|
||||
# Option B: Manually copy and commit only your files
|
||||
# From your work branch, get the file contents
|
||||
git show feature/my-awesome-app:ct/myapp.sh > /tmp/myapp.sh
|
||||
git show feature/my-awesome-app:install/myapp-install.sh > /tmp/myapp-install.sh
|
||||
|
||||
# Add them to the clean branch
|
||||
cp /tmp/myapp.sh ct/myapp.sh
|
||||
cp /tmp/myapp-install.sh install/myapp-install.sh
|
||||
|
||||
# Commit
|
||||
git add ct/myapp.sh install/myapp-install.sh
|
||||
git commit -m "feat: add MyApp"
|
||||
```
|
||||
|
||||
#### 4. Verify only your files are in the PR
|
||||
|
||||
```bash
|
||||
# Check git diff against upstream
|
||||
git diff upstream/main --name-only
|
||||
# Should show ONLY:
|
||||
# ct/myapp.sh
|
||||
# install/myapp-install.sh
|
||||
```
|
||||
|
||||
#### 5. Push and create PR
|
||||
|
||||
```bash
|
||||
# Push your clean submission branch
|
||||
git push origin submit/myapp
|
||||
|
||||
# Create PR on GitHub from: submit/myapp → main
|
||||
```
|
||||
|
||||
### Why This Matters
|
||||
|
||||
- ✅ Clean PR with only your changes
|
||||
- ✅ Easier for maintainers to review
|
||||
- ✅ Faster merge without conflicts
|
||||
- ❌ Without cherry-pick: PR has 600+ file changes (won't merge!)
|
||||
|
||||
### If You Made a Mistake
|
||||
|
||||
```bash
|
||||
# Delete the messy branch
|
||||
git branch -D submit/myapp
|
||||
|
||||
# Go back to clean branch
|
||||
git checkout -b submit/myapp upstream/main
|
||||
|
||||
# Try cherry-picking again
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
If you're using **Visual Studio Code** with an AI assistant, you can leverage our detailed guidelines to generate high-quality contributions automatically.
|
||||
|
||||
### How to Use AI Assistance
|
||||
|
||||
1. **Open the AI Guidelines**
|
||||
|
||||
```
|
||||
docs/contribution/AI.md
|
||||
```
|
||||
|
||||
This file contains all requirements, patterns, and examples for writing proper scripts.
|
||||
|
||||
2. **Prepare Your Information**
|
||||
|
||||
Before asking the AI to generate code, gather:
|
||||
- **Repository URL**: e.g., `https://github.com/owner/myapp`
|
||||
- **Dockerfile/Script**: Paste the app's installation instructions (if available)
|
||||
- **Dependencies**: What packages does it need? (Node, Python, Java, PostgreSQL, etc.)
|
||||
- **Ports**: What port does it listen on? (e.g., 3000, 8080, 5000)
|
||||
- **Configuration**: Any environment variables or config files?
|
||||
|
||||
3. **Tell the AI Assistant**
|
||||
|
||||
Share with the AI:
|
||||
- The repository URL
|
||||
- The Dockerfile or install instructions
|
||||
- Link to [docs/contribution/AI.md](AI.md) with instructions to follow
|
||||
|
||||
**Example prompt:**
|
||||
|
||||
```
|
||||
I want to contribute a container script for MyApp to ProxmoxVE.
|
||||
Repository: https://github.com/owner/myapp
|
||||
|
||||
Here's the Dockerfile:
|
||||
[paste Dockerfile content]
|
||||
|
||||
Please follow the guidelines in docs/contribution/AI.md to create:
|
||||
1. ct/myapp.sh (container script)
|
||||
2. install/myapp-install.sh (installation script)
|
||||
|
||||
Website listing/metadata is requested separately via the website (Report issue on the script page).
|
||||
```
|
||||
|
||||
4. **AI Will Generate**
|
||||
|
||||
The AI will produce scripts that:
|
||||
- Follow all ProxmoxVE patterns and conventions
|
||||
- Use helper functions from `tools.func` correctly
|
||||
- Include proper error handling and messages
|
||||
- Have correct update mechanisms
|
||||
- Are ready to submit as a PR
|
||||
|
||||
Website listing/metadata is requested separately via the website (Report issue on the script page).
|
||||
|
||||
### Key Points for AI Assistants
|
||||
|
||||
- **Templates Location**: `docs/contribution/templates_ct/AppName.sh`, `templates_install/`, `templates_json/`
|
||||
- **Guidelines**: Must follow `docs/contribution/AI.md` exactly
|
||||
- **Helper Functions**: Use only functions from `misc/tools.func` - never write custom ones
|
||||
- **Testing**: Always test before submission via curl from your fork
|
||||
```bash
|
||||
bash -c "$(curl -fsSL https://raw.githubusercontent.com/YOUR_USERNAME/ProxmoxVE/main/ct/myapp.sh)"
|
||||
# Wait 10-30 seconds after pushing changes
|
||||
```
|
||||
- **No Docker**: Container scripts must be bare-metal, not Docker-based
|
||||
|
||||
### Benefits
|
||||
|
||||
- **Speed**: AI generates boilerplate in seconds
|
||||
- **Consistency**: Follows same patterns as 200+ existing scripts
|
||||
- **Quality**: Less bugs and more maintainable code
|
||||
- **Learning**: See how your app should be structured
|
||||
|
||||
---
|
||||
|
||||
### Documentation
|
||||
|
||||
- **[docs/README.md](../README.md)** - Main documentation hub
|
||||
- **[docs/ct/README.md](../ct/README.md)** - Container scripts overview
|
||||
- **[docs/install/README.md](../install/README.md)** - Installation scripts overview
|
||||
- **[docs/ct/DETAILED_GUIDE.md](../ct/DETAILED_GUIDE.md)** - Complete ct/ script reference
|
||||
- **[docs/install/DETAILED_GUIDE.md](../install/DETAILED_GUIDE.md)** - Complete install/ script reference
|
||||
- **[docs/TECHNICAL_REFERENCE.md](../TECHNICAL_REFERENCE.md)** - Architecture deep-dive
|
||||
- **[docs/EXIT_CODES.md](../EXIT_CODES.md)** - Exit codes reference
|
||||
- **[docs/DEV_MODE.md](../DEV_MODE.md)** - Debugging guide
|
||||
|
||||
### Community Guides
|
||||
|
||||
See [USER_SUBMITTED_GUIDES.md](USER_SUBMITTED_GUIDES.md) for excellent community-written guides:
|
||||
|
||||
- Home Assistant installation and configuration
|
||||
- Frigate setup on Proxmox
|
||||
- Docker and Portainer installation
|
||||
- Database setup and optimization
|
||||
- And many more!
|
||||
|
||||
### Templates
|
||||
|
||||
Use these templates when creating new scripts:
|
||||
|
||||
```bash
|
||||
# Container script template
|
||||
cp docs/contribution/templates_ct/AppName.sh ct/my-app.sh
|
||||
|
||||
# Installation script template
|
||||
cp docs/contribution/templates_install/AppName-install.sh install/my-app-install.sh
|
||||
```
|
||||
|
||||
For website metadata (description, logo, etc.), use the Report issue button on the script's page on the website.
|
||||
|
||||
**Template Features:**
|
||||
|
||||
- Updated to match current codebase patterns
|
||||
- Includes all available helper functions from `tools.func`
|
||||
- Examples for Node.js, Python, PHP, Go applications
|
||||
- Database setup examples (MariaDB, PostgreSQL)
|
||||
- Proper service creation and cleanup
|
||||
|
||||
---
|
||||
|
||||
## 🔄 Git Workflow
|
||||
|
||||
### Keep Your Fork Updated
|
||||
|
||||
```bash
|
||||
# Fetch latest from upstream
|
||||
git fetch upstream
|
||||
|
||||
# Rebase your work on latest main
|
||||
git rebase upstream/main
|
||||
|
||||
# Push to your fork
|
||||
git push -f origin main
|
||||
```
|
||||
|
||||
### Create Feature Branch
|
||||
|
||||
```bash
|
||||
# Create and switch to new branch
|
||||
git checkout -b feature/my-feature
|
||||
|
||||
# Make changes...
|
||||
git add .
|
||||
git commit -m "feat: description of changes"
|
||||
|
||||
# Push to your fork
|
||||
git push origin feature/my-feature
|
||||
|
||||
# Create Pull Request on GitHub
|
||||
```
|
||||
|
||||
### Before Submitting PR
|
||||
|
||||
1. **Sync with upstream**
|
||||
|
||||
```bash
|
||||
git fetch upstream
|
||||
git rebase upstream/main
|
||||
```
|
||||
|
||||
2. **Test your changes** (via curl from your fork)
|
||||
|
||||
```bash
|
||||
bash -c "$(curl -fsSL https://raw.githubusercontent.com/YOUR_USERNAME/ProxmoxVE/main/ct/my-app.sh)"
|
||||
# Follow prompts and test the container
|
||||
# ⏱️ Wait 10-30 seconds after pushing - GitHub takes time to update
|
||||
```
|
||||
|
||||
3. **Check code standards**
|
||||
- [ ] Follows template structure
|
||||
- [ ] Proper error handling
|
||||
- [ ] Documentation updated (if needed)
|
||||
- [ ] No hardcoded values
|
||||
- [ ] Version tracking implemented
|
||||
|
||||
4. **Push final changes**
|
||||
```bash
|
||||
git push origin feature/my-feature
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📋 Pull Request Checklist
|
||||
|
||||
Before opening a PR:
|
||||
|
||||
- [ ] Code follows coding standards (see CONTRIBUTING.md)
|
||||
- [ ] All templates used correctly
|
||||
- [ ] Tested on Proxmox VE
|
||||
- [ ] Error handling implemented
|
||||
- [ ] Documentation updated (if applicable)
|
||||
- [ ] No merge conflicts
|
||||
- [ ] Synced with upstream/main
|
||||
- [ ] Clear PR title and description
|
||||
|
||||
---
|
||||
|
||||
## ❓ FAQ
|
||||
|
||||
### ❌ Why can't I test with `bash ct/myapp.sh` locally?
|
||||
|
||||
You might try:
|
||||
|
||||
```bash
|
||||
# ❌ WRONG - This won't test your actual changes!
|
||||
bash ct/myapp.sh
|
||||
./ct/myapp.sh
|
||||
sh ct/myapp.sh
|
||||
```
|
||||
|
||||
**Why this fails:**
|
||||
|
||||
- `bash ct/myapp.sh` uses the LOCAL clone file
|
||||
- The LOCAL file doesn't execute the curl commands - it's already on disk
|
||||
- The curl URLs INSIDE the script are modified by setup-fork.sh, but they're not executed
|
||||
- So you can't verify if your curl URLs actually work
|
||||
- Users will get the curl URL version (which may be broken)
|
||||
|
||||
**Solution:** Always test via curl from GitHub:
|
||||
|
||||
```bash
|
||||
# ✅ CORRECT - Tests the actual GitHub URLs
|
||||
bash -c "$(curl -fsSL https://raw.githubusercontent.com/YOUR_USERNAME/ProxmoxVE/main/ct/myapp.sh)"
|
||||
```
|
||||
|
||||
### ❓ How do I test my changes?
|
||||
|
||||
You **cannot** test locally with `bash ct/myapp.sh` from your cloned directory!
|
||||
|
||||
You **must** push to GitHub and test via curl from your fork:
|
||||
|
||||
```bash
|
||||
# 1. Push your changes to your fork
|
||||
git push origin feature/my-awesome-app
|
||||
|
||||
# 2. Test via curl (this loads the script from GitHub, not local files)
|
||||
bash -c "$(curl -fsSL https://raw.githubusercontent.com/YOUR_USERNAME/ProxmoxVE/main/ct/my-app.sh)"
|
||||
|
||||
# 3. For verbose/debug output, pass environment variables
|
||||
VERBOSE=yes bash -c "$(curl -fsSL https://raw.githubusercontent.com/YOUR_USERNAME/ProxmoxVE/main/ct/my-app.sh)"
|
||||
DEV_MODE_LOGS=true bash -c "$(curl -fsSL https://raw.githubusercontent.com/YOUR_USERNAME/ProxmoxVE/main/ct/my-app.sh)"
|
||||
```
|
||||
|
||||
**Why?**
|
||||
|
||||
- Local `bash ct/myapp.sh` uses local files from your clone
|
||||
- But the script's INTERNAL curl commands have been modified by setup-fork.sh to point to your fork
|
||||
- This discrepancy means you're not actually testing the curl URLs
|
||||
- Testing via curl ensures the script downloads from YOUR fork GitHub URLs
|
||||
- ⏱️ **Important:** GitHub takes 10-30 seconds to recognize newly pushed files. Wait before testing!
|
||||
|
||||
**What if local bash worked?**
|
||||
|
||||
You'd be testing local files only, not the actual GitHub URLs that users will download. This means broken curl links wouldn't be caught during testing.
|
||||
|
||||
### What if my PR has conflicts?
|
||||
|
||||
```bash
|
||||
# Sync with upstream main repository
|
||||
git fetch upstream
|
||||
git rebase upstream/main
|
||||
|
||||
# Resolve conflicts in your editor
|
||||
git add .
|
||||
git rebase --continue
|
||||
git push -f origin your-branch
|
||||
```
|
||||
|
||||
### How do I keep my fork updated?
|
||||
|
||||
Two ways:
|
||||
|
||||
**Option 1: Run setup script again**
|
||||
|
||||
```bash
|
||||
bash docs/contribution/setup-fork.sh --full
|
||||
```
|
||||
|
||||
**Option 2: Manual sync**
|
||||
|
||||
```bash
|
||||
git fetch upstream
|
||||
git rebase upstream/main
|
||||
git push -f origin main
|
||||
```
|
||||
|
||||
### Where do I ask questions?
|
||||
|
||||
- **GitHub Issues**: For bugs and feature requests
|
||||
- **GitHub Discussions**: For general questions and ideas
|
||||
- **Discord**: Community-scripts server for real-time chat
|
||||
|
||||
---
|
||||
|
||||
## 🎓 Learning Resources
|
||||
|
||||
### For First-Time Contributors
|
||||
|
||||
1. Read: [docs/README.md](../README.md) - Documentation overview
|
||||
2. Read: [CONTRIBUTING.md](CONTRIBUTING.md) - Essential coding standards
|
||||
3. Choose your path:
|
||||
- Containers → [docs/ct/DETAILED_GUIDE.md](../ct/DETAILED_GUIDE.md)
|
||||
- Installation → [docs/install/DETAILED_GUIDE.md](../install/DETAILED_GUIDE.md)
|
||||
4. Study existing scripts in same category
|
||||
5. Create your contribution
|
||||
|
||||
### For Experienced Developers
|
||||
|
||||
1. Review [CONTRIBUTING.md](CONTRIBUTING.md) - Coding standards
|
||||
2. Review [CODE_AUDIT.md](CODE_AUDIT.md) - Audit checklist
|
||||
3. Check templates in `/docs/contribution/templates_*/`
|
||||
4. Use AI assistants with [AI.md](AI.md) for code generation
|
||||
5. Submit PR with confidence
|
||||
|
||||
### For Using AI Assistants
|
||||
|
||||
See "Using AI Assistants" section above for:
|
||||
|
||||
- How to structure prompts
|
||||
- What information to provide
|
||||
- How to validate AI output
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Ready to Contribute?
|
||||
|
||||
1. **Fork** the repository
|
||||
2. **Clone** your fork and **setup** with `bash docs/contribution/setup-fork.sh --full`
|
||||
3. **Choose** your contribution type (container, installation, tools, etc.)
|
||||
4. **Read** the appropriate detailed guide
|
||||
5. **Create** your feature branch
|
||||
6. **Develop** and **test** your changes
|
||||
7. **Commit** with clear messages
|
||||
8. **Push** to your fork
|
||||
9. **Create** Pull Request
|
||||
|
||||
---
|
||||
|
||||
## 📞 Contact & Support
|
||||
|
||||
- **GitHub**: [community-scripts/ProxmoxVE](https://github.com/community-scripts/ProxmoxVE)
|
||||
- **Issues**: [GitHub Issues](https://github.com/community-scripts/ProxmoxVE/issues)
|
||||
- **Discussions**: [GitHub Discussions](https://github.com/community-scripts/ProxmoxVE/discussions)
|
||||
- **Discord**: [Join Server](https://discord.gg/UHrpNWGwkH)
|
||||
|
||||
---
|
||||
|
||||
**Thank you for contributing to ProxmoxVE!** 🙏
|
||||
|
||||
Your efforts help make Proxmox VE automation accessible to everyone. Happy coding! 🚀
|
||||
@@ -1,336 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
################################################################################
|
||||
# ProxmoxVE Fork Setup Script
|
||||
#
|
||||
# Automatically configures documentation and scripts for your fork
|
||||
# Detects your GitHub username and repository from git config
|
||||
# Updates all hardcoded links to point to your fork
|
||||
#
|
||||
# Usage:
|
||||
# ./setup-fork.sh # Auto-detect from git config (updates misc/ only)
|
||||
# ./setup-fork.sh YOUR_USERNAME # Specify username (updates misc/ only)
|
||||
# ./setup-fork.sh YOUR_USERNAME REPO_NAME # Specify both (updates misc/ only)
|
||||
# ./setup-fork.sh --full # Update all files including ct/, install/, vm/, etc.
|
||||
#
|
||||
# Examples:
|
||||
# ./setup-fork.sh john # Uses john/ProxmoxVE, updates misc/ only
|
||||
# ./setup-fork.sh john my-fork # Uses john/my-fork, updates misc/ only
|
||||
# ./setup-fork.sh --full # Auto-detect + update all files
|
||||
################################################################################
|
||||
|
||||
set -e
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Default values
|
||||
REPO_NAME="ProxmoxVE"
|
||||
USERNAME=""
|
||||
AUTO_DETECT=true
|
||||
UPDATE_ALL=false
|
||||
|
||||
################################################################################
|
||||
# FUNCTIONS
|
||||
################################################################################
|
||||
|
||||
print_header() {
|
||||
echo -e "\n${BLUE}╔════════════════════════════════════════════════════════════╗${NC}"
|
||||
echo -e "${BLUE}║${NC} ProxmoxVE Fork Setup Script"
|
||||
echo -e "${BLUE}║${NC} Configuring for your fork..."
|
||||
echo -e "${BLUE}╚════════════════════════════════════════════════════════════╝${NC}\n"
|
||||
}
|
||||
|
||||
print_info() {
|
||||
echo -e "${BLUE}ℹ${NC} $1"
|
||||
}
|
||||
|
||||
print_success() {
|
||||
echo -e "${GREEN}✓${NC} $1"
|
||||
}
|
||||
|
||||
print_warning() {
|
||||
echo -e "${YELLOW}⚠${NC} $1"
|
||||
}
|
||||
|
||||
print_error() {
|
||||
echo -e "${RED}✗${NC} $1"
|
||||
}
|
||||
|
||||
# Detect username from git remote
|
||||
detect_username() {
|
||||
local remote_url
|
||||
|
||||
# Try to get from origin
|
||||
if ! remote_url=$(git config --get remote.origin.url 2>/dev/null); then
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Extract username from SSH or HTTPS URL
|
||||
if [[ $remote_url =~ git@github.com:([^/]+) ]]; then
|
||||
echo "${BASH_REMATCH[1]}"
|
||||
elif [[ $remote_url =~ github.com/([^/]+) ]]; then
|
||||
echo "${BASH_REMATCH[1]}"
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Detect repo name from git remote
|
||||
detect_repo_name() {
|
||||
local remote_url
|
||||
|
||||
if ! remote_url=$(git config --get remote.origin.url 2>/dev/null); then
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Extract repo name (remove .git if present)
|
||||
if [[ $remote_url =~ /([^/]+?)(.git)?$ ]]; then
|
||||
local repo="${BASH_REMATCH[1]}"
|
||||
echo "${repo%.git}"
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Ask user for confirmation
|
||||
confirm() {
|
||||
local prompt="$1"
|
||||
local response
|
||||
|
||||
echo -ne "${YELLOW}${prompt} (y/n)${NC} "
|
||||
read -r response
|
||||
[[ $response =~ ^[Yy]$ ]]
|
||||
}
|
||||
|
||||
# Update links in files
|
||||
update_links() {
|
||||
local old_repo="community-scripts"
|
||||
local old_name="ProxmoxVE"
|
||||
local new_owner="$1"
|
||||
local new_repo="$2"
|
||||
local files_updated=0
|
||||
|
||||
print_info "Scanning for hardcoded links..."
|
||||
|
||||
# Change to repo root
|
||||
local repo_root=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
|
||||
|
||||
# Determine search path
|
||||
local search_path="$repo_root/misc"
|
||||
if [[ "$UPDATE_ALL" == "true" ]]; then
|
||||
search_path="$repo_root"
|
||||
print_info "Searching all files (--full mode)"
|
||||
else
|
||||
print_info "Searching misc/ directory only (core functions)"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
||||
# Find all files containing the old repo reference
|
||||
while IFS= read -r file; do
|
||||
# Count occurrences
|
||||
local count=$(grep -E -c "(github.com|githubusercontent.com)/$old_repo/$old_name" "$file" 2>/dev/null || echo 0)
|
||||
|
||||
if [[ $count -gt 0 ]]; then
|
||||
# Backup original
|
||||
cp "$file" "$file.backup"
|
||||
|
||||
# Replace links - use different sed syntax for BSD/macOS vs GNU sed
|
||||
if sed --version &>/dev/null 2>&1; then
|
||||
# GNU sed
|
||||
sed -E -i "s@(github.com|githubusercontent.com)/$old_repo/$old_name@\\1/$new_owner/$new_repo@g" "$file"
|
||||
else
|
||||
# BSD sed (macOS)
|
||||
sed -E -i '' "s@(github.com|githubusercontent.com)/$old_repo/$old_name@\\1/$new_owner/$new_repo@g" "$file"
|
||||
fi
|
||||
|
||||
((files_updated++))
|
||||
print_success "Updated $file ($count links)"
|
||||
fi
|
||||
done < <(find "$search_path" -type f \( -name "*.md" -o -name "*.sh" -o -name "*.func" -o -name "*.json" \) -not -path "*/.git/*" 2>/dev/null | xargs grep -E -l "(github.com|githubusercontent.com)/$old_repo/$old_name" 2>/dev/null)
|
||||
|
||||
return $files_updated
|
||||
}
|
||||
|
||||
# Create user git config setup info
|
||||
create_git_setup_info() {
|
||||
local username="$1"
|
||||
|
||||
cat >.git-setup-info <<'EOF'
|
||||
# Git Configuration for ProxmoxVE Development
|
||||
|
||||
## Recommended Git Configuration
|
||||
|
||||
### Set up remotes for easy syncing with upstream:
|
||||
|
||||
```bash
|
||||
# View your current remotes
|
||||
git remote -v
|
||||
|
||||
# If you don't have 'upstream' configured, add it:
|
||||
git remote add upstream https://github.com/community-scripts/ProxmoxVE.git
|
||||
|
||||
# Verify both remotes exist:
|
||||
git remote -v
|
||||
# Should show:
|
||||
# origin https://github.com/YOUR_USERNAME/ProxmoxVE.git (fetch)
|
||||
# origin https://github.com/YOUR_USERNAME/ProxmoxVE.git (push)
|
||||
# upstream https://github.com/community-scripts/ProxmoxVE.git (fetch)
|
||||
# upstream https://github.com/community-scripts/ProxmoxVE.git (push)
|
||||
```
|
||||
|
||||
### Configure Git User (if not done globally)
|
||||
|
||||
```bash
|
||||
git config user.name "Your Name"
|
||||
git config user.email "your.email@example.com"
|
||||
|
||||
# Or configure globally:
|
||||
git config --global user.name "Your Name"
|
||||
git config --global user.email "your.email@example.com"
|
||||
```
|
||||
|
||||
### Useful Git Workflows
|
||||
|
||||
**Keep your fork up-to-date:**
|
||||
```bash
|
||||
git fetch upstream
|
||||
git rebase upstream/main
|
||||
git push origin main
|
||||
```
|
||||
|
||||
**Create feature branch:**
|
||||
```bash
|
||||
git checkout -b feature/my-awesome-app
|
||||
# Make changes...
|
||||
git commit -m "feat: add my awesome app"
|
||||
git push origin feature/my-awesome-app
|
||||
```
|
||||
|
||||
**Pull latest from upstream:**
|
||||
```bash
|
||||
git fetch upstream
|
||||
git merge upstream/main
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
For more help, see: docs/contribution/README.md
|
||||
EOF
|
||||
|
||||
print_success "Created .git-setup-info file"
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# MAIN LOGIC
|
||||
################################################################################
|
||||
|
||||
print_header
|
||||
|
||||
# Parse command line arguments
|
||||
if [[ $# -gt 0 ]]; then
|
||||
# Check for --full flag
|
||||
if [[ "$1" == "--full" ]]; then
|
||||
UPDATE_ALL=true
|
||||
shift # Remove --full from arguments
|
||||
fi
|
||||
|
||||
# Process remaining arguments
|
||||
if [[ $# -gt 0 ]]; then
|
||||
USERNAME="$1"
|
||||
AUTO_DETECT=false
|
||||
|
||||
if [[ $# -gt 1 ]]; then
|
||||
REPO_NAME="$2"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Try auto-detection
|
||||
if [[ -z "$USERNAME" ]]; then
|
||||
if username=$(detect_username); then
|
||||
USERNAME="$username"
|
||||
print_success "Detected GitHub username: $USERNAME"
|
||||
else
|
||||
print_error "Could not auto-detect GitHub username from git config"
|
||||
echo -e "${YELLOW}Please run:${NC}"
|
||||
echo " ./setup-fork.sh YOUR_USERNAME"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Auto-detect repo name if needed
|
||||
if repo_name=$(detect_repo_name); then
|
||||
REPO_NAME="$repo_name"
|
||||
if [[ "$REPO_NAME" != "ProxmoxVE" ]]; then
|
||||
print_info "Detected custom repo name: $REPO_NAME"
|
||||
else
|
||||
print_success "Using default repo name: ProxmoxVE"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Validate inputs
|
||||
if [[ -z "$USERNAME" ]]; then
|
||||
print_error "Username cannot be empty"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "$REPO_NAME" ]]; then
|
||||
print_error "Repository name cannot be empty"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Show what we'll do
|
||||
echo -e "${BLUE}Configuration Summary:${NC}"
|
||||
echo " Repository URL: https://github.com/$USERNAME/$REPO_NAME"
|
||||
if [[ "$UPDATE_ALL" == "true" ]]; then
|
||||
echo " Files to update: ALL files (ct/, install/, vm/, misc/, docs/, etc.)"
|
||||
else
|
||||
echo " Files to update: misc/ directory only (core functions)"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# Ask for confirmation
|
||||
if ! confirm "Apply these changes?"; then
|
||||
print_warning "Setup cancelled"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
||||
# Update all links
|
||||
if update_links "$USERNAME" "$REPO_NAME"; then
|
||||
links_changed=$?
|
||||
print_success "Updated $links_changed files"
|
||||
else
|
||||
print_warning "No links needed updating or some files not found"
|
||||
fi
|
||||
|
||||
# Create git setup info file
|
||||
create_git_setup_info "$USERNAME"
|
||||
|
||||
# Final summary
|
||||
echo ""
|
||||
echo -e "${GREEN}╔════════════════════════════════════════════════════════════╗${NC}"
|
||||
echo -e "${GREEN}║${NC} Fork Setup Complete! ${GREEN}║${NC}"
|
||||
echo -e "${GREEN}╚════════════════════════════════════════════════════════════╝${NC}"
|
||||
echo ""
|
||||
|
||||
print_success "All documentation links updated to point to your fork"
|
||||
print_info "Your fork: https://github.com/$USERNAME/$REPO_NAME"
|
||||
print_info "Upstream: https://github.com/community-scripts/ProxmoxVE"
|
||||
echo ""
|
||||
|
||||
echo -e "${BLUE}Next Steps:${NC}"
|
||||
echo " 1. Review the changes: git diff"
|
||||
echo " 2. Check .git-setup-info for recommended git workflow"
|
||||
echo " 3. Start developing: git checkout -b feature/my-app"
|
||||
echo " 4. Read: docs/contribution/README.md"
|
||||
echo ""
|
||||
|
||||
print_success "Happy contributing! 🚀"
|
||||
@@ -1,278 +0,0 @@
|
||||
# CT Container Scripts - Quick Reference
|
||||
|
||||
> [!WARNING]
|
||||
> **This is legacy documentation.** Refer to the **modern template** at [templates_ct/AppName.sh](AppName.sh) for best practices.
|
||||
>
|
||||
> Current templates use:
|
||||
>
|
||||
> - `tools.func` helpers instead of manual patterns
|
||||
> - `check_for_gh_release` and `fetch_and_deploy_gh_release` from build.func
|
||||
> - Automatic setup-fork.sh configuration
|
||||
|
||||
---
|
||||
|
||||
## Before Creating a Script
|
||||
|
||||
1. **Fork & Clone:**
|
||||
|
||||
```bash
|
||||
git clone https://github.com/YOUR_USERNAME/ProxmoxVE.git
|
||||
cd ProxmoxVE
|
||||
```
|
||||
|
||||
2. **Run setup-fork.sh** (updates all curl URLs to your fork):
|
||||
|
||||
```bash
|
||||
bash docs/contribution/setup-fork.sh
|
||||
```
|
||||
|
||||
3. **Copy the Modern Template:**
|
||||
|
||||
```bash
|
||||
cp templates_ct/AppName.sh ct/MyApp.sh
|
||||
# Edit ct/MyApp.sh with your app details
|
||||
```
|
||||
|
||||
4. **Test Your Script (via GitHub):**
|
||||
|
||||
⚠️ **Important:** You must push to GitHub and test via curl, not `bash ct/MyApp.sh`!
|
||||
|
||||
```bash
|
||||
# Push your changes to your fork first
|
||||
git push origin feature/my-awesome-app
|
||||
|
||||
# Then test via curl (this loads from YOUR fork, not local files)
|
||||
bash -c "$(curl -fsSL https://raw.githubusercontent.com/YOUR_USERNAME/ProxmoxVE/main/ct/MyApp.sh)"
|
||||
```
|
||||
|
||||
> 💡 **Why?** The script's curl commands are modified by setup-fork.sh, but local execution uses local files, not the updated GitHub URLs. Testing via curl ensures your script actually works.
|
||||
>
|
||||
> ⏱️ **Note:** GitHub sometimes takes 10-30 seconds to update files. If you don't see your changes, wait and try again.
|
||||
|
||||
5. **Cherry-Pick for PR** (submit ONLY your 3-4 files):
|
||||
- See [Cherry-Pick Guide](../README.md) for step-by-step git commands
|
||||
|
||||
---
|
||||
|
||||
## Template Structure
|
||||
|
||||
The modern template includes:
|
||||
|
||||
### Header
|
||||
|
||||
```bash
|
||||
#!/usr/bin/env bash
|
||||
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
|
||||
# (Note: setup-fork.sh changes this URL to point to YOUR fork during development)
|
||||
```
|
||||
|
||||
### Metadata
|
||||
|
||||
```bash
|
||||
# Copyright (c) 2021-2026 community-scripts ORG
|
||||
# Author: YourUsername
|
||||
# License: MIT
|
||||
APP="MyApp"
|
||||
var_tags="app-category;foss"
|
||||
var_cpu="2"
|
||||
var_ram="2048"
|
||||
var_disk="4"
|
||||
var_os="alpine"
|
||||
var_version="3.20"
|
||||
var_unprivileged="1"
|
||||
```
|
||||
|
||||
### Core Setup
|
||||
|
||||
```bash
|
||||
header_info "$APP"
|
||||
variables
|
||||
color
|
||||
catch_errors
|
||||
```
|
||||
|
||||
### Update Function
|
||||
|
||||
The modern template provides a standard update pattern:
|
||||
|
||||
```bash
|
||||
function update_script() {
|
||||
header_info
|
||||
check_container_storage
|
||||
check_container_resources
|
||||
|
||||
# Use tools.func helpers:
|
||||
check_for_gh_release "myapp" "owner/repo"
|
||||
fetch_and_deploy_gh_release "myapp" "owner/repo" "tarball" "latest" "/opt/myapp"
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Key Patterns
|
||||
|
||||
### Check for Updates (App Repository)
|
||||
|
||||
Use `check_for_gh_release` with the **app repo**:
|
||||
|
||||
```bash
|
||||
check_for_gh_release "myapp" "owner/repo"
|
||||
```
|
||||
|
||||
### Deploy External App
|
||||
|
||||
Use `fetch_and_deploy_gh_release` with the **app repo**:
|
||||
|
||||
```bash
|
||||
fetch_and_deploy_gh_release "myapp" "owner/repo"
|
||||
```
|
||||
|
||||
### Avoid Manual Version Checking
|
||||
|
||||
❌ OLD (manual):
|
||||
|
||||
```bash
|
||||
RELEASE=$(curl -fsSL https://api.github.com/repos/myapp/myapp/releases/latest | grep tag_name)
|
||||
```
|
||||
|
||||
✅ NEW (use tools.func):
|
||||
|
||||
```bash
|
||||
fetch_and_deploy_gh_release "myapp" "owner/repo"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Best Practices
|
||||
|
||||
1. **Use tools.func helpers** - Don't manually curl for versions
|
||||
2. **Only add app-specific dependencies** - Don't add ca-certificates, curl, gnupg (handled by build.func)
|
||||
3. **Test via curl from your fork** - Push first, then: `bash -c "$(curl -fsSL https://raw.githubusercontent.com/YOUR_USERNAME/ProxmoxVE/main/ct/MyApp.sh)"`
|
||||
4. **Wait for GitHub to update** - Takes 10-30 seconds after git push
|
||||
5. **Cherry-pick only YOUR files** - Submit only ct/MyApp.sh, install/MyApp-install.sh (2 files). Website metadata: use Report issue on the script's page on the website.
|
||||
6. **Verify before PR** - Run `git diff upstream/main --name-only` to confirm only your files changed
|
||||
|
||||
---
|
||||
|
||||
## Common Update Patterns
|
||||
|
||||
See the [modern template](AppName.sh) and [AI.md](../AI.md) for complete working examples.
|
||||
|
||||
Recent reference scripts with good update functions:
|
||||
|
||||
- [Trip](https://github.com/community-scripts/ProxmoxVE/blob/main/ct/trip.sh)
|
||||
- [Thingsboard](https://github.com/community-scripts/ProxmoxVE/blob/main/ct/thingsboard.sh)
|
||||
- [UniFi](https://github.com/community-scripts/ProxmoxVE/blob/main/ct/unifi.sh)
|
||||
|
||||
---
|
||||
|
||||
## Need Help?
|
||||
|
||||
- **[README.md](../README.md)** - Full contribution workflow
|
||||
- **[AI.md](../AI.md)** - AI-generated script guidelines
|
||||
- **[FORK_SETUP.md](../FORK_SETUP.md)** - Why setup-fork.sh is important
|
||||
- **[Slack Community](https://discord.gg/your-link)** - Ask questions
|
||||
|
||||
````
|
||||
|
||||
### 3.4 **Verbosity**
|
||||
|
||||
- Use the appropriate flag (**-q** in the examples) for a command to suppress its output.
|
||||
Example:
|
||||
|
||||
```bash
|
||||
curl -fsSL
|
||||
unzip -q
|
||||
````
|
||||
|
||||
- If a command does not come with this functionality use `$STD` to suppress it's output.
|
||||
|
||||
Example:
|
||||
|
||||
```bash
|
||||
$STD php artisan migrate --force
|
||||
$STD php artisan config:clear
|
||||
```
|
||||
|
||||
### 3.5 **Backups**
|
||||
|
||||
- Backup user data if necessary.
|
||||
- Move all user data back in the directory when the update is finished.
|
||||
|
||||
> [!NOTE]
|
||||
> This is not meant to be a permanent backup
|
||||
|
||||
Example backup:
|
||||
|
||||
```bash
|
||||
mv /opt/snipe-it /opt/snipe-it-backup
|
||||
```
|
||||
|
||||
Example config restore:
|
||||
|
||||
```bash
|
||||
cp /opt/snipe-it-backup/.env /opt/snipe-it/.env
|
||||
cp -r /opt/snipe-it-backup/public/uploads/ /opt/snipe-it/public/uploads/
|
||||
cp -r /opt/snipe-it-backup/storage/private_uploads /opt/snipe-it/storage/private_uploads
|
||||
```
|
||||
|
||||
### 3.6 **Cleanup**
|
||||
|
||||
- Do not forget to remove any temporary files/folders such as zip-files or temporary backups.
|
||||
Example:
|
||||
|
||||
```bash
|
||||
rm -rf /opt/v${RELEASE}.zip
|
||||
rm -rf /opt/snipe-it-backup
|
||||
```
|
||||
|
||||
### 3.7 **No update function**
|
||||
|
||||
- In case you can not provide an update function use the following code to provide user feedback.
|
||||
|
||||
```bash
|
||||
function update_script() {
|
||||
header_info
|
||||
check_container_storage
|
||||
check_container_resources
|
||||
if [[ ! -d /opt/snipeit ]]; then
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
fi
|
||||
msg_error "Currently we don't provide an update function for this ${APP}."
|
||||
exit
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 4 **End of the script**
|
||||
|
||||
- `start`: Launches Whiptail dialogue
|
||||
- `build_container`: Collects and integrates user settings
|
||||
- `description`: Sets LXC container description
|
||||
- With `echo -e "${TAB}${GATEWAY}${BGN}http://${IP}${CL}"` you can point the user to the IP:PORT/folder needed to access the app.
|
||||
|
||||
```bash
|
||||
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}"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 5. **Contribution checklist**
|
||||
|
||||
- [ ] Shebang is correctly set (`#!/usr/bin/env bash`).
|
||||
- [ ] Correct link to _build.func_
|
||||
- [ ] Metadata (author, license) is included at the top.
|
||||
- [ ] Variables follow naming conventions.
|
||||
- [ ] Update function exists.
|
||||
- [ ] Update functions checks if app is installed and for new version.
|
||||
- [ ] Update function cleans up temporary files.
|
||||
- [ ] Script ends with a helpful message for the user to reach the application.
|
||||
@@ -1,138 +0,0 @@
|
||||
#!/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: [YourGitHubUsername]
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: [SOURCE_URL e.g. https://github.com/example/app]
|
||||
|
||||
# ============================================================================
|
||||
# APP CONFIGURATION
|
||||
# ============================================================================
|
||||
# These values are sent to build.func and define default container resources.
|
||||
# Users can customize these during installation via the interactive prompts.
|
||||
# ============================================================================
|
||||
|
||||
APP="[AppName]"
|
||||
var_tags="${var_tags:-[category1];[category2]}" # Max 2 tags, semicolon-separated
|
||||
var_cpu="${var_cpu:-2}" # CPU cores: 1-4 typical
|
||||
var_ram="${var_ram:-2048}" # RAM in MB: 512, 1024, 2048, etc.
|
||||
var_disk="${var_disk:-8}" # Disk in GB: 6, 8, 10, 20 typical
|
||||
var_os="${var_os:-debian}" # OS: debian, ubuntu, alpine
|
||||
var_version="${var_version:-13}" # OS Version: 13 (Debian), 24.04 (Ubuntu), 3.21 (Alpine)
|
||||
var_unprivileged="${var_unprivileged:-1}" # 1=unprivileged (secure), 0=privileged (for Docker/Podman)
|
||||
|
||||
# ============================================================================
|
||||
# INITIALIZATION - These are required in all CT scripts
|
||||
# ============================================================================
|
||||
header_info "$APP" # Display app name and setup header
|
||||
variables # Initialize build.func variables
|
||||
color # Load color variables for output
|
||||
catch_errors # Enable error handling with automatic exit on failure
|
||||
|
||||
# ============================================================================
|
||||
# UPDATE SCRIPT - Called when user selects "Update" from web interface
|
||||
# ============================================================================
|
||||
# This function is triggered by the web interface to update the application.
|
||||
# It should:
|
||||
# 1. Check if installation exists
|
||||
# 2. Check for new GitHub releases
|
||||
# 3. Stop running services
|
||||
# 4. Backup critical data
|
||||
# 5. Deploy new version
|
||||
# 6. Run post-update commands (migrations, config updates, etc.)
|
||||
# 7. Restore data if needed
|
||||
# 8. Start services
|
||||
#
|
||||
# Exit with `exit` at the end to prevent container restart.
|
||||
# ============================================================================
|
||||
|
||||
function update_script() {
|
||||
header_info
|
||||
check_container_storage
|
||||
check_container_resources
|
||||
|
||||
# Step 1: Verify installation exists
|
||||
if [[ ! -d /opt/[appname] ]]; then
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
fi
|
||||
|
||||
# Step 2: Check if update is available
|
||||
if check_for_gh_release "[appname]" "YourUsername/YourRepo"; then
|
||||
|
||||
# Step 3: Stop services before update
|
||||
msg_info "Stopping Service"
|
||||
systemctl stop [appname]
|
||||
msg_ok "Stopped Service"
|
||||
|
||||
# Step 4: Backup critical data before overwriting
|
||||
msg_info "Backing up Data"
|
||||
cp -r /opt/[appname]/data /opt/[appname]_data_backup 2>/dev/null || true
|
||||
msg_ok "Backed up Data"
|
||||
|
||||
# Step 5: Download and deploy new version
|
||||
# CLEAN_INSTALL=1 removes old directory before extracting
|
||||
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "[appname]" "owner/repo" "tarball" "latest" "/opt/[appname]"
|
||||
|
||||
# Step 6: Run post-update commands (uncomment as needed)
|
||||
# These examples show common patterns - use what applies to your app:
|
||||
#
|
||||
# For Node.js apps:
|
||||
# msg_info "Installing Dependencies"
|
||||
# cd /opt/[appname]
|
||||
# $STD npm ci --production
|
||||
# msg_ok "Installed Dependencies"
|
||||
#
|
||||
# For Python apps:
|
||||
# msg_info "Installing Dependencies"
|
||||
# cd /opt/[appname]
|
||||
# $STD uv sync --frozen
|
||||
# msg_ok "Installed Dependencies"
|
||||
#
|
||||
# For database migrations:
|
||||
# msg_info "Running Database Migrations"
|
||||
# cd /opt/[appname]
|
||||
# $STD npm run migrate
|
||||
# msg_ok "Ran Database Migrations"
|
||||
#
|
||||
# For PHP apps:
|
||||
# msg_info "Installing Dependencies"
|
||||
# cd /opt/[appname]
|
||||
# $STD composer install --no-dev
|
||||
# msg_ok "Installed Dependencies"
|
||||
|
||||
# Step 7: Restore data from backup
|
||||
msg_info "Restoring Data"
|
||||
cp -r /opt/[appname]_data_backup/. /opt/[appname]/data/ 2>/dev/null || true
|
||||
rm -rf /opt/[appname]_data_backup
|
||||
msg_ok "Restored Data"
|
||||
|
||||
# Step 8: Restart service with new version
|
||||
msg_info "Starting Service"
|
||||
systemctl start [appname]
|
||||
msg_ok "Started Service"
|
||||
msg_ok "Updated successfully!"
|
||||
fi
|
||||
exit
|
||||
}
|
||||
|
||||
# ============================================================================
|
||||
# MAIN EXECUTION - Container creation flow
|
||||
# ============================================================================
|
||||
# These are called by build.func and handle the full installation process:
|
||||
# 1. start - Initialize container creation
|
||||
# 2. build_container - Execute the install script inside container
|
||||
# 3. description - Display completion info and access details
|
||||
# ============================================================================
|
||||
|
||||
start
|
||||
build_container
|
||||
description
|
||||
|
||||
# ============================================================================
|
||||
# COMPLETION MESSAGE
|
||||
# ============================================================================
|
||||
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}:[PORT]${CL}"
|
||||
@@ -1,494 +0,0 @@
|
||||
# Install Scripts - Quick Reference
|
||||
|
||||
> [!WARNING]
|
||||
> **This is legacy documentation.** Refer to the **modern template** at [templates_install/AppName-install.sh](AppName-install.sh) for best practices.
|
||||
>
|
||||
> Current templates use:
|
||||
>
|
||||
> - `tools.func` helpers (setup_nodejs, setup_uv, setup_postgresql_db, etc.)
|
||||
> - Automatic dependency installation via build.func
|
||||
> - Standardized environment variable patterns
|
||||
|
||||
---
|
||||
|
||||
## Before Creating a Script
|
||||
|
||||
1. **Copy the Modern Template:**
|
||||
|
||||
```bash
|
||||
cp templates_install/AppName-install.sh install/MyApp-install.sh
|
||||
# Edit install/MyApp-install.sh
|
||||
```
|
||||
|
||||
2. **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
|
||||
|
||||
3. **Test via GitHub:**
|
||||
|
||||
```bash
|
||||
# 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
|
||||
|
||||
```bash
|
||||
#!/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)
|
||||
|
||||
```bash
|
||||
# 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:
|
||||
|
||||
```bash
|
||||
# ✅ 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
|
||||
|
||||
```bash
|
||||
# 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
|
||||
|
||||
```bash
|
||||
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):
|
||||
|
||||
```bash
|
||||
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):
|
||||
|
||||
```bash
|
||||
# In CT script, not install script:
|
||||
fetch_and_deploy_gh_release "myapp" "app/repo" "app.tar.gz" "latest" "/opt/myapp"
|
||||
```
|
||||
|
||||
### Database Setup
|
||||
|
||||
```bash
|
||||
# Use setup_postgresql_db, setup_mysql_db, etc.
|
||||
PG_DB_NAME="myapp"
|
||||
PG_DB_USER="myapp"
|
||||
setup_postgresql_db
|
||||
```
|
||||
|
||||
### Node.js Setup
|
||||
|
||||
```bash
|
||||
NODE_VERSION="20"
|
||||
setup_nodejs
|
||||
npm install --no-save
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Best Practices
|
||||
|
||||
1. **Only add app-specific dependencies**
|
||||
- Don't add: ca-certificates, curl, gnupg, wget, git, jq
|
||||
- These are handled by build.func
|
||||
|
||||
2. **Use tools.func helpers**
|
||||
- setup_nodejs, setup_python, setup_uv, setup_postgresql_db, setup_mysql_db, etc.
|
||||
|
||||
3. **Don't do version checks in install script**
|
||||
- Version checking happens in CT script's update_script()
|
||||
- Install script just installs the latest
|
||||
|
||||
4. **Structure:**
|
||||
- Dependencies
|
||||
- Runtime setup (tools.func)
|
||||
- Deployment (fetch from CT script)
|
||||
- Configuration files
|
||||
- Systemd service
|
||||
- Finalization
|
||||
|
||||
---
|
||||
|
||||
## Reference Scripts
|
||||
|
||||
See working examples:
|
||||
|
||||
- [Trip](https://github.com/community-scripts/ProxmoxVE/blob/main/install/trip-install.sh)
|
||||
- [Thingsboard](https://github.com/community-scripts/ProxmoxVE/blob/main/install/thingsboard-install.sh)
|
||||
- [UniFi](https://github.com/community-scripts/ProxmoxVE/blob/main/install/unifi-install.sh)
|
||||
|
||||
---
|
||||
|
||||
## Need Help?
|
||||
|
||||
- **[Modern Template](AppName-install.sh)** - Start here
|
||||
- **[CT Template](../templates_ct/AppName.sh)** - How CT scripts work
|
||||
- **[README.md](../README.md)** - Full contribution workflow
|
||||
- **[AI.md](../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:
|
||||
|
||||
```bash
|
||||
# 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.
|
||||
|
||||
```bash
|
||||
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:
|
||||
|
||||
```bash
|
||||
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:
|
||||
|
||||
```bash
|
||||
$STD apt-get install -y \
|
||||
curl \
|
||||
composer \
|
||||
git \
|
||||
sudo \
|
||||
mc \
|
||||
nginx
|
||||
```
|
||||
|
||||
### 3.2 **Collapse dependencies**
|
||||
|
||||
Collapse dependencies to keep the code readable.
|
||||
|
||||
Example:
|
||||
Use
|
||||
|
||||
```bash
|
||||
php8.2-{bcmath,common,ctype}
|
||||
```
|
||||
|
||||
instead of
|
||||
|
||||
```bash
|
||||
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:
|
||||
|
||||
```bash
|
||||
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:
|
||||
|
||||
```bash
|
||||
echo "${RELEASE}" >"/opt/AppName_version.txt"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 6. **Input and output management**
|
||||
|
||||
### 6.1 **User feedback**
|
||||
|
||||
- Use standard functions like `msg_info`, `msg_ok` or `msg_error` to print status messages.
|
||||
- Each `msg_info` must be followed with a `msg_ok` before any other output is made.
|
||||
- Display meaningful progress messages at key stages.
|
||||
|
||||
Example:
|
||||
|
||||
```bash
|
||||
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:
|
||||
|
||||
```bash
|
||||
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:
|
||||
|
||||
```bash
|
||||
$STD apt-get install -y nginx
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 7. **String/File Manipulation**
|
||||
|
||||
### 7.1 **File Manipulation**
|
||||
|
||||
- Use `sed` to replace placeholder values in configuration files.
|
||||
|
||||
Example:
|
||||
|
||||
```bash
|
||||
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 `openssl` to generate random passwords.
|
||||
- Use only alphanumeric values to not introduce unknown behaviour.
|
||||
|
||||
Example:
|
||||
|
||||
```bash
|
||||
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:
|
||||
|
||||
```bash
|
||||
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:
|
||||
|
||||
```bash
|
||||
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:
|
||||
|
||||
```bash
|
||||
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:
|
||||
|
||||
```bash
|
||||
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:
|
||||
|
||||
```bash
|
||||
systemctl enable -q --now nginx
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 10. **Cleanup**
|
||||
|
||||
### 10.1 **Remove temporary files**
|
||||
|
||||
Remove temporary files and downloads after use.
|
||||
|
||||
Example:
|
||||
|
||||
```bash
|
||||
rm -rf /opt/v${RELEASE}.zip
|
||||
```
|
||||
|
||||
### 10.2 **Autoremove and autoclean**
|
||||
|
||||
Remove unused dependencies to reduce disk space usage.
|
||||
|
||||
Example:
|
||||
|
||||
```bash
|
||||
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
|
||||
|
||||
1. Dependencies installation
|
||||
2. Database setup
|
||||
3. Download and configure application
|
||||
4. Service configuration
|
||||
5. Final cleanup
|
||||
@@ -1,207 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2026 community-scripts ORG
|
||||
# Author: [YourGitHubUsername]
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: [SOURCE_URL e.g. https://github.com/example/app]
|
||||
|
||||
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
||||
color
|
||||
verb_ip6
|
||||
catch_errors
|
||||
setting_up_container
|
||||
network_check
|
||||
update_os
|
||||
|
||||
# =============================================================================
|
||||
# DEPENDENCIES - Only add app-specific dependencies here!
|
||||
# Don't add: ca-certificates, curl, gnupg, git, build-essential (handled by build.func)
|
||||
# =============================================================================
|
||||
|
||||
msg_info "Installing Dependencies"
|
||||
$STD apt install -y \
|
||||
libharfbuzz0b \
|
||||
fontconfig
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
# =============================================================================
|
||||
# SETUP RUNTIMES & DATABASES (if needed)
|
||||
# =============================================================================
|
||||
# Examples (uncomment as needed):
|
||||
#
|
||||
# NODE_VERSION="22" setup_nodejs
|
||||
# NODE_VERSION="22" NODE_MODULE="pnpm" setup_nodejs # Installs pnpm
|
||||
# PYTHON_VERSION="3.13" setup_uv
|
||||
# JAVA_VERSION="21" setup_java
|
||||
# GO_VERSION="1.22" setup_go
|
||||
# PHP_VERSION="8.4" PHP_FPM="YES" setup_php
|
||||
# setup_postgresql # Server only
|
||||
# setup_mariadb # Server only
|
||||
# setup_meilisearch # Search engine
|
||||
#
|
||||
# Then set up DB and user (sets $[DB]_DB_PASS):
|
||||
# PG_DB_NAME="myapp" PG_DB_USER="myapp" setup_postgresql_db
|
||||
# MARIADB_DB_NAME="myapp" MARIADB_DB_USER="myapp" setup_mariadb_db
|
||||
|
||||
# =============================================================================
|
||||
# DOWNLOAD & DEPLOY APPLICATION
|
||||
# =============================================================================
|
||||
# fetch_and_deploy_gh_release modes:
|
||||
# "tarball" - Source tarball (default if omitted)
|
||||
# "binary" - .deb package (auto-detects amd64/arm64)
|
||||
# "prebuild" - Pre-built archive (.tar.gz)
|
||||
# "singlefile" - Single binary file
|
||||
#
|
||||
# Examples:
|
||||
# fetch_and_deploy_gh_release "myapp" "YourUsername/myapp" "tarball" "latest" "/opt/myapp"
|
||||
# fetch_and_deploy_gh_release "myapp" "YourUsername/myapp" "binary" "latest" "/tmp"
|
||||
# fetch_and_deploy_gh_release "myapp" "YourUsername/myapp" "prebuild" "latest" "/opt/myapp" "myapp-*.tar.gz"
|
||||
|
||||
fetch_and_deploy_gh_release "[appname]" "owner/repo" "tarball" "latest" "/opt/[appname]"
|
||||
|
||||
# --- Tools & Utilities ---
|
||||
# get_lxc_ip # Sets $LOCAL_IP variable (call early!)
|
||||
# setup_ffmpeg # Install FFmpeg with codecs
|
||||
# setup_hwaccel # Setup GPU hardware acceleration
|
||||
# setup_imagemagick # Install ImageMagick 7
|
||||
# setup_docker # Install Docker Engine
|
||||
# setup_adminer # Install Adminer for DB management
|
||||
# create_self_signed_cert # Creates cert in /etc/ssl/[appname]/
|
||||
|
||||
# =============================================================================
|
||||
# EXAMPLES
|
||||
# =============================================================================
|
||||
#
|
||||
# EXAMPLE 1: Node.js Application with PostgreSQL
|
||||
# ---------------------------------------------
|
||||
# NODE_VERSION="22" setup_nodejs
|
||||
# PG_VERSION="17" setup_postgresql
|
||||
# PG_DB_NAME="myapp" PG_DB_USER="myapp" setup_postgresql_db
|
||||
# get_lxc_ip
|
||||
# fetch_and_deploy_gh_release "myapp" "owner/myapp" "tarball" "latest" "/opt/myapp"
|
||||
#
|
||||
# msg_info "Configuring MyApp"
|
||||
# cd /opt/myapp
|
||||
# $STD npm ci
|
||||
# cat <<EOF >/opt/myapp/.env
|
||||
# DATABASE_URL=postgresql://${PG_DB_USER}:${PG_DB_PASS}@localhost/${PG_DB_NAME}
|
||||
# HOST=${LOCAL_IP}
|
||||
# PORT=3000
|
||||
# EOF
|
||||
# msg_ok "Configured MyApp"
|
||||
#
|
||||
# EXAMPLE 2: Python Application with uv
|
||||
# ------------------------------------
|
||||
# PYTHON_VERSION="3.13" setup_uv
|
||||
# get_lxc_ip
|
||||
# fetch_and_deploy_gh_release "myapp" "owner/myapp" "tarball" "latest" "/opt/myapp"
|
||||
#
|
||||
# msg_info "Setting up MyApp"
|
||||
# cd /opt/myapp
|
||||
# $STD uv sync
|
||||
# cat <<EOF >/opt/myapp/.env
|
||||
# HOST=${LOCAL_IP}
|
||||
# PORT=8000
|
||||
# EOF
|
||||
# msg_ok "Setup MyApp"
|
||||
|
||||
# =============================================================================
|
||||
# EXAMPLE 3: PHP Application with MariaDB + Nginx
|
||||
# =============================================================================
|
||||
# PHP_VERSION="8.4" PHP_FPM="YES" PHP_MODULE="bcmath,curl,gd,intl,mbstring,mysql,xml,zip" setup_php
|
||||
# setup_composer
|
||||
# setup_mariadb
|
||||
# MARIADB_DB_NAME="myapp" MARIADB_DB_USER="myapp" setup_mariadb_db
|
||||
# get_lxc_ip
|
||||
# fetch_and_deploy_gh_release "myapp" "owner/myapp" "prebuild" "latest" "/opt/myapp" "myapp-*.tar.gz"
|
||||
#
|
||||
# msg_info "Configuring MyApp"
|
||||
# cd /opt/myapp
|
||||
# cp .env.example .env
|
||||
# sed -i "s|APP_URL=.*|APP_URL=http://${LOCAL_IP}|" .env
|
||||
# sed -i "s|DB_DATABASE=.*|DB_DATABASE=${MARIADB_DB_NAME}|" .env
|
||||
# sed -i "s|DB_USERNAME=.*|DB_USERNAME=${MARIADB_DB_USER}|" .env
|
||||
# sed -i "s|DB_PASSWORD=.*|DB_PASSWORD=${MARIADB_DB_PASS}|" .env
|
||||
# $STD composer install --no-dev --no-interaction
|
||||
# chown -R www-data:www-data /opt/myapp
|
||||
# msg_ok "Configured MyApp"
|
||||
|
||||
# =============================================================================
|
||||
# YOUR APPLICATION INSTALLATION
|
||||
# =============================================================================
|
||||
# 1. Setup runtimes and databases FIRST
|
||||
# 2. Call get_lxc_ip if you need the container IP
|
||||
# 3. Use fetch_and_deploy_gh_release to download the app (handles version tracking)
|
||||
# 4. Configure the application
|
||||
# 5. Create systemd service
|
||||
# 6. Finalize with motd_ssh, customize, cleanup_lxc
|
||||
|
||||
# --- Setup runtimes/databases ---
|
||||
NODE_VERSION="22" setup_nodejs
|
||||
get_lxc_ip
|
||||
|
||||
# --- Download and install app ---
|
||||
fetch_and_deploy_gh_release "[appname]" "[owner/repo]" "tarball" "latest" "/opt/[appname]"
|
||||
|
||||
msg_info "Setting up [AppName]"
|
||||
cd /opt/[appname]
|
||||
# $STD npm ci
|
||||
msg_ok "Setup [AppName]"
|
||||
|
||||
# =============================================================================
|
||||
# CONFIGURATION
|
||||
# =============================================================================
|
||||
|
||||
msg_info "Configuring [AppName]"
|
||||
cd /opt/[appname]
|
||||
|
||||
# Install application dependencies (uncomment as needed):
|
||||
# $STD npm ci --production # Node.js apps
|
||||
# $STD uv sync --frozen # Python apps
|
||||
# $STD composer install --no-dev # PHP apps
|
||||
# $STD cargo build --release # Rust apps
|
||||
|
||||
# Create .env file if needed:
|
||||
cat <<EOF >/opt/[appname]/.env
|
||||
# Use import_local_ip to get container IP, or hardcode if building on Proxmox
|
||||
APP_URL=http://localhost
|
||||
PORT=8080
|
||||
EOF
|
||||
|
||||
msg_ok "Configured [AppName]"
|
||||
|
||||
# =============================================================================
|
||||
# CREATE SYSTEMD SERVICE
|
||||
# =============================================================================
|
||||
|
||||
msg_info "Creating Service"
|
||||
cat <<EOF >/etc/systemd/system/[appname].service
|
||||
[Unit]
|
||||
Description=[AppName] Service
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=root
|
||||
WorkingDirectory=/opt/[appname]
|
||||
ExecStart=/usr/bin/node /opt/[appname]/server.js
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl enable -q --now [appname]
|
||||
msg_ok "Created Service"
|
||||
|
||||
# =============================================================================
|
||||
# CLEANUP & FINALIZATION
|
||||
# =============================================================================
|
||||
# These are called automatically, but shown here for clarity:
|
||||
# motd_ssh - Displays service info on SSH login
|
||||
# customize - Enables optional customizations
|
||||
# cleanup_lxc - Removes temp files, bash history, logs
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
cleanup_lxc
|
||||
@@ -1,40 +0,0 @@
|
||||
{
|
||||
"name": "AppName",
|
||||
"slug": "appname",
|
||||
"categories": [
|
||||
0
|
||||
],
|
||||
"date_created": "2026-01-18",
|
||||
"type": "ct",
|
||||
"updateable": true,
|
||||
"privileged": false,
|
||||
"interface_port": 3000,
|
||||
"documentation": "https://docs.example.com/",
|
||||
"website": "https://example.com/",
|
||||
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@main/webp/appname.webp",
|
||||
"config_path": "/opt/appname/.env",
|
||||
"description": "Short description of what AppName does and its main features.",
|
||||
"install_methods": [
|
||||
{
|
||||
"type": "default",
|
||||
"script": "ct/appname.sh",
|
||||
"resources": {
|
||||
"cpu": 2,
|
||||
"ram": 2048,
|
||||
"hdd": 8,
|
||||
"os": "Debian",
|
||||
"version": "13"
|
||||
}
|
||||
}
|
||||
],
|
||||
"default_credentials": {
|
||||
"username": null,
|
||||
"password": null
|
||||
},
|
||||
"notes": [
|
||||
{
|
||||
"text": "Change the default password after first login!",
|
||||
"type": "warning"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,160 +0,0 @@
|
||||
# Website Metadata - Quick Reference
|
||||
|
||||
Metadata (name, slug, description, logo, categories, etc.) controls how your application appears on the website. You do **not** add JSON files to the repo — you request changes via the website.
|
||||
|
||||
---
|
||||
|
||||
## How to Request or Update Metadata
|
||||
|
||||
1. **Go to the script on the website** — Open the [ProxmoxVE website](https://community-scripts.github.io/ProxmoxVE/), find your script (or the script you want to update).
|
||||
2. **Press the "Report issue" button** on that script’s page.
|
||||
3. **Follow the guide** — The flow will walk you through submitting or updating metadata.
|
||||
|
||||
---
|
||||
|
||||
## Metadata Structure (Reference)
|
||||
|
||||
The following describes the structure of script metadata used by the website. Use it as reference when filling out the form or describing what you need.
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "MyApp",
|
||||
"slug": "myapp",
|
||||
"categories": [1],
|
||||
"date_created": "2026-01-18",
|
||||
"type": "ct",
|
||||
"updateable": true,
|
||||
"privileged": false,
|
||||
"interface_port": 3000,
|
||||
"documentation": "https://docs.example.com/",
|
||||
"website": "https://example.com/",
|
||||
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@main/webp/myapp.webp",
|
||||
"config_path": "/opt/myapp/.env",
|
||||
"description": "Brief description of what MyApp does",
|
||||
"install_methods": [
|
||||
{
|
||||
"type": "default",
|
||||
"script": "ct/myapp.sh",
|
||||
"resources": {
|
||||
"cpu": 2,
|
||||
"ram": 2048,
|
||||
"hdd": 8,
|
||||
"os": "Debian",
|
||||
"version": "13"
|
||||
}
|
||||
}
|
||||
],
|
||||
"default_credentials": {
|
||||
"username": null,
|
||||
"password": null
|
||||
},
|
||||
"notes": [
|
||||
{
|
||||
"text": "Change the default password after first login!",
|
||||
"type": "warning"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Field Reference
|
||||
|
||||
| Field | Required | Example | Notes |
|
||||
| --------------------- | -------- | ----------------- | ---------------------------------------------- |
|
||||
| `name` | Yes | "MyApp" | Display name |
|
||||
| `slug` | Yes | "myapp" | URL-friendly identifier (lowercase, no spaces) |
|
||||
| `categories` | Yes | [1] | One or more category IDs |
|
||||
| `date_created` | Yes | "2026-01-18" | Format: YYYY-MM-DD |
|
||||
| `type` | Yes | "ct" | Container type: "ct" or "vm" |
|
||||
| `interface_port` | Yes | 3000 | Default web interface port |
|
||||
| `logo` | No | "https://..." | Logo URL (64px x 64px PNG) |
|
||||
| `config_path` | Yes | "/opt/myapp/.env" | Main config file location |
|
||||
| `description` | Yes | "App description" | Brief description (100 chars) |
|
||||
| `install_methods` | Yes | See below | Installation resources (array) |
|
||||
| `default_credentials` | No | See below | Optional default login |
|
||||
| `notes` | No | See below | Additional notes (array) |
|
||||
|
||||
---
|
||||
|
||||
## Install Methods
|
||||
|
||||
Each installation method specifies resource requirements:
|
||||
|
||||
```json
|
||||
"install_methods": [
|
||||
{
|
||||
"type": "default",
|
||||
"script": "ct/myapp.sh",
|
||||
"resources": {
|
||||
"cpu": 2,
|
||||
"ram": 2048,
|
||||
"hdd": 8,
|
||||
"os": "Debian",
|
||||
"version": "13"
|
||||
}
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
**Resource Defaults:**
|
||||
|
||||
- CPU: Cores (1-8)
|
||||
- RAM: Megabytes (256-4096)
|
||||
- Disk: Gigabytes (4-50)
|
||||
|
||||
---
|
||||
|
||||
## Common Categories
|
||||
|
||||
- `0` Miscellaneous
|
||||
- `1` Proxmox & Virtualization
|
||||
- `2` Operating Systems
|
||||
- `3` Containers & Docker
|
||||
- `4` Network & Firewall
|
||||
- `5` Adblock & DNS
|
||||
- `6` Authentication & Security
|
||||
- `7` Backup & Recovery
|
||||
- `8` Databases
|
||||
- `9` Monitoring & Analytics
|
||||
- `10` Dashboards & Frontends
|
||||
- `11` Files & Downloads
|
||||
- `12` Documents & Notes
|
||||
- `13` Media & Streaming
|
||||
- `14` \*Arr Suite
|
||||
- `15` NVR & Cameras
|
||||
- `16` IoT & Smart Home
|
||||
- `17` ZigBee, Z-Wave & Matter
|
||||
- `18` MQTT & Messaging
|
||||
- `19` Automation & Scheduling
|
||||
- `20` AI / Coding & Dev-Tools
|
||||
- `21` Webservers & Proxies
|
||||
- `22` Bots & ChatOps
|
||||
- `23` Finance & Budgeting
|
||||
- `24` Gaming & Leisure
|
||||
- `25` Business & ERP
|
||||
|
||||
---
|
||||
|
||||
## Best Practices
|
||||
|
||||
1. **Use the JSON Generator** - It validates structure
|
||||
2. **Keep descriptions short** - 100 characters max
|
||||
3. **Use real resource requirements** - Based on your testing
|
||||
4. **Include sensible defaults** - Pre-filled in install_methods
|
||||
5. **Slug must be lowercase** - No spaces, use hyphens
|
||||
|
||||
---
|
||||
|
||||
## See Examples on the Website
|
||||
|
||||
View script pages on the [ProxmoxVE website](https://community-scripts.github.io/ProxmoxVE/) to see how metadata is displayed for existing scripts.
|
||||
|
||||
---
|
||||
|
||||
## Need Help?
|
||||
|
||||
- **Request metadata** — Use the Report issue button on the script’s page on the website (see [How to Request or Update Metadata](#how-to-request-or-update-metadata) above).
|
||||
- **[JSON Generator](https://community-scripts.github.io/ProxmoxVE/json-editor)** - Reference only; structure validation
|
||||
- **[README.md](../README.md)** - Full contribution workflow
|
||||
Reference in New Issue
Block a user