mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2025-11-11 13:52:51 +00:00
Compare commits
1 Commits
2025-11-10
...
add-script
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
81f82b92e7 |
11
CHANGELOG.md
11
CHANGELOG.md
@@ -10,26 +10,15 @@
|
||||
> [!CAUTION]
|
||||
Exercise vigilance regarding copycat or coat-tailing sites that seek to exploit the project's popularity for potentially malicious purposes.
|
||||
|
||||
## 2025-11-11
|
||||
|
||||
## 2025-11-10
|
||||
|
||||
### 🚀 Updated Scripts
|
||||
|
||||
- #### 🐞 Bug Fixes
|
||||
|
||||
- Plex: extend checking for deb822 source [@Matt17000](https://github.com/Matt17000) ([#9036](https://github.com/community-scripts/ProxmoxVE/pull/9036))
|
||||
|
||||
- #### ✨ New Features
|
||||
|
||||
- tools.func: add helper functions for MariaDB and PostgreSQL setup [@MickLesk](https://github.com/MickLesk) ([#9026](https://github.com/community-scripts/ProxmoxVE/pull/9026))
|
||||
- core: update message for no available updates scenario (if pinned) [@MickLesk](https://github.com/MickLesk) ([#9021](https://github.com/community-scripts/ProxmoxVE/pull/9021))
|
||||
- Migrate Open WebUI to uv-based installation [@MickLesk](https://github.com/MickLesk) ([#9019](https://github.com/community-scripts/ProxmoxVE/pull/9019))
|
||||
|
||||
- #### 🔧 Refactor
|
||||
|
||||
- Refactor: phpIPAM [@MickLesk](https://github.com/MickLesk) ([#9027](https://github.com/community-scripts/ProxmoxVE/pull/9027))
|
||||
|
||||
## 2025-11-09
|
||||
|
||||
### 🚀 Updated Scripts
|
||||
|
||||
67
ct/domain-monitor.sh
Normal file
67
ct/domain-monitor.sh
Normal file
@@ -0,0 +1,67 @@
|
||||
#!/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: Slaviša Arežina (tremor021)
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://github.com/Hosteroid/domain-monitor
|
||||
|
||||
APP="Domain-Monitor"
|
||||
var_tags="${var_tags:-proxy}"
|
||||
var_cpu="${var_cpu:-2}"
|
||||
var_ram="${var_ram:-512}"
|
||||
var_disk="${var_disk:-2}"
|
||||
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/domain-monitor ]]; then
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
fi
|
||||
|
||||
if check_for_gh_release "domain-monitor" "Hosteroid/domain-monitor"; then
|
||||
msg_info "Stopping Service"
|
||||
systemctl stop apache2
|
||||
msg_info "Service stopped"
|
||||
|
||||
msg_info "Creating backup"
|
||||
mv /opt/domain-monitor/.env /opt
|
||||
msg_ok "Created backup"
|
||||
|
||||
setup_composer
|
||||
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "domain-monitor" "Hosteroid/domain-monitor" "prebuild" "latest" "/opt/domain-monitor" "domain-monitor-v*.zip"
|
||||
|
||||
msg_info "Updating Domain Monitor"
|
||||
cd /opt/domain-monitor
|
||||
$STD composer install
|
||||
msg_ok "Updated Domain Monitor"
|
||||
|
||||
msg_info "Restoring backup"
|
||||
mv /opt/.env /opt/domain-monitor
|
||||
msg_ok "Restored backup"
|
||||
|
||||
msg_info "Restarting Services"
|
||||
systemctl reload apache2
|
||||
msg_ok "Restarted Services"
|
||||
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}${CL}"
|
||||
6
ct/headers/domain-monitor
Normal file
6
ct/headers/domain-monitor
Normal file
@@ -0,0 +1,6 @@
|
||||
____ _ __ ___ _ __
|
||||
/ __ \____ ____ ___ ____ _(_)___ / |/ /___ ____ (_) /_____ _____
|
||||
/ / / / __ \/ __ `__ \/ __ `/ / __ \______/ /|_/ / __ \/ __ \/ / __/ __ \/ ___/
|
||||
/ /_/ / /_/ / / / / / / /_/ / / / / /_____/ / / / /_/ / / / / / /_/ /_/ / /
|
||||
/_____/\____/_/ /_/ /_/\__,_/_/_/ /_/ /_/ /_/\____/_/ /_/_/\__/\____/_/
|
||||
|
||||
@@ -33,22 +33,17 @@ function update_script() {
|
||||
systemctl stop apache2
|
||||
msg_ok "Stopped Service"
|
||||
|
||||
PHP_VERSION="8.4" PHP_APACHE="YES" PHP_FPM="YES" PHP_MODULE="mysql,gmp,snmp,ldap,apcu" setup_php
|
||||
|
||||
msg_info "Installing PHP-PEAR"
|
||||
$STD apt install -y \
|
||||
php-pear \
|
||||
php-dev
|
||||
msg_ok "Installed PHP-PEAR"
|
||||
|
||||
mv /opt/phpipam/ /opt/phpipam-backup
|
||||
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "phpipam" "phpipam/phpipam" "prebuild" "latest" "/opt/phpipam" "phpipam-v*.zip"
|
||||
fetch_and_deploy_gh_release "phpipam" "phpipam/phpipam" "prebuild" "latest" "/opt/phpipam" "phpipam-v*.zip"
|
||||
cp /opt/phpipam-backup/config.php /opt/phpipam
|
||||
rm -r /opt/phpipam-backup
|
||||
|
||||
msg_info "Starting Service"
|
||||
systemctl start apache2
|
||||
msg_ok "Started Service"
|
||||
|
||||
msg_info "Cleaning up"
|
||||
rm -r /opt/phpipam-backup
|
||||
msg_ok "Cleaned"
|
||||
msg_ok "Updated successfully!"
|
||||
fi
|
||||
exit
|
||||
|
||||
@@ -23,7 +23,7 @@ function update_script() {
|
||||
header_info
|
||||
check_container_storage
|
||||
check_container_resources
|
||||
if [ ! -f /etc/apt/sources.list.d/plexmediaserver.list ]] && [[ ! -f /etc/apt/sources.list.d/plexmediaserver.sources ]]; then
|
||||
if [[ ! -f /etc/apt/sources.list.d/plexmediaserver.list ]]; then
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
fi
|
||||
|
||||
35
frontend/public/json/domain-monitor.json
Normal file
35
frontend/public/json/domain-monitor.json
Normal file
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"name": "Domain Monitor",
|
||||
"slug": "domain-monitor",
|
||||
"categories": [
|
||||
9
|
||||
],
|
||||
"date_created": "2025-09-04",
|
||||
"type": "ct",
|
||||
"updateable": true,
|
||||
"privileged": false,
|
||||
"interface_port": 80,
|
||||
"documentation": "https://github.com/Hosteroid/domain-monitor/blob/main/README.md",
|
||||
"config_path": "/opt/domain-monitor/.env",
|
||||
"website": "https://github.com/Hosteroid/domain-monitor",
|
||||
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/png/domain-monitor.png",
|
||||
"description": "A self-hosted PHP domain expiration monitoring tool that tracks domain expiry dates, RDAP/WHOIS data, and SSL certificate validity. Supports alerts, multi-user setup, and cron automation. Built for developers, hosting providers, and IT admins who want full control without third-party services.",
|
||||
"install_methods": [
|
||||
{
|
||||
"type": "default",
|
||||
"script": "ct/domain-monitor.sh",
|
||||
"resources": {
|
||||
"cpu": 2,
|
||||
"ram": 512,
|
||||
"hdd": 2,
|
||||
"os": "Debian",
|
||||
"version": "13"
|
||||
}
|
||||
}
|
||||
],
|
||||
"default_credentials": {
|
||||
"username": null,
|
||||
"password": null
|
||||
},
|
||||
"notes": []
|
||||
}
|
||||
@@ -1,68 +1,18 @@
|
||||
[
|
||||
{
|
||||
"name": "chrisvel/tududi",
|
||||
"version": "v0.86",
|
||||
"date": "2025-11-10T20:54:25Z"
|
||||
"name": "dgtlmoon/changedetection.io",
|
||||
"version": "0.50.41",
|
||||
"date": "2025-11-10T11:00:46Z"
|
||||
},
|
||||
{
|
||||
"name": "pommee/goaway",
|
||||
"version": "v0.62.17",
|
||||
"date": "2025-11-10T19:45:49Z"
|
||||
},
|
||||
{
|
||||
"name": "chrisbenincasa/tunarr",
|
||||
"version": "v0.22.13",
|
||||
"date": "2025-11-10T18:12:24Z"
|
||||
"name": "emqx/emqx",
|
||||
"version": "e5.10.2",
|
||||
"date": "2025-11-10T10:58:21Z"
|
||||
},
|
||||
{
|
||||
"name": "autobrr/autobrr",
|
||||
"version": "v1.69.0",
|
||||
"date": "2025-11-10T17:22:00Z"
|
||||
},
|
||||
{
|
||||
"name": "meilisearch/meilisearch",
|
||||
"version": "latest",
|
||||
"date": "2025-11-10T17:01:21Z"
|
||||
},
|
||||
{
|
||||
"name": "gtsteffaniak/filebrowser",
|
||||
"version": "v1.0.1-stable",
|
||||
"date": "2025-11-10T16:51:44Z"
|
||||
},
|
||||
{
|
||||
"name": "msgbyte/tianji",
|
||||
"version": "v1.30.9",
|
||||
"date": "2025-11-10T16:23:29Z"
|
||||
},
|
||||
{
|
||||
"name": "fuma-nama/fumadocs",
|
||||
"version": "fumadocs-mdx@13.0.6",
|
||||
"date": "2025-11-10T14:43:06Z"
|
||||
},
|
||||
{
|
||||
"name": "n8n-io/n8n",
|
||||
"version": "v1.0.0",
|
||||
"date": "2025-11-07T12:52:42Z"
|
||||
},
|
||||
{
|
||||
"name": "grokability/snipe-it",
|
||||
"version": "v8.3.5",
|
||||
"date": "2025-11-10T14:12:12Z"
|
||||
},
|
||||
{
|
||||
"name": "SigNoz/signoz",
|
||||
"version": "v0.101.0-rc.1",
|
||||
"date": "2025-11-10T13:08:55Z"
|
||||
},
|
||||
{
|
||||
"name": "dgtlmoon/changedetection.io",
|
||||
"version": "0.50.42",
|
||||
"date": "2025-11-10T12:32:49Z"
|
||||
},
|
||||
{
|
||||
"name": "emqx/emqx",
|
||||
"version": "e6.0.1",
|
||||
"date": "2025-11-10T11:58:39Z"
|
||||
"date": "2025-11-10T10:57:40Z"
|
||||
},
|
||||
{
|
||||
"name": "documenso/documenso",
|
||||
@@ -124,6 +74,11 @@
|
||||
"version": "v2.4.5",
|
||||
"date": "2025-11-09T17:14:01Z"
|
||||
},
|
||||
{
|
||||
"name": "msgbyte/tianji",
|
||||
"version": "v1.30.7",
|
||||
"date": "2025-11-09T16:20:57Z"
|
||||
},
|
||||
{
|
||||
"name": "TechnitiumSoftware/DnsServer",
|
||||
"version": "v14.0.1",
|
||||
@@ -199,16 +154,31 @@
|
||||
"version": "v7.13.0",
|
||||
"date": "2025-11-08T13:36:25Z"
|
||||
},
|
||||
{
|
||||
"name": "pommee/goaway",
|
||||
"version": "v0.62.16",
|
||||
"date": "2025-11-08T12:15:30Z"
|
||||
},
|
||||
{
|
||||
"name": "runtipi/runtipi",
|
||||
"version": "v4.6.3",
|
||||
"date": "2025-11-08T10:06:18Z"
|
||||
},
|
||||
{
|
||||
"name": "fuma-nama/fumadocs",
|
||||
"version": "fumadocs-openapi@10.0.2",
|
||||
"date": "2025-11-08T09:58:09Z"
|
||||
},
|
||||
{
|
||||
"name": "pocketbase/pocketbase",
|
||||
"version": "v0.32.0",
|
||||
"date": "2025-11-08T09:36:27Z"
|
||||
},
|
||||
{
|
||||
"name": "chrisvel/tududi",
|
||||
"version": "v0.85.1",
|
||||
"date": "2025-10-31T10:45:26Z"
|
||||
},
|
||||
{
|
||||
"name": "home-assistant/core",
|
||||
"version": "2025.11.1",
|
||||
@@ -249,6 +219,11 @@
|
||||
"version": "v0.16.0",
|
||||
"date": "2025-11-07T12:55:42Z"
|
||||
},
|
||||
{
|
||||
"name": "n8n-io/n8n",
|
||||
"version": "v1.0.0",
|
||||
"date": "2025-11-07T12:52:42Z"
|
||||
},
|
||||
{
|
||||
"name": "element-hq/synapse",
|
||||
"version": "v1.142.0rc2",
|
||||
@@ -294,6 +269,11 @@
|
||||
"version": "v2.19.5",
|
||||
"date": "2025-11-06T20:20:13Z"
|
||||
},
|
||||
{
|
||||
"name": "chrisbenincasa/tunarr",
|
||||
"version": "v0.22.12",
|
||||
"date": "2025-11-06T18:43:51Z"
|
||||
},
|
||||
{
|
||||
"name": "MariaDB/server",
|
||||
"version": "mariadb-11.8.4",
|
||||
@@ -314,11 +294,21 @@
|
||||
"version": "v2025.11.2",
|
||||
"date": "2025-11-06T12:08:24Z"
|
||||
},
|
||||
{
|
||||
"name": "meilisearch/meilisearch",
|
||||
"version": "prototype-v1.24.0.s3-snapshots-5",
|
||||
"date": "2025-11-06T11:43:12Z"
|
||||
},
|
||||
{
|
||||
"name": "transmission/transmission",
|
||||
"version": "4.0.1-beta.1",
|
||||
"date": "2024-12-13T00:16:24Z"
|
||||
},
|
||||
{
|
||||
"name": "SigNoz/signoz",
|
||||
"version": "v0.100.1",
|
||||
"date": "2025-11-06T07:53:11Z"
|
||||
},
|
||||
{
|
||||
"name": "apache/tomcat",
|
||||
"version": "9.0.112",
|
||||
@@ -357,7 +347,7 @@
|
||||
{
|
||||
"name": "javedh-dev/tracktor",
|
||||
"version": "0.5.1",
|
||||
"date": "2025-11-05T16:14:37Z"
|
||||
"date": "2025-11-05T15:51:02Z"
|
||||
},
|
||||
{
|
||||
"name": "zitadel/zitadel",
|
||||
@@ -494,6 +484,11 @@
|
||||
"version": "v25.11.0",
|
||||
"date": "2025-11-04T00:32:21Z"
|
||||
},
|
||||
{
|
||||
"name": "gtsteffaniak/filebrowser",
|
||||
"version": "v1.0.0-stable",
|
||||
"date": "2025-11-03T22:24:23Z"
|
||||
},
|
||||
{
|
||||
"name": "jupyter/notebook",
|
||||
"version": "@jupyter-notebook/ui-components@7.5.0-rc.0",
|
||||
@@ -849,6 +844,11 @@
|
||||
"version": "0.20.4",
|
||||
"date": "2025-10-18T10:00:42Z"
|
||||
},
|
||||
{
|
||||
"name": "grokability/snipe-it",
|
||||
"version": "v8.3.4",
|
||||
"date": "2025-10-17T18:13:24Z"
|
||||
},
|
||||
{
|
||||
"name": "NodeBB/NodeBB",
|
||||
"version": "v4.6.1",
|
||||
|
||||
65
install/domain-monitor-install.sh
Normal file
65
install/domain-monitor-install.sh
Normal file
@@ -0,0 +1,65 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2025 community-scripts ORG
|
||||
# Author: Slaviša Arežina (tremor021)
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://github.com/Hosteroid/domain-monitor
|
||||
|
||||
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 --no-install-recommends \
|
||||
libicu-dev \
|
||||
libzip-dev \
|
||||
libpng-dev \
|
||||
libjpeg62-turbo-dev \
|
||||
libfreetype6-dev \
|
||||
libxml2-dev \
|
||||
libcurl4-openssl-dev \
|
||||
libonig-dev \
|
||||
pkg-config
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
PHP_VERSION="8.4" PHP_APACHE="YES" PHP_FPM="YES" PHP_MODULE="mysql" setup_php
|
||||
setup_composer
|
||||
setup_mariadb
|
||||
MARIADB_DB_NAME="domain_monitor" MARIADB_DB_USER="domainmonitor" setup_mariadb_db
|
||||
fetch_and_deploy_gh_release "domain-monitor" "Hosteroid/domain-monitor" "prebuild" "latest" "/opt/domain-monitor" "domain-monitor-v*.zip"
|
||||
|
||||
msg_info "Setting up Domain Monitor"
|
||||
ENC_KEY=$(openssl rand -base64 48 | tr -dc 'A-Za-z0-9' | head -c 32)
|
||||
cd /opt/domain-monitor
|
||||
$STD composer install
|
||||
cp env.example.txt .env
|
||||
sed -i -e "s|^APP_ENV=.*|APP_ENV=production|" \
|
||||
-e "s|^APP_ENCRYPTION_KEY=.*|APP_ENCRYPTION_KEY=$ENC_KEY|" \
|
||||
-e "s|^SESSION_COOKIE_HTTPONLY=.*|SESSION_COOKIE_HTTPONLY=0|" \
|
||||
-e "s|^DB_USERNAME=.*|DB_USERNAME=$MARIADB_DB_USER|" \
|
||||
-e "s|^DB_PASSWORD=.*|DB_PASSWORD=$MARIADB_DB_PASS|" \
|
||||
-e "s|^DB_DATABASE=.*|DB_DATABASE=$MARIADB_DB_NAME|" .env
|
||||
|
||||
cat <<EOF >/etc/apache2/sites-enabled/000-default.conf
|
||||
<VirtualHost *:80>
|
||||
ServerName domainmonitor.local
|
||||
DocumentRoot "/opt/domain-monitor/public"
|
||||
|
||||
<Directory "/opt/domain-monitor/public">
|
||||
AllowOverride All
|
||||
Require all granted
|
||||
</Directory>
|
||||
</VirtualHost>
|
||||
EOF
|
||||
chown -R www-data:www-data /opt/domain-monitor
|
||||
$STD a2enmod rewrite headers
|
||||
$STD systemctl reload apache2
|
||||
msg_ok "Setup Domain Monitor"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
cleanup_lxc
|
||||
@@ -13,27 +13,39 @@ setting_up_container
|
||||
network_check
|
||||
update_os
|
||||
|
||||
PHP_VERSION="8.4" PHP_APACHE="YES" PHP_FPM="YES" PHP_MODULE="mysql,gmp,snmp,ldap,apcu" setup_php
|
||||
|
||||
msg_info "Installing PHP-PEAR"
|
||||
$STD apt install -y \
|
||||
php-pear \
|
||||
php-dev
|
||||
msg_ok "Installed PHP-PEAR"
|
||||
msg_info "Installing Dependencies"
|
||||
$STD apt install -y php-pear
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
PHP_VERSION="8.2" PHP_APACHE="YES" PHP_FPM="YES" PHP_MODULE="mysql,imap,apcu,pspell,tidy,xmlrpc,gmp,ldap,common,snmp" setup_php
|
||||
setup_mariadb
|
||||
MARIADB_DB_NAME="phpipam" MARIADB_DB_USER="phpipam" setup_mariadb_db
|
||||
|
||||
msg_info "Setting up MariaDB"
|
||||
DB_NAME=phpipam
|
||||
DB_USER=phpipam
|
||||
DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
|
||||
$STD mariadb -u root -e "CREATE DATABASE $DB_NAME;"
|
||||
$STD mariadb -u root -e "CREATE USER '$DB_USER'@'localhost' IDENTIFIED BY '$DB_PASS';"
|
||||
$STD mariadb -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUSH PRIVILEGES;"
|
||||
{
|
||||
echo "phpIPAM-Credentials"
|
||||
echo "phpIPAM Database User: $DB_USER"
|
||||
echo "phpIPAM Database Password: $DB_PASS"
|
||||
echo "phpIPAM Database Name: $DB_NAME"
|
||||
} >>~/phpipam.creds
|
||||
msg_ok "Set up MariaDB"
|
||||
|
||||
fetch_and_deploy_gh_release "phpipam" "phpipam/phpipam" "prebuild" "latest" "/opt/phpipam" "phpipam-v*.zip"
|
||||
|
||||
msg_info "Installing phpIPAM"
|
||||
$STD mariadb -u root "${MARIADB_DB_NAME}" </opt/phpipam/db/SCHEMA.sql
|
||||
$STD mariadb -u root "${DB_NAME}" </opt/phpipam/db/SCHEMA.sql
|
||||
cp /opt/phpipam/config.dist.php /opt/phpipam/config.php
|
||||
sed -i -e "s/\(\$disable_installer = \).*/\1true;/" \
|
||||
-e "s/\(\$db\['user'\] = \).*/\1'$MARIADB_DB_USER';/" \
|
||||
-e "s/\(\$db\['pass'\] = \).*/\1'$MARIADB_DB_PASS';/" \
|
||||
-e "s/\(\$db\['name'\] = \).*/\1'$MARIADB_DB_NAME';/" \
|
||||
-e "s/\(\$db\['user'\] = \).*/\1'$DB_USER';/" \
|
||||
-e "s/\(\$db\['pass'\] = \).*/\1'$DB_PASS';/" \
|
||||
-e "s/\(\$db\['name'\] = \).*/\1'$DB_NAME';/" \
|
||||
/opt/phpipam/config.php
|
||||
sed -i '/max_execution_time/s/= .*/= 600/' /etc/php/8.4/apache2/php.ini
|
||||
sed -i '/max_execution_time/s/= .*/= 600/' /etc/php/8.2/apache2/php.ini
|
||||
msg_ok "Installed phpIPAM"
|
||||
|
||||
msg_info "Creating Service"
|
||||
@@ -59,4 +71,9 @@ msg_ok "Created Service"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
cleanup_lxc
|
||||
|
||||
msg_info "Cleaning up"
|
||||
$STD apt -y autoremove
|
||||
$STD apt -y autoclean
|
||||
$STD apt -y clean
|
||||
msg_ok "Cleaned"
|
||||
|
||||
@@ -386,28 +386,28 @@ cleanup_lxc() {
|
||||
|
||||
# Truncate writable log files silently (permission errors ignored)
|
||||
if command -v truncate >/dev/null 2>&1; then
|
||||
find /var/log -type f -writable -print0 2>/dev/null |
|
||||
find /var/log -type f -writable -print0 2>/dev/null | \
|
||||
xargs -0 -n1 truncate -s 0 2>/dev/null || true
|
||||
fi
|
||||
|
||||
# Python pip
|
||||
if command -v pip &>/dev/null; then $STD pip cache purge || true; fi
|
||||
if command -v pip &>/dev/null; then pip cache purge || true; fi
|
||||
# Python uv
|
||||
if command -v uv &>/dev/null; then $STD uv cache clear || true; fi
|
||||
if command -v uv &>/dev/null; then uv cache clear || true; fi
|
||||
# Node.js npm
|
||||
if command -v npm &>/dev/null; then $STD npm cache clean --force || true; fi
|
||||
if command -v npm &>/dev/null; then npm cache clean --force || true; fi
|
||||
# Node.js yarn
|
||||
if command -v yarn &>/dev/null; then $STD yarn cache clean || true; fi
|
||||
if command -v yarn &>/dev/null; then yarn cache clean || true; fi
|
||||
# Node.js pnpm
|
||||
if command -v pnpm &>/dev/null; then $STD pnpm store prune || true; fi
|
||||
if command -v pnpm &>/dev/null; then pnpm store prune || true; fi
|
||||
# Go
|
||||
if command -v go &>/dev/null; then $STD go clean -cache -modcache || true; fi
|
||||
if command -v go &>/dev/null; then go clean -cache -modcache || true; fi
|
||||
# Rust cargo
|
||||
if command -v cargo &>/dev/null; then $STD cargo clean || true; fi
|
||||
if command -v cargo &>/dev/null; then cargo clean || true; fi
|
||||
# Ruby gem
|
||||
if command -v gem &>/dev/null; then $STD gem cleanup || true; fi
|
||||
if command -v gem &>/dev/null; then gem cleanup || true; fi
|
||||
# Composer (PHP)
|
||||
if command -v composer &>/dev/null; then $STD composer clear-cache || true; fi
|
||||
if command -v composer &>/dev/null; then composer clear-cache || true; fi
|
||||
|
||||
if command -v journalctl &>/dev/null; then
|
||||
$STD journalctl --rotate || true
|
||||
|
||||
176
misc/tools.func
176
misc/tools.func
@@ -3052,85 +3052,6 @@ setup_mariadb() {
|
||||
msg_ok "Setup MariaDB $MARIADB_VERSION"
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Creates MariaDB database with user, charset and optional extra grants/modes
|
||||
#
|
||||
# Description:
|
||||
# - Generates password if empty
|
||||
# - Creates database with utf8mb4_unicode_ci
|
||||
# - Creates local user with password
|
||||
# - Grants full access to this DB
|
||||
# - Optional: apply extra GRANT statements (comma-separated)
|
||||
# - Optional: apply custom GLOBAL sql_mode
|
||||
# - Saves credentials to file
|
||||
# - Exports variables for use in calling script
|
||||
#
|
||||
# Usage:
|
||||
# MARIADB_DB_NAME="myapp_db" MARIADB_DB_USER="myapp_user" setup_mariadb_db
|
||||
# MARIADB_DB_NAME="domain_monitor" MARIADB_DB_USER="domainmonitor" setup_mariadb_db
|
||||
# MARIADB_DB_NAME="myapp" MARIADB_DB_USER="myapp" MARIADB_DB_EXTRA_GRANTS="GRANT SELECT ON \`mysql\`.\`time_zone_name\`" setup_mariadb_db
|
||||
# MARIADB_DB_NAME="ghostfolio" MARIADB_DB_USER="ghostfolio" MARIADB_DB_SQL_MODE="" setup_mariadb_db
|
||||
#
|
||||
# Variables:
|
||||
# MARIADB_DB_NAME - Database name (required)
|
||||
# MARIADB_DB_USER - Database user (required)
|
||||
# MARIADB_DB_PASS - User password (optional, auto-generated if empty)
|
||||
# MARIADB_DB_EXTRA_GRANTS - Comma-separated GRANT statements (optional)
|
||||
# Example: "GRANT SELECT ON \`mysql\`.\`time_zone_name\`"
|
||||
# MARIADB_DB_SQL_MODE - Optional global sql_mode override (e.g. "", "STRICT_TRANS_TABLES")
|
||||
# MARIADB_DB_CREDS_FILE - Credentials file path (optional, default: ~/${APPLICATION}.creds)
|
||||
#
|
||||
# Exports:
|
||||
# MARIADB_DB_NAME, MARIADB_DB_USER, MARIADB_DB_PASS
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
function setup_mariadb_db() {
|
||||
if [[ -z "${MARIADB_DB_NAME:-}" || -z "${MARIADB_DB_USER:-}" ]]; then
|
||||
msg_error "MARIADB_DB_NAME and MARIADB_DB_USER must be set before calling setup_mariadb_db"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ -z "${MARIADB_DB_PASS:-}" ]]; then
|
||||
MARIADB_DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
|
||||
fi
|
||||
|
||||
msg_info "Setting up MariaDB Database"
|
||||
|
||||
$STD mariadb -u root -e "CREATE DATABASE \`$MARIADB_DB_NAME\` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
|
||||
$STD mariadb -u root -e "CREATE USER '$MARIADB_DB_USER'@'localhost' IDENTIFIED BY '$MARIADB_DB_PASS';"
|
||||
$STD mariadb -u root -e "GRANT ALL ON \`$MARIADB_DB_NAME\`.* TO '$MARIADB_DB_USER'@'localhost';"
|
||||
|
||||
# Optional extra grants
|
||||
if [[ -n "${MARIADB_DB_EXTRA_GRANTS:-}" ]]; then
|
||||
IFS=',' read -ra G_LIST <<<"${MARIADB_DB_EXTRA_GRANTS:-}"
|
||||
for g in "${G_LIST[@]}"; do
|
||||
g=$(echo "$g" | xargs)
|
||||
$STD mariadb -u root -e "$g TO '$MARIADB_DB_USER'@'localhost';"
|
||||
done
|
||||
fi
|
||||
|
||||
# Optional sql_mode override
|
||||
if [[ -n "${MARIADB_DB_SQL_MODE:-}" ]]; then
|
||||
$STD mariadb -u root -e "SET GLOBAL sql_mode='${MARIADB_DB_SQL_MODE:-}';"
|
||||
fi
|
||||
|
||||
$STD mariadb -u root -e "FLUSH PRIVILEGES;"
|
||||
|
||||
local CREDS_FILE="${MARIADB_DB_CREDS_FILE:-${HOME}/${APPLICATION}.creds}"
|
||||
{
|
||||
echo "MariaDB Credentials"
|
||||
echo "Database: $MARIADB_DB_NAME"
|
||||
echo "User: $MARIADB_DB_USER"
|
||||
echo "Password: $MARIADB_DB_PASS"
|
||||
} >>"$CREDS_FILE"
|
||||
|
||||
msg_ok "Set up MariaDB Database"
|
||||
|
||||
export MARIADB_DB_NAME
|
||||
export MARIADB_DB_USER
|
||||
export MARIADB_DB_PASS
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Installs or updates MongoDB to specified major version.
|
||||
#
|
||||
@@ -3890,103 +3811,6 @@ function setup_postgresql() {
|
||||
fi
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Creates PostgreSQL database with user and optional extensions
|
||||
#
|
||||
# Description:
|
||||
# - Creates PostgreSQL role with login and password
|
||||
# - Creates database with UTF8 encoding and template0
|
||||
# - Installs optional extensions (postgis, pgvector, etc.)
|
||||
# - Configures ALTER ROLE settings for Django/Rails compatibility
|
||||
# - Saves credentials to file
|
||||
# - Exports variables for use in calling script
|
||||
#
|
||||
# Usage:
|
||||
# PG_DB_NAME="myapp_db" PG_DB_USER="myapp_user" setup_postgresql_db
|
||||
# PG_DB_NAME="immich" PG_DB_USER="immich" PG_DB_EXTENSIONS="pgvector" setup_postgresql_db
|
||||
# PG_DB_NAME="ghostfolio" PG_DB_USER="ghostfolio" PG_DB_GRANT_SUPERUSER="true" setup_postgresql_db
|
||||
# PG_DB_NAME="adventurelog" PG_DB_USER="adventurelog" PG_DB_EXTENSIONS="postgis" setup_postgresql_db
|
||||
#
|
||||
# Variables:
|
||||
# PG_DB_NAME - Database name (required)
|
||||
# PG_DB_USER - Database user (required)
|
||||
# PG_DB_PASS - Database password (optional, auto-generated if empty)
|
||||
# PG_DB_EXTENSIONS - Comma-separated list of extensions (optional, e.g. "postgis,pgvector")
|
||||
# PG_DB_GRANT_SUPERUSER - Grant SUPERUSER privilege (optional, "true" to enable, security risk!)
|
||||
# PG_DB_SCHEMA_PERMS - Grant schema-level permissions (optional, "true" to enable)
|
||||
# PG_DB_SKIP_ALTER_ROLE - Skip ALTER ROLE settings (optional, "true" to skip)
|
||||
# PG_DB_CREDS_FILE - Credentials file path (optional, default: ~/${APPLICATION}.creds)
|
||||
#
|
||||
# Exports:
|
||||
# PG_DB_NAME, PG_DB_USER, PG_DB_PASS - For use in calling script
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
function setup_postgresql_db() {
|
||||
# Validation
|
||||
if [[ -z "${PG_DB_NAME:-}" || -z "${PG_DB_USER:-}" ]]; then
|
||||
msg_error "PG_DB_NAME and PG_DB_USER must be set before calling setup_postgresql_db"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Generate password if not provided
|
||||
if [[ -z "${PG_DB_PASS:-}" ]]; then
|
||||
PG_DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
|
||||
fi
|
||||
|
||||
msg_info "Setting up PostgreSQL Database"
|
||||
$STD sudo -u postgres psql -c "CREATE ROLE $PG_DB_USER WITH LOGIN PASSWORD '$PG_DB_PASS';"
|
||||
$STD sudo -u postgres psql -c "CREATE DATABASE $PG_DB_NAME WITH OWNER $PG_DB_USER ENCODING 'UTF8' TEMPLATE template0;"
|
||||
|
||||
# Install extensions (comma-separated)
|
||||
if [[ -n "${PG_DB_EXTENSIONS:-}" ]]; then
|
||||
IFS=',' read -ra EXT_LIST <<<"${PG_DB_EXTENSIONS:-}"
|
||||
for ext in "${EXT_LIST[@]}"; do
|
||||
ext=$(echo "$ext" | xargs) # Trim whitespace
|
||||
$STD sudo -u postgres psql -d "$PG_DB_NAME" -c "CREATE EXTENSION IF NOT EXISTS $ext;"
|
||||
done
|
||||
fi
|
||||
|
||||
# ALTER ROLE settings for Django/Rails compatibility (unless skipped)
|
||||
if [[ "${PG_DB_SKIP_ALTER_ROLE:-}" != "true" ]]; then
|
||||
$STD sudo -u postgres psql -c "ALTER ROLE $PG_DB_USER SET client_encoding TO 'utf8';"
|
||||
$STD sudo -u postgres psql -c "ALTER ROLE $PG_DB_USER SET default_transaction_isolation TO 'read committed';"
|
||||
$STD sudo -u postgres psql -c "ALTER ROLE $PG_DB_USER SET timezone TO 'UTC';"
|
||||
fi
|
||||
|
||||
# Schema permissions (if requested)
|
||||
if [[ "${PG_DB_SCHEMA_PERMS:-}" == "true" ]]; then
|
||||
$STD sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE $PG_DB_NAME TO $PG_DB_USER;"
|
||||
$STD sudo -u postgres psql -c "ALTER USER $PG_DB_USER CREATEDB;"
|
||||
$STD sudo -u postgres psql -d "$PG_DB_NAME" -c "GRANT ALL ON SCHEMA public TO $PG_DB_USER;"
|
||||
$STD sudo -u postgres psql -d "$PG_DB_NAME" -c "GRANT CREATE ON SCHEMA public TO $PG_DB_USER;"
|
||||
$STD sudo -u postgres psql -d "$PG_DB_NAME" -c "ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON TABLES TO $PG_DB_USER;"
|
||||
$STD sudo -u postgres psql -d "$PG_DB_NAME" -c "ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON SEQUENCES TO $PG_DB_USER;"
|
||||
fi
|
||||
|
||||
# Superuser grant (if requested - WARNING!)
|
||||
if [[ "${PG_DB_GRANT_SUPERUSER:-}" == "true" ]]; then
|
||||
msg_warn "Granting SUPERUSER privilege (security risk!)"
|
||||
$STD sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE $PG_DB_NAME to $PG_DB_USER;"
|
||||
$STD sudo -u postgres psql -c "ALTER USER $PG_DB_USER WITH SUPERUSER;"
|
||||
fi
|
||||
|
||||
# Save credentials
|
||||
local CREDS_FILE="${PG_DB_CREDS_FILE:-${HOME}/${APPLICATION}.creds}"
|
||||
{
|
||||
echo "PostgreSQL Credentials"
|
||||
echo "Database: $PG_DB_NAME"
|
||||
echo "User: $PG_DB_USER"
|
||||
echo "Password: $PG_DB_PASS"
|
||||
} >>"$CREDS_FILE"
|
||||
|
||||
msg_ok "Set up PostgreSQL Database"
|
||||
|
||||
# Export for use in calling script
|
||||
export PG_DB_NAME
|
||||
export PG_DB_USER
|
||||
export PG_DB_PASS
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Installs rbenv and ruby-build, installs Ruby and optionally Rails.
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user