mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-11-24 10:26:32 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
19b01df93d |
No files matched your search
@@ -0,0 +1,72 @@
|
||||
#!/usr/bin/env bash
|
||||
_cs_boot="${COMMUNITY_SCRIPTS_CORE_DIR:-$(dirname "${BASH_SOURCE[0]}")/../../core}/core/build.func"
|
||||
source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/build.func")
|
||||
# Copyright (c) 2021-2026 community-scripts ORG
|
||||
# Author: MickLesk (CanbiZ)
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://github.com/David-Crty/databasement
|
||||
|
||||
APP="Databasement"
|
||||
var_tags="${var_tags:-backup;database}"
|
||||
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_arm64="${var_arm64:-yes}"
|
||||
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/databasement ]]; then
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
fi
|
||||
|
||||
if check_for_gh_release "databasement" "David-Crty/databasement"; then
|
||||
msg_info "Stopping Databasement"
|
||||
systemctl stop databasement-worker databasement-scheduler php8.5-fpm
|
||||
msg_ok "Stopped Databasement"
|
||||
|
||||
setup_composer
|
||||
NODE_VERSION="22" setup_nodejs
|
||||
|
||||
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "databasement" "David-Crty/databasement" "tarball"
|
||||
|
||||
msg_info "Updating Databasement"
|
||||
ln -sf /opt/databasement_data/.env /opt/databasement/.env
|
||||
sed -i "s/^APP_VERSION=.*/APP_VERSION=$(cat ~/.databasement)/" /opt/databasement_data/.env
|
||||
cd /opt/databasement
|
||||
$STD composer install --no-dev --optimize-autoloader --no-interaction
|
||||
$STD php artisan vendor:publish --force --tag=livewire:assets
|
||||
$STD npm ci --ignore-scripts
|
||||
$STD npm run build
|
||||
$STD php artisan migrate --force
|
||||
$STD php artisan optimize
|
||||
chown -R www-data:www-data /opt/databasement /opt/databasement_data
|
||||
msg_ok "Updated Databasement"
|
||||
|
||||
msg_info "Starting Databasement"
|
||||
systemctl start php8.5-fpm databasement-worker databasement-scheduler
|
||||
msg_ok "Started Databasement"
|
||||
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 "${GATEWAY}${BGN}http://${IP}${CL}"
|
||||
@@ -0,0 +1,159 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2026 community-scripts ORG
|
||||
# Author: MickLesk (CanbiZ)
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://github.com/David-Crty/databasement
|
||||
|
||||
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 \
|
||||
git \
|
||||
mariadb-client \
|
||||
redis-tools \
|
||||
sqlite3 \
|
||||
sshpass \
|
||||
zstd \
|
||||
7zip
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
msg_info "Installing PostgreSQL Clients"
|
||||
setup_deb822_repo \
|
||||
"pgdg" \
|
||||
"https://www.postgresql.org/media/keys/ACCC4CF8.asc" \
|
||||
"https://apt.postgresql.org/pub/repos/apt" \
|
||||
"$(get_os_info codename)-pgdg" \
|
||||
"main"
|
||||
# pg_dump on PATH resolves to the newest client; Databasement switches to the 16 client for servers up to 16
|
||||
$STD apt install -y \
|
||||
postgresql-client-16 \
|
||||
postgresql-client-18
|
||||
msg_ok "Installed PostgreSQL Clients"
|
||||
|
||||
# MongoDB ships no Debian 13 build of its tools and only an amd64 Debian 12 one; the Ubuntu 24.04 build covers both
|
||||
fetch_and_deploy_from_url "https://fastdl.mongodb.org/tools/db/mongodb-database-tools-ubuntu2404-$(arch_resolve "x86_64" "arm64")-$(get_latest_gh_tag "mongodb/mongo-tools" "100.").deb"
|
||||
|
||||
PHP_VERSION="8.5" PHP_FPM="YES" PHP_MODULE="mongodb,smbclient" setup_php
|
||||
setup_composer
|
||||
NODE_VERSION="22" setup_nodejs
|
||||
|
||||
fetch_and_deploy_gh_release "databasement" "David-Crty/databasement" "tarball"
|
||||
|
||||
msg_info "Setting up Databasement"
|
||||
mkdir -p /opt/databasement_data/backups
|
||||
touch /opt/databasement_data/database.sqlite
|
||||
cat <<EOF >/opt/databasement_data/.env
|
||||
APP_NAME=Databasement
|
||||
APP_ENV=production
|
||||
APP_KEY=base64:$(openssl rand -base64 32)
|
||||
APP_DEBUG=false
|
||||
APP_URL=http://${LOCAL_IP}
|
||||
APP_VERSION=$(cat ~/.databasement)
|
||||
APP_DISPLAY_TIMEZONE=UTC
|
||||
|
||||
DB_CONNECTION=sqlite
|
||||
DB_DATABASE=/opt/databasement_data/database.sqlite
|
||||
|
||||
LOG_LEVEL=warning
|
||||
EOF
|
||||
ln -sf /opt/databasement_data/.env /opt/databasement/.env
|
||||
# the demo backup offered at sign-up writes to /data/backups, the volume path of the upstream image
|
||||
ln -s /opt/databasement_data /data
|
||||
cd /opt/databasement
|
||||
$STD composer install --no-dev --optimize-autoloader --no-interaction
|
||||
$STD php artisan vendor:publish --force --tag=livewire:assets
|
||||
$STD npm ci --ignore-scripts
|
||||
$STD npm run build
|
||||
$STD php artisan migrate --force
|
||||
$STD php artisan optimize
|
||||
chown -R www-data:www-data /opt/databasement /opt/databasement_data
|
||||
chmod 600 /opt/databasement_data/.env
|
||||
msg_ok "Set up Databasement"
|
||||
|
||||
msg_info "Configuring Nginx"
|
||||
PHP_SOCK=$(get_php_fpm_socket)
|
||||
cat <<EOF >/etc/nginx/sites-available/databasement
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
root /opt/databasement/public;
|
||||
|
||||
add_header X-Frame-Options "SAMEORIGIN";
|
||||
add_header X-Content-Type-Options "nosniff";
|
||||
|
||||
index index.php;
|
||||
charset utf-8;
|
||||
|
||||
location / {
|
||||
try_files \$uri \$uri/ /index.php?\$query_string;
|
||||
}
|
||||
|
||||
location = /favicon.ico { access_log off; log_not_found off; }
|
||||
location = /robots.txt { access_log off; log_not_found off; }
|
||||
|
||||
error_page 404 /index.php;
|
||||
|
||||
location ~ \.php\$ {
|
||||
fastcgi_pass unix:${PHP_SOCK};
|
||||
fastcgi_param SCRIPT_FILENAME \$realpath_root\$fastcgi_script_name;
|
||||
include fastcgi_params;
|
||||
fastcgi_hide_header X-Powered-By;
|
||||
}
|
||||
|
||||
location ~ /\.(?!well-known).* {
|
||||
deny all;
|
||||
}
|
||||
}
|
||||
EOF
|
||||
nginx_enable_site "databasement"
|
||||
msg_ok "Configured Nginx"
|
||||
|
||||
msg_info "Creating Services"
|
||||
cat <<EOF >/etc/systemd/system/databasement-worker.service
|
||||
[Unit]
|
||||
Description=Databasement Queue Worker
|
||||
After=network.target php8.5-fpm.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=www-data
|
||||
Group=www-data
|
||||
WorkingDirectory=/opt/databasement
|
||||
ExecStart=/usr/bin/php artisan queue:work --queue=backups,default --tries=3 --timeout=3600 --sleep=3 --max-jobs=1000
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
cat <<EOF >/etc/systemd/system/databasement-scheduler.service
|
||||
[Unit]
|
||||
Description=Databasement Scheduler
|
||||
After=network.target php8.5-fpm.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=www-data
|
||||
Group=www-data
|
||||
WorkingDirectory=/opt/databasement
|
||||
ExecStart=/usr/bin/php artisan schedule:work --quiet
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl enable -q --now databasement-worker databasement-scheduler
|
||||
msg_ok "Created Services"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
cleanup_lxc
|
||||
Reference in new issue
Block a user