Compare commits

..

2 Commits

Author SHA1 Message Date
CanbiZ
23a20ec5f5 add more mariadb migrations 2025-05-27 14:32:01 +02:00
CanbiZ
3563354516 merge MariaDB to tools.func Installer 2025-05-27 14:26:00 +02:00
17 changed files with 59 additions and 360 deletions

View File

@ -18,13 +18,10 @@ All LXC instances created using this repository come pre-installed with Midnight
### 🆕 New Scripts ### 🆕 New Scripts
- Backrest ([#4766](https://github.com/community-scripts/ProxmoxVE/pull/4766))
- Pulse ([#4728](https://github.com/community-scripts/ProxmoxVE/pull/4728)) - Pulse ([#4728](https://github.com/community-scripts/ProxmoxVE/pull/4728))
### 🚀 Updated Scripts ### 🚀 Updated Scripts
- Alpine-Vaultwarden: Increase min disk requirements to 1GB [@neyzm](https://github.com/neyzm) ([#4764](https://github.com/community-scripts/ProxmoxVE/pull/4764))
- #### 🐞 Bug Fixes - #### 🐞 Bug Fixes
- lldap: fix update-check [@MickLesk](https://github.com/MickLesk) ([#4742](https://github.com/community-scripts/ProxmoxVE/pull/4742)) - lldap: fix update-check [@MickLesk](https://github.com/MickLesk) ([#4742](https://github.com/community-scripts/ProxmoxVE/pull/4742))
@ -33,17 +30,6 @@ All LXC instances created using this repository come pre-installed with Midnight
- Big NodeJS Update: Use Helper Function on all Install-Scripts [@MickLesk](https://github.com/MickLesk) ([#4744](https://github.com/community-scripts/ProxmoxVE/pull/4744)) - Big NodeJS Update: Use Helper Function on all Install-Scripts [@MickLesk](https://github.com/MickLesk) ([#4744](https://github.com/community-scripts/ProxmoxVE/pull/4744))
- #### 🔧 Refactor
- merge MariaDB to tools.func Installer [@MickLesk](https://github.com/MickLesk) ([#4753](https://github.com/community-scripts/ProxmoxVE/pull/4753))
- merge PostgreSQL to tools.func Installer [@MickLesk](https://github.com/MickLesk) ([#4752](https://github.com/community-scripts/ProxmoxVE/pull/4752))
### 🌐 Website
- #### 📝 Script Information
- Increase default RAM allocation for BunkerWeb to 8192MB [@TheophileDiot](https://github.com/TheophileDiot) ([#4762](https://github.com/community-scripts/ProxmoxVE/pull/4762))
## 2025-05-26 ## 2025-05-26
### 🆕 New Scripts ### 🆕 New Scripts

View File

@ -9,7 +9,7 @@ APP="Alpine-Vaultwarden"
var_tags="${var_tags:-alpine;vault}" var_tags="${var_tags:-alpine;vault}"
var_cpu="${var_cpu:-1}" var_cpu="${var_cpu:-1}"
var_ram="${var_ram:-256}" var_ram="${var_ram:-256}"
var_disk="${var_disk:-1}" var_disk="${var_disk:-0.5}"
var_os="${var_os:-alpine}" var_os="${var_os:-alpine}"
var_version="${var_version:-3.21}" var_version="${var_version:-3.21}"
var_unprivileged="${var_unprivileged:-1}" var_unprivileged="${var_unprivileged:-1}"

View File

@ -1,66 +0,0 @@
#!/usr/bin/env bash
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
# Copyright (c) 2021-2025 community-scripts ORG
# Author: ksad (enirys31)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://garethgeorge.github.io/backrest/
APP="Backrest"
var_tags="${var_tags:-backup}"
var_cpu="${var_cpu:-1}"
var_ram="${var_ram:-512}"
var_disk="${var_disk:-8}"
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/backrest ]]; then
msg_error "No ${APP} Installation Found!"
exit
fi
RELEASE=$(curl -fsSL https://api.github.com/repos/garethgeorge/backrest/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
msg_info "Stopping ${APP}"
systemctl stop backrest
msg_ok "Stopped ${APP}"
msg_info "Updating ${APP} to ${RELEASE}"
temp_file=$(mktemp)
rm -f /opt/backrest/bin/backrest
curl -fsSL "https://github.com/garethgeorge/backrest/releases/download/v${RELEASE}/backrest_Linux_x86_64.tar.gz" -o "$temp_file"
tar xzf $temp_file -C /opt/backrest/bin
chmod +x /opt/backrest/bin/backrest
echo "${RELEASE}" >/opt/${APP}_version.txt
msg_ok "Updated ${APP} to ${RELEASE}"
msg_info "Starting ${APP}"
systemctl start backrest
msg_ok "Started ${APP}"
msg_info "Cleaning up"
rm -f "$temp_file"
msg_ok "Cleaned up"
msg_ok "Updated Successfully"
else
msg_ok "No update required. ${APP} is already at ${RELEASE}"
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}:9898${CL}"

View File

@ -8,7 +8,7 @@ source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxV
APP="BunkerWeb" APP="BunkerWeb"
var_tags="${var_tags:-webserver}" var_tags="${var_tags:-webserver}"
var_cpu="${var_cpu:-2}" var_cpu="${var_cpu:-2}"
var_ram="${var_ram:-8192}" var_ram="${var_ram:-4096}"
var_disk="${var_disk:-4}" var_disk="${var_disk:-4}"
var_os="${var_os:-debian}" var_os="${var_os:-debian}"
var_version="${var_version:-12}" var_version="${var_version:-12}"

View File

@ -1,6 +0,0 @@
____ __ __
/ __ )____ ______/ /__________ _____/ /_
/ __ / __ `/ ___/ //_/ ___/ _ \/ ___/ __/
/ /_/ / /_/ / /__/ ,< / / / __(__ ) /_
/_____/\__,_/\___/_/|_/_/ \___/____/\__/

View File

@ -1,40 +0,0 @@
{
"name": "Backrest",
"slug": "backrest",
"categories": [
7
],
"date_created": "2025-05-27",
"type": "ct",
"updateable": true,
"privileged": false,
"interface_port": 9898,
"documentation": "https://garethgeorge.github.io/backrest/introduction/getting-started",
"website": "https://garethgeorge.github.io/backrest",
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/backrest.webp",
"config_path": "/opt/backrest/config/config.json",
"description": "Backrest is a web-accessible backup solution built on top of restic and providing a WebUI which wraps the restic CLI and makes it easy to create repos, browse snapshots, and restore files. Additionally, Backrest can run in the background and take an opinionated approach to scheduling snapshots and orchestrating repo health operations.",
"install_methods": [
{
"type": "default",
"script": "ct/backrest.sh",
"resources": {
"cpu": 1,
"ram": 512,
"hdd": 8,
"os": "debian",
"version": "12"
}
}
],
"default_credentials": {
"username": null,
"password": null
},
"notes": [
{
"type": "info",
"text": "`cat ~/.ssh/id_ed25519.pub` to view ssh public key. This key is used to authenticate with sftp targets. You can add this key on the sftp server."
}
]
}

View File

@ -20,7 +20,7 @@
"script": "ct/bunkerweb.sh", "script": "ct/bunkerweb.sh",
"resources": { "resources": {
"cpu": 2, "cpu": 2,
"ram": 8192, "ram": 4096,
"hdd": 4, "hdd": 4,
"os": "debian", "os": "debian",
"version": "12" "version": "12"

View File

@ -32,7 +32,7 @@
"resources": { "resources": {
"cpu": 1, "cpu": 1,
"ram": 256, "ram": 256,
"hdd": 1, "hdd": 0.5,
"os": "alpine", "os": "alpine",
"version": "3.21" "version": "3.21"
} }

View File

@ -25,9 +25,10 @@ $STD apt-get install -y \
msg_ok "Installed Dependencies" msg_ok "Installed Dependencies"
NODE_VERSION="22" NODE_MODULE="pnpm@latest" install_node_and_modules NODE_VERSION="22" NODE_MODULE="pnpm@latest" install_node_and_modules
PG_VERSION="16" PG_MODULES="postgis" install_postgresql PG_VERSION="16" install_postgresql
msg_info "Set up PostgreSQL Database" msg_info "Install/Set up PostgreSQL Database"
$STD apt-get install -y postgresql-16-postgis
DB_NAME="adventurelog_db" DB_NAME="adventurelog_db"
DB_USER="adventurelog_user" DB_USER="adventurelog_user"
DB_PASS="$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13)" DB_PASS="$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13)"

View File

@ -37,7 +37,7 @@ $STD apt-get install -y \
msg_ok "Installed Dependencies" msg_ok "Installed Dependencies"
setup_uv setup_uv
PG_VERSION="16" PG_MODULES="contrib" install_postgresql PG_VERSION="16" install_postgresql
NODE_VERSION="22" install_node_and_modules NODE_VERSION="22" install_node_and_modules
install_go install_go
@ -61,7 +61,8 @@ cat <<EOF >/etc/GeoIP.conf
EOF EOF
msg_ok "Installed GeoIP" msg_ok "Installed GeoIP"
msg_info "Setup PostgreSQL Database" msg_info "Installing PostgreSQL"
$STD apt-get install -y postgresql-16 postgresql-contrib-16
DB_NAME="authentik" DB_NAME="authentik"
DB_USER="authentik" DB_USER="authentik"
DB_PASS="$(openssl rand -base64 18 | cut -c1-13)" DB_PASS="$(openssl rand -base64 18 | cut -c1-13)"

View File

@ -1,54 +0,0 @@
#!/usr/bin/env bash
# Copyright (c) 2021-2025 community-scripts ORG
# Author: ksad (enirys31)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://garethgeorge.github.io/backrest/
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
msg_info "Installing Backrest"
RELEASE=$(curl -fsSL https://api.github.com/repos/garethgeorge/backrest/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
temp_file=$(mktemp)
mkdir -p /opt/backrest/{bin,config,data}
curl -fsSL "https://github.com/garethgeorge/backrest/releases/download/v${RELEASE}/backrest_Linux_x86_64.tar.gz" -o "$temp_file"
tar xzf $temp_file -C /opt/backrest/bin
chmod +x /opt/backrest/bin/backrest
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
msg_ok "Installed Backrest"
msg_info "Creating Service"
cat <<EOF >/etc/systemd/system/backrest.service
[Unit]
Description=Backrest
After=network.target
[Service]
Type=simple
User=root
ExecStart=/opt/backrest/bin/backrest
Environment="BACKREST_PORT=9898"
Environment="BACKREST_CONFIG=/opt/backrest/config/config.json"
Environment="BACKREST_DATA=/opt/backrest/data"
Environment="XDG_CACHE_HOME=/opt/backrest/cache"
[Install]
WantedBy=multi-user.target
EOF
systemctl enable -q --now backrest
msg_ok "Created Service"
motd_ssh
customize
msg_info "Cleaning up"
rm -f "$temp_file"
$STD apt-get -y autoremove
$STD apt-get -y autoclean
msg_ok "Cleaned"

View File

@ -15,14 +15,13 @@ update_os
msg_info "Installing Dependencies" msg_info "Installing Dependencies"
$STD apt-get install -y \ $STD apt-get install -y \
postgresql \
apache2 \ apache2 \
libapache2-mod-php \ libapache2-mod-php \
php-{pgsql,dom} php-{pgsql,dom}
msg_ok "Installed Dependencies" msg_ok "Installed Dependencies"
PG_VERSION="16" install_postgresql msg_info "Setting up PostgreSQL"
msg_info "Setting up PostgreSQL Database"
DB_NAME=baikal DB_NAME=baikal
DB_USER=baikal DB_USER=baikal
DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13) DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13)
@ -34,7 +33,7 @@ $STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER TEMP
echo "Baikal Database Password: $DB_PASS" echo "Baikal Database Password: $DB_PASS"
echo "Baikal Database Name: $DB_NAME" echo "Baikal Database Name: $DB_NAME"
} >>~/baikal.creds } >>~/baikal.creds
msg_ok "Set up PostgreSQL Database" msg_ok "Set up PostgreSQL"
msg_info "Installing Baikal" msg_info "Installing Baikal"
RELEASE=$(curl -fsSL https://api.github.com/repos/sabre-io/Baikal/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') RELEASE=$(curl -fsSL https://api.github.com/repos/sabre-io/Baikal/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')

View File

@ -15,13 +15,12 @@ update_os
msg_info "Installing Dependencies" msg_info "Installing Dependencies"
$STD apt-get install -y \ $STD apt-get install -y \
postgresql \
apache2 \ apache2 \
php-{curl,dom,json,ctype,pgsql,gmp,mbstring,iconv,zip} \ php-{curl,dom,json,ctype,pgsql,gmp,mbstring,iconv,zip} \
libapache2-mod-php libapache2-mod-php
msg_ok "Installed Dependencies" msg_ok "Installed Dependencies"
PG_VERSION="16" install_postgresql
msg_info "Setting up PostgreSQL" msg_info "Setting up PostgreSQL"
DB_NAME=freshrss DB_NAME=freshrss
DB_USER=freshrss DB_USER=freshrss

View File

@ -17,6 +17,7 @@ msg_info "Installing Dependencies"
$STD apt-get install -y \ $STD apt-get install -y \
apache2 \ apache2 \
redis-server \ redis-server \
postgresql \
build-essential \ build-essential \
libxml2-dev \ libxml2-dev \
libxslt1-dev \ libxslt1-dev \
@ -26,8 +27,6 @@ $STD apt-get install -y \
zlib1g-dev zlib1g-dev
msg_ok "Installed Dependencies" msg_ok "Installed Dependencies"
PG_VERSION="16" install_postgresql
msg_info "Installing Python" msg_info "Installing Python"
$STD apt-get install -y \ $STD apt-get install -y \
python3 \ python3 \

View File

@ -16,6 +16,7 @@ update_os
msg_info "Installing Dependencies (Patience)" msg_info "Installing Dependencies (Patience)"
$STD apt-get install -y \ $STD apt-get install -y \
redis \ redis \
postgresql \
build-essential \ build-essential \
imagemagick \ imagemagick \
fonts-liberation \ fonts-liberation \
@ -36,8 +37,6 @@ $STD apt-get install -y \
libleptonica-dev libleptonica-dev
msg_ok "Installed Dependencies" msg_ok "Installed Dependencies"
PG_VERSION="16" install_postgresql
msg_info "Setup Python3" msg_info "Setup Python3"
$STD apt-get install -y \ $STD apt-get install -y \
python3 \ python3 \

View File

@ -13,7 +13,19 @@ setting_up_container
network_check network_check
update_os update_os
PG_VERSION="17" install_postgresql msg_info "Installing Dependencies"
$STD apt-get install -y gnupg
msg_ok "Installed Dependencies"
msg_info "Setting up PostgreSQL Repository"
VERSION="$(awk -F'=' '/^VERSION_CODENAME=/{ print $NF }' /etc/os-release)"
echo "deb http://apt.postgresql.org/pub/repos/apt ${VERSION}-pgdg main" >/etc/apt/sources.list.d/pgdg.list
curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor --output /etc/apt/trusted.gpg.d/postgresql.gpg
msg_ok "Setup PostgreSQL Repository"
msg_info "Installing PostgreSQL"
$STD apt-get update
$STD apt-get install -y postgresql
cat <<EOF >/etc/postgresql/17/main/pg_hba.conf cat <<EOF >/etc/postgresql/17/main/pg_hba.conf
# PostgreSQL Client Authentication Configuration File # PostgreSQL Client Authentication Configuration File
@ -115,7 +127,7 @@ default_text_search_config = 'pg_catalog.english'
include_dir = 'conf.d' include_dir = 'conf.d'
EOF EOF
systemctl restart postgresql sudo systemctl restart postgresql
msg_ok "Installed PostgreSQL" msg_ok "Installed PostgreSQL"
read -r -p "${TAB3}Would you like to add Adminer? <y/N> " prompt read -r -p "${TAB3}Would you like to add Adminer? <y/N> " prompt

View File

@ -122,22 +122,20 @@ install_node_and_modules() {
} }
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Installs or upgrades PostgreSQL and optional extensions/modules. # Installs or upgrades PostgreSQL and performs data migration.
# #
# Description: # Description:
# - Detects existing PostgreSQL version # - Detects existing PostgreSQL version
# - Dumps all databases before upgrade # - Dumps all databases before upgrade
# - Adds PGDG repo and installs specified version # - Adds PGDG repo and installs specified version
# - Installs optional PG_MODULES (e.g. postgis, contrib)
# - Restores dumped data post-upgrade # - Restores dumped data post-upgrade
# #
# Variables: # Variables:
# PG_VERSION - Major PostgreSQL version (e.g. 15, 16) (default: 16) # PG_VERSION - Major PostgreSQL version (e.g. 15, 16) (default: 16)
# PG_MODULES - Comma-separated list of extensions (e.g. "postgis,contrib")
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
install_postgresql() { install_postgresql() {
local PG_VERSION="${PG_VERSION:-16}" local PG_VERSION="${PG_VERSION:-16}"
local PG_MODULES="${PG_MODULES:-}"
local CURRENT_PG_VERSION="" local CURRENT_PG_VERSION=""
local DISTRO local DISTRO
local NEED_PG_INSTALL=false local NEED_PG_INSTALL=false
@ -147,10 +145,10 @@ install_postgresql() {
CURRENT_PG_VERSION="$(psql -V | awk '{print $3}' | cut -d. -f1)" CURRENT_PG_VERSION="$(psql -V | awk '{print $3}' | cut -d. -f1)"
if [[ "$CURRENT_PG_VERSION" == "$PG_VERSION" ]]; then if [[ "$CURRENT_PG_VERSION" == "$PG_VERSION" ]]; then
msg_ok "PostgreSQL $PG_VERSION is already installed" msg_ok "PostgreSQL $PG_VERSION is already installed"
else return
fi
msg_info "Detected PostgreSQL $CURRENT_PG_VERSION, preparing upgrade to $PG_VERSION" msg_info "Detected PostgreSQL $CURRENT_PG_VERSION, preparing upgrade to $PG_VERSION"
NEED_PG_INSTALL=true NEED_PG_INSTALL=true
fi
else else
msg_info "Setup PostgreSQL $PG_VERSION" msg_info "Setup PostgreSQL $PG_VERSION"
NEED_PG_INSTALL=true NEED_PG_INSTALL=true
@ -181,34 +179,20 @@ install_postgresql() {
$STD apt-get install -y "postgresql-${PG_VERSION}" "postgresql-client-${PG_VERSION}" $STD apt-get install -y "postgresql-${PG_VERSION}" "postgresql-client-${PG_VERSION}"
if [[ -n "$CURRENT_PG_VERSION" ]]; then if [[ -n "$CURRENT_PG_VERSION" ]]; then
msg_info "Removing old PostgreSQL $CURRENT_PG_VERSION packages" $STD msg_info "Removing old PostgreSQL $CURRENT_PG_VERSION packages"
$STD apt-get purge -y "postgresql-${CURRENT_PG_VERSION}" "postgresql-client-${CURRENT_PG_VERSION}" || true $STD apt-get purge -y "postgresql-${CURRENT_PG_VERSION}" "postgresql-client-${CURRENT_PG_VERSION}" || true
fi fi
msg_info "Starting PostgreSQL $PG_VERSION" $STD msg_info "Starting PostgreSQL $PG_VERSION"
systemctl enable -q --now postgresql systemctl enable -q --now postgresql
if [[ -n "$CURRENT_PG_VERSION" ]]; then if [[ -n "$CURRENT_PG_VERSION" ]]; then
msg_info "Restoring dumped data" $STD msg_info "Restoring dumped data"
su - postgres -c "psql < /var/lib/postgresql/backup_$(date +%F)_v${CURRENT_PG_VERSION}.sql" su - postgres -c "psql < /var/lib/postgresql/backup_$(date +%F)_v${CURRENT_PG_VERSION}.sql"
fi fi
msg_ok "PostgreSQL $PG_VERSION installed" msg_ok "PostgreSQL $PG_VERSION installed"
fi fi
# Install optional PostgreSQL modules
if [[ -n "$PG_MODULES" ]]; then
IFS=',' read -ra MODULES <<<"$PG_MODULES"
for module in "${MODULES[@]}"; do
local pkg="postgresql-${PG_VERSION}-${module}"
msg_info "Installing PostgreSQL module: $pkg"
$STD apt-get install -y "$pkg" || {
msg_error "Failed to install $pkg"
continue
}
done
msg_ok "All requested PostgreSQL modules installed"
fi
} }
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
@ -380,10 +364,8 @@ install_php() {
CURRENT_PHP="" CURRENT_PHP=""
fi fi
if [[ -z "$CURRENT_PHP" ]]; then if [[ "$CURRENT_PHP" != "$PHP_VERSION" ]]; then
msg_info "Setup PHP $PHP_VERSION" $STD msg_info "PHP $CURRENT_PHP detected, migrating to PHP $PHP_VERSION"
elif [[ "$CURRENT_PHP" != "$PHP_VERSION" ]]; then
msg_info "PHP $CURRENT_PHP detected, migrating to PHP $PHP_VERSION"
if [[ ! -f /etc/apt/sources.list.d/php.list ]]; then if [[ ! -f /etc/apt/sources.list.d/php.list ]]; then
$STD curl -fsSLo /tmp/debsuryorg-archive-keyring.deb https://packages.sury.org/debsuryorg-archive-keyring.deb $STD curl -fsSLo /tmp/debsuryorg-archive-keyring.deb https://packages.sury.org/debsuryorg-archive-keyring.deb
$STD dpkg -i /tmp/debsuryorg-archive-keyring.deb $STD dpkg -i /tmp/debsuryorg-archive-keyring.deb
@ -400,9 +382,6 @@ install_php() {
for mod in "${MODULES[@]}"; do for mod in "${MODULES[@]}"; do
MODULE_LIST+=" php${PHP_VERSION}-${mod}" MODULE_LIST+=" php${PHP_VERSION}-${mod}"
done done
if [[ "$PHP_FPM" == "YES" ]]; then
MODULE_LIST+=" php${PHP_VERSION}-fpm"
fi
if [[ "$PHP_APACHE" == "YES" ]]; then if [[ "$PHP_APACHE" == "YES" ]]; then
# Optionally disable old Apache PHP module # Optionally disable old Apache PHP module
@ -469,7 +448,7 @@ install_composer() {
# Download and install latest composer # Download and install latest composer
curl -fsSL https://getcomposer.org/installer -o /tmp/composer-setup.php curl -fsSL https://getcomposer.org/installer -o /tmp/composer-setup.php
php /tmp/composer-setup.php --install-dir=/usr/local/bin --filename=composer >/dev/null 2>&1 php /tmp/composer-setup.php --install-dir=/usr/local/bin --filename=composer &>/dev/null
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
msg_error "Failed to install Composer" msg_error "Failed to install Composer"
@ -477,9 +456,7 @@ install_composer() {
fi fi
chmod +x "$COMPOSER_BIN" chmod +x "$COMPOSER_BIN"
composer diagnose >/dev/null 2>&1 msg_ok "Installed Composer $($COMPOSER_BIN --version | awk '{print $3}')"
msg_ok "Setup Composer"
#msg_ok "Installed Composer $($COMPOSER_BIN --version | awk '{print $3}')"
} }
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
@ -612,21 +589,11 @@ install_java() {
install_mongodb() { install_mongodb() {
local MONGO_VERSION="${MONGO_VERSION:-8.0}" local MONGO_VERSION="${MONGO_VERSION:-8.0}"
local DISTRO_ID DISTRO_CODENAME MONGO_BASE_URL local DISTRO_CODENAME
DISTRO_ID=$(awk -F= '/^ID=/{ gsub(/"/,"",$2); print $2 }' /etc/os-release) DISTRO_CODENAME=$(awk -F= '/VERSION_CODENAME/ { print $2 }' /etc/os-release)
DISTRO_CODENAME=$(awk -F= '/^VERSION_CODENAME=/{ print $2 }' /etc/os-release)
case "$DISTRO_ID" in
ubuntu) MONGO_BASE_URL="https://repo.mongodb.org/apt/ubuntu" ;;
debian) MONGO_BASE_URL="https://repo.mongodb.org/apt/debian" ;;
*)
msg_error "Unsupported distribution: $DISTRO_ID"
return 1
;;
esac
local REPO_LIST="/etc/apt/sources.list.d/mongodb-org-${MONGO_VERSION}.list" local REPO_LIST="/etc/apt/sources.list.d/mongodb-org-${MONGO_VERSION}.list"
# Aktuell installierte Major-Version ermitteln
local INSTALLED_VERSION="" local INSTALLED_VERSION=""
if command -v mongod >/dev/null; then if command -v mongod >/dev/null; then
INSTALLED_VERSION=$(mongod --version | awk '/db version/{print $3}' | cut -d. -f1,2) INSTALLED_VERSION=$(mongod --version | awk '/db version/{print $3}' | cut -d. -f1,2)
@ -640,6 +607,7 @@ install_mongodb() {
return 0 return 0
fi fi
# Ältere Version entfernen (nur Packages, nicht Daten!)
if [[ -n "$INSTALLED_VERSION" ]]; then if [[ -n "$INSTALLED_VERSION" ]]; then
msg_info "Replacing MongoDB $INSTALLED_VERSION with $MONGO_VERSION (data will be preserved)" msg_info "Replacing MongoDB $INSTALLED_VERSION with $MONGO_VERSION (data will be preserved)"
$STD systemctl stop mongod || true $STD systemctl stop mongod || true
@ -650,17 +618,15 @@ install_mongodb() {
msg_info "Installing MongoDB $MONGO_VERSION" msg_info "Installing MongoDB $MONGO_VERSION"
fi fi
# MongoDB Repo hinzufügen
curl -fsSL "https://pgp.mongodb.com/server-${MONGO_VERSION}.asc" | gpg --dearmor -o "/etc/apt/trusted.gpg.d/mongodb-${MONGO_VERSION}.gpg" curl -fsSL "https://pgp.mongodb.com/server-${MONGO_VERSION}.asc" | gpg --dearmor -o "/etc/apt/trusted.gpg.d/mongodb-${MONGO_VERSION}.gpg"
echo "deb [signed-by=/etc/apt/trusted.gpg.d/mongodb-${MONGO_VERSION}.gpg] ${MONGO_BASE_URL} ${DISTRO_CODENAME}/mongodb-org/${MONGO_VERSION} main" \ echo "deb [signed-by=/etc/apt/trusted.gpg.d/mongodb-${MONGO_VERSION}.gpg] https://repo.mongodb.org/apt/debian ${DISTRO_CODENAME}/mongodb-org/${MONGO_VERSION} main" \
>"$REPO_LIST" >"$REPO_LIST"
$STD apt-get update || { $STD apt-get update
msg_error "APT update failed — invalid MongoDB repo for ${DISTRO_ID}-${DISTRO_CODENAME}?"
return 1
}
$STD apt-get install -y mongodb-org $STD apt-get install -y mongodb-org
# Sicherstellen, dass Datenverzeichnis intakt bleibt
mkdir -p /var/lib/mongodb mkdir -p /var/lib/mongodb
chown -R mongodb:mongodb /var/lib/mongodb chown -R mongodb:mongodb /var/lib/mongodb
@ -1246,100 +1212,3 @@ create_selfsigned_certs() {
-subj "/C=US/O=$app/OU=Domain Control Validated/CN=localhost" -subj "/C=US/O=$app/OU=Domain Control Validated/CN=localhost"
$STD msg_ok "Created Self-Signed Certificate" $STD msg_ok "Created Self-Signed Certificate"
} }
# ------------------------------------------------------------------------------
# Installs Rust toolchain and optional global crates via cargo.
#
# Description:
# - Installs rustup (if missing)
# - Installs or updates desired Rust toolchain (stable, nightly, or versioned)
# - Installs or updates specified global crates using `cargo install`
#
# Notes:
# - Skips crate install if exact version is already present
# - Updates crate if newer version or different version is requested
#
# Variables:
# RUST_TOOLCHAIN - Rust toolchain to install (default: stable)
# RUST_CRATES - Comma-separated list of crates (e.g. "cargo-edit,wasm-pack@0.12.1")
# ------------------------------------------------------------------------------
install_rust_and_crates() {
local RUST_TOOLCHAIN="${RUST_TOOLCHAIN:-stable}"
local RUST_CRATES="${RUST_CRATES:-}"
local CARGO_BIN="${HOME}/.cargo/bin"
# rustup & toolchain
if ! command -v rustup &>/dev/null; then
msg_info "Installing rustup"
curl -fsSL https://sh.rustup.rs | $STD sh -s -- -y --default-toolchain "$RUST_TOOLCHAIN"
export PATH="$CARGO_BIN:$PATH"
echo 'export PATH="$HOME/.cargo/bin:$PATH"' >>"$HOME/.profile"
msg_ok "Installed rustup with $RUST_TOOLCHAIN"
else
$STD rustup install "$RUST_TOOLCHAIN"
$STD rustup default "$RUST_TOOLCHAIN"
$STD rustup update "$RUST_TOOLCHAIN"
msg_ok "Rust toolchain set to $RUST_TOOLCHAIN"
fi
# install/update crates
if [[ -n "$RUST_CRATES" ]]; then
IFS=',' read -ra CRATES <<<"$RUST_CRATES"
for crate in "${CRATES[@]}"; do
local NAME VER INSTALLED_VER
if [[ "$crate" == *"@"* ]]; then
NAME="${crate%@*}"
VER="${crate##*@}"
else
NAME="$crate"
VER=""
fi
INSTALLED_VER=$(cargo install --list 2>/dev/null | awk "/^$NAME v[0-9]/ {print \$2}" | tr -d 'v')
if [[ -n "$INSTALLED_VER" ]]; then
if [[ -n "$VER" && "$VER" != "$INSTALLED_VER" ]]; then
msg_info "Updating $NAME from $INSTALLED_VER to $VER"
$STD cargo install "$NAME" --version "$VER" --force
elif [[ -z "$VER" ]]; then
msg_info "Updating $NAME to latest"
$STD cargo install "$NAME" --force
else
msg_ok "$NAME@$INSTALLED_VER already up to date"
fi
else
msg_info "Installing $NAME ${VER:+($VER)}"
$STD cargo install "$NAME" ${VER:+--version "$VER"}
fi
done
msg_ok "All requested Rust crates processed"
fi
}
# ------------------------------------------------------------------------------
# Installs Adminer (Debian/Ubuntu via APT, Alpine via direct download).
#
# Description:
# - Adds Adminer to Apache or web root
# - Supports Alpine and Debian-based systems
# ------------------------------------------------------------------------------
install_adminer() {
if grep -qi alpine /etc/os-release; then
msg_info "Installing Adminer (Alpine)"
mkdir -p /var/www/localhost/htdocs/adminer
if ! curl -fsSL https://github.com/vrana/adminer/releases/latest/download/adminer.php \
-o /var/www/localhost/htdocs/adminer/index.php; then
msg_error "Failed to download Adminer"
return 1
fi
msg_ok "Adminer available at /adminer (Alpine)"
else
msg_info "Installing Adminer (Debian/Ubuntu)"
$STD apt-get install -y adminer
$STD a2enconf adminer
$STD systemctl reload apache2
msg_ok "Adminer available at /adminer (Debian/Ubuntu)"
fi
}