diff --git a/ct/alpine-garage.sh b/ct/alpine-garage.sh deleted file mode 100644 index ecf981770..000000000 --- a/ct/alpine-garage.sh +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env bash -source <(curl -fsSL https://git.community-scripts.org/community-scripts/ProxmoxVED/raw/branch/main/misc/build.func) -# Copyright (c) 2021-2025 tteck -# Author: tteck (tteckster) -# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE -# Source: https://alpinelinux.org/ - -APP="Alpine-Garage" -var_tags="${var_tags:-alpine;object-storage}" -var_cpu="${var_cpu:-1}" -var_ram="${var_ram:-512}" -var_disk="${var_disk:-3}" -var_os="${var_os:-alpine}" -var_version="${var_version:-3.22}" -var_unprivileged="${var_unprivileged:-1}" - -header_info "$APP" -variables -color -catch_errors - -function update_script() { - header_info - if [[ ! -f /usr/local/bin/garage ]]; then - msg_error "No ${APP} Installation Found!" - exit - fi - - GITEA_RELEASE=$(curl -fsSL https://api.github.com/repos/deuxfleurs-org/garage/tags | jq -r '.[0].name') - if [[ "${GITEA_RELEASE}" != "$(cat ~/.garage 2>/dev/null)" ]] || [[ ! -f ~/.garage ]]; then - msg_info "Stopping Service" - rc-service garage stop || true - msg_ok "Stopped Service" - - msg_info "Backing Up Data" - cp /usr/local/bin/garage /usr/local/bin/garage.old 2>/dev/null || true - cp /etc/garage.toml /etc/garage.toml.bak 2>/dev/null || true - msg_ok "Backed Up Data" - - msg_info "Updating Garage" - curl -fsSL "https://garagehq.deuxfleurs.fr/_releases/${GITEA_RELEASE}/x86_64-unknown-linux-musl/garage" -o /usr/local/bin/garage - chmod +x /usr/local/bin/garage - echo "${GITEA_RELEASE}" > ~/.garage - msg_ok "Updated Garage" - - msg_info "Starting Service" - rc-service garage start || rc-service garage restart - msg_ok "Started Service" - msg_ok "Update Successfully!" - else - msg_ok "No update required. Garage is already at ${GITEA_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}${CL}" - diff --git a/ct/dispatcharr.sh b/ct/dispatcharr.sh deleted file mode 100644 index 91113904b..000000000 --- a/ct/dispatcharr.sh +++ /dev/null @@ -1,143 +0,0 @@ -#!/usr/bin/env bash -source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func) -# Copyright (c) 2021-2025 community-scripts ORG -# Author: ekke85 -# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE -# Source: https://github.com/Dispatcharr/Dispatcharr - -APP="Dispatcharr" -APP_NAME=${APP,,} -var_tags="${var_tags:-media;arr}" -var_cpu="${var_cpu:-1}" -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/dispatcharr" ]]; then - msg_error "No ${APP} Installation Found!" - exit - fi - - setup_uv - NODE_VERSION="24" setup_nodejs - - if check_for_gh_release "Dispatcharr" "Dispatcharr/Dispatcharr"; then - msg_info "Stopping Services" - systemctl stop dispatcharr-celery - systemctl stop dispatcharr-celerybeat - systemctl stop dispatcharr-daphne - systemctl stop dispatcharr - msg_ok "Stopped Services" - - msg_info "Creating Backup" - BACKUP_FILE="/opt/dispatcharr_backup_$(date +%F_%H-%M-%S).tar.gz" - if [[ -f /opt/dispatcharr/.env ]]; then - cp /opt/dispatcharr/.env /tmp/dispatcharr.env.backup - fi - - if [[ -f /opt/dispatcharr/start-gunicorn.sh ]]; then - cp /opt/dispatcharr/start-gunicorn.sh /tmp/start-gunicorn.sh.backup - fi - if [[ -f /opt/dispatcharr/start-celery.sh ]]; then - cp /opt/dispatcharr/start-celery.sh /tmp/start-celery.sh.backup - fi - if [[ -f /opt/dispatcharr/start-celerybeat.sh ]]; then - cp /opt/dispatcharr/start-celerybeat.sh /tmp/start-celerybeat.sh.backup - fi - if [[ -f /opt/dispatcharr/start-daphne.sh ]]; then - cp /opt/dispatcharr/start-daphne.sh /tmp/start-daphne.sh.backup - fi - - if [[ -f /opt/dispatcharr/.env ]]; then - set -o allexport - source /opt/dispatcharr/.env - set +o allexport - if [[ -n "$POSTGRES_DB" ]] && [[ -n "$POSTGRES_USER" ]] && [[ -n "$POSTGRES_PASSWORD" ]]; then - PGPASSWORD=$POSTGRES_PASSWORD pg_dump -U $POSTGRES_USER -h ${POSTGRES_HOST:-localhost} $POSTGRES_DB >/tmp/dispatcharr_db_$(date +%F).sql - msg_info "Database backup created" - fi - fi - $STD tar -czf "$BACKUP_FILE" -C /opt dispatcharr /tmp/dispatcharr_db_*.sql 2>/dev/null || true - msg_ok "Backup created: $BACKUP_FILE" - - CLEAN_INSTALL=1 fetch_and_deploy_gh_release "dispatcharr" "Dispatcharr/Dispatcharr" - - msg_info "Updating Dispatcharr Backend" - if [[ -f /tmp/dispatcharr.env.backup ]]; then - mv /tmp/dispatcharr.env.backup /opt/dispatcharr/.env - msg_info "Restored environment configuration" - fi - - # Restore service scripts - if [[ -f /tmp/start-gunicorn.sh.backup ]]; then - mv /tmp/start-gunicorn.sh.backup /opt/dispatcharr/start-gunicorn.sh - fi - if [[ -f /tmp/start-celery.sh.backup ]]; then - mv /tmp/start-celery.sh.backup /opt/dispatcharr/start-celery.sh - fi - if [[ -f /tmp/start-celerybeat.sh.backup ]]; then - mv /tmp/start-celerybeat.sh.backup /opt/dispatcharr/start-celerybeat.sh - fi - if [[ -f /tmp/start-daphne.sh.backup ]]; then - mv /tmp/start-daphne.sh.backup /opt/dispatcharr/start-daphne.sh - fi - - cd /opt/dispatcharr || exit - rm -rf .venv - $STD uv venv - $STD uv pip install -r requirements.txt --index-strategy unsafe-best-match - $STD uv pip install gunicorn gevent celery redis daphne - msg_ok "Updated Dispatcharr Backend" - - msg_info "Building Frontend" - cd /opt/dispatcharr/frontend || exit - $STD npm install --legacy-peer-deps - $STD npm run build - msg_ok "Built Frontend" - - msg_info "Running Django Migrations" - cd /opt/dispatcharr || exit - if [[ -f .env ]]; then - set -o allexport - source .env - set +o allexport - fi - $STD uv run python manage.py migrate --noinput - $STD uv run python manage.py collectstatic --noinput - msg_ok "Migrations Complete" - - msg_info "Starting Services" - systemctl start dispatcharr - systemctl start dispatcharr-celery - systemctl start dispatcharr-celerybeat - systemctl start dispatcharr-daphne - msg_ok "Started Services" - - msg_info "Cleaning up" - rm -f /tmp/dispatcharr_db_*.sql - msg_ok "Cleanup completed" - msg_ok "Update 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}" diff --git a/ct/garage.sh b/ct/garage.sh deleted file mode 100644 index a43859bb7..000000000 --- a/ct/garage.sh +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env bash -source <(curl -fsSL https://git.community-scripts.org/community-scripts/ProxmoxVED/raw/branch/main/misc/build.func) -# Copyright (c) 2021-2025 community-scripts ORG -# Author: MickLesk (CanbiZ) -# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE -# Source: https://garagehq.deuxfleurs.fr/ - -APP="Garage" -var_tags="${var_tags:-object-storage}" -var_cpu="${var_cpu:-1}" -var_ram="${var_ram:-512}" -var_disk="${var_disk:-3}" -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 [[ ! -f /usr/local/bin/garage ]]; then - msg_error "No ${APP} Installation Found!" - exit - fi - GITEA_RELEASE=$(curl -fsSL https://api.github.com/repos/deuxfleurs-org/garage/tags | jq -r '.[0].name') - if [[ "${GITEA_RELEASE}" != "$(cat ~/.garage 2>/dev/null)" ]] || [[ ! -f ~/.garage ]]; then - msg_info "Stopping Service" - systemctl stop garage - msg_ok "Stopped Service" - - msg_info "Backing Up Data" - cp /usr/local/bin/garage /usr/local/bin/garage.old 2>/dev/null || true - cp /etc/garage.toml /etc/garage.toml.bak 2>/dev/null || true - msg_ok "Backed Up Data" - - msg_info "Updating Garage" - curl -fsSL "https://garagehq.deuxfleurs.fr/_releases/${GITEA_RELEASE}/x86_64-unknown-linux-musl/garage" -o /usr/local/bin/garage - chmod +x /usr/local/bin/garage - echo "${GITEA_RELEASE}" > ~/.garage - msg_ok "Updated Garage" - - msg_info "Starting Service" - systemctl start garage - msg_ok "Started Service" - msg_ok "Update Successfully!" - else - msg_ok "No update required. Garage is already at ${GITEA_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}${CL}" - diff --git a/ct/hanko.sh b/ct/hanko.sh deleted file mode 100644 index de3079c26..000000000 --- a/ct/hanko.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env bash -source <(curl -fsSL https://git.community-scripts.org/community-scripts/ProxmoxVED/raw/branch/main/misc/build.func) -# Copyright (c) 2021-2025 tteck -# Author: tteck (tteckster) -# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE -# Source: https://www.debian.org/ - -APP="Hanko" -var_tags="${var_tags:-os}" -var_cpu="${var_cpu:-1}" -var_ram="${var_ram:-1024}" -var_disk="${var_disk:-4}" -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 /var ]]; then - msg_error "No ${APP} Installation Found!" - exit - fi - msg_info "Updating $APP LXC" - $STD apt-get update - $STD apt-get -y upgrade - msg_ok "Updated $APP LXC" - 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}:8000${CL}" diff --git a/ct/patchmon.sh b/ct/patchmon.sh deleted file mode 100644 index 0080df89c..000000000 --- a/ct/patchmon.sh +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/env bash -source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func) -# Copyright (c) 2021-2025 community-scripts ORG -# Author: vhsdream -# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE -# Source: https://github.com/PatchMon/PatchMon - -APP="PatchMon" -APP_NAME=${APP,,} -var_tags="${var_tags:-monitoring}" -var_cpu="${var_cpu:-2}" -var_ram="${var_ram:-2048}" -var_disk="${var_disk:-4}" -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/patchmon" ]]; then - msg_error "No ${APP} Installation Found!" - exit - fi - - NODE_VERSION="24" setup_nodejs - - if check_for_gh_release "PatchMon" "PatchMon/PatchMon"; then - - msg_info "Stopping $APP" - systemctl stop patchmon-server - msg_ok "Stopped $APP" - - msg_info "Creating Backup" - cp /opt/patchmon/backend/.env /opt/backend.env - cp /opt/patchmon/frontend/.env /opt/frontend.env - msg_ok "Backup Created" - - rm -rf /opt/patchmon - fetch_and_deploy_gh_release "PatchMon" "PatchMon/PatchMon" "tarball" "latest" "/opt/patchmon" - - msg_info "Updating ${APP}" - cd /opt/patchmon - export NODE_ENV=production - $STD npm install --no-audit --no-fund --no-save --ignore-scripts - cd /opt/patchmon/backend - $STD npm install --no-audit --no-fund --no-save --ignore-scripts - cd /opt/patchmon/frontend - $STD npm install --include=dev --no-audit --no-fund --no-save --ignore-scripts - $STD npm run build - cd /opt/patchmon/backend - mv /opt/backend.env /opt/patchmon/backend/.env - mv /opt/frontend.env /opt/patchmon/frontend/.env - $STD npx prisma migrate deploy - $STD npx prisma generate - msg_ok "Updated ${APP}" - - msg_info "Starting $APP" - systemctl start patchmon-server - msg_ok "Started $APP" - 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}" diff --git a/ct/reitti.sh b/ct/reitti.sh new file mode 100644 index 000000000..11bbdd8fd --- /dev/null +++ b/ct/reitti.sh @@ -0,0 +1,54 @@ +#!/usr/bin/env bash +source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func) +# Copyright (c) 2021-2025 community-scripts ORG +# Author: madelyn (DysfunctionalProgramming) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/dedicatedcode/reitti + +APP="Reitti" +var_tags="${var_tags:-location-tracker}" +var_cpu="${var_cpu:-1}" +var_ram="${var_ram:-2048}" +var_disk="${var_disk:-4}" +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 [[ ! -f /opt/reitti/reitti.jar ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + if check_for_gh_release "reitti" "dedicatedcode/reitti"; then + msg_info "Stopping Service" + systemctl stop reitti + msg_ok "Stopped Service" + + rm -f /opt/reitti/reitti.jar + USE_ORIGINAL_FILENAME="true" fetch_and_deploy_gh_release "reitti" "dedicatedcode/reitti" "singlefile" "latest" "/opt/reitti" "reitti-app.jar" + mv /opt/reitti/reitti-*.jar /opt/reitti/reitti.jar + + msg_info "Starting Service" + systemctl start reitti + 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}:25600${CL}" diff --git a/frontend/public/json/garage.json b/frontend/public/json/garage.json deleted file mode 100644 index d7a407392..000000000 --- a/frontend/public/json/garage.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "name": "Garage", - "slug": "garage", - "categories": [ - 8 - ], - "date_created": "2025-10-27", - "type": "ct", - "updateable": true, - "privileged": false, - "interface_port": 3900, - "documentation": "https://garagehq.deuxfleurs.fr/documentation/quick-start/", - "website": "https://garagehq.deuxfleurs.fr/", - "logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/garage.webp", - "config_path": "/etc/garage.toml", - "description": "Garage is a lightweight, self-hosted, S3-compatible object storage service built for distributed environments. It is designed to be simple, efficient, and easy to deploy across multiple nodes.", - "install_methods": [ - { - "type": "default", - "script": "ct/garage.sh", - "resources": { - "cpu": 1, - "ram": 512, - "hdd": 3, - "os": "debian", - "version": "13" - } - }, - { - "type": "alpine", - "script": "ct/alpine-garage.sh", - "resources": { - "cpu": 1, - "ram": 512, - "hdd": 3, - "os": "alpine", - "version": "3.22" - } - } - ], - "default_credentials": { - "username": null, - "password": null - }, - "notes": [ - { - "text": "The Garage configuration file is located at `/etc/garage.toml`. You can edit RPC and API bindings, tokens, and data directories there.", - "type": "info" - }, - { - "text": "Admin API runs by default on port `3903`, S3 API on port `3900`, Web UI on `3902`. Adjust firewall rules accordingly.", - "type": "warning" - }, - { - "text": "To view your generated tokens and RPC secret, check `~/garage.creds` after installation.", - "type": "info" - } - ] -} diff --git a/frontend/public/json/hanko.json b/frontend/public/json/hanko.json deleted file mode 100644 index d8628ad87..000000000 --- a/frontend/public/json/hanko.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "Hanko", - "slug": "hanko", - "categories": [ - 21 - ], - "date_created": "2025-07-02", - "type": "ct", - "updateable": true, - "privileged": false, - "config_path": "/opt/hanko/.env", - "interface_port": 3000, - "documentation": "https://docs.hanko.io/", - "website": "https://hanko.io/", - "logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/svg/hanko.svg", - "description": "Hanko is an open-source authentication solution providing passkey-first login with support for WebAuthn/FIDO2, biometrics and modern identity flows. Easy to self-host and integrate via API or widget.", - "install_methods": [ - { - "type": "default", - "script": "ct/hanko.sh", - "resources": { - "cpu": 1, - "ram": 1024, - "hdd": 2, - "os": "Debian", - "version": "12" - } - } - ], - "default_credentials": { - "username": null, - "password": null - }, - "notes": [] -} diff --git a/frontend/public/json/patchmon.json b/frontend/public/json/patchmon.json deleted file mode 100644 index 9b78f66f6..000000000 --- a/frontend/public/json/patchmon.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "PatchMon", - "slug": "patchmon", - "categories": [ - 9 - ], - "date_created": "2025-10-23", - "type": "ct", - "updateable": true, - "privileged": false, - "interface_port": 3399, - "documentation": "https://docs.patchmon.net", - "website": "https://patchmon.net", - "logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/patchmon.webp", - "config_path": "/opt/patchmon/backend/.env, /opt/patchmon/frontend/.env", - "description": "Monitor Linux patches across all your hosts with real-time visibility, security update tracking, and comprehensive package management.", - "install_methods": [ - { - "type": "default", - "script": "ct/patchmon.sh", - "resources": { - "cpu": 2, - "ram": 2048, - "hdd": 4, - "os": "debian", - "version": "13" - } - } - ], - "default_credentials": { - "username": null, - "password": null - }, - "notes": [] -} diff --git a/install/alpine-garage-install.sh b/install/alpine-garage-install.sh deleted file mode 100644 index c82f3e03c..000000000 --- a/install/alpine-garage-install.sh +++ /dev/null @@ -1,84 +0,0 @@ -#!/usr/bin/env bash - -# Copyright (c) 2021-2025 community-scripts ORG -# Author: MickLesk (CanbiZ) -# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE -# Source: https://garagehq.deuxfleurs.fr/ - -source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" -color -verb_ip6 -catch_errors -setting_up_container -network_check -update_os - -msg_info "Installing Dependencies" -$STD apk add -y openssl -msg_ok "Installed Dependencies" - -GITEA_RELEASE=$(curl -s https://api.github.com/repos/deuxfleurs-org/garage/tags | jq -r '.[0].name') -curl -fsSL "https://garagehq.deuxfleurs.fr/_releases/${GITEA_RELEASE}/x86_64-unknown-linux-musl/garage" -o /usr/local/bin/garage -chmod +x /usr/local/bin/garage -mkdir -p /var/lib/garage/{data,meta,snapshots} -mkdir -p /etc/garage -RPC_SECRET=$(openssl rand -hex 64 | cut -c1-64) -ADMIN_TOKEN=$(openssl rand -base64 32) -METRICS_TOKEN=$(openssl rand -base64 32) -{ - echo "Garage Tokens and Secrets" - echo "RPC Secret: $RPC_SECRET" - echo "Admin Token: $ADMIN_TOKEN" - echo "Metrics Token: $METRICS_TOKEN" -} >~/garage.creds -echo $GITEA_RELEASE >>~/.garage -cat </etc/garage.toml -metadata_dir = "/var/lib/garage/meta" -data_dir = "/var/lib/garage/data" -db_engine = "sqlite" -replication_factor = 1 - -rpc_bind_addr = "0.0.0.0:3901" -rpc_public_addr = "127.0.0.1:3901" -rpc_secret = "${RPC_SECRET}" - -[s3_api] -s3_region = "garage" -api_bind_addr = "0.0.0.0:3900" -root_domain = ".s3.garage" - -[s3_web] -bind_addr = "0.0.0.0:3902" -root_domain = ".web.garage" -index = "index.html" - -[k2v_api] -api_bind_addr = "0.0.0.0:3904" - -[admin] -api_bind_addr = "0.0.0.0:3903" -admin_token = "${ADMIN_TOKEN}" -metrics_token = "${METRICS_TOKEN}" -EOF -msg_ok "Configured Garage" - -msg_info "Creating Service" -cat <<'EOF' >/etc/init.d/garage -#!/sbin/openrc-run -name="Garage Object Storage" -command="/usr/local/bin/garage" -command_args="server" -command_background="yes" -pidfile="/run/garage.pid" -depend() { - need net -} -EOF - -chmod +x /etc/init.d/garage -$STD rc-update add garage default -$STD rc-service garage restart || rc-service garage start -msg_ok "Service active" - -motd_ssh -customize diff --git a/install/deferred/hanko-install.sh b/install/deferred/hanko-install.sh deleted file mode 100644 index e1ec43c9d..000000000 --- a/install/deferred/hanko-install.sh +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/env bash - -# Copyright (c) 2021-2025 community-scripts ORG -# Author: MickLesk (CanbiZ) -# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE -# Source: https://hanko.io/ - -source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" -color -verb_ip6 -catch_errors -setting_up_container -network_check -update_os - -setup_yq -PG_VERSION="16" setup_postgresql -NODE_VERSION=22 NODE_MODULE="yarn@latest,npm@latest" setup_nodejs - -msg_info "Setting up PostgreSQL Database" -DB_NAME=hanko -DB_USER=hanko -DB_PASS="$(openssl rand -base64 18 | cut -c1-13)" -APP_SECRET=$(openssl rand -base64 32) -$STD sudo -u postgres psql -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS';" -$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER ENCODING 'UTF8' TEMPLATE template0;" -$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET client_encoding TO 'utf8';" -$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET default_transaction_isolation TO 'read committed';" -$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET timezone TO 'UTC'" -{ - echo "Hanko-Credentials" - echo "Hanko Database User: $DB_USER" - echo "Hanko Database Password: $DB_PASS" - echo "Hanko Database Name: $DB_NAME" -} >>~/hanko.creds -msg_ok "Set up PostgreSQL Database" - -msg_info "Setup Hanko" -fetch_and_deploy_gh_release "hanko" "teamhanko/hanko" "prebuild" "latest" "/opt/hanko" "hanko_Linux_x86_64.tar.gz" -curl -fsSL https://raw.githubusercontent.com/teamhanko/hanko/refs/heads/main/backend/config/config.yaml -o /opt/hanko/config.yaml -env DB_USER="$DB_USER" DB_PASS="$DB_PASS" APP_SECRET="$APP_SECRET" \ - yq eval ' - .database.user = strenv(DB_USER) | - .database.password = strenv(DB_PASS) | - .database.host = "localhost" | - .database.port = "5432" | - .database.dialect = "postgres" | - .app.secret = strenv(APP_SECRET) -' -i /opt/hanko/config.yaml -$STD /opt/hanko/hanko --config /opt/hanko/config.yaml migrate up -yarn add @teamhanko/hanko-elements -msg_ok "Setup Hanko" - -msg_info "Setup Service" -cat </etc/systemd/system/hanko.service -[Unit] -Description=Hanko Service -After=network.target - -[Service] -Type=simple -ExecStart=/opt/hanko/hanko serve all --config /opt/hanko/config.yaml -Restart=on-failure -RestartSec=5 - -[Install] -WantedBy=multi-user.target -EOF - -systemctl enable -q --now hanko -msg_ok "Service Setup" - -motd_ssh -customize - -msg_info "Cleaning up" -$STD apt-get -y autoremove -$STD apt-get -y autoclean -msg_ok "Cleaned" diff --git a/install/dispatcharr-install.sh b/install/dispatcharr-install.sh deleted file mode 100644 index 9e35bfe5c..000000000 --- a/install/dispatcharr-install.sh +++ /dev/null @@ -1,266 +0,0 @@ -#!/usr/bin/env bash - -# Copyright (c) 2021-2025 community-scripts ORG -# Author: ekke85 -# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE -# Source: https://github.com/Dispatcharr/Dispatcharr - -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 \ - build-essential \ - gcc \ - python3-dev \ - libpq-dev \ - nginx \ - redis-server \ - ffmpeg \ - procps \ - streamlink -msg_ok "Installed Dependencies" - -setup_uv -NODE_VERSION="24" setup_nodejs -PG_VERSION="16" setup_postgresql - -msg_info "Creating PostgreSQL Database" -DB_NAME=dispatcharr_db -DB_USER=dispatcharr_usr -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 $DB_NAME WITH OWNER $DB_USER ENCODING 'UTF8' TEMPLATE template0;" -$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET client_encoding TO 'utf8';" -$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET default_transaction_isolation TO 'read committed';" -$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET timezone TO 'UTC';" -{ - echo "Dispatcharr Credentials" - echo "Database Name: $DB_NAME" - echo "Database User: $DB_USER" - echo "Database Password: $DB_PASS" - echo "" -} >>~/dispatcharr.creds -msg_ok "Created PostgreSQL Database" - -fetch_and_deploy_gh_release "dispatcharr" "Dispatcharr/Dispatcharr" - -msg_info "Installing Python Dependencies with uv" -cd /opt/dispatcharr || exit - -$STD uv venv -$STD uv pip install -r requirements.txt --index-strategy unsafe-best-match -$STD uv pip install gunicorn gevent celery redis daphne -msg_ok "Installed Python Dependencies" - -msg_info "Configuring Dispatcharr" -export DATABASE_URL="postgresql://${DB_USER}:${DB_PASS}@localhost:5432/${DB_NAME}" -export POSTGRES_DB=$DB_NAME -export POSTGRES_USER=$DB_USER -export POSTGRES_PASSWORD=$DB_PASS -export POSTGRES_HOST=localhost -$STD uv run python manage.py migrate --noinput -$STD uv run python manage.py collectstatic --noinput -cat </opt/dispatcharr/.env -DATABASE_URL=postgresql://${DB_USER}:${DB_PASS}@localhost:5432/${DB_NAME} -POSTGRES_DB=$DB_NAME -POSTGRES_USER=$DB_USER -POSTGRES_PASSWORD=$DB_PASS -POSTGRES_HOST=localhost -CELERY_BROKER_URL=redis://localhost:6379/0 -EOF -cd /opt/dispatcharr/frontend || exit -$STD npm install --legacy-peer-deps -$STD npm run build -msg_ok "Configured Dispatcharr" - -msg_info "Configuring Nginx" -cat </etc/nginx/sites-available/dispatcharr.conf -server { - listen 80; - server_name _; - - # Serve static assets with correct MIME types - location /assets/ { - alias /opt/dispatcharr/frontend/dist/assets/; - expires 30d; - add_header Cache-Control "public, immutable"; - - # Explicitly set MIME types for webpack-built assets - types { - text/javascript js; - text/css css; - image/png png; - image/svg+xml svg svgz; - font/woff2 woff2; - font/woff woff; - font/ttf ttf; - } - } - - location /static/ { - alias /opt/dispatcharr/static/; - expires 30d; - add_header Cache-Control "public, immutable"; - } - - location /media/ { - alias /opt/dispatcharr/media/; - } - - location /ws/ { - proxy_pass http://127.0.0.1:8001; - proxy_http_version 1.1; - proxy_set_header Upgrade \$http_upgrade; - proxy_set_header Connection "Upgrade"; - proxy_set_header Host \$host; - proxy_set_header X-Real-IP \$remote_addr; - proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto \$scheme; - } - - # All other requests proxy to Gunicorn - location / { - include proxy_params; - proxy_pass http://127.0.0.1:5656; - } -} -EOF - -ln -sf /etc/nginx/sites-available/dispatcharr.conf /etc/nginx/sites-enabled/dispatcharr.conf -rm -f /etc/nginx/sites-enabled/default -systemctl restart nginx -msg_ok "Configured Nginx" - -msg_info "Creating Services" -cat </opt/dispatcharr/start-gunicorn.sh -#!/usr/bin/env bash -cd /opt/dispatcharr -set -a -source .env -set +a -exec uv run gunicorn \\ - --workers=4 \\ - --worker-class=gevent \\ - --timeout=300 \\ - --bind 0.0.0.0:5656 \\ - dispatcharr.wsgi:application -EOF -chmod +x /opt/dispatcharr/start-gunicorn.sh - -cat </opt/dispatcharr/start-celery.sh -#!/usr/bin/env bash -cd /opt/dispatcharr -set -a -source .env -set +a -exec uv run celery -A dispatcharr worker -l info -c 4 -EOF -chmod +x /opt/dispatcharr/start-celery.sh - -cat </opt/dispatcharr/start-celerybeat.sh -#!/usr/bin/env bash -cd /opt/dispatcharr -set -a -source .env -set +a -exec uv run celery -A dispatcharr beat -l info -EOF -chmod +x /opt/dispatcharr/start-celerybeat.sh - -cat </opt/dispatcharr/start-daphne.sh -#!/usr/bin/env bash -cd /opt/dispatcharr -set -a -source .env -set +a -exec uv run daphne -b 0.0.0.0 -p 8001 dispatcharr.asgi:application -EOF -chmod +x /opt/dispatcharr/start-daphne.sh - -cat </etc/systemd/system/dispatcharr.service -[Unit] -Description=Dispatcharr Web Server -After=network.target postgresql.service redis-server.service - -[Service] -Type=simple -WorkingDirectory=/opt/dispatcharr -ExecStart=/opt/dispatcharr/start-gunicorn.sh -Restart=on-failure -RestartSec=10 -User=root - -[Install] -WantedBy=multi-user.target -EOF - -cat </etc/systemd/system/dispatcharr-celery.service -[Unit] -Description=Dispatcharr Celery Worker -After=network.target redis-server.service -Requires=dispatcharr.service - -[Service] -Type=simple -WorkingDirectory=/opt/dispatcharr -ExecStart=/opt/dispatcharr/start-celery.sh -Restart=on-failure -RestartSec=10 -User=root - -[Install] -WantedBy=multi-user.target -EOF - -cat </etc/systemd/system/dispatcharr-celerybeat.service -[Unit] -Description=Dispatcharr Celery Beat Scheduler -After=network.target redis-server.service -Requires=dispatcharr.service - -[Service] -Type=simple -WorkingDirectory=/opt/dispatcharr -ExecStart=/opt/dispatcharr/start-celerybeat.sh -Restart=on-failure -RestartSec=10 -User=root - -[Install] -WantedBy=multi-user.target -EOF - -cat </etc/systemd/system/dispatcharr-daphne.service -[Unit] -Description=Dispatcharr WebSocket Server (Daphne) -After=network.target -Requires=dispatcharr.service - -[Service] -Type=simple -WorkingDirectory=/opt/dispatcharr -ExecStart=/opt/dispatcharr/start-daphne.sh -Restart=on-failure -RestartSec=10 -User=root - -[Install] -WantedBy=multi-user.target -EOF -systemctl enable -q --now dispatcharr dispatcharr-celery dispatcharr-celerybeat dispatcharr-daphne -msg_ok "Created Services" - -motd_ssh -customize - -msg_info "Cleaning up" -$STD apt -y autoremove -$STD apt -y autoclean -$STD apt -y clean -msg_ok "Cleaned" diff --git a/install/garage-install.sh b/install/garage-install.sh deleted file mode 100644 index b8f1a39ec..000000000 --- a/install/garage-install.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/env bash - -# Copyright (c) 2021-2025 community-scripts ORG -# Author: Test Suite for tools.func -# License: MIT -# https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE -# Purpose: Run comprehensive test suite for all setup_* functions from tools.func - -source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" -color -verb_ip6 -catch_errors -setting_up_container -network_check -update_os - -msg_info "Setup Garage" -GITEA_RELEASE=$(curl -s https://api.github.com/repos/deuxfleurs-org/garage/tags | jq -r '.[0].name') -curl -fsSL "https://garagehq.deuxfleurs.fr/_releases/${GITEA_RELEASE}/x86_64-unknown-linux-musl/garage" -o /usr/local/bin/garage -chmod +x /usr/local/bin/garage -mkdir -p /var/lib/garage/{data,meta,snapshots} -mkdir -p /etc/garage -RPC_SECRET=$(openssl rand -hex 32) -ADMIN_TOKEN=$(openssl rand -base64 32) -METRICS_TOKEN=$(openssl rand -base64 32) -{ - echo "Garage Tokens and Secrets" - echo "RPC Secret: $RPC_SECRET" - echo "Admin Token: $ADMIN_TOKEN" - echo "Metrics Token: $METRICS_TOKEN" -} >>~/garage.creds -echo $GITEA_RELEASE >>~/.garage -cat </etc/garage.toml -metadata_dir = "/var/lib/garage/meta" -data_dir = "/var/lib/garage/data" -db_engine = "sqlite" -replication_factor = 1 - -rpc_bind_addr = "[::]:3901" -rpc_public_addr = "127.0.0.1:3901" -rpc_secret = "${RPC_SECRET}" - -[s3_api] -s3_region = "garage" -api_bind_addr = "[::]:3900" -root_domain = ".s3.garage.localhost" - -[s3_web] -bind_addr = "[::]:3902" -root_domain = ".web.garage.localhost" -index = "index.html" - -[k2v_api] -api_bind_addr = "[::]:3904" - -[admin] -api_bind_addr = "[::]:3903" -admin_token = "${ADMIN_TOKEN}" -metrics_token = "${METRICS_TOKEN}" -EOF -msg_ok "Set up Garage" - - -motd_ssh -customize - -msg_info "Cleaning up" -$STD apt -y autoremove -$STD apt -y autoclean -$STD apt -y clean -msg_ok "Cleaned" diff --git a/install/patchmon-install.sh b/install/patchmon-install.sh deleted file mode 100644 index 209b03e1c..000000000 --- a/install/patchmon-install.sh +++ /dev/null @@ -1,289 +0,0 @@ -#!/usr/bin/env bash - -# Copyright (c) 2021-2025 community-scripts ORG -# Author: vhsdream -# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE -# Source: https://github.com/PatcMmon/PatchMon - -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 \ - build-essential \ - gcc \ - nginx \ - redis-server -msg_ok "Installed Dependencies" - -NODE_VERSION="24" setup_nodejs -PG_VERSION="17" setup_postgresql - -msg_info "Creating PostgreSQL Database" -DB_NAME=patchmon_db -DB_USER=patchmon_usr -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 $DB_NAME WITH OWNER $DB_USER ENCODING 'UTF8' TEMPLATE template0;" -$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET client_encoding TO 'utf8';" -$STD sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE $DB_NAME TO $DB_USER;" - -cat <~/patchmon.creds -PatchMon Credentials -PatchMon Database Name: $DB_NAME -PatchMon Database User: $DB_USER -PatchMon Database Password: $DB_PASS -EOF -msg_ok "Created PostgreSQL Database" - -fetch_and_deploy_gh_release "PatchMon" "PatchMon/PatchMon" "tarball" "latest" "/opt/patchmon" - -msg_info "Configuring PatchMon" -cd /opt/patchmon -export NODE_ENV=production -$STD npm install --no-audit --no-fund --no-save --ignore-scripts -cd /opt/patchmon/backend -$STD npm install --no-audit --no-fund --no-save --ignore-scripts -cd /opt/patchmon/frontend -$STD npm install --include=dev --no-audit --no-fund --no-save --ignore-scripts -$STD npm run build - -JWT_SECRET="$(openssl rand -base64 64 | tr -d "=+/" | cut -c1-50)" -LOCAL_IP="$(hostname -I | awk '{print $1}')" -cat </opt/patchmon/backend/.env -# Database Configuration -DATABASE_URL="postgresql://$DB_USER:$DB_PASS@localhost:5432/$DB_NAME" -PY_THRESHOLD=3M_DB_CONN_MAX_ATTEMPTS=30 -PM_DB_CONN_WAIT_INTERVAL=2 - -# JWT Configuration -JWT_SECRET="$JWT_SECRET" -JWT_EXPIRES_IN=1h -JWT_REFRESH_EXPIRES_IN=7d - -# Server Configuration -PORT=3399 -NODE_ENV=production - -# API Configuration -API_VERSION=v1 - -# CORS Configuration -CORS_ORIGIN="http://$LOCAL_IP" - -# Session Configuration -SESSION_INACTIVITY_TIMEOUT_MINUTES=30 - -# User Configuration -DEFAULT_USER_ROLE=user - -# Rate Limiting (times in milliseconds) -RATE_LIMIT_WINDOW_MS=900000 -RATE_LIMIT_MAX=5000 -AUTH_RATE_LIMIT_WINDOW_MS=600000 -AUTH_RATE_LIMIT_MAX=500 -AGENT_RATE_LIMIT_WINDOW_MS=60000 -AGENT_RATE_LIMIT_MAX=1000 - -# Redis Configuration -REDIS_HOST=localhost -REDIS_PORT=6379 - -# Logging -LOG_LEVEL=info -ENABLE_LOGGING=true - -# TFA Configuration -TFA_REMEMBER_ME_EXPIRES_IN=30d -TFA_MAX_REMEMBER_SESSIONS=5 -TFA_SUSPICIOUS_ACTIVITY_THRESHOLD=3 -EOF - -cat </opt/patchmon/frontend/.env -VITE_API_URL=http://$LOCAL_IP/api/v1 -VITE_APP_NAME=PatchMon -VITE_APP_VERSION=1.3.0 -EOF - -cd /opt/patchmon/backend -$STD npx prisma migrate deploy -$STD npx prisma generate -msg_ok "Configured PatchMon" - -msg_info "Configuring Nginx" -cat </etc/nginx/sites-available/patchmon.conf -server { - listen 80; - server_name $LOCAL_IP; - - # Security headers - add_header X-Frame-Options DENY always; - add_header X-Content-Type-Options nosniff always; - add_header X-XSS-Protection "1; mode=block" always; - add_header Referrer-Policy "strict-origin-when-cross-origin" always; - - # Frontend - location / { - root /opt/patchmon/frontend/dist; - try_files \$uri \$uri/ /index.html; - } - - # Bull Board proxy - location /bullboard { - proxy_pass http://127.0.0.1:3399; - proxy_http_version 1.1; - proxy_set_header Upgrade \$http_upgrade; - proxy_set_header Connection 'upgrade'; - proxy_set_header Host \$host; - proxy_set_header X-Real-IP \$remote_addr; - proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto \$scheme; - proxy_set_header X-Forwarded-Host \$host; - proxy_set_header Cookie \$http_cookie; - proxy_cache_bypass \$http_upgrade; - proxy_read_timeout 300s; - proxy_connect_timeout 75s; - - # Enable cookie passthrough - proxy_pass_header Set-Cookie; - proxy_cookie_path / /; - - # Preserve original client IP - proxy_set_header X-Original-Forwarded-For \$http_x_forwarded_for; - if (\$request_method = 'OPTIONS') { - return 204; - } - } - - # API proxy - location /api/ { - proxy_pass http://127.0.0.1:3399; - proxy_http_version 1.1; - proxy_set_header Upgrade \$http_upgrade; - proxy_set_header Connection 'upgrade'; - proxy_set_header Host \$host; - proxy_set_header X-Real-IP \$remote_addr; - proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto \$scheme; - proxy_cache_bypass \$http_upgrade; - proxy_read_timeout 300s; - proxy_connect_timeout 75s; - - # Preserve original client IP - proxy_set_header X-Original-Forwarded-For \$http_x_forwarded_for; - if (\$request_method = 'OPTIONS') { - return 204; - } - } - - # Static assets caching (exclude Bull Board assets) - location ~* ^/(?!bullboard).*\.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ { - root /opt/patchmon/frontend/dist; - expires 1y; - add_header Cache-Control "public, immutable"; - } - - # Health check endpoint - location /health { - proxy_pass http://127.0.0.1:3399/health; - access_log off; - } -} -EOF -ln -sf /etc/nginx/sites-available/patchmon.conf /etc/nginx/sites-enabled/ -rm -f /etc/nginx/sites-enabled/default -$STD nginx -t -systemctl restart nginx -msg_ok "Configured Nginx" - -msg_info "Creating service" -cat </etc/systemd/system/patchmon-server.service -[Unit] -Description=PatchMon Service -After=network.target postgresql.service - -[Service] -Type=simple -WorkingDirectory=/opt/patchmon/backend -ExecStart=/usr/bin/node src/server.js -Restart=always -RestartSec=10 -Environment=NODE_ENV=production -Environment=PATH=/usr/bin:/usr/local/bin -NoNewPrivileges=true -PrivateTmp=true -ProtectSystem=strict -ProtectHome=true -ReadWritePaths=/opt/patchmon - -[Install] -WantedBy=multi-user.target -EOF -systemctl enable -q --now patchmon-server -msg_ok "Created and started service" - -msg_info "Updating settings" -cat </opt/patchmon/backend/update-settings.js -const { PrismaClient } = require('@prisma/client'); -const { v4: uuidv4 } = require('uuid'); -const prisma = new PrismaClient(); - -async function updateSettings() { - try { - const existingSettings = await prisma.settings.findFirst(); - - const settingsData = { - id: uuidv4(), - server_url: 'http://$LOCAL_IP', - server_protocol: 'http', - server_host: '$LOCAL_IP', - server_port: 3399, - update_interval: 60, - auto_update: true, - signup_enabled: false, - ignore_ssl_self_signed: false, - updated_at: new Date() - }; - - if (existingSettings) { - // Update existing settings - await prisma.settings.update({ - where: { id: existingSettings.id }, - data: settingsData - }); - } else { - // Create new settings record - await prisma.settings.create({ - data: settingsData - }); - } - - console.log('✅ Database settings updated successfully'); - } catch (error) { - console.error('❌ Error updating settings:', error.message); - process.exit(1); - } finally { - await prisma.\$disconnect(); - } -} - -updateSettings(); -EOF - -cd /opt/patchmon/backend -$STD node update-settings.js -msg_ok "Settings updated successfully" - -motd_ssh -customize - -msg_info "Cleaning up" -$STD apt -y autoremove -$STD apt -y autoclean -$STD apt -y clean -msg_ok "Cleaned" diff --git a/install/reitti-install.sh b/install/reitti-install.sh new file mode 100644 index 000000000..f0762a0d2 --- /dev/null +++ b/install/reitti-install.sh @@ -0,0 +1,152 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2025 community-scripts ORG +# Author: Test Suite for tools.func +# License: MIT +# https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE +# Purpose: Run comprehensive test suite for all setup_* functions from tools.func + +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies" +apt install -y \ + redis-server \ + rabbitmq-server \ + libpq-dev +msg_ok "Installed Dependencies" + +JAVA_VERSION="24" setup_java +PG_VERSION="17" PG_MODULES="postgis" setup_postgresql + +msg_info "Setting up PostgreSQL" +DB_NAME="reitti_db" +DB_USER="reitti" +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 $DB_NAME WITH OWNER $DB_USER ENCODING 'UTF8' TEMPLATE template0;" +$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET client_encoding TO 'utf8';" +$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET default_transaction_isolation TO 'read committed';" +$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET timezone TO 'UTC';" +$STD sudo -u postgres psql -d "$DB_NAME" -c "CREATE EXTENSION IF NOT EXISTS postgis;" +$STD sudo -u postgres psql -d "$DB_NAME" -c "CREATE EXTENSION IF NOT EXISTS postgis_topology;" +{ + echo "Reitti Credentials" + echo "Database Name: $DB_NAME" + echo "Database User: $DB_USER" + echo "Database Password: $DB_PASS" +} >>~/reitti.creds +msg_ok "PostgreSQL Setup Completed" + +msg_info "Configuring RabbitMQ" +RABBIT_USER="reitti" +RABBIT_PASS="$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13)" +RABBIT_VHOST="/" +$STD rabbitmqctl add_user "$RABBIT_USER" "$RABBIT_PASS" +$STD rabbitmqctl add_vhost "$RABBIT_VHOST" +$STD rabbitmqctl set_permissions -p "$RABBIT_VHOST" "$RABBIT_USER" ".*" ".*" ".*" +$STD rabbitmqctl set_user_tags "$RABBIT_USER" administrator +{ + echo "" + echo "Reitti Credentials" + echo "RabbitMQ User: $RABBIT_USER" + echo "RabbitMQ Password: $RABBIT_PASS" +} >>~/reitti.creds +msg_ok "Configured RabbitMQ" + +USE_ORIGINAL_FILENAME="true" fetch_and_deploy_gh_release "reitti" "dedicatedcode/reitti" "singlefile" "latest" "/opt/reitti" "reitti-app.jar" +mv /opt/reitti/reitti-*.jar /opt/reitti/reitti.jar +USE_ORIGINAL_FILENAME="true" fetch_and_deploy_gh_release "photon" "komoot/photon" "singlefile" "latest" "/opt/photon" "photon*.jar" +mv /opt/photon/photon-*.jar /opt/photon/photon.jar + +msg_info "Create Configuration" +cat </opt/reitti/application.properties +# PostgreSQL Database Connection +spring.datasource.url=jdbc:postgresql://127.0.0.1:5432/$DB_NAME +spring.datasource.username=$DB_USER +spring.datasource.password=$DB_PASS +spring.datasource.driver-class-name=org.postgresql.Driver + +# Flyway Database Migrations +spring.flyway.enabled=true +spring.flyway.locations=classpath:db/migration +spring.flyway.baseline-on-migrate=true + +# RabbitMQ (Message Queue) +spring.rabbitmq.host=127.0.0.1 +spring.rabbitmq.port=5672 +spring.rabbitmq.username=$RABBIT_USER +spring.rabbitmq.password=$RABBIT_PASS + +# Redis (Cache) +spring.data.redis.host=127.0.0.1 +spring.data.redis.port=6379 + +# Server Port +server.port=8080 + +# Optional: Logging & Performance +logging.level.root=INFO +spring.jpa.hibernate.ddl-auto=none +spring.datasource.hikari.maximum-pool-size=10 + +# Photon (Geocoding) +PHOTON_BASE_URL=http://127.0.0.1:2322 +PROCESSING_WAIT_TIME=15 +PROCESSING_BATCH_SIZE=1000 +PROCESSING_WORKERS_PER_QUEUE=4-16 + +# Disable potentially dangerous features unless needed +DANGEROUS_LIFE=false +EOF + +msg_info "Creating Services" +cat </etc/systemd/system/reitti.service +[Unit] +Description=Reitti +After=syslog.target network.target + +[Service] +Type=simple +WorkingDirectory=/opt/reitti/ +Environment=LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu +ExecStart=/usr/bin/java --enable-native-access=ALL-UNNAMED -jar -Xmx2g reitti.jar +TimeoutStopSec=20 +KillMode=process +Restart=on-failure + +[Install] +WantedBy=multi-user.target +EOF + +cat </etc/systemd/system/photon.service +[Unit] +Description=Photon Geocoding Service +After=network.target + +[Service] +Type=simple +WorkingDirectory=/opt/photon +ExecStart=/usr/bin/java -Xmx2g -jar photon.jar +Restart=on-failure +TimeoutStopSec=20 + +[Install] +WantedBy=multi-user.target +EOF + +systemctl enable -q --now photon +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned"