mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-06-04 22:59:36 +02:00
Merge main and resolve conflicts in documentation templates
This commit is contained in:
@@ -440,12 +440,12 @@ create_self_signed_cert
|
||||
|
||||
## Utility Functions
|
||||
|
||||
### `import_local_ip`
|
||||
### `get_lxc_ip`
|
||||
|
||||
Set the `$LOCAL_IP` variable with the container's IP address.
|
||||
|
||||
```bash
|
||||
import_local_ip
|
||||
get_lxc_ip
|
||||
echo "Container IP: $LOCAL_IP"
|
||||
|
||||
# Use in config files
|
||||
@@ -534,7 +534,7 @@ msg_ok "Installed Dependencies"
|
||||
NODE_VERSION="22" setup_nodejs
|
||||
PG_VERSION="16" setup_postgresql
|
||||
PG_DB_NAME="myapp" PG_DB_USER="myapp" setup_postgresql_db
|
||||
import_local_ip
|
||||
get_lxc_ip
|
||||
|
||||
# Download app using fetch_and_deploy (handles version tracking)
|
||||
fetch_and_deploy_gh_release "myapp" "example/myapp" "tarball" "latest" "/opt/myapp"
|
||||
@@ -670,7 +670,7 @@ PHP_VERSION="8.4" PHP_FPM="YES" PHP_MODULE="bcmath,curl,gd,intl,mbstring,mysql,x
|
||||
setup_composer
|
||||
setup_mariadb
|
||||
MARIADB_DB_NAME="myapp" MARIADB_DB_USER="myapp" setup_mariadb_db
|
||||
import_local_ip
|
||||
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"
|
||||
|
||||
@@ -57,8 +57,97 @@ msg_ok "Installed Dependencies"
|
||||
|
||||
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]/
|
||||
|
||||
# =============================================================================
|
||||
# CONFIGURE APPLICATION
|
||||
# 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]"
|
||||
|
||||
@@ -544,7 +544,8 @@ network_check
|
||||
update_os
|
||||
|
||||
PHP_VERSION="8.4" PHP_MODULE="bcmath,curl,pdo_mysql" setup_php
|
||||
MARIADB_VERSION="11.4" setup_mariadb
|
||||
setup_mariadb # Uses distribution packages (recommended)
|
||||
# Or for specific version: MARIADB_VERSION="11.4" setup_mariadb
|
||||
|
||||
# Database setup
|
||||
DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
|
||||
|
||||
@@ -85,7 +85,8 @@ pkg_install curl wget git
|
||||
```bash
|
||||
setup_nodejs "20"
|
||||
setup_php "8.3"
|
||||
setup_mariadb "11"
|
||||
setup_mariadb # Uses distribution packages (recommended)
|
||||
# MARIADB_VERSION="11.4" setup_mariadb # For specific version
|
||||
```
|
||||
|
||||
### Phase 4: Application Download
|
||||
|
||||
@@ -75,7 +75,8 @@ Complete reference of environment variables and configuration options.
|
||||
```bash
|
||||
setup_nodejs "20" # Install Node.js v20
|
||||
setup_php "8.2" # Install PHP 8.2
|
||||
setup_mariadb "11" # Install MariaDB 11
|
||||
setup_mariadb # Install MariaDB (distribution packages)
|
||||
# MARIADB_VERSION="11.4" setup_mariadb # Specific version from official repo
|
||||
```
|
||||
|
||||
### Safe Package Operations
|
||||
|
||||
@@ -24,7 +24,7 @@ Complete alphabetical reference of all functions in tools.func with parameters,
|
||||
- `setup_golang(VERSION)` - Install Go programming language
|
||||
|
||||
**Databases**:
|
||||
- `setup_mariadb(VERSION)` - Install MariaDB server
|
||||
- `setup_mariadb()` - Install MariaDB server (distro packages by default)
|
||||
- `setup_postgresql(VERSION)` - Install PostgreSQL
|
||||
- `setup_mongodb(VERSION)` - Install MongoDB
|
||||
- `setup_redis(VERSION)` - Install Redis cache
|
||||
@@ -179,6 +179,62 @@ verify_tool_version "nodejs" "22" "$(node -v | grep -oP '^v\K[0-9]+')"
|
||||
|
||||
---
|
||||
|
||||
### setup_deb822_repo()
|
||||
|
||||
Add repository in modern deb822 format.
|
||||
|
||||
**Signature**:
|
||||
```bash
|
||||
setup_deb822_repo NAME GPG_URL REPO_URL SUITE COMPONENT [ARCHITECTURES] [ENABLED]
|
||||
```
|
||||
|
||||
**Parameters**:
|
||||
- `NAME` - Repository name (e.g., "nodejs")
|
||||
- `GPG_URL` - URL to GPG key (e.g., https://example.com/key.gpg)
|
||||
- `REPO_URL` - Main repository URL (e.g., https://example.com/repo)
|
||||
- `SUITE` - Repository suite (e.g., "jammy", "bookworm")
|
||||
- `COMPONENT` - Repository component (e.g., "main", "testing")
|
||||
- `ARCHITECTURES` - Optional Comma-separated list of architectures (e.g., "amd64,arm64")
|
||||
- `ENABLED` - Optional "true" or "false" (default: "true")
|
||||
|
||||
**Returns**:
|
||||
- `0` - Repository added successfully
|
||||
- `1` - Repository setup failed
|
||||
|
||||
**Example**:
|
||||
```bash
|
||||
setup_deb822_repo \
|
||||
"nodejs" \
|
||||
"https://deb.nodesource.com/gpgkey/nodesource.gpg.key" \
|
||||
"https://deb.nodesource.com/node_20.x" \
|
||||
"jammy" \
|
||||
"main"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### cleanup_repo_metadata()
|
||||
|
||||
Clean up GPG keys and old repository configurations.
|
||||
|
||||
**Signature**:
|
||||
```bash
|
||||
cleanup_repo_metadata
|
||||
```
|
||||
|
||||
**Parameters**: None
|
||||
|
||||
**Returns**:
|
||||
- `0` - Cleanup complete
|
||||
|
||||
**Example**:
|
||||
```bash
|
||||
cleanup_repo_metadata
|
||||
>>>>>>> origin/main
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Tool Installation Functions
|
||||
|
||||
### setup_nodejs(VERSION)
|
||||
@@ -233,17 +289,20 @@ setup_php "8.3"
|
||||
|
||||
---
|
||||
|
||||
### setup_mariadb(VERSION)
|
||||
### setup_mariadb()
|
||||
|
||||
Install MariaDB server and client utilities.
|
||||
|
||||
**Signature**:
|
||||
```bash
|
||||
setup_mariadb VERSION
|
||||
setup_mariadb # Uses distribution packages (recommended)
|
||||
MARIADB_VERSION="11.4" setup_mariadb # Uses official MariaDB repository
|
||||
```
|
||||
|
||||
**Parameters**:
|
||||
- `VERSION` - MariaDB version (e.g., "10.6", "11.0")
|
||||
**Variables**:
|
||||
- `MARIADB_VERSION` - (optional) Specific MariaDB version
|
||||
- Not set or `"latest"`: Uses distribution packages (most reliable, avoids mirror issues)
|
||||
- Specific version (e.g., `"11.4"`, `"12.2"`): Uses official MariaDB repository
|
||||
|
||||
**Returns**:
|
||||
- `0` - Installation successful
|
||||
@@ -254,7 +313,11 @@ setup_mariadb VERSION
|
||||
|
||||
**Example**:
|
||||
```bash
|
||||
setup_mariadb "11.0"
|
||||
# Recommended: Use distribution packages (stable, no mirror issues)
|
||||
setup_mariadb
|
||||
|
||||
# Specific version from official repository
|
||||
MARIADB_VERSION="11.4" setup_mariadb
|
||||
```
|
||||
|
||||
---
|
||||
@@ -436,7 +499,7 @@ source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
||||
|
||||
pkg_update # Update package lists
|
||||
setup_nodejs "20" # Install Node.js
|
||||
setup_mariadb "11" # Install MariaDB
|
||||
setup_mariadb # Install MariaDB (distribution packages)
|
||||
|
||||
# ... application installation ...
|
||||
|
||||
@@ -455,7 +518,7 @@ source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
||||
pkg_update
|
||||
setup_nginx
|
||||
setup_php "8.3"
|
||||
setup_mariadb "11"
|
||||
setup_mariadb # Uses distribution packages
|
||||
setup_composer
|
||||
```
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ pkg_update
|
||||
|
||||
setup_nginx
|
||||
setup_php "8.3"
|
||||
setup_mariadb "11"
|
||||
setup_mariadb # Uses distribution packages (recommended)
|
||||
setup_composer
|
||||
|
||||
msg_ok "Web stack installed"
|
||||
@@ -221,10 +221,10 @@ msg_info "Setting up repository"
|
||||
|
||||
# Add custom repository in deb822 format
|
||||
setup_deb822_repo \
|
||||
"https://my-repo.example.com/gpg.key" \
|
||||
"my-applications" \
|
||||
"jammy" \
|
||||
"https://my-repo.example.com/gpg.key" \
|
||||
"https://my-repo.example.com/debian" \
|
||||
"jammy" \
|
||||
"main"
|
||||
|
||||
msg_ok "Repository configured"
|
||||
@@ -244,18 +244,18 @@ msg_info "Setting up repositories"
|
||||
|
||||
# Node.js repository
|
||||
setup_deb822_repo \
|
||||
"https://deb.nodesource.com/gpgkey/nodesource.gpg.key" \
|
||||
"nodejs" \
|
||||
"jammy" \
|
||||
"https://deb.nodesource.com/gpgkey/nodesource.gpg.key" \
|
||||
"https://deb.nodesource.com/node_20.x" \
|
||||
"jammy" \
|
||||
"main"
|
||||
|
||||
# Docker repository
|
||||
setup_deb822_repo \
|
||||
"https://download.docker.com/linux/ubuntu/gpg" \
|
||||
"docker" \
|
||||
"jammy" \
|
||||
"https://download.docker.com/linux/ubuntu/gpg" \
|
||||
"https://download.docker.com/linux/ubuntu" \
|
||||
"jammy" \
|
||||
"stable"
|
||||
|
||||
# Update once for all repos
|
||||
@@ -388,7 +388,7 @@ pkg_install package-name
|
||||
# Chain multiple tools together
|
||||
setup_nodejs "20"
|
||||
setup_php "8.3"
|
||||
setup_mariadb "11"
|
||||
setup_mariadb # Distribution packages (recommended)
|
||||
|
||||
# Check command success
|
||||
if ! setup_docker; then
|
||||
|
||||
Reference in New Issue
Block a user