18dd4f720d
ci / build-test (push) Successful in 1m18s
Adds deploy/ct/metervault.sh (host) + deploy/install/metervault-install.sh (in-LXC), modeled on MQTTower's community-scripts installer but adapted for MeterVault: it lives on public Gitea (not GitHub) and is a single Blazor app + TimescaleDB (not multi-mode). The host script sources the community-scripts framework, creates a Debian 12 LXC and runs the install script via pct exec. The install script sets up PostgreSQL 16 + TimescaleDB, installs the .NET SDK, builds the app from the public Gitea repo (no prebuilt tarball exists — releases ship as a container image), writes /etc/metervault/environment + a systemd unit on port 8760, and installs an 'update' command (git pull + rebuild). scripts/run-metervault-ct-install.sh is the maintainer helper. All three pass shellcheck (warning-level clean) and bash -n. README documents the one-liner. Claude-Session: https://claude.ai/code/session_01Kib2MniVFbD95fkgLgBBnB
40 lines
2.0 KiB
Bash
Executable File
40 lines
2.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Maintainer helper. Not part of the community-scripts tree under deploy/.
|
|
#
|
|
# If bash reports "$'\r': command not found" or "set: pipefail: invalid option", the file has
|
|
# CRLF line endings. Fix (use the real path to this file — not $0 from an interactive shell):
|
|
# sed -i 's/\r$//' /tmp/run-metervault-ct-install.sh && bash /tmp/run-metervault-ct-install.sh
|
|
#
|
|
# Run this **inside** an existing Debian LXC (not on the Proxmox host). It exports the same
|
|
# METERVAULT_* variables that deploy/ct/metervault.sh passes via pct exec, then runs the official
|
|
# install script from the public Gitea repo.
|
|
#
|
|
# Optional overrides file: export METERVAULT_INSTALL_ENV=/root/metervault-install.env
|
|
|
|
set -euo pipefail
|
|
|
|
[[ "${1:-}" == "-h" || "${1:-}" == "--help" ]] && { echo "Usage: $0 (run as root inside the LXC)"; exit 0; }
|
|
[[ "$(id -u)" -eq 0 ]] || { echo "error: run as root inside the container" >&2; exit 1; }
|
|
|
|
rand_hex() { openssl rand -hex 16 2>/dev/null || head -c 16 /dev/urandom | xxd -p; }
|
|
|
|
METERVAULT_DEPLOY_BASE="${METERVAULT_DEPLOY_BASE:-https://git.finalfactory.de/FinalFactory/MeterVault/raw/branch/master/deploy}"
|
|
METERVAULT_INSTALL_URL="${METERVAULT_INSTALL_URL:-${METERVAULT_DEPLOY_BASE}/install/metervault-install.sh}"
|
|
|
|
[[ -n "${METERVAULT_INSTALL_ENV:-}" && -f "${METERVAULT_INSTALL_ENV}" ]] && { set -a; # shellcheck source=/dev/null
|
|
source "${METERVAULT_INSTALL_ENV}"; set +a; }
|
|
|
|
export CONTAINER_INSTALLING="${CONTAINER_INSTALLING:-true}"
|
|
export METERVAULT_CT_URL="${METERVAULT_CT_URL:-${METERVAULT_DEPLOY_BASE}/ct/metervault.sh}"
|
|
export METERVAULT_PORT="${METERVAULT_PORT:-8760}"
|
|
export METERVAULT_TIMEZONE="${METERVAULT_TIMEZONE:-Europe/Berlin}"
|
|
export METERVAULT_SEED="${METERVAULT_SEED:-false}"
|
|
if [[ -z "${METERVAULT_DB_PASSWORD:-}" ]]; then
|
|
METERVAULT_DB_PASSWORD="$(rand_hex)"
|
|
echo "Generated METERVAULT_DB_PASSWORD: ${METERVAULT_DB_PASSWORD}"
|
|
fi
|
|
export METERVAULT_DB_PASSWORD
|
|
|
|
echo "METERVAULT_INSTALL_URL=${METERVAULT_INSTALL_URL} PORT=${METERVAULT_PORT} SEED=${METERVAULT_SEED}"
|
|
exec bash -c "$(curl -fsSL "$METERVAULT_INSTALL_URL")"
|