diff --git a/ct/adguard.sh b/ct/adguard.sh index 87c47f6ed..752cea7f8 100644 --- a/ct/adguard.sh +++ b/ct/adguard.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash -source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +_CS_DEFAULT_URL="https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main" +_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 tteck # Author: tteck (tteckster) # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE @@ -8,28 +10,57 @@ source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxV APP="Adguard" var_tags="${var_tags:-adblock}" var_cpu="${var_cpu:-1}" -var_ram="${var_ram:-512}" -var_disk="${var_disk:-2}" -var_os="${var_os:-debian}" -var_version="${var_version:-13}" var_arm64="${var_arm64:-yes}" var_unprivileged="${var_unprivileged:-1}" +if [[ -z "${var_os:-}" ]] && command -v pveversion >/dev/null 2>&1; then + var_os=$(msg_menu "Choose the container OS" \ + "debian" "Debian 13" \ + "alpine" "Alpine (smaller footprint)") +fi + +if [[ "${var_os:-}" == "alpine" ]]; then + var_ram="${var_ram:-256}" + var_disk="${var_disk:-1}" + var_version="${var_version:-3.24}" +else + var_ram="${var_ram:-512}" + var_disk="${var_disk:-2}" + var_version="${var_version:-13}" +fi header_info "$APP" variables color catch_errors -function update_script() { - header_info - check_container_storage - check_container_resources +update_deb_based() { if [[ ! -d /opt/AdGuardHome ]]; then msg_error "No ${APP} Installation Found!" exit fi msg_error "Adguard Home can only be updated via the user interface." - exit +} + +update_alpine() { + msg_info "Updating Alpine Packages" + $STD apk -U upgrade + msg_ok "Updated Alpine Packages" + + msg_info "Updating AdGuard Home" + $STD /opt/AdGuardHome/AdGuardHome --update + msg_ok "Updated AdGuard Home" + + msg_info "Restarting AdGuard Home" + $STD rc-service adguardhome restart + msg_ok "Restarted AdGuard Home" + msg_ok "Updated successfully!" +} + +function update_script() { + header_info + check_container_storage + check_container_resources + run_os_update } start diff --git a/ct/bitmagnet.sh b/ct/bitmagnet.sh index 56966f954..fa5c8ed5e 100644 --- a/ct/bitmagnet.sh +++ b/ct/bitmagnet.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash -source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +_CS_DEFAULT_URL="https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main" +_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: Slaviša Arežina (tremor021) # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE @@ -8,22 +10,30 @@ source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxV APP="Bitmagnet" var_tags="${var_tags:-os}" 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_arm64="${var_arm64:-yes}" var_unprivileged="${var_unprivileged:-1}" +if [[ -z "${var_os:-}" ]] && command -v pveversion >/dev/null 2>&1; then + var_os=$(msg_menu "Choose the container OS" \ + "debian" "Debian 13" \ + "alpine" "Alpine (smaller footprint)") +fi + +if [[ "${var_os:-}" == "alpine" ]]; then + var_ram="${var_ram:-2048}" + var_disk="${var_disk:-3}" + var_version="${var_version:-3.24}" +else + var_ram="${var_ram:-2048}" + var_disk="${var_disk:-4}" + var_version="${var_version:-13}" +fi header_info "$APP" variables color catch_errors -function update_script() { - header_info - check_container_storage - check_container_resources +update_deb_based() { if [[ ! -d /opt/bitmagnet ]]; then msg_error "No ${APP} Installation Found!" exit @@ -75,7 +85,69 @@ function update_script() { msg_ok "Started Service" msg_ok "Updated successfully!" fi - exit +} + +update_alpine() { + if [[ ! -d /opt/bitmagnet ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + RELEASE=$(curl -fsSL https://api.github.com/repos/bitmagnet-io/bitmagnet/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') + if [ "${RELEASE}" != "$(cat /opt/bitmagnet_version.txt)" ] || [ ! -f /opt/bitmagnet_version.txt ]; then + msg_info "Backing up database" + rm -f /tmp/backup.sql + $STD sudo -u postgres pg_dump \ + --column-inserts \ + --data-only \ + --on-conflict-do-nothing \ + --rows-per-insert=1000 \ + --table=metadata_sources \ + --table=content \ + --table=content_attributes \ + --table=content_collections \ + --table=content_collections_content \ + --table=torrent_sources \ + --table=torrents \ + --table=torrent_files \ + --table=torrent_hints \ + --table=torrent_contents \ + --table=torrent_tags \ + --table=torrents_torrent_sources \ + --table=key_values \ + bitmagnet \ + >/tmp/backup.sql + mv /tmp/backup.sql /opt/ + msg_ok "Database backed up" + + msg_info "Updating ${APP} from $(cat /opt/bitmagnet_version.txt) to ${RELEASE}" + $STD apk -U upgrade + $STD service bitmagnet stop + [ -f /opt/bitmagnet/.env ] && cp /opt/bitmagnet/.env /opt/ + [ -f /opt/bitmagnet/config.yml ] && cp /opt/bitmagnet/config.yml /opt/ + rm -rf /opt/bitmagnet/* + temp_file=$(mktemp) + curl -fsSL "https://github.com/bitmagnet-io/bitmagnet/archive/refs/tags/v${RELEASE}.tar.gz" -o "$temp_file" + tar zxf "$temp_file" --strip-components=1 -C /opt/bitmagnet + cd /opt/bitmagnet + VREL=v$RELEASE + $STD go build -ldflags "-s -w -X github.com/bitmagnet-io/bitmagnet/internal/version.GitTag=$VREL" + chmod +x bitmagnet + [ -f "/opt/.env" ] && cp "/opt/.env" /opt/bitmagnet/ + [ -f "/opt/config.yml" ] && cp "/opt/config.yml" /opt/bitmagnet/ + rm -f "$temp_file" + echo "${RELEASE}" >/opt/bitmagnet_version.txt + $STD service bitmagnet start + msg_ok "Updated successfully!" + else + msg_ok "No update required. ${APP} is already at ${RELEASE}" + fi +} + +function update_script() { + header_info + check_container_storage + check_container_resources + run_os_update } start diff --git a/ct/caddy.sh b/ct/caddy.sh index 7cd9a0750..34db90c9e 100644 --- a/ct/caddy.sh +++ b/ct/caddy.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash -source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +_CS_DEFAULT_URL="https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main" +_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 tteck # Author: tteck (tteckster) # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE @@ -8,22 +10,30 @@ source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxV APP="Caddy" var_tags="${var_tags:-webserver}" var_cpu="${var_cpu:-1}" -var_ram="${var_ram:-512}" -var_disk="${var_disk:-6}" -var_os="${var_os:-debian}" -var_version="${var_version:-13}" var_arm64="${var_arm64:-yes}" var_unprivileged="${var_unprivileged:-1}" +if [[ -z "${var_os:-}" ]] && command -v pveversion >/dev/null 2>&1; then + var_os=$(msg_menu "Choose the container OS" \ + "debian" "Debian 13" \ + "alpine" "Alpine (smaller footprint)") +fi + +if [[ "${var_os:-}" == "alpine" ]]; then + var_ram="${var_ram:-256}" + var_disk="${var_disk:-3}" + var_version="${var_version:-3.24}" +else + var_ram="${var_ram:-512}" + var_disk="${var_disk:-6}" + var_version="${var_version:-13}" +fi header_info "$APP" variables color catch_errors -function update_script() { - header_info - check_container_storage - check_container_resources +update_deb_based() { if [[ ! -d /etc/caddy ]]; then msg_error "No ${APP} Installation Found!" exit @@ -45,7 +55,28 @@ function update_script() { fi fi msg_ok "Updated successfully!" - exit +} + +update_alpine() { + if [[ ! -d /etc/caddy ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + msg_info "Updating $APP LXC" + $STD apk -U upgrade + msg_ok "Updated $APP LXC" + + msg_info "Restarting Caddy" + rc-service caddy restart + msg_ok "Restarted Caddy" + msg_ok "Updated successfully!" +} + +function update_script() { + header_info + check_container_storage + check_container_resources + run_os_update } start diff --git a/ct/docker.sh b/ct/docker.sh index 9f6984027..d1cd3ba78 100644 --- a/ct/docker.sh +++ b/ct/docker.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash -source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +_CS_DEFAULT_URL="https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main" +_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 tteck # Author: tteck (tteckster) # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE @@ -8,23 +10,30 @@ source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxV APP="Docker" var_tags="${var_tags:-docker}" 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_arm64="${var_arm64:-yes}" var_unprivileged="${var_unprivileged:-1}" +if [[ -z "${var_os:-}" ]] && command -v pveversion >/dev/null 2>&1; then + var_os=$(msg_menu "Choose the container OS" \ + "debian" "Debian 13" \ + "alpine" "Alpine (smaller footprint)") +fi + +if [[ "${var_os:-}" == "alpine" ]]; then + var_ram="${var_ram:-1024}" + var_disk="${var_disk:-2}" + var_version="${var_version:-3.24}" +else + var_ram="${var_ram:-2048}" + var_disk="${var_disk:-4}" + var_version="${var_version:-13}" +fi header_info "$APP" variables color catch_errors -function update_script() { - header_info - check_container_storage - check_container_resources - +update_deb_based() { msg_info "Updating base system" $STD apt update $STD apt upgrade -y @@ -43,7 +52,18 @@ function update_script() { fi msg_ok "Updated successfully!" - exit +} + +update_alpine() { + $STD apk -U upgrade + msg_ok "Updated successfully!" +} + +function update_script() { + header_info + check_container_storage + check_container_resources + run_os_update } start diff --git a/ct/forgejo.sh b/ct/forgejo.sh index 19c10aad6..12b4325c0 100644 --- a/ct/forgejo.sh +++ b/ct/forgejo.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash -source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +_CS_DEFAULT_URL="https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main" +_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 tteck # Author: tteck (tteckster) # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE @@ -8,22 +10,30 @@ source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxV APP="Forgejo" var_tags="${var_tags:-git}" var_cpu="${var_cpu:-2}" -var_ram="${var_ram:-2048}" -var_disk="${var_disk:-10}" -var_os="${var_os:-debian}" -var_version="${var_version:-13}" var_arm64="${var_arm64:-yes}" var_unprivileged="${var_unprivileged:-1}" +if [[ -z "${var_os:-}" ]] && command -v pveversion >/dev/null 2>&1; then + var_os=$(msg_menu "Choose the container OS" \ + "debian" "Debian 13" \ + "alpine" "Alpine (smaller footprint)") +fi + +if [[ "${var_os:-}" == "alpine" ]]; then + var_ram="${var_ram:-256}" + var_disk="${var_disk:-1}" + var_version="${var_version:-3.24}" +else + var_ram="${var_ram:-2048}" + var_disk="${var_disk:-10}" + var_version="${var_version:-13}" +fi header_info "$APP" variables color catch_errors -function update_script() { - header_info - check_container_storage - check_container_resources +update_deb_based() { if [[ ! -d /opt/forgejo ]]; then msg_error "No ${APP} Installation Found!" exit @@ -50,7 +60,28 @@ function update_script() { else msg_ok "No update required. ${APP} is already at the latest version." fi - exit +} + +update_alpine() { + msg_info "Updating Alpine Packages" + $STD apk -U upgrade + msg_ok "Updated Alpine Packages" + + msg_info "Updating Forgejo" + $STD apk upgrade forgejo + msg_ok "Updated Forgejo" + + msg_info "Restarting Forgejo" + $STD rc-service forgejo restart + msg_ok "Restarted Forgejo" + msg_ok "Updated successfully!" +} + +function update_script() { + header_info + check_container_storage + check_container_resources + run_os_update } start diff --git a/ct/garage.sh b/ct/garage.sh index ebca5a3b4..93268168a 100644 --- a/ct/garage.sh +++ b/ct/garage.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash -source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +_CS_DEFAULT_URL="https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main" +_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 @@ -8,22 +10,30 @@ source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxV APP="Garage" var_tags="${var_tags:-object-storage}" var_cpu="${var_cpu:-1}" -var_ram="${var_ram:-1024}" -var_disk="${var_disk:-5}" -var_os="${var_os:-debian}" -var_version="${var_version:-13}" var_arm64="${var_arm64:-yes}" var_unprivileged="${var_unprivileged:-1}" +if [[ -z "${var_os:-}" ]] && command -v pveversion >/dev/null 2>&1; then + var_os=$(msg_menu "Choose the container OS" \ + "debian" "Debian 13" \ + "alpine" "Alpine (smaller footprint)") +fi + +if [[ "${var_os:-}" == "alpine" ]]; then + var_ram="${var_ram:-512}" + var_disk="${var_disk:-5}" + var_version="${var_version:-3.24}" +else + var_ram="${var_ram:-1024}" + var_disk="${var_disk:-5}" + var_version="${var_version:-13}" +fi header_info "$APP" variables color catch_errors -function update_script() { - header_info - check_container_storage - check_container_resources +update_deb_based() { if [[ ! -f /usr/local/bin/garage ]]; then msg_error "No ${APP} Installation Found!" exit @@ -52,7 +62,45 @@ function update_script() { else msg_ok "No update required. Garage is already at ${GITEA_RELEASE}" fi - exit +} + +update_alpine() { + 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}/$(arch_resolve "x86_64" "aarch64")-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 "Updated successfully!" + else + msg_ok "No update required. Garage is already at ${GITEA_RELEASE}" + fi +} + +function update_script() { + header_info + check_container_storage + check_container_resources + run_os_update } start diff --git a/ct/gatus.sh b/ct/gatus.sh index 726bcb652..2faf7bec3 100644 --- a/ct/gatus.sh +++ b/ct/gatus.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash -source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +_CS_DEFAULT_URL="https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main" +_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: Slaviša Arežina (tremor021) # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE @@ -8,23 +10,30 @@ source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxV APP="gatus" var_tags="${var_tags:-monitoring}" var_cpu="${var_cpu:-1}" -var_ram="${var_ram:-512}" -var_disk="${var_disk:-4}" -var_os="${var_os:-debian}" -var_version="${var_version:-13}" var_arm64="${var_arm64:-yes}" var_unprivileged="${var_unprivileged:-1}" +if [[ -z "${var_os:-}" ]] && command -v pveversion >/dev/null 2>&1; then + var_os=$(msg_menu "Choose the container OS" \ + "debian" "Debian 13" \ + "alpine" "Alpine (smaller footprint)") +fi + +if [[ "${var_os:-}" == "alpine" ]]; then + var_ram="${var_ram:-512}" + var_disk="${var_disk:-3}" + var_version="${var_version:-3.24}" +else + var_ram="${var_ram:-512}" + var_disk="${var_disk:-4}" + var_version="${var_version:-13}" +fi header_info "$APP" variables color catch_errors -function update_script() { - header_info - check_container_storage - check_container_resources - +update_deb_based() { if [[ ! -d /opt/gatus ]]; then msg_error "No ${APP} Installation Found!" exit @@ -50,7 +59,42 @@ function update_script() { msg_ok "Started Service" msg_ok "Updated successfully!" fi - exit +} + +update_alpine() { + if [[ ! -d /opt/gatus ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + RELEASE=$(curl -s https://api.github.com/repos/TwiN/gatus/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') + if [ "${RELEASE}" != "$(cat /opt/gatus_version.txt)" ] || [ ! -f /opt/gatus_version.txt ]; then + msg_info "Updating ${APP} LXC" + $STD apk -U upgrade + $STD service gatus stop + mv /opt/gatus/config/config.yaml /opt + rm -rf /opt/gatus/* + temp_file=$(mktemp) + curl -fsSL "https://github.com/TwiN/gatus/archive/refs/tags/v${RELEASE}.tar.gz" -o "$temp_file" + tar zxf "$temp_file" --strip-components=1 -C /opt/gatus + cd /opt/gatus + $STD go mod tidy + CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o gatus . + setcap CAP_NET_RAW+ep gatus + mv /opt/config.yaml config + rm -f "$temp_file" + echo "${RELEASE}" >/opt/gatus_version.txt + $STD service gatus start + msg_ok "Updated successfully!" + else + msg_ok "No update required. ${APP} is already at ${RELEASE}" + fi +} + +function update_script() { + header_info + check_container_storage + check_container_resources + run_os_update } start diff --git a/ct/gitea.sh b/ct/gitea.sh index f29289de8..98977f66e 100644 --- a/ct/gitea.sh +++ b/ct/gitea.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash -source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +_CS_DEFAULT_URL="https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main" +_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 tteck # Author: tteck (tteckster) | Co-Author: Rogue-King # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE @@ -8,23 +10,30 @@ source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxV APP="Gitea" var_tags="${var_tags:-git}" var_cpu="${var_cpu:-1}" -var_ram="${var_ram:-1024}" -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}" +if [[ -z "${var_os:-}" ]] && command -v pveversion >/dev/null 2>&1; then + var_os=$(msg_menu "Choose the container OS" \ + "debian" "Debian 13" \ + "alpine" "Alpine (smaller footprint)") +fi + +if [[ "${var_os:-}" == "alpine" ]]; then + var_ram="${var_ram:-256}" + var_disk="${var_disk:-1}" + var_version="${var_version:-3.24}" +else + var_ram="${var_ram:-1024}" + var_disk="${var_disk:-8}" + var_version="${var_version:-13}" +fi header_info "$APP" variables color catch_errors -function update_script() { - header_info - check_container_storage - check_container_resources - +update_deb_based() { if [[ ! -f /usr/local/bin/gitea ]]; then msg_error "No ${APP} Installation Found!" exit @@ -43,7 +52,28 @@ function update_script() { msg_ok "Started service" msg_ok "Updated successfully!" fi - exit +} + +update_alpine() { + msg_info "Updating Alpine Packages" + $STD apk -U upgrade + msg_ok "Updated Alpine Packages" + + msg_info "Updating Gitea" + apk upgrade gitea + msg_ok "Updated Gitea" + + msg_info "Restarting Gitea" + rc-service gitea restart + msg_ok "Restarted Gitea" + msg_ok "Updated successfully!" +} + +function update_script() { + header_info + check_container_storage + check_container_resources + run_os_update } start diff --git a/ct/grafana.sh b/ct/grafana.sh index 3c04e141a..6101bd30a 100644 --- a/ct/grafana.sh +++ b/ct/grafana.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash -source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +_CS_DEFAULT_URL="https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main" +_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 tteck # Author: tteck (tteckster) # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE @@ -8,23 +10,30 @@ source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxV APP="Grafana" var_tags="${var_tags:-monitoring;visualization}" var_cpu="${var_cpu:-1}" -var_ram="${var_ram:-512}" -var_disk="${var_disk:-4}" -var_os="${var_os:-debian}" -var_version="${var_version:-13}" var_arm64="${var_arm64:-yes}" var_unprivileged="${var_unprivileged:-1}" +if [[ -z "${var_os:-}" ]] && command -v pveversion >/dev/null 2>&1; then + var_os=$(msg_menu "Choose the container OS" \ + "debian" "Debian 13" \ + "alpine" "Alpine (smaller footprint)") +fi + +if [[ "${var_os:-}" == "alpine" ]]; then + var_ram="${var_ram:-512}" + var_disk="${var_disk:-2}" + var_version="${var_version:-3.24}" +else + var_ram="${var_ram:-512}" + var_disk="${var_disk:-4}" + var_version="${var_version:-13}" +fi header_info "$APP" variables color catch_errors -function update_script() { - header_info - check_container_storage - check_container_resources - +update_deb_based() { if ! dpkg -s grafana >/dev/null 2>&1; then msg_error "No ${APP} Installation Found!" exit 233 @@ -43,7 +52,42 @@ function update_script() { $STD apt update $STD apt --only-upgrade install -y grafana msg_ok "Updated successfully!" - exit +} + +update_alpine() { + LXCIP=$(ip a s dev eth0 | awk '/inet / {print $2}' | cut -d/ -f1) + + CHOICE=$(msg_menu "Grafana Update Options" \ + "1" "Check for Grafana Updates" \ + "2" "Allow 0.0.0.0 for listening" \ + "3" "Allow only ${LXCIP} for listening") + + case $CHOICE in + 1) + $STD apk -U upgrade + msg_ok "Updated successfully!" + exit + ;; + 2) + sed -i -e "s/cfg:server.http_addr=.*/cfg:server.http_addr=0.0.0.0/g" /etc/conf.d/grafana + service grafana restart + msg_ok "Allowed listening on all interfaces!" + exit + ;; + 3) + sed -i -e "s/cfg:server.http_addr=.*/cfg:server.http_addr=$LXCIP/g" /etc/conf.d/grafana + service grafana restart + msg_ok "Allowed listening only on ${LXCIP}!" + exit + ;; + esac +} + +function update_script() { + header_info + check_container_storage + check_container_resources + run_os_update } start diff --git a/ct/ironclaw.sh b/ct/ironclaw.sh index b56f76e54..4362a2621 100644 --- a/ct/ironclaw.sh +++ b/ct/ironclaw.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash -source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +_CS_DEFAULT_URL="https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main" +_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 @@ -8,23 +10,30 @@ source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxV APP="IronClaw" var_tags="${var_tags:-ai;agent;security}" 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}" +if [[ -z "${var_os:-}" ]] && command -v pveversion >/dev/null 2>&1; then + var_os=$(msg_menu "Choose the container OS" \ + "debian" "Debian 13" \ + "alpine" "Alpine (smaller footprint)") +fi + +if [[ "${var_os:-}" == "alpine" ]]; then + var_ram="${var_ram:-1024}" + var_disk="${var_disk:-8}" + var_version="${var_version:-3.24}" +else + var_ram="${var_ram:-2048}" + var_disk="${var_disk:-8}" + var_version="${var_version:-13}" +fi header_info "$APP" variables color catch_errors -function update_script() { - header_info - check_container_storage - check_container_resources - +update_deb_based() { if [[ ! -f /usr/local/bin/ironclaw ]]; then msg_error "No ${APP} Installation Found!" exit @@ -54,7 +63,45 @@ function update_script() { msg_ok "Started Service" msg_ok "Updated successfully!" fi - exit +} + +update_alpine() { + if [[ ! -f /usr/local/bin/ironclaw ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + + RELEASE="ironclaw-v0.29.1" + if check_for_gh_release "ironclaw-bin" "nearai/ironclaw" "${RELEASE}" "IronClaw 1.0 (Reborn) is a ground-up rearchitecture with an incompatible CLI/config format; pinned until this script supports it"; then + msg_info "Stopping Service" + rc-service ironclaw stop 2>/dev/null || true + msg_ok "Stopped Service" + + msg_info "Backing up Configuration" + cp /root/.ironclaw/.env /root/ironclaw.env.bak + msg_ok "Backed up Configuration" + + fetch_and_deploy_gh_release "ironclaw-bin" "nearai/ironclaw" "prebuild" "${RELEASE}" "/usr/local/bin" \ + "ironclaw-$(uname -m)-unknown-linux-musl.tar.gz" + chmod +x /usr/local/bin/ironclaw + + msg_info "Restoring Configuration" + cp /root/ironclaw.env.bak /root/.ironclaw/.env + rm -f /root/ironclaw.env.bak + msg_ok "Restored Configuration" + + msg_info "Starting Service" + rc-service ironclaw start + msg_ok "Started Service" + msg_ok "Updated successfully!" + fi +} + +function update_script() { + header_info + check_container_storage + check_container_resources + run_os_update } start diff --git a/ct/loki.sh b/ct/loki.sh index d1c6a2570..b2373529e 100644 --- a/ct/loki.sh +++ b/ct/loki.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash -source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +_CS_DEFAULT_URL="https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main" +_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: hoholms # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE @@ -8,23 +10,30 @@ source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxV APP="Loki" var_tags="${var_tags:-monitoring;logs}" var_cpu="${var_cpu:-1}" -var_ram="${var_ram:-512}" -var_disk="${var_disk:-2}" -var_os="${var_os:-debian}" -var_version="${var_version:-13}" var_arm64="${var_arm64:-yes}" var_unprivileged="${var_unprivileged:-1}" +if [[ -z "${var_os:-}" ]] && command -v pveversion >/dev/null 2>&1; then + var_os=$(msg_menu "Choose the container OS" \ + "debian" "Debian 13" \ + "alpine" "Alpine (smaller footprint)") +fi + +if [[ "${var_os:-}" == "alpine" ]]; then + var_ram="${var_ram:-256}" + var_disk="${var_disk:-1}" + var_version="${var_version:-3.24}" +else + var_ram="${var_ram:-512}" + var_disk="${var_disk:-2}" + var_version="${var_version:-13}" +fi header_info "$APP" variables color catch_errors -function update_script() { - header_info - check_container_storage - check_container_resources - +update_deb_based() { if ! dpkg -s loki >/dev/null 2>&1; then msg_error "No ${APP} Installation Found!" exit 233 @@ -69,7 +78,42 @@ function update_script() { exit ;; esac - exit 0 +} + +update_alpine() { + LXCIP=$(ip a s dev eth0 | awk '/inet / {print $2}' | cut -d/ -f1) + + CHOICE=$(msg_menu "Loki Update Options" \ + "1" "Check for Loki Updates" \ + "2" "Allow 0.0.0.0 for listening" \ + "3" "Allow only ${LXCIP} for listening") + + case $CHOICE in + 1) + $STD apk -U upgrade + msg_ok "Updated successfully!" + exit + ;; + 2) + sed -i -e "s/cfg:server.http_addr=.*/cfg:server.http_addr=0.0.0.0/g" /etc/conf.d/loki + service loki restart + msg_ok "Allowed listening on all interfaces!" + exit + ;; + 3) + sed -i -e "s/cfg:server.http_addr=.*/cfg:server.http_addr=$LXCIP/g" /etc/conf.d/loki + service loki restart + msg_ok "Allowed listening only on ${LXCIP}!" + exit + ;; + esac +} + +function update_script() { + header_info + check_container_storage + check_container_resources + run_os_update } start diff --git a/ct/mariadb.sh b/ct/mariadb.sh index 4d425132d..30687acb2 100644 --- a/ct/mariadb.sh +++ b/ct/mariadb.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash -source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +_CS_DEFAULT_URL="https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main" +_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 tteck # Author: tteck (tteckster) # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE @@ -8,22 +10,30 @@ source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxV APP="MariaDB" var_tags="${var_tags:-database}" var_cpu="${var_cpu:-1}" -var_ram="${var_ram:-1024}" -var_disk="${var_disk:-4}" -var_os="${var_os:-debian}" -var_version="${var_version:-13}" var_arm64="${var_arm64:-yes}" var_unprivileged="${var_unprivileged:-1}" +if [[ -z "${var_os:-}" ]] && command -v pveversion >/dev/null 2>&1; then + var_os=$(msg_menu "Choose the container OS" \ + "debian" "Debian 13" \ + "alpine" "Alpine (smaller footprint)") +fi + +if [[ "${var_os:-}" == "alpine" ]]; then + var_ram="${var_ram:-256}" + var_disk="${var_disk:-1}" + var_version="${var_version:-3.24}" +else + var_ram="${var_ram:-1024}" + var_disk="${var_disk:-4}" + var_version="${var_version:-13}" +fi header_info "$APP" variables color catch_errors -function update_script() { - header_info - check_container_storage - check_container_resources +update_deb_based() { if [[ ! -d /etc/mysql/mariadb.conf.d ]]; then msg_error "No ${APP} Installation Found!" exit @@ -33,7 +43,28 @@ function update_script() { $STD apt update $STD apt -y upgrade msg_ok "Updated successfully!" - exit +} + +update_alpine() { + msg_info "Updating Alpine Packages" + $STD apk -U upgrade + msg_ok "Updated Alpine Packages" + + msg_info "Updating MariaDB" + $STD apk upgrade mariadb mariadb-client + msg_ok "Updated MariaDB" + + msg_info "Restarting MariaDB" + $STD rc-service mariadb restart + msg_ok "Restarted MariaDB" + msg_ok "Updated successfully!" +} + +function update_script() { + header_info + check_container_storage + check_container_resources + run_os_update } start diff --git a/ct/node-red.sh b/ct/node-red.sh index 6debbd438..317c1dd89 100644 --- a/ct/node-red.sh +++ b/ct/node-red.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash -source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +_CS_DEFAULT_URL="https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main" +_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 tteck # Author: tteck (tteckster) # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE @@ -8,22 +10,30 @@ source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxV APP="Node-Red" var_tags="${var_tags:-automation}" var_cpu="${var_cpu:-1}" -var_ram="${var_ram:-1024}" -var_disk="${var_disk:-4}" -var_os="${var_os:-debian}" -var_version="${var_version:-13}" var_arm64="${var_arm64:-yes}" var_unprivileged="${var_unprivileged:-1}" +if [[ -z "${var_os:-}" ]] && command -v pveversion >/dev/null 2>&1; then + var_os=$(msg_menu "Choose the container OS" \ + "debian" "Debian 13" \ + "alpine" "Alpine (smaller footprint)") +fi + +if [[ "${var_os:-}" == "alpine" ]]; then + var_ram="${var_ram:-256}" + var_disk="${var_disk:-1}" + var_version="${var_version:-3.24}" +else + var_ram="${var_ram:-1024}" + var_disk="${var_disk:-4}" + var_version="${var_version:-13}" +fi header_info "$APP" variables color catch_errors -function update_script() { - header_info - check_container_storage - check_container_resources +update_deb_based() { if [[ ! -d /root/.node-red ]]; then msg_error "No ${APP} Installation Found!" exit @@ -86,6 +96,32 @@ function update_script() { fi } +update_alpine() { + msg_info "Updating Alpine Packages" + $STD apk -U upgrade + msg_ok "Updated Alpine Packages" + + msg_info "Updating Node.js and npm" + $STD apk upgrade nodejs npm + msg_ok "Updated Node.js and npm" + + msg_info "Updating Node-RED" + $STD npm install -g --unsafe-perm node-red + msg_ok "Updated Node-RED" + + msg_info "Restarting Node-RED" + $STD rc-service nodered restart + msg_ok "Restarted Node-RED" + msg_ok "Updated successfully!" +} + +function update_script() { + header_info + check_container_storage + check_container_resources + run_os_update +} + start build_container description diff --git a/ct/ntfy.sh b/ct/ntfy.sh index da1c46911..aa6dc0bc2 100644 --- a/ct/ntfy.sh +++ b/ct/ntfy.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash -source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +_CS_DEFAULT_URL="https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main" +_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: CrazyWolf13 # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE @@ -8,22 +10,30 @@ source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxV APP="ntfy" var_tags="${var_tags:-notification}" var_cpu="${var_cpu:-1}" -var_ram="${var_ram:-512}" -var_disk="${var_disk:-2}" -var_os="${var_os:-debian}" -var_version="${var_version:-13}" var_arm64="${var_arm64:-yes}" var_unprivileged="${var_unprivileged:-1}" +if [[ -z "${var_os:-}" ]] && command -v pveversion >/dev/null 2>&1; then + var_os=$(msg_menu "Choose the container OS" \ + "debian" "Debian 13" \ + "alpine" "Alpine (smaller footprint)") +fi + +if [[ "${var_os:-}" == "alpine" ]]; then + var_ram="${var_ram:-256}" + var_disk="${var_disk:-2}" + var_version="${var_version:-3.24}" +else + var_ram="${var_ram:-512}" + var_disk="${var_disk:-2}" + var_version="${var_version:-13}" +fi header_info "$APP" variables color catch_errors -function update_script() { - header_info - check_container_storage - check_container_resources +update_deb_based() { if [[ ! -d /etc/ntfy ]]; then msg_error "No ${APP} Installation Found!" exit @@ -48,7 +58,29 @@ function update_script() { $STD apt upgrade -y msg_ok "Updated ntfy" msg_ok "Updated successfully!" - exit +} + +update_alpine() { + if [[ ! -d /etc/ntfy ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + msg_info "Updating ntfy LXC" + $STD apk -U upgrade + setcap 'cap_net_bind_service=+ep' /usr/bin/ntfy + msg_ok "Updated ntfy LXC" + + msg_info "Restarting ntfy" + rc-service ntfy restart + msg_ok "Restarted ntfy" + msg_ok "Updated successfully!" +} + +function update_script() { + header_info + check_container_storage + check_container_resources + run_os_update } start diff --git a/ct/postgresql.sh b/ct/postgresql.sh index f84563ab6..91fb6a542 100644 --- a/ct/postgresql.sh +++ b/ct/postgresql.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash -source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +_CS_DEFAULT_URL="https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main" +_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 tteck # Author: tteck (tteckster) # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE @@ -8,31 +10,60 @@ source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxV APP="PostgreSQL" var_tags="${var_tags:-database}" var_cpu="${var_cpu:-1}" -var_ram="${var_ram:-1024}" -var_disk="${var_disk:-4}" -var_os="${var_os:-debian}" -var_version="${var_version:-13}" var_arm64="${var_arm64:-yes}" var_unprivileged="${var_unprivileged:-1}" +if [[ -z "${var_os:-}" ]] && command -v pveversion >/dev/null 2>&1; then + var_os=$(msg_menu "Choose the container OS" \ + "debian" "Debian 13" \ + "alpine" "Alpine (smaller footprint)") +fi + +if [[ "${var_os:-}" == "alpine" ]]; then + var_ram="${var_ram:-256}" + var_disk="${var_disk:-1}" + var_version="${var_version:-3.24}" +else + var_ram="${var_ram:-1024}" + var_disk="${var_disk:-4}" + var_version="${var_version:-13}" +fi header_info "$APP" variables color catch_errors +update_deb_based() { + if ! command -v psql >/dev/null 2>&1; then + msg_error "No ${APP} Installation Found!" + exit + fi + msg_info "Updating ${APP} LXC" + $STD apt update + $STD apt -y upgrade + msg_ok "Updated successfully!" +} + +update_alpine() { + msg_info "Updating Alpine Packages" + $STD apk -U upgrade + msg_ok "Updated Alpine Packages" + + msg_info "Updating PostgreSQL" + $STD apk upgrade postgresql postgresql-contrib + msg_ok "Updated PostgreSQL" + + msg_info "Restarting PostgreSQL" + $STD rc-service postgresql restart + msg_ok "Restarted PostgreSQL" + msg_ok "Updated successfully!" +} + function update_script() { - header_info - check_container_storage - check_container_resources - if ! command -v psql >/dev/null 2>&1; then - msg_error "No ${APP} Installation Found!" - exit - fi - msg_info "Updating ${APP} LXC" - $STD apt update - $STD apt -y upgrade - msg_ok "Updated successfully!" - exit + header_info + check_container_storage + check_container_resources + run_os_update } start diff --git a/ct/prometheus.sh b/ct/prometheus.sh index d6507ba29..9692bf5a9 100644 --- a/ct/prometheus.sh +++ b/ct/prometheus.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash -source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +_CS_DEFAULT_URL="https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main" +_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: tteck (tteckster) # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE @@ -8,22 +10,30 @@ source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxV APP="Prometheus" var_tags="${var_tags:-monitoring}" 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_arm64="${var_arm64:-yes}" var_unprivileged="${var_unprivileged:-1}" +if [[ -z "${var_os:-}" ]] && command -v pveversion >/dev/null 2>&1; then + var_os=$(msg_menu "Choose the container OS" \ + "debian" "Debian 13" \ + "alpine" "Alpine (smaller footprint)") +fi + +if [[ "${var_os:-}" == "alpine" ]]; then + var_ram="${var_ram:-256}" + var_disk="${var_disk:-1}" + var_version="${var_version:-3.24}" +else + var_ram="${var_ram:-2048}" + var_disk="${var_disk:-4}" + var_version="${var_version:-13}" +fi header_info "$APP" variables color catch_errors -function update_script() { - header_info - check_container_storage - check_container_resources +update_deb_based() { if [[ ! -f /etc/systemd/system/prometheus.service ]]; then msg_error "No ${APP} Installation Found!" exit @@ -42,7 +52,28 @@ function update_script() { msg_ok "Updated successfully!" fi - exit +} + +update_alpine() { + msg_info "Updating Alpine Packages" + $STD apk -U upgrade + msg_ok "Updated Alpine Packages" + + msg_info "Updating Prometheus" + $STD apk upgrade prometheus + msg_ok "Updated Prometheus" + + msg_info "Restarting Prometheus" + $STD rc-service prometheus restart + msg_ok "Restarted Prometheus" + msg_ok "Updated successfully!" +} + +function update_script() { + header_info + check_container_storage + check_container_resources + run_os_update } start diff --git a/ct/rclone.sh b/ct/rclone.sh index 6c791d258..5e468725f 100644 --- a/ct/rclone.sh +++ b/ct/rclone.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash -source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +_CS_DEFAULT_URL="https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main" +_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: Slaviša Arežina (tremor021) # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE @@ -8,23 +10,30 @@ source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxV APP="Rclone" var_tags="${var_tags:-os}" var_cpu="${var_cpu:-1}" -var_ram="${var_ram:-512}" -var_disk="${var_disk:-2}" -var_os="${var_os:-debian}" -var_version="${var_version:-13}" var_arm64="${var_arm64:-yes}" var_unprivileged="${var_unprivileged:-1}" -var_fuse="${var_fuse:-yes}" +if [[ -z "${var_os:-}" ]] && command -v pveversion >/dev/null 2>&1; then + var_os=$(msg_menu "Choose the container OS" \ + "debian" "Debian 13" \ + "alpine" "Alpine (smaller footprint)") +fi + +if [[ "${var_os:-}" == "alpine" ]]; then + var_ram="${var_ram:-256}" + var_disk="${var_disk:-1}" + var_version="${var_version:-3.24}" +else + var_ram="${var_ram:-512}" + var_disk="${var_disk:-2}" + var_version="${var_version:-13}" +fi header_info "$APP" variables color catch_errors -function update_script() { - header_info - check_container_storage - check_container_resources +update_deb_based() { if [[ ! -d /opt/rclone ]]; then msg_error "No ${APP} Installation Found!" exit @@ -41,7 +50,32 @@ function update_script() { msg_ok "Started Service" msg_ok "Updated successfully!" fi - exit +} + +update_alpine() { + if [ ! -d /opt/rclone ]; then + msg_error "No ${APP} Installation Found!" + exit + fi + RELEASE=$(curl -s https://api.github.com/repos/rclone/rclone/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') + if [ "${RELEASE}" != "$(cat /opt/rclone_version.txt)" ] || [ ! -f /opt/rclone_version.txt ]; then + msg_info "Updating ${APP} LXC" + temp_file=$(mktemp) + curl -fsSL "https://github.com/rclone/rclone/releases/download/v${RELEASE}/rclone-v${RELEASE}-linux-$(arch_resolve).zip" -o "$temp_file" + $STD unzip -o "$temp_file" '*/**' -d /opt/rclone + rm -f "$temp_file" + echo "${RELEASE}" >/opt/rclone_version.txt + msg_ok "Updated successfully!" + else + msg_ok "No update required. ${APP} is already at ${RELEASE}" + fi +} + +function update_script() { + header_info + check_container_storage + check_container_resources + run_os_update } start diff --git a/ct/rustdeskserver.sh b/ct/rustdeskserver.sh index 8831bda20..27b0a6cf2 100644 --- a/ct/rustdeskserver.sh +++ b/ct/rustdeskserver.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash -source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +_CS_DEFAULT_URL="https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main" +_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: Slaviša Arežina (tremor021) # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE @@ -8,23 +10,30 @@ source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxV APP="RustDesk Server" var_tags="${var_tags:-remote-desktop}" var_cpu="${var_cpu:-1}" -var_ram="${var_ram:-512}" -var_disk="${var_disk:-2}" -var_os="${var_os:-debian}" -var_version="${var_version:-13}" var_arm64="${var_arm64:-yes}" var_unprivileged="${var_unprivileged:-1}" +if [[ -z "${var_os:-}" ]] && command -v pveversion >/dev/null 2>&1; then + var_os=$(msg_menu "Choose the container OS" \ + "debian" "Debian 13" \ + "alpine" "Alpine (smaller footprint)") +fi + +if [[ "${var_os:-}" == "alpine" ]]; then + var_ram="${var_ram:-512}" + var_disk="${var_disk:-3}" + var_version="${var_version:-3.24}" +else + var_ram="${var_ram:-512}" + var_disk="${var_disk:-2}" + var_version="${var_version:-13}" +fi header_info "$APP" variables color catch_errors -function update_script() { - header_info - check_container_storage - check_container_resources - +update_deb_based() { if [[ ! -x /usr/bin/hbbr ]]; then msg_error "No ${APP} Installation Found!" exit @@ -50,7 +59,58 @@ function update_script() { msg_ok "Updated successfully!" fi - exit +} + +update_alpine() { + if [[ ! -d /opt/rustdesk-server ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + + APIRELEASE=$(curl -s https://api.github.com/repos/lejianwen/rustdesk-api/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') + RELEASE=$(curl -s https://api.github.com/repos/lejianwen/rustdesk-server/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') + if [ "${RELEASE}" != "$(cat ~/.rustdesk-server 2>/dev/null)" ] || [ ! -f ~/.rustdesk-server ]; then + msg_info "Updating RustDesk Server to v${RELEASE}" + $STD apk -U upgrade + $STD service rustdesk-server-hbbs stop + $STD service rustdesk-server-hbbr stop + temp_file1=$(mktemp) + ARCH=$(arch_resolve "amd64" "arm64v8") + curl -fsSL "https://github.com/lejianwen/rustdesk-server/releases/download/${RELEASE}/rustdesk-server-linux-${ARCH}.zip" -o "$temp_file1" + $STD unzip "$temp_file1" + cp -r "$ARCH"/* /opt/rustdesk-server/ + echo "${RELEASE}" >~/.rustdesk-server + $STD service rustdesk-server-hbbs start + $STD service rustdesk-server-hbbr start + rm -rf "$ARCH" + rm -f "$temp_file1" + msg_ok "Updated RustDesk Server" + else + msg_ok "No update required. ${APP} is already at v${RELEASE}" + fi + if [ "${APIRELEASE}" != "$(cat ~/.rustdesk-api)" ] || [ ! -f ~/.rustdesk-api ]; then + msg_info "Updating RustDesk API to v${APIRELEASE}" + $STD service rustdesk-api stop + temp_file2=$(mktemp) + curl -fsSL "https://github.com/lejianwen/rustdesk-api/releases/download/v${APIRELEASE}/linux-$(arch_resolve).tar.gz" -o "$temp_file2" + $STD tar zxvf "$temp_file2" + cp -r release/* /opt/rustdesk-api + echo "${APIRELEASE}" >~/.rustdesk-api + $STD service rustdesk-api start + rm -rf release + rm -f "$temp_file2" + msg_ok "Updated RustDesk API" + else + msg_ok "No update required. RustDesk API is already at v${APIRELEASE}" + fi + msg_ok "Updated successfully!" +} + +function update_script() { + header_info + check_container_storage + check_container_resources + run_os_update } start diff --git a/ct/rustypaste.sh b/ct/rustypaste.sh index 33b705fd4..a1215436c 100644 --- a/ct/rustypaste.sh +++ b/ct/rustypaste.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash -source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +_CS_DEFAULT_URL="https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main" +_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: GoldenSpringness # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE @@ -8,23 +10,30 @@ source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/m APP="rustypaste" var_tags="${var_tags:-pastebin;storage}" var_cpu="${var_cpu:-1}" -var_ram="${var_ram:-1024}" -var_disk="${var_disk:-20}" -var_os="${var_os:-debian}" -var_version="${var_version:-13}" var_arm64="${var_arm64:-no}" var_unprivileged="${var_unprivileged:-1}" +if [[ -z "${var_os:-}" ]] && command -v pveversion >/dev/null 2>&1; then + var_os=$(msg_menu "Choose the container OS" \ + "debian" "Debian 13" \ + "alpine" "Alpine (smaller footprint)") +fi + +if [[ "${var_os:-}" == "alpine" ]]; then + var_ram="${var_ram:-256}" + var_disk="${var_disk:-4}" + var_version="${var_version:-3.24}" +else + var_ram="${var_ram:-1024}" + var_disk="${var_disk:-20}" + var_version="${var_version:-13}" +fi header_info "$APP" variables color catch_errors -function update_script() { - header_info - check_container_storage - check_container_resources - +update_deb_based() { if [[ ! -f /opt/rustypaste/rustypaste ]]; then msg_error "No ${APP} Installation Found!" exit @@ -50,7 +59,30 @@ function update_script() { if check_for_gh_release "rustypaste-cli" "orhun/rustypaste-cli"; then fetch_and_deploy_gh_release "rustypaste-cli" "orhun/rustypaste-cli" "prebuild" "latest" "/usr/local/bin" "*x86_64-unknown-linux-gnu.tar.gz" fi - exit +} + +update_alpine() { + if ! apk info -e rustypaste >/dev/null 2>&1; then + msg_error "No ${APP} Installation Found!" + exit + fi + + msg_info "Updating RustyPaste" + $STD apk update + $STD apk upgrade rustypaste --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community + msg_ok "Updated RustyPaste" + + msg_info "Restarting Services" + $STD rc-service rustypaste restart + msg_ok "Restarted Services" + msg_ok "Updated successfully!" +} + +function update_script() { + header_info + check_container_storage + check_container_resources + run_os_update } start diff --git a/ct/syncthing.sh b/ct/syncthing.sh index d786a1bf7..d47850341 100644 --- a/ct/syncthing.sh +++ b/ct/syncthing.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash -source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +_CS_DEFAULT_URL="https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main" +_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 tteck # Author: tteck (tteckster) # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE @@ -8,22 +10,30 @@ source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxV APP="Syncthing" var_tags="${var_tags:-sync}" 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}" +if [[ -z "${var_os:-}" ]] && command -v pveversion >/dev/null 2>&1; then + var_os=$(msg_menu "Choose the container OS" \ + "debian" "Debian 13" \ + "alpine" "Alpine (smaller footprint)") +fi + +if [[ "${var_os:-}" == "alpine" ]]; then + var_ram="${var_ram:-256}" + var_disk="${var_disk:-1}" + var_version="${var_version:-3.24}" +else + var_ram="${var_ram:-2048}" + var_disk="${var_disk:-8}" + var_version="${var_version:-13}" +fi header_info "$APP" variables color catch_errors -function update_script() { - header_info - check_container_storage - check_container_resources +update_deb_based() { if [[ ! -f /etc/apt/sources.list.d/syncthing.list && ! -f /etc/apt/sources.list.d/syncthing.sources ]]; then msg_error "No ${APP} Installation Found!" exit @@ -33,7 +43,28 @@ function update_script() { $STD apt update $STD apt upgrade -y msg_ok "Updated successfully!" - exit +} + +update_alpine() { + msg_info "Updating Alpine Packages" + $STD apk -U upgrade + msg_ok "Updated Alpine Packages" + + msg_info "Updating Syncthing" + $STD apk upgrade syncthing + msg_ok "Updated Syncthing" + + msg_info "Restarting Syncthing" + $STD rc-service syncthing restart + msg_ok "Restarted Syncthing" + msg_ok "Updated successfully!" +} + +function update_script() { + header_info + check_container_storage + check_container_resources + run_os_update } start diff --git a/ct/teamspeak-server.sh b/ct/teamspeak-server.sh index f85706708..0476fa98b 100644 --- a/ct/teamspeak-server.sh +++ b/ct/teamspeak-server.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash -source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +_CS_DEFAULT_URL="https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main" +_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: tremor021 (Slaviša Arežina) # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE @@ -8,22 +10,30 @@ source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxV APP="Teamspeak-Server" var_tags="${var_tags:-voice;communication}" var_cpu="${var_cpu:-1}" -var_ram="${var_ram:-512}" -var_disk="${var_disk:-2}" -var_os="${var_os:-debian}" -var_version="${var_version:-13}" var_arm64="${var_arm64:-no}" var_unprivileged="${var_unprivileged:-1}" +if [[ -z "${var_os:-}" ]] && command -v pveversion >/dev/null 2>&1; then + var_os=$(msg_menu "Choose the container OS" \ + "debian" "Debian 13" \ + "alpine" "Alpine (smaller footprint)") +fi + +if [[ "${var_os:-}" == "alpine" ]]; then + var_ram="${var_ram:-256}" + var_disk="${var_disk:-2}" + var_version="${var_version:-3.24}" +else + var_ram="${var_ram:-512}" + var_disk="${var_disk:-2}" + var_version="${var_version:-13}" +fi header_info "$APP" variables color catch_errors -function update_script() { - header_info - check_container_storage - check_container_resources +update_deb_based() { if [[ ! -d /opt/teamspeak-server ]]; then msg_error "No ${APP} Installation Found!" exit @@ -50,7 +60,38 @@ function update_script() { else msg_ok "Already up to date" fi - exit +} + +update_alpine() { + if [[ ! -d /opt/teamspeak-server ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + + RELEASE=$(curl -fsSL https://teamspeak.com/en/downloads/#server | sed -n 's/.*teamspeak3-server_linux_amd64-\([0-9.]*[0-9]\).*/\1/p' | awk 'NR==1') + + if [ "${RELEASE}" != "$(cat ~/.teamspeak-server)" ] || [ ! -f ~/.teamspeak-server ]; then + msg_info "Updating ${APP} LXC" + $STD apk -U upgrade + $STD service teamspeak stop + curl -fsSL "https://files.teamspeak-services.com/releases/server/${RELEASE}/teamspeak3-server_linux_amd64-${RELEASE}.tar.bz2" -o ts3server.tar.bz2 + tar -xf ./ts3server.tar.bz2 + cp -ru teamspeak3-server_linux_amd64/* /opt/teamspeak-server/ + rm -f ~/ts3server.tar.bz* + rm -rf teamspeak3-server_linux_amd64 + echo "${RELEASE}" >~/.teamspeak-server + $STD service teamspeak start + msg_ok "Updated successfully!" + else + msg_ok "No update required. ${APP} is already at ${RELEASE}" + fi +} + +function update_script() { + header_info + check_container_storage + check_container_resources + run_os_update } start diff --git a/ct/tinyauth.sh b/ct/tinyauth.sh index 4209e974a..d31d11040 100644 --- a/ct/tinyauth.sh +++ b/ct/tinyauth.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash -source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +_CS_DEFAULT_URL="https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main" +_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 @@ -8,22 +10,30 @@ source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxV APP="Tinyauth" var_tags="${var_tags:-auth}" var_cpu="${var_cpu:-1}" -var_ram="${var_ram:-512}" -var_disk="${var_disk:-4}" -var_os="${var_os:-debian}" -var_version="${var_version:-13}" var_arm64="${var_arm64:-yes}" var_unprivileged="${var_unprivileged:-1}" +if [[ -z "${var_os:-}" ]] && command -v pveversion >/dev/null 2>&1; then + var_os=$(msg_menu "Choose the container OS" \ + "debian" "Debian 13" \ + "alpine" "Alpine (smaller footprint)") +fi + +if [[ "${var_os:-}" == "alpine" ]]; then + var_ram="${var_ram:-256}" + var_disk="${var_disk:-2}" + var_version="${var_version:-3.24}" +else + var_ram="${var_ram:-512}" + var_disk="${var_disk:-4}" + var_version="${var_version:-13}" +fi header_info "$APP" variables color catch_errors -function update_script() { - header_info - check_container_storage - check_container_resources +update_deb_based() { if [[ ! -d /opt/tinyauth ]]; then msg_error "No ${APP} Installation Found!" exit @@ -41,7 +51,59 @@ function update_script() { msg_ok "Started Service" msg_ok "Updated successfully!" fi - exit +} + +update_alpine() { + if [[ ! -d /opt/tinyauth ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + + msg_info "Updating packages" + $STD apk -U upgrade + msg_ok "Updated packages" + + RELEASE=$(curl -s https://api.github.com/repos/tinyauthapp/tinyauth/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') + if [ "${RELEASE}" != "$(cat ~/.tinyauth 2>/dev/null)" ] || [ ! -f ~/.tinyauth ]; then + msg_info "Stopping Service" + $STD service tinyauth stop + msg_ok "Service Stopped" + + if [[ -f /opt/tinyauth/.env ]] && ! grep -q "^TINYAUTH_" /opt/tinyauth/.env; then + msg_info "Migrating .env to v5 format" + sed -i \ + -e 's/^DATABASE_PATH=/TINYAUTH_DATABASE_PATH=/' \ + -e 's/^USERS=/TINYAUTH_AUTH_USERS=/' \ + -e "s/^USERS='/TINYAUTH_AUTH_USERS='/" \ + -e 's/^APP_URL=/TINYAUTH_APPURL=/' \ + -e 's/^SECRET=/TINYAUTH_AUTH_SECRET=/' \ + -e 's/^PORT=/TINYAUTH_SERVER_PORT=/' \ + -e 's/^ADDRESS=/TINYAUTH_SERVER_ADDRESS=/' \ + /opt/tinyauth/.env + msg_ok "Migrated .env to v5 format" + fi + + msg_info "Updating Tinyauth" + rm -f /opt/tinyauth/tinyauth + curl -fsSL "https://github.com/tinyauthapp/tinyauth/releases/download/v${RELEASE}/tinyauth-$(arch_resolve)" -o /opt/tinyauth/tinyauth + chmod +x /opt/tinyauth/tinyauth + echo "${RELEASE}" >~/.tinyauth + msg_ok "Updated Tinyauth" + + msg_info "Restarting Tinyauth" + $STD service tinyauth start + msg_ok "Restarted Tinyauth" + msg_ok "Updated successfully!" + else + msg_ok "No update required. ${APP} is already at ${RELEASE}" + fi +} + +function update_script() { + header_info + check_container_storage + check_container_resources + run_os_update } start diff --git a/ct/traefik.sh b/ct/traefik.sh index 523f648ef..b135c8a60 100644 --- a/ct/traefik.sh +++ b/ct/traefik.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash -source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +_CS_DEFAULT_URL="https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main" +_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 tteck # Author: tteck (tteckster) # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE @@ -8,22 +10,30 @@ source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxV APP="Traefik" var_tags="${var_tags:-proxy}" var_cpu="${var_cpu:-1}" -var_ram="${var_ram:-512}" -var_disk="${var_disk:-2}" -var_os="${var_os:-debian}" -var_version="${var_version:-13}" var_arm64="${var_arm64:-yes}" var_unprivileged="${var_unprivileged:-1}" +if [[ -z "${var_os:-}" ]] && command -v pveversion >/dev/null 2>&1; then + var_os=$(msg_menu "Choose the container OS" \ + "debian" "Debian 13" \ + "alpine" "Alpine (smaller footprint)") +fi + +if [[ "${var_os:-}" == "alpine" ]]; then + var_ram="${var_ram:-512}" + var_disk="${var_disk:-1}" + var_version="${var_version:-3.24}" +else + var_ram="${var_ram:-512}" + var_disk="${var_disk:-2}" + var_version="${var_version:-13}" +fi header_info "$APP" variables color catch_errors -function update_script() { - header_info - check_container_storage - check_container_resources +update_deb_based() { if [[ ! -f /etc/systemd/system/traefik.service ]]; then msg_error "No ${APP} Installation Found!" exit @@ -41,7 +51,24 @@ function update_script() { msg_ok "Started Service" msg_ok "Updated successfully!" fi - exit +} + +update_alpine() { + msg_info "Updating Alpine Packages" + $STD apk -U upgrade + msg_ok "Updated Alpine Packages" + + msg_info "Updating traefik from edge" + $STD apk add traefik --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community + msg_ok "Updated traefik" + msg_ok "Updated successfully!" +} + +function update_script() { + header_info + check_container_storage + check_container_resources + run_os_update } start diff --git a/ct/transmission.sh b/ct/transmission.sh index 0257ce7ec..ee86f8194 100644 --- a/ct/transmission.sh +++ b/ct/transmission.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash -source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +_CS_DEFAULT_URL="https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main" +_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 tteck # Author: tteck (tteckster) # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE @@ -8,22 +10,30 @@ source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxV APP="Transmission" var_tags="${var_tags:-torrent}" 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}" +if [[ -z "${var_os:-}" ]] && command -v pveversion >/dev/null 2>&1; then + var_os=$(msg_menu "Choose the container OS" \ + "debian" "Debian 13" \ + "alpine" "Alpine (smaller footprint)") +fi + +if [[ "${var_os:-}" == "alpine" ]]; then + var_ram="${var_ram:-256}" + var_disk="${var_disk:-1}" + var_version="${var_version:-3.24}" +else + var_ram="${var_ram:-2048}" + var_disk="${var_disk:-8}" + var_version="${var_version:-13}" +fi header_info "$APP" variables color catch_errors -function update_script() { - header_info - check_container_storage - check_container_resources +update_deb_based() { if [[ ! -f /etc/transmission-daemon/settings.json ]]; then msg_error "No ${APP} Installation Found!" exit @@ -33,7 +43,28 @@ function update_script() { $STD apt -y upgrade msg_ok "Updated Transmission" msg_ok "Updated successfully!" - exit +} + +update_alpine() { + msg_info "Updating Alpine Packages" + $STD apk -U upgrade + msg_ok "Updated Alpine Packages" + + msg_info "Updating Transmission" + $STD apk upgrade transmission-daemon + msg_ok "Updated Transmission" + + msg_info "Restarting Transmission" + $STD rc-service transmission-daemon restart + msg_ok "Restarted Transmission" + msg_ok "Updated successfully!" +} + +function update_script() { + header_info + check_container_storage + check_container_resources + run_os_update } start diff --git a/ct/valkey.sh b/ct/valkey.sh index 7d5e2694f..73645a22d 100644 --- a/ct/valkey.sh +++ b/ct/valkey.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash -source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +_CS_DEFAULT_URL="https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main" +_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: pshankinclarke (lazarillo) # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE @@ -8,32 +10,80 @@ source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxV APP="Valkey" var_tags="${var_tags:-database}" var_cpu="${var_cpu:-1}" -var_ram="${var_ram:-1024}" -var_disk="${var_disk:-4}" -var_os="${var_os:-debian}" -var_version="${var_version:-13}" var_arm64="${var_arm64:-yes}" var_unprivileged="${var_unprivileged:-1}" +if [[ -z "${var_os:-}" ]] && command -v pveversion >/dev/null 2>&1; then + var_os=$(msg_menu "Choose the container OS" \ + "debian" "Debian 13" \ + "alpine" "Alpine (smaller footprint)") +fi + +if [[ "${var_os:-}" == "alpine" ]]; then + var_ram="${var_ram:-256}" + var_disk="${var_disk:-1}" + var_version="${var_version:-3.24}" +else + var_ram="${var_ram:-1024}" + var_disk="${var_disk:-4}" + var_version="${var_version:-13}" +fi header_info "$APP" variables color catch_errors -function update_script() { - header_info - check_container_storage - check_container_resources - if [[ ! -f /lib/systemd/system/valkey-server.service ]]; then - msg_error "No Valkey Installation Found!" - exit - fi - msg_info "Updating Valkey LXC" - $STD apt update - $STD apt -y upgrade - msg_ok "Updated Valkey LXC" +update_deb_based() { + if [[ ! -f /lib/systemd/system/valkey-server.service ]]; then + msg_error "No Valkey Installation Found!" + exit + fi + msg_info "Updating Valkey LXC" + $STD apt update + $STD apt -y upgrade + msg_ok "Updated Valkey LXC" + msg_ok "Updated successfully!" +} + +update_alpine() { + LXCIP=$(ip a s dev eth0 | awk '/inet / {print $2}' | cut -d/ -f1) + + CHOICE=$(msg_menu "Valkey Management" \ + "1" "Update Valkey" \ + "2" "Allow 0.0.0.0 for listening" \ + "3" "Allow only ${LXCIP} for listening") + + case $CHOICE in + 1) + msg_info "Updating Valkey" + apk update && apk upgrade valkey + rc-service valkey restart + msg_ok "Updated Valkey" msg_ok "Updated successfully!" exit + ;; + 2) + msg_info "Setting Valkey to listen on all interfaces" + sed -i 's/^bind .*/bind 0.0.0.0/' /etc/valkey/valkey.conf + rc-service valkey restart + msg_ok "Valkey now listens on all interfaces!" + exit + ;; + 3) + msg_info "Setting Valkey to listen only on ${LXCIP}" + sed -i "s/^bind .*/bind ${LXCIP}/" /etc/valkey/valkey.conf + rc-service valkey restart + msg_ok "Valkey now listens only on ${LXCIP}!" + exit + ;; + esac +} + +function update_script() { + header_info + check_container_storage + check_container_resources + run_os_update } start diff --git a/ct/vaultwarden.sh b/ct/vaultwarden.sh index 8d7a01345..5ac6f3855 100644 --- a/ct/vaultwarden.sh +++ b/ct/vaultwarden.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash -source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +_CS_DEFAULT_URL="https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main" +_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 tteck # Author: tteck (tteckster) # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE @@ -8,22 +10,30 @@ source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxV APP="Vaultwarden" var_tags="${var_tags:-password-manager}" var_cpu="${var_cpu:-4}" -var_ram="${var_ram:-6144}" -var_disk="${var_disk:-20}" -var_os="${var_os:-debian}" -var_version="${var_version:-13}" var_arm64="${var_arm64:-yes}" var_unprivileged="${var_unprivileged:-1}" +if [[ -z "${var_os:-}" ]] && command -v pveversion >/dev/null 2>&1; then + var_os=$(msg_menu "Choose the container OS" \ + "debian" "Debian 13" \ + "alpine" "Alpine (smaller footprint)") +fi + +if [[ "${var_os:-}" == "alpine" ]]; then + var_ram="${var_ram:-256}" + var_disk="${var_disk:-1}" + var_version="${var_version:-3.24}" +else + var_ram="${var_ram:-6144}" + var_disk="${var_disk:-20}" + var_version="${var_version:-13}" +fi header_info "$APP" variables color catch_errors -function update_script() { - header_info - check_container_storage - check_container_resources +update_deb_based() { if [[ ! -f /etc/systemd/system/vaultwarden.service ]]; then msg_error "No ${APP} Installation Found!" exit @@ -115,6 +125,48 @@ function update_script() { fi } +update_alpine() { + CHOICE=$(msg_menu "Vaultwarden Update Options" \ + "1" "Update Vaultwarden" \ + "2" "Reset ADMIN_TOKEN") + + case $CHOICE in + 1) + $STD apk -U upgrade + rc-service vaultwarden restart -q + msg_ok "Updated successfully!" + exit + ;; + 2) + if [[ "${PHS_SILENT:-0}" == "1" ]]; then + msg_warn "Reset ADMIN_TOKEN requires interactive mode, skipping." + exit + fi + read -r -s -p "Setup your ADMIN_TOKEN (make it strong): " NEWTOKEN + echo "" + if [[ -n "$NEWTOKEN" ]]; then + if ! command -v argon2 >/dev/null 2>&1; then apk add argon2 &>/dev/null; fi + TOKEN=$(echo -n "${NEWTOKEN}" | argon2 "$(openssl rand -base64 32)" -e -id -k 19456 -t 2 -p 1) + if [[ ! -f /var/lib/vaultwarden/config.json ]]; then + sed -i "s|export ADMIN_TOKEN=.*|export ADMIN_TOKEN='${TOKEN}'|" /etc/conf.d/vaultwarden + else + sed -i "s|\"admin_token\": .*|\"admin_token\": \"${TOKEN}\",|" /var/lib/vaultwarden/config.json + fi + rc-service vaultwarden restart -q + msg_ok "Admin token updated" + fi + exit + ;; + esac +} + +function update_script() { + header_info + check_container_storage + check_container_resources + run_os_update +} + start build_container description diff --git a/ct/wireguard.sh b/ct/wireguard.sh index 864c79222..87d73055f 100644 --- a/ct/wireguard.sh +++ b/ct/wireguard.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash -source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +_CS_DEFAULT_URL="https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main" +_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 tteck # Author: tteck (tteckster) # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE @@ -8,28 +10,35 @@ source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxV APP="Wireguard" var_tags="${var_tags:-network;vpn}" var_cpu="${var_cpu:-1}" -var_ram="${var_ram:-512}" -var_disk="${var_disk:-4}" -var_os="${var_os:-debian}" -var_version="${var_version:-13}" var_arm64="${var_arm64:-yes}" var_unprivileged="${var_unprivileged:-1}" -var_tun="${var_tun:-1}" +if [[ -z "${var_os:-}" ]] && command -v pveversion >/dev/null 2>&1; then + var_os=$(msg_menu "Choose the container OS" \ + "debian" "Debian 13" \ + "alpine" "Alpine (smaller footprint)") +fi + +if [[ "${var_os:-}" == "alpine" ]]; then + var_ram="${var_ram:-256}" + var_disk="${var_disk:-1}" + var_version="${var_version:-3.24}" +else + var_ram="${var_ram:-512}" + var_disk="${var_disk:-4}" + var_version="${var_version:-13}" +fi header_info "$APP" variables color catch_errors -function update_script() { - header_info - check_container_storage - check_container_resources +update_deb_based() { if [[ ! -d /etc/wireguard ]]; then msg_error "No ${APP} Installation Found!" exit fi - + ensure_dependencies git msg_info "Updating LXC" @@ -43,7 +52,32 @@ function update_script() { fi msg_ok "Updated LXC" msg_ok "Updated successfully!" - exit +} + +update_alpine() { + msg_info "Updating Alpine Packages" + $STD apk -U upgrade + msg_ok "Updated Alpine Packages" + + msg_info "update wireguard-tools" + $STD apk add --no-cache --upgrade wireguard-tools + msg_ok "wireguard-tools updated" + + if [[ -d /etc/wgdashboard/src ]]; then + msg_info "update WGDashboard" + cd /etc/wgdashboard/src + echo "y" | ./wgd.sh update >/dev/null 2>&1 + $STD ./wgd.sh start + msg_ok "WGDashboard updated" + fi + msg_ok "Updated successfully!" +} + +function update_script() { + header_info + check_container_storage + check_container_resources + run_os_update } start diff --git a/ct/zigbee2mqtt.sh b/ct/zigbee2mqtt.sh index 714090477..0d3cba5b9 100644 --- a/ct/zigbee2mqtt.sh +++ b/ct/zigbee2mqtt.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash -source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +_CS_DEFAULT_URL="https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main" +_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 tteck # Author: tteck (tteckster) # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE @@ -8,22 +10,30 @@ source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxV APP="Zigbee2MQTT" var_tags="${var_tags:-smarthome;zigbee;mqtt}" var_cpu="${var_cpu:-2}" -var_ram="${var_ram:-1024}" -var_disk="${var_disk:-5}" -var_os="${var_os:-debian}" -var_version="${var_version:-13}" var_arm64="${var_arm64:-yes}" var_unprivileged="${var_unprivileged:-0}" +if [[ -z "${var_os:-}" ]] && command -v pveversion >/dev/null 2>&1; then + var_os=$(msg_menu "Choose the container OS" \ + "debian" "Debian 13" \ + "alpine" "Alpine (smaller footprint)") +fi + +if [[ "${var_os:-}" == "alpine" ]]; then + var_ram="${var_ram:-256}" + var_disk="${var_disk:-1}" + var_version="${var_version:-3.24}" +else + var_ram="${var_ram:-1024}" + var_disk="${var_disk:-5}" + var_version="${var_version:-13}" +fi header_info "$APP" variables color catch_errors -function update_script() { - header_info - check_container_storage - check_container_resources +update_deb_based() { if [[ ! -d /opt/zigbee2mqtt ]]; then msg_error "No ${APP} Installation Found!" exit @@ -62,7 +72,18 @@ function update_script() { msg_ok "Started Service" msg_ok "Updated successfully!" fi - exit +} + +update_alpine() { + $STD apk -U upgrade + msg_ok "Updated successfully!" +} + +function update_script() { + header_info + check_container_storage + check_container_resources + run_os_update } start diff --git a/install/adguard-install.sh b/install/adguard-install.sh index 37c80e318..2bfe8231c 100644 --- a/install/adguard-install.sh +++ b/install/adguard-install.sh @@ -13,31 +13,67 @@ setting_up_container network_check update_os -fetch_and_deploy_gh_release "AdGuardHome" "AdguardTeam/AdGuardHome" "prebuild" "latest" "/opt/AdGuardHome" "AdGuardHome_linux_$(arch_resolve).tar.gz" +setup_deb_based() { + fetch_and_deploy_gh_release "AdGuardHome" "AdguardTeam/AdGuardHome" "prebuild" "latest" "/opt/AdGuardHome" "AdGuardHome_linux_$(arch_resolve).tar.gz" -msg_info "Creating Service" -cat </etc/systemd/system/AdGuardHome.service -[Unit] -Description=AdGuard Home: Network-level blocker -ConditionFileIsExecutable=/opt/AdGuardHome/AdGuardHome -After=syslog.target network-online.target + msg_info "Creating Service" + cat </etc/systemd/system/AdGuardHome.service + [Unit] + Description=AdGuard Home: Network-level blocker + ConditionFileIsExecutable=/opt/AdGuardHome/AdGuardHome + After=syslog.target network-online.target -[Service] -StartLimitInterval=5 -StartLimitBurst=10 -ExecStart=/opt/AdGuardHome/AdGuardHome "-s" "run" -WorkingDirectory=/opt/AdGuardHome -StandardOutput=file:/var/log/AdGuardHome.out -StandardError=file:/var/log/AdGuardHome.err -Restart=always -RestartSec=10 -EnvironmentFile=-/etc/sysconfig/AdGuardHome + [Service] + StartLimitInterval=5 + StartLimitBurst=10 + ExecStart=/opt/AdGuardHome/AdGuardHome "-s" "run" + WorkingDirectory=/opt/AdGuardHome + StandardOutput=file:/var/log/AdGuardHome.out + StandardError=file:/var/log/AdGuardHome.err + Restart=always + RestartSec=10 + EnvironmentFile=-/etc/sysconfig/AdGuardHome -[Install] -WantedBy=multi-user.target -EOF -systemctl enable -q --now AdGuardHome -msg_ok "Created Service" + [Install] + WantedBy=multi-user.target + EOF + systemctl enable -q --now AdGuardHome + msg_ok "Created Service" +} + +setup_alpine() { + msg_info "Downloading AdGuard Home" + $STD curl -fsSL -o /tmp/AdGuardHome_linux_$(arch_resolve).tar.gz \ + "https://github.com/AdguardTeam/AdGuardHome/releases/latest/download/AdGuardHome_linux_$(arch_resolve).tar.gz" + msg_ok "Downloaded AdGuard Home" + + msg_info "Installing AdGuard Home" + $STD tar -xzf /tmp/AdGuardHome_linux_$(arch_resolve).tar.gz -C /opt + $STD rm /tmp/AdGuardHome_linux_$(arch_resolve).tar.gz + msg_ok "Installed AdGuard Home" + + msg_info "Creating AdGuard Home Service" + cat </etc/init.d/adguardhome + #!/sbin/openrc-run + name="AdGuardHome" + description="AdGuard Home Service" + command="/opt/AdGuardHome/AdGuardHome" + command_background="yes" + pidfile="/run/adguardhome.pid" + EOF + $STD chmod +x /etc/init.d/adguardhome + msg_ok "Created AdGuard Home Service" + + msg_info "Enabling AdGuard Home Service" + $STD rc-update add adguardhome default + msg_ok "Enabled AdGuard Home Service" + + msg_info "Starting AdGuard Home" + $STD rc-service adguardhome start + msg_ok "Started AdGuard Home" +} + +run_os_setup motd_ssh customize diff --git a/install/bitmagnet-install.sh b/install/bitmagnet-install.sh index de33f083e..6ee7b3108 100644 --- a/install/bitmagnet-install.sh +++ b/install/bitmagnet-install.sh @@ -13,60 +13,129 @@ setting_up_container network_check update_os -msg_info "Installing Dependencies" -$STD apt install -y \ - iproute2 \ - gcc \ - musl-dev -msg_ok "Installed Dependencies" +setup_deb_based() { + msg_info "Installing Dependencies" + $STD apt install -y \ + iproute2 \ + gcc \ + musl-dev + msg_ok "Installed Dependencies" -PG_VERSION="16" setup_postgresql -PG_DB_NAME="bitmagnet" PG_DB_USER="bitmagnet" setup_postgresql_db -setup_go + PG_VERSION="16" setup_postgresql + PG_DB_NAME="bitmagnet" PG_DB_USER="bitmagnet" setup_postgresql_db + setup_go -fetch_and_deploy_gh_release "bitmagnet" "bitmagnet-io/bitmagnet" "tarball" -RELEASE=$(cat ~/.bitmagnet) + fetch_and_deploy_gh_release "bitmagnet" "bitmagnet-io/bitmagnet" "tarball" + RELEASE=$(cat ~/.bitmagnet) -msg_info "Configuring bitmagnet" -cd /opt/bitmagnet -$STD go build -ldflags "-s -w -X github.com/bitmagnet-io/bitmagnet/internal/version.GitTag=v${RELEASE}" -chmod +x bitmagnet -msg_ok "Configured bitmagnet" + msg_info "Configuring bitmagnet" + cd /opt/bitmagnet + $STD go build -ldflags "-s -w -X github.com/bitmagnet-io/bitmagnet/internal/version.GitTag=v${RELEASE}" + chmod +x bitmagnet + msg_ok "Configured bitmagnet" -read -r -p "${TAB3}Enter your TMDB API key if you have one: " tmdbapikey + read -r -p "${TAB3}Enter your TMDB API key if you have one: " tmdbapikey -cat </etc/bitmagnet.env -POSTGRES_HOST=localhost -POSTGRES_USER=${PG_DB_USER} -POSTGRES_NAME=${PG_DB_NAME} -POSTGRES_PASSWORD=${PG_DB_PASS} -EOF + cat </etc/bitmagnet.env + POSTGRES_HOST=localhost + POSTGRES_USER=${PG_DB_USER} + POSTGRES_NAME=${PG_DB_NAME} + POSTGRES_PASSWORD=${PG_DB_PASS} + EOF -if [ -z "$tmdbapikey" ]; then - echo "TMDB_ENABLED=false" >>/etc/bitmagnet.env -else - echo "TMDB_API_KEY=$tmdbapikey" >>/etc/bitmagnet.env -fi + if [ -z "$tmdbapikey" ]; then + echo "TMDB_ENABLED=false" >>/etc/bitmagnet.env + else + echo "TMDB_API_KEY=$tmdbapikey" >>/etc/bitmagnet.env + fi -msg_info "Creating Service" -cat </etc/systemd/system/bitmagnet-web.service -[Unit] -Description=bitmagnet Web GUI -After=network-online.target + msg_info "Creating Service" + cat </etc/systemd/system/bitmagnet-web.service + [Unit] + Description=bitmagnet Web GUI + After=network-online.target -[Service] -Type=simple -User=root -WorkingDirectory=/opt/bitmagnet -EnvironmentFile=/etc/bitmagnet.env -ExecStart=/opt/bitmagnet/bitmagnet worker run --all -Restart=on-failure + [Service] + Type=simple + User=root + WorkingDirectory=/opt/bitmagnet + EnvironmentFile=/etc/bitmagnet.env + ExecStart=/opt/bitmagnet/bitmagnet worker run --all + Restart=on-failure -[Install] -WantedBy=multi-user.target -EOF -systemctl enable -q --now bitmagnet-web -msg_ok "Created Service" + [Install] + WantedBy=multi-user.target + EOF + systemctl enable -q --now bitmagnet-web + msg_ok "Created Service" +} + +setup_alpine() { + msg_info "Installing dependencies" + $STD apk add --no-cache \ + gcc \ + musl-dev \ + git \ + iproute2-ss \ + sudo + $STD apk add --no-cache --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community go + msg_ok "Installed dependencies" + + msg_info "Installing PostgreSQL" + $STD apk add --no-cache \ + postgresql16 \ + postgresql16-contrib \ + postgresql16-openrc + $STD rc-update add postgresql + $STD rc-service postgresql start + msg_ok "Installed PostreSQL" + + RELEASE=$(curl -fsSL https://api.github.com/repos/bitmagnet-io/bitmagnet/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') + + msg_info "Installing bitmagnet v${RELEASE}" + mkdir -p /opt/bitmagnet + temp_file=$(mktemp) + curl -fsSL "https://github.com/bitmagnet-io/bitmagnet/archive/refs/tags/v${RELEASE}.tar.gz" -o "$temp_file" + tar zxf "$temp_file" --strip-components=1 -C /opt/bitmagnet + cd /opt/bitmagnet + VREL=v$RELEASE + $STD go build -ldflags "-s -w -X github.com/bitmagnet-io/bitmagnet/internal/version.GitTag=$VREL" + chmod +x bitmagnet + $STD su - postgres -c "psql -c 'CREATE DATABASE bitmagnet;'" + echo "${RELEASE}" >/opt/bitmagnet_version.txt + msg_ok "Installed bitmagnet v${RELEASE}" + + read -rp "${TAB3}Enter your TMDB API key if you have one: " tmdbapikey + + msg_info "Enabling bitmagnet Service" + cat </etc/init.d/bitmagnet + #!/sbin/openrc-run + description="bitmagnet Service" + directory="/opt/bitmagnet" + command="/opt/bitmagnet/bitmagnet" + command_args="worker run --all" + command_background="true" + command_user="root" + pidfile="/var/run/bitmagnet.pid" + + depend() { + use net + } + + start_pre() { + export TMDB_API_KEY="$tmdbapikey" + } + EOF + chmod +x /etc/init.d/bitmagnet + $STD rc-update add bitmagnet default + msg_ok "Enabled bitmagnet Service" + + msg_info "Starting bitmagnet" + $STD service bitmagnet start + msg_ok "Started bitmagnet" +} + +run_os_setup motd_ssh customize diff --git a/install/caddy-install.sh b/install/caddy-install.sh index 6591d4fd0..20325afca 100644 --- a/install/caddy-install.sh +++ b/install/caddy-install.sh @@ -13,32 +13,91 @@ setting_up_container network_check update_os -msg_info "Installing Dependencies" -$STD apt install -y \ - debian-keyring \ - debian-archive-keyring \ - apt-transport-https -msg_ok "Installed Dependencies" +setup_deb_based() { + msg_info "Installing Dependencies" + $STD apt install -y \ + debian-keyring \ + debian-archive-keyring \ + apt-transport-https + msg_ok "Installed Dependencies" -msg_info "Installing Caddy" -setup_deb822_repo \ - "caddy" \ - "https://dl.cloudsmith.io/public/caddy/stable/gpg.key" \ - "https://dl.cloudsmith.io/public/caddy/stable/deb/debian" \ - "any-version" -$STD apt install -y caddy -msg_ok "Installed Caddy" + msg_info "Installing Caddy" + setup_deb822_repo \ + "caddy" \ + "https://dl.cloudsmith.io/public/caddy/stable/gpg.key" \ + "https://dl.cloudsmith.io/public/caddy/stable/deb/debian" \ + "any-version" + $STD apt install -y caddy + msg_ok "Installed Caddy" -read -r -p "${TAB3}Would you like to install xCaddy Addon? " prompt -if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then - setup_go - fetch_and_deploy_gh_release "xcaddy" "caddyserver/xcaddy" "binary" + read -r -p "${TAB3}Would you like to install xCaddy Addon? " prompt + if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then + setup_go + fetch_and_deploy_gh_release "xcaddy" "caddyserver/xcaddy" "binary" - msg_info "Setup xCaddy" - $STD apt install -y git - $STD xcaddy build - msg_ok "Setup xCaddy" -fi + msg_info "Setup xCaddy" + $STD apt install -y git + $STD xcaddy build + msg_ok "Setup xCaddy" + fi +} + +setup_alpine() { + msg_info "Installing Caddy" + $STD apk add --no-cache caddy caddy-openrc + cat </etc/caddy/Caddyfile + :80 { + # Set this path to your site's directory. + root * /var/www/html + + # Enable the static file server. + file_server + + # Another common task is to set up a reverse proxy: + # reverse_proxy localhost:8080 + + # Or serve a PHP site through php-fpm: + # php_fastcgi localhost:9000 + } + EOF + mkdir -p /var/www/html + cat </var/www/html/index.html + + + + Caddy works! + + +

Hello Caddy!

+

For more information, refer to the Caddy documentation

+ + + EOF + msg_ok "Installed Caddy" + + read -r -p "${TAB3}Would you like to install xCaddy Addon? " prompt + if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then + GO_VERSION="$(curl -fsSL https://go.dev/VERSION?m=text | head -1 | cut -c3-)" setup_go + msg_info "Setup xCaddy" + cd /opt + RELEASE=$(curl -fsSL https://api.github.com/repos/caddyserver/xcaddy/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') + curl -fsSL "https://github.com/caddyserver/xcaddy/releases/download/${RELEASE}/xcaddy_${RELEASE:1}_linux_amd64.tar.gz" -o "xcaddy_${RELEASE:1}_linux_amd64.tar.gz" + $STD tar xzf xcaddy_"${RELEASE:1}"_linux_amd64.tar.gz -C /usr/local/bin xcaddy + rm -rf /opt/xcaddy* + $STD xcaddy build + msg_ok "Setup xCaddy" + fi + + msg_info "Enabling Caddy Service" + $STD rc-update add caddy default + msg_ok "Enabled Caddy Service" + + msg_info "Starting Caddy" + $STD service caddy start + msg_ok "Started Caddy" +} + +run_os_setup motd_ssh customize diff --git a/install/docker-install.sh b/install/docker-install.sh index 904a65938..7f558bd94 100644 --- a/install/docker-install.sh +++ b/install/docker-install.sh @@ -13,64 +13,122 @@ setting_up_container network_check update_os -PORTAINER_AGENT_LATEST_VERSION=$(get_latest_github_release "portainer/agent") +setup_deb_based() { + PORTAINER_AGENT_LATEST_VERSION=$(get_latest_github_release "portainer/agent") -setup_docker + setup_docker -if prompt_confirm "${TAB3}Would you like to install Portainer (UI) via the community-scripts addon?" "n" 60; then - bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/addon/portainer.sh)" <<<"y" -else - read -r -p "${TAB3}Would you like to install the Portainer Agent (for remote management)? " prompt_agent - if [[ ${prompt_agent,,} =~ ^(y|yes)$ ]]; then - msg_info "Installing Portainer Agent $PORTAINER_AGENT_LATEST_VERSION" - $STD docker run -d \ - -p 9001:9001 \ - --name portainer_agent \ - --restart=always \ - -v /var/run/docker.sock:/var/run/docker.sock \ - -v /var/lib/docker/volumes:/var/lib/docker/volumes \ - portainer/agent - msg_ok "Installed Portainer Agent $PORTAINER_AGENT_LATEST_VERSION" - fi -fi - -read -r -p "${TAB3}Expose Docker TCP socket (insecure) ? [n = No, l = Local only (127.0.0.1), a = All interfaces (0.0.0.0)] : " socket_choice -case "${socket_choice,,}" in -l) - socket="tcp://127.0.0.1:2375" - ;; -a) - socket="tcp://0.0.0.0:2375" - ;; -*) - socket="" - ;; -esac - -if [[ -n "$socket" ]]; then - msg_info "Enabling Docker TCP socket on $socket" - $STD apt-get install -y jq - - tmpfile=$(mktemp) - jq --arg sock "$socket" '. + { "hosts": ["unix:///var/run/docker.sock", $sock] }' /etc/docker/daemon.json >"$tmpfile" && mv "$tmpfile" /etc/docker/daemon.json - - mkdir -p /etc/systemd/system/docker.service.d - cat </etc/systemd/system/docker.service.d/override.conf -[Service] -ExecStart= -ExecStart=$(command -v dockerd || echo /usr/sbin/dockerd) -EOF - - $STD systemctl daemon-reexec - $STD systemctl daemon-reload - - if systemctl restart docker; then - msg_ok "Docker TCP socket available on $socket" + if prompt_confirm "${TAB3}Would you like to install Portainer (UI) via the community-scripts addon?" "n" 60; then + bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/addon/portainer.sh)" <<<"y" else - msg_error "Docker failed to restart. Check journalctl -xeu docker.service" - exit 150 + read -r -p "${TAB3}Would you like to install the Portainer Agent (for remote management)? " prompt_agent + if [[ ${prompt_agent,,} =~ ^(y|yes)$ ]]; then + msg_info "Installing Portainer Agent $PORTAINER_AGENT_LATEST_VERSION" + $STD docker run -d \ + -p 9001:9001 \ + --name portainer_agent \ + --restart=always \ + -v /var/run/docker.sock:/var/run/docker.sock \ + -v /var/lib/docker/volumes:/var/lib/docker/volumes \ + portainer/agent + msg_ok "Installed Portainer Agent $PORTAINER_AGENT_LATEST_VERSION" + fi fi -fi + + read -r -p "${TAB3}Expose Docker TCP socket (insecure) ? [n = No, l = Local only (127.0.0.1), a = All interfaces (0.0.0.0)] : " socket_choice + case "${socket_choice,,}" in + l) + socket="tcp://127.0.0.1:2375" + ;; + a) + socket="tcp://0.0.0.0:2375" + ;; + *) + socket="" + ;; + esac + + if [[ -n "$socket" ]]; then + msg_info "Enabling Docker TCP socket on $socket" + $STD apt-get install -y jq + + tmpfile=$(mktemp) + jq --arg sock "$socket" '. + { "hosts": ["unix:///var/run/docker.sock", $sock] }' /etc/docker/daemon.json >"$tmpfile" && mv "$tmpfile" /etc/docker/daemon.json + + mkdir -p /etc/systemd/system/docker.service.d + cat </etc/systemd/system/docker.service.d/override.conf + [Service] + ExecStart= + ExecStart=$(command -v dockerd || echo /usr/sbin/dockerd) + EOF + + $STD systemctl daemon-reexec + $STD systemctl daemon-reload + + if systemctl restart docker; then + msg_ok "Docker TCP socket available on $socket" + else + msg_error "Docker failed to restart. Check journalctl -xeu docker.service" + exit 150 + fi + fi +} + +setup_alpine() { + msg_info "Installing Dependencies" + $STD apk add tzdata openssl + msg_ok "Installed Dependencies" + + msg_info "Installing Docker" + $STD apk add docker + $STD rc-service docker start + $STD rc-update add docker default + msg_ok "Installed Docker" + + get_latest_release() { + curl -fsSL https://api.github.com/repos/"$1"/releases/latest | grep '"tag_name":' | cut -d'"' -f4 + } + DOCKER_COMPOSE_LATEST_VERSION=$(get_latest_release "docker/compose") + PORTAINER_AGENT_LATEST_VERSION=$(get_latest_release "portainer/agent") + + read -r -p "${TAB3}Would you like to add Docker Compose? " prompt + if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then + msg_info "Installing Docker Compose $DOCKER_COMPOSE_LATEST_VERSION" + DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker} + mkdir -p "$DOCKER_CONFIG"/cli-plugins + curl -fsSL https://github.com/docker/compose/releases/download/"$DOCKER_COMPOSE_LATEST_VERSION"/docker-compose-linux-$(arch_resolve "x86_64" "aarch64") -o ~/.docker/cli-plugins/docker-compose + chmod +x "$DOCKER_CONFIG"/cli-plugins/docker-compose + msg_ok "Installed Docker Compose $DOCKER_COMPOSE_LATEST_VERSION" + fi + + if prompt_confirm "${TAB3}Would you like to install Portainer (UI) via the community-scripts addon?" "n" 60; then + bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/addon/portainer.sh)" <<<"y" + else + read -r -p "${TAB3}Would you like to add the Portainer Agent? " prompt + if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then + msg_info "Installing Portainer agent $PORTAINER_AGENT_LATEST_VERSION" + $STD docker run -d \ + -p 9001:9001 \ + --name portainer_agent \ + --restart=always \ + -v /var/run/docker.sock:/var/run/docker.sock \ + -v /var/lib/docker/volumes:/var/lib/docker/volumes \ + portainer/agent + msg_ok "Installed Portainer Agent $PORTAINER_AGENT_LATEST_VERSION" + fi + fi + + read -r -p "${TAB3}Would you like to expose the Docker TCP socket? " prompt + if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then + msg_info "Exposing Docker TCP socket" + $STD mkdir -p /etc/docker + $STD echo '{ "hosts": ["unix:///var/run/docker.sock", "tcp://0.0.0.0:2375"] }' >/etc/docker/daemon.json + $STD rc-service docker restart + msg_ok "Exposed Docker TCP socket at tcp://+:2375" + fi +} + +run_os_setup motd_ssh customize diff --git a/install/forgejo-install.sh b/install/forgejo-install.sh index 38fa16813..dda245271 100644 --- a/install/forgejo-install.sh +++ b/install/forgejo-install.sh @@ -13,45 +13,63 @@ setting_up_container network_check update_os -msg_info "Installing Dependencies" -$STD apt install -y \ - git \ - git-lfs -msg_ok "Installed Dependencies" +setup_deb_based() { + msg_info "Installing Dependencies" + $STD apt install -y \ + git \ + git-lfs + msg_ok "Installed Dependencies" -fetch_and_deploy_codeberg_release "forgejo" "forgejo/forgejo" "singlefile" "latest" "/opt/forgejo" "forgejo-*-linux-$(arch_resolve)" -ln -sf /opt/forgejo/forgejo /usr/local/bin/forgejo + fetch_and_deploy_codeberg_release "forgejo" "forgejo/forgejo" "singlefile" "latest" "/opt/forgejo" "forgejo-*-linux-$(arch_resolve)" + ln -sf /opt/forgejo/forgejo /usr/local/bin/forgejo -msg_info "Setting up Forgejo" -$STD adduser --system --shell /bin/bash --gecos 'Git Version Control' --group --disabled-password --home /home/git git -mkdir /var/lib/forgejo -chown git:git /var/lib/forgejo -chmod 750 /var/lib/forgejo -mkdir /etc/forgejo -chown root:git /etc/forgejo -chmod 770 /etc/forgejo -msg_ok "Setup Forgejo" + msg_info "Setting up Forgejo" + $STD adduser --system --shell /bin/bash --gecos 'Git Version Control' --group --disabled-password --home /home/git git + mkdir /var/lib/forgejo + chown git:git /var/lib/forgejo + chmod 750 /var/lib/forgejo + mkdir /etc/forgejo + chown root:git /etc/forgejo + chmod 770 /etc/forgejo + msg_ok "Setup Forgejo" -msg_info "Creating Service" -cat </etc/systemd/system/forgejo.service -[Unit] -Description=Forgejo -After=syslog.target -After=network.target -[Service] -RestartSec=2s -Type=simple -User=git -Group=git -WorkingDirectory=/var/lib/forgejo/ -ExecStart=/usr/local/bin/forgejo web --config /etc/forgejo/app.ini -Restart=always -Environment=USER=git HOME=/home/git FORGEJO_WORK_DIR=/var/lib/forgejo -[Install] -WantedBy=multi-user.target -EOF -systemctl enable -q --now forgejo -msg_ok "Created Service" + msg_info "Creating Service" + cat </etc/systemd/system/forgejo.service + [Unit] + Description=Forgejo + After=syslog.target + After=network.target + [Service] + RestartSec=2s + Type=simple + User=git + Group=git + WorkingDirectory=/var/lib/forgejo/ + ExecStart=/usr/local/bin/forgejo web --config /etc/forgejo/app.ini + Restart=always + Environment=USER=git HOME=/home/git FORGEJO_WORK_DIR=/var/lib/forgejo + [Install] + WantedBy=multi-user.target + EOF + systemctl enable -q --now forgejo + msg_ok "Created Service" +} + +setup_alpine() { + msg_info "Installing Forgejo" + $STD apk add --no-cache forgejo + msg_ok "Installed Forgejo" + + msg_info "Enabling Forgejo Service" + $STD rc-update add forgejo default + msg_ok "Enabled Forgejo Service" + + msg_info "Starting Forgejo" + $STD service forgejo start + msg_ok "Started Forgejo" +} + +run_os_setup motd_ssh customize diff --git a/install/garage-install.sh b/install/garage-install.sh index 469f5c123..443bca5d0 100644 --- a/install/garage-install.sh +++ b/install/garage-install.sh @@ -13,76 +13,149 @@ 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}/$(arch_resolve "x86_64" "aarch64")-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) -cat <~/garage.creds -Garage Tokens and Secrets -RPC Secret: $RPC_SECRET -Admin Token: $ADMIN_TOKEN -Metrics Token: $METRICS_TOKEN -EOF -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 +setup_deb_based() { + 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}/$(arch_resolve "x86_64" "aarch64")-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) + cat <~/garage.creds + Garage Tokens and Secrets + RPC Secret: $RPC_SECRET + Admin Token: $ADMIN_TOKEN + Metrics Token: $METRICS_TOKEN + EOF + 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}" + 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_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" + [s3_web] + bind_addr = "[::]:3902" + root_domain = ".web.garage.localhost" + index = "index.html" -[k2v_api] -api_bind_addr = "[::]:3904" + [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" + [admin] + api_bind_addr = "[::]:3903" + admin_token = "${ADMIN_TOKEN}" + metrics_token = "${METRICS_TOKEN}" + EOF + msg_ok "Set up Garage" -msg_info "Creating service" -cat <<'EOF' >/etc/systemd/system/garage.service -[Unit] -Description=Garage Object Storage (Deuxfleurs) -After=network-online.target -Wants=network-online.target + msg_info "Creating service" + cat <<'EOF' >/etc/systemd/system/garage.service + [Unit] + Description=Garage Object Storage (Deuxfleurs) + After=network-online.target + Wants=network-online.target -[Service] -Type=simple -ExecStart=/usr/local/bin/garage -c /etc/garage.toml server -Restart=always -RestartSec=5 -User=root -WorkingDirectory=/var/lib/garage -Environment=RUST_LOG=info -StandardOutput=append:/var/log/garage.log -StandardError=append:/var/log/garage.log -LimitNOFILE=65536 + [Service] + Type=simple + ExecStart=/usr/local/bin/garage -c /etc/garage.toml server + Restart=always + RestartSec=5 + User=root + WorkingDirectory=/var/lib/garage + Environment=RUST_LOG=info + StandardOutput=append:/var/log/garage.log + StandardError=append:/var/log/garage.log + LimitNOFILE=65536 -[Install] -WantedBy=multi-user.target -EOF -$STD systemctl enable -q --now garage -msg_ok "Created Service" + [Install] + WantedBy=multi-user.target + EOF + $STD systemctl enable -q --now garage + msg_ok "Created Service" +} + +setup_alpine() { + msg_info "Installing Dependencies" + $STD apk add --no-cache 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}/$(arch_resolve "x86_64" "aarch64")-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) + cat <~/garage.creds + Garage Tokens and Secrets + RPC Secret: $RPC_SECRET + Admin Token: $ADMIN_TOKEN + Metrics Token: $METRICS_TOKEN + EOF + 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" +} + +run_os_setup motd_ssh customize diff --git a/install/gatus-install.sh b/install/gatus-install.sh index 2da993fe1..30de2276f 100644 --- a/install/gatus-install.sh +++ b/install/gatus-install.sh @@ -13,41 +13,95 @@ setting_up_container network_check update_os -msg_info "Installing Dependencies" -$STD apt install -y \ - ca-certificates \ - libcap2-bin -msg_ok "Installed Dependencies" +setup_deb_based() { + msg_info "Installing Dependencies" + $STD apt install -y \ + ca-certificates \ + libcap2-bin + msg_ok "Installed Dependencies" -setup_go -fetch_and_deploy_gh_release "gatus" "TwiN/gatus" "tarball" + setup_go + fetch_and_deploy_gh_release "gatus" "TwiN/gatus" "tarball" -msg_info "Configuring gatus" -cd /opt/gatus -$STD go mod tidy -CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o gatus . -setcap CAP_NET_RAW+ep gatus -mv config.yaml config -msg_ok "Configured gatus" + msg_info "Configuring gatus" + cd /opt/gatus + $STD go mod tidy + CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o gatus . + setcap CAP_NET_RAW+ep gatus + mv config.yaml config + msg_ok "Configured gatus" -msg_info "Creating Service" -cat </etc/systemd/system/gatus.service -[Unit] -Description=gatus Service -After=network.target + msg_info "Creating Service" + cat </etc/systemd/system/gatus.service + [Unit] + Description=gatus Service + After=network.target -[Service] -Type=simple -User=root -WorkingDirectory=/opt/gatus -ExecStart=/opt/gatus/gatus -Restart=always + [Service] + Type=simple + User=root + WorkingDirectory=/opt/gatus + ExecStart=/opt/gatus/gatus + Restart=always -[Install] -WantedBy=multi-user.target -EOF -systemctl enable -q --now gatus -msg_ok "Created Service" + [Install] + WantedBy=multi-user.target + EOF + systemctl enable -q --now gatus + msg_ok "Created Service" +} + +setup_alpine() { + msg_info "Installing dependencies" + $STD apk add --no-cache \ + ca-certificates \ + libcap-setcap + $STD apk add --no-cache --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community go + msg_ok "Installed dependencies" + + RELEASE=$(curl -s https://api.github.com/repos/TwiN/gatus/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') + msg_info "Installing gatus v${RELEASE}" + temp_file=$(mktemp) + mkdir -p /opt/gatus + curl -fsSL "https://github.com/TwiN/gatus/archive/refs/tags/v${RELEASE}.tar.gz" -o "$temp_file" + tar zxf "$temp_file" --strip-components=1 -C /opt/gatus + cd /opt/gatus + $STD go mod tidy + CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o gatus . + setcap CAP_NET_RAW+ep gatus + mv config.yaml config + echo "${RELEASE}" >/opt/gatus_version.txt + msg_ok "Installed gatus v${RELEASE}" + + msg_info "Enabling gatus Service" + cat </etc/init.d/gatus + #!/sbin/openrc-run + description="gatus Service" + directory="/opt/gatus" + command="/opt/gatus/gatus" + command_args="" + command_background="true" + command_user="root" + pidfile="/var/run/gatus.pid" + + export GATUS_CONFIG_PATH="" + export GATUS_LOG_LEVEL="INFO" + export PORT="8080" + + depend() { + use net + } + EOF + chmod +x /etc/init.d/gatus + $STD rc-update add gatus default + msg_ok "Enabled gatus Service" + + msg_info "Starting gatus" + $STD service gatus start + msg_ok "Started gatus" +} + +run_os_setup motd_ssh customize diff --git a/install/gitea-install.sh b/install/gitea-install.sh index 83da30c41..48a5884d2 100644 --- a/install/gitea-install.sh +++ b/install/gitea-install.sh @@ -14,58 +14,76 @@ setting_up_container network_check update_os -msg_info "Installing Dependencies" -$STD apt install -y \ - git \ - sqlite3 -msg_ok "Installed Dependencies" +setup_deb_based() { + msg_info "Installing Dependencies" + $STD apt install -y \ + git \ + sqlite3 + msg_ok "Installed Dependencies" -fetch_and_deploy_gh_release "gitea" "go-gitea/gitea" "singlefile" "latest" "/usr/local/bin" "gitea-*-linux-$(arch_resolve)" + fetch_and_deploy_gh_release "gitea" "go-gitea/gitea" "singlefile" "latest" "/usr/local/bin" "gitea-*-linux-$(arch_resolve)" -msg_info "Configuring Gitea" -chmod +x /usr/local/bin/gitea -$STD adduser --system --group --disabled-password --shell /bin/bash --home /etc/gitea gitea -mkdir -p /var/lib/gitea/{custom,data,log} -chown -R gitea:gitea /var/lib/gitea/ -chmod -R 750 /var/lib/gitea/ -chown root:gitea /etc/gitea -chmod 770 /etc/gitea -sudo -u gitea ln -s /var/lib/gitea/data/.ssh/ /etc/gitea/.ssh -msg_ok "Configured Gitea" + msg_info "Configuring Gitea" + chmod +x /usr/local/bin/gitea + $STD adduser --system --group --disabled-password --shell /bin/bash --home /etc/gitea gitea + mkdir -p /var/lib/gitea/{custom,data,log} + chown -R gitea:gitea /var/lib/gitea/ + chmod -R 750 /var/lib/gitea/ + chown root:gitea /etc/gitea + chmod 770 /etc/gitea + sudo -u gitea ln -s /var/lib/gitea/data/.ssh/ /etc/gitea/.ssh + msg_ok "Configured Gitea" -msg_info "Creating Service" -cat </etc/systemd/system/gitea.service -[Unit] -Description=Gitea (Git with a cup of tea) -After=syslog.target -After=network.target + msg_info "Creating Service" + cat </etc/systemd/system/gitea.service + [Unit] + Description=Gitea (Git with a cup of tea) + After=syslog.target + After=network.target -[Service] -# Uncomment notify and watchdog if you want to use them -# Uncomment the next line if you have repos with lots of files and get a HTTP 500 error because of that -# LimitNOFILE=524288:524288 -RestartSec=2s -Type=simple -#Type=notify -User=gitea -Group=gitea -#The mount point we added to the container -WorkingDirectory=/var/lib/gitea -#Create directory in /run -RuntimeDirectory=gitea -ExecStart=/usr/local/bin/gitea web --config /etc/gitea/app.ini -Restart=always -Environment=USER=gitea HOME=/var/lib/gitea/data GITEA_WORK_DIR=/var/lib/gitea -#WatchdogSec=30s -#Capabilities to bind to low-numbered ports -#CapabilityBoundingSet=CAP_NET_BIND_SERVICE -#AmbientCapabilities=CAP_NET_BIND_SERVICE + [Service] + # Uncomment notify and watchdog if you want to use them + # Uncomment the next line if you have repos with lots of files and get a HTTP 500 error because of that + # LimitNOFILE=524288:524288 + RestartSec=2s + Type=simple + #Type=notify + User=gitea + Group=gitea + #The mount point we added to the container + WorkingDirectory=/var/lib/gitea + #Create directory in /run + RuntimeDirectory=gitea + ExecStart=/usr/local/bin/gitea web --config /etc/gitea/app.ini + Restart=always + Environment=USER=gitea HOME=/var/lib/gitea/data GITEA_WORK_DIR=/var/lib/gitea + #WatchdogSec=30s + #Capabilities to bind to low-numbered ports + #CapabilityBoundingSet=CAP_NET_BIND_SERVICE + #AmbientCapabilities=CAP_NET_BIND_SERVICE -[Install] -WantedBy=multi-user.target -EOF -systemctl enable -q --now gitea -msg_ok "Created Service" + [Install] + WantedBy=multi-user.target + EOF + systemctl enable -q --now gitea + msg_ok "Created Service" +} + +setup_alpine() { + msg_info "Installing Gitea" + $STD apk add --no-cache gitea + msg_ok "Installed Gitea" + + msg_info "Enabling Gitea Service" + $STD rc-update add gitea default + msg_ok "Enabled Gitea Service" + + msg_info "Starting Gitea" + $STD service gitea start + msg_ok "Started Gitea" +} + +run_os_setup motd_ssh customize diff --git a/install/grafana-install.sh b/install/grafana-install.sh index 964c75f67..b33c750f1 100644 --- a/install/grafana-install.sh +++ b/install/grafana-install.sh @@ -13,23 +13,36 @@ setting_up_container network_check update_os -msg_info "Installing Dependencies" -$STD apt install -y apt-transport-https -msg_ok "Installed Dependencies" +setup_deb_based() { + msg_info "Installing Dependencies" + $STD apt install -y apt-transport-https + msg_ok "Installed Dependencies" -msg_info "Setting up Grafana Repository" -setup_deb822_repo \ - "grafana" \ - "https://apt.grafana.com/gpg.key" \ - "https://apt.grafana.com" \ - "stable" \ - "main" -msg_ok "Grafana Repository setup sucessfully" + msg_info "Setting up Grafana Repository" + setup_deb822_repo \ + "grafana" \ + "https://apt.grafana.com/gpg.key" \ + "https://apt.grafana.com" \ + "stable" \ + "main" + msg_ok "Grafana Repository setup sucessfully" -msg_info "Installing Grafana" -$STD apt install -y grafana -systemctl enable -q --now grafana-server -msg_ok "Installed Grafana" + msg_info "Installing Grafana" + $STD apt install -y grafana + systemctl enable -q --now grafana-server + msg_ok "Installed Grafana" +} + +setup_alpine() { + msg_info "Installing Grafana" + $STD apk add grafana + $STD sed -i '/http_addr/s/127.0.0.1/0.0.0.0/g' /etc/conf.d/grafana + $STD rc-service grafana start + $STD rc-update add grafana default + msg_ok "Installed Grafana" +} + +run_os_setup motd_ssh customize diff --git a/install/ironclaw-install.sh b/install/ironclaw-install.sh index b1ba733bf..b1a86c047 100644 --- a/install/ironclaw-install.sh +++ b/install/ironclaw-install.sh @@ -13,74 +13,160 @@ setting_up_container network_check update_os -msg_info "Installing Dependencies" -$STD apt install -y \ - dbus-user-session \ - gnome-keyring \ - libsecret-tools -msg_ok "Installed Dependencies" +setup_deb_based() { + msg_info "Installing Dependencies" + $STD apt install -y \ + dbus-user-session \ + gnome-keyring \ + libsecret-tools + msg_ok "Installed Dependencies" -PG_VERSION="17" PG_MODULES="pgvector" setup_postgresql -PG_DB_NAME="ironclaw" PG_DB_USER="ironclaw" PG_DB_EXTENSIONS="vector" setup_postgresql_db + PG_VERSION="17" PG_MODULES="pgvector" setup_postgresql + PG_DB_NAME="ironclaw" PG_DB_USER="ironclaw" PG_DB_EXTENSIONS="vector" setup_postgresql_db -fetch_and_deploy_gh_release "ironclaw-bin" "nearai/ironclaw" "prebuild" "ironclaw-v0.29.1" "/usr/local/bin" \ - "ironclaw-$(uname -m)-unknown-linux-gnu.tar.gz" -chmod +x /usr/local/bin/ironclaw + fetch_and_deploy_gh_release "ironclaw-bin" "nearai/ironclaw" "prebuild" "ironclaw-v0.29.1" "/usr/local/bin" \ + "ironclaw-$(uname -m)-unknown-linux-gnu.tar.gz" + chmod +x /usr/local/bin/ironclaw -msg_info "Configuring Environment" -GATEWAY_TOKEN=$(openssl rand -hex 32) -mkdir -p /root/.ironclaw -cat </root/.ironclaw/gateway.creds -Gateway-Token -Token: $GATEWAY_TOKEN -EOF + msg_info "Configuring Environment" + GATEWAY_TOKEN=$(openssl rand -hex 32) + mkdir -p /root/.ironclaw + cat </root/.ironclaw/gateway.creds + Gateway-Token + Token: $GATEWAY_TOKEN + EOF -mkdir -p /root/.ironclaw -cat </root/.ironclaw/.env -DATABASE_BACKEND=postgres -DATABASE_URL=postgresql://${PG_DB_USER}:${PG_DB_PASS}@localhost:5432/${PG_DB_NAME}?sslmode=disable -GATEWAY_ENABLED=true -GATEWAY_HOST=0.0.0.0 -GATEWAY_PORT=3000 -GATEWAY_AUTH_TOKEN=${GATEWAY_TOKEN} -CLI_ENABLED=false -RUST_LOG=ironclaw=info,tower_http=info -EOF -chmod 600 /root/.ironclaw/.env -msg_ok "Configured Environment" + mkdir -p /root/.ironclaw + cat </root/.ironclaw/.env + DATABASE_BACKEND=postgres + DATABASE_URL=postgresql://${PG_DB_USER}:${PG_DB_PASS}@localhost:5432/${PG_DB_NAME}?sslmode=disable + GATEWAY_ENABLED=true + GATEWAY_HOST=0.0.0.0 + GATEWAY_PORT=3000 + GATEWAY_AUTH_TOKEN=${GATEWAY_TOKEN} + CLI_ENABLED=false + RUST_LOG=ironclaw=info,tower_http=info + EOF + chmod 600 /root/.ironclaw/.env + msg_ok "Configured Environment" -msg_info "Configuring IronClaw" -# Set values in the database since it is typically the true source of truth and ensures values are set correctly on first run before the service starts. -/usr/local/bin/ironclaw --no-onboard config set database_backend postgres >/dev/null -/usr/local/bin/ironclaw --no-onboard config set database_url "postgresql://${PG_DB_USER}:${PG_DB_PASS}@localhost:5432/${PG_DB_NAME}?sslmode=disable" >/dev/null -/usr/local/bin/ironclaw --no-onboard config set channels.gateway_enabled true >/dev/null -/usr/local/bin/ironclaw --no-onboard config set channels.gateway_host 0.0.0.0 >/dev/null -/usr/local/bin/ironclaw --no-onboard config set channels.gateway_port 3000 >/dev/null -/usr/local/bin/ironclaw --no-onboard config set channels.gateway_auth_token "${GATEWAY_TOKEN}" >/dev/null -/usr/local/bin/ironclaw --no-onboard config set channels.cli_enabled false >/dev/null -/usr/local/bin/ironclaw --no-onboard config set secrets_master_key_source none >/dev/null -# Running ironclaw defaults to use env for secrets and creates this entry, but we want to set that during onboard. -sleep 5 -sed -i '/SECRETS_MASTER_KEY/d' /root/.ironclaw/.env -msg_ok "Configured IronClaw" + msg_info "Configuring IronClaw" + # Set values in the database since it is typically the true source of truth and ensures values are set correctly on first run before the service starts. + /usr/local/bin/ironclaw --no-onboard config set database_backend postgres >/dev/null + /usr/local/bin/ironclaw --no-onboard config set database_url "postgresql://${PG_DB_USER}:${PG_DB_PASS}@localhost:5432/${PG_DB_NAME}?sslmode=disable" >/dev/null + /usr/local/bin/ironclaw --no-onboard config set channels.gateway_enabled true >/dev/null + /usr/local/bin/ironclaw --no-onboard config set channels.gateway_host 0.0.0.0 >/dev/null + /usr/local/bin/ironclaw --no-onboard config set channels.gateway_port 3000 >/dev/null + /usr/local/bin/ironclaw --no-onboard config set channels.gateway_auth_token "${GATEWAY_TOKEN}" >/dev/null + /usr/local/bin/ironclaw --no-onboard config set channels.cli_enabled false >/dev/null + /usr/local/bin/ironclaw --no-onboard config set secrets_master_key_source none >/dev/null + # Running ironclaw defaults to use env for secrets and creates this entry, but we want to set that during onboard. + sleep 5 + sed -i '/SECRETS_MASTER_KEY/d' /root/.ironclaw/.env + msg_ok "Configured IronClaw" -msg_info "Creating Service" -cat </etc/systemd/system/ironclaw.service -[Unit] -Description=IronClaw AI Agent -After=network.target postgresql.service + msg_info "Creating Service" + cat </etc/systemd/system/ironclaw.service + [Unit] + Description=IronClaw AI Agent + After=network.target postgresql.service -[Service] -Type=simple -ExecStart=/usr/bin/dbus-run-session /usr/local/bin/ironclaw run -Restart=on-failure -RestartSec=5 + [Service] + Type=simple + ExecStart=/usr/bin/dbus-run-session /usr/local/bin/ironclaw run + Restart=on-failure + RestartSec=5 -[Install] -WantedBy=multi-user.target -EOF -systemctl enable -q ironclaw -msg_ok "Created Service" + [Install] + WantedBy=multi-user.target + EOF + systemctl enable -q ironclaw + msg_ok "Created Service" +} + +setup_alpine() { + msg_info "Installing Dependencies" + $STD apk add openssl dbus gnome-keyring + msg_ok "Installed Dependencies" + + msg_info "Installing PostgreSQL" + $STD apk add postgresql17 postgresql17-openrc postgresql-pgvector postgresql-common + $STD rc-service postgresql setup + $STD rc-update add postgresql default + $STD rc-service postgresql start + msg_ok "Installed PostgreSQL" + + msg_info "Setting up Database" + PG_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13) + $STD su -s /bin/sh postgres -c "psql -c \"CREATE ROLE ironclaw WITH LOGIN PASSWORD '${PG_PASS}';\"" + $STD su -s /bin/sh postgres -c "psql -c \"CREATE DATABASE ironclaw WITH OWNER ironclaw;\"" + $STD su -s /bin/sh postgres -c "psql -d ironclaw -c \"CREATE EXTENSION IF NOT EXISTS vector;\"" + msg_ok "Set up Database" + + fetch_and_deploy_gh_release "ironclaw-bin" "nearai/ironclaw" "prebuild" "ironclaw-v0.29.1" "/usr/local/bin" \ + "ironclaw-$(uname -m)-unknown-linux-musl.tar.gz" + chmod +x /usr/local/bin/ironclaw + + msg_info "Configuring Environment" + GATEWAY_TOKEN=$(openssl rand -hex 32) + mkdir -p /root/.ironclaw + cat </root/.ironclaw/gateway.creds + Gateway-Token + Token: $GATEWAY_TOKEN + EOF + + mkdir -p /root/.ironclaw + cat </root/.ironclaw/.env + DATABASE_BACKEND=postgres + DATABASE_URL=postgresql://ironclaw:${PG_PASS}@localhost:5432/ironclaw?sslmode=disable + GATEWAY_ENABLED=true + GATEWAY_HOST=0.0.0.0 + GATEWAY_PORT=3000 + GATEWAY_AUTH_TOKEN=${GATEWAY_TOKEN} + CLI_ENABLED=false + RUST_LOG=ironclaw=info,tower_http=info + EOF + chmod 600 /root/.ironclaw/.env + msg_ok "Configured Environment" + + msg_info "Configuring IronClaw" + # Set values in the database since it is typically the true source of truth and ensures values are set correctly on first run before the service starts. + /usr/local/bin/ironclaw --no-onboard config set database_backend postgres >/dev/null + /usr/local/bin/ironclaw --no-onboard config set database_url "postgresql://ironclaw:${PG_PASS}@localhost:5432/ironclaw?sslmode=disable" >/dev/null + /usr/local/bin/ironclaw --no-onboard config set channels.gateway_enabled true >/dev/null + /usr/local/bin/ironclaw --no-onboard config set channels.gateway_host 0.0.0.0 >/dev/null + /usr/local/bin/ironclaw --no-onboard config set channels.gateway_port 3000 >/dev/null + /usr/local/bin/ironclaw --no-onboard config set channels.gateway_auth_token "${GATEWAY_TOKEN}" >/dev/null + /usr/local/bin/ironclaw --no-onboard config set channels.cli_enabled false >/dev/null + /usr/local/bin/ironclaw --no-onboard config set secrets_master_key_source none >/dev/null + # Running ironclaw defaults to use env for secrets and creates this entry, but we want to set that during onboard. + sleep 5 + sed -i '/SECRETS_MASTER_KEY/d' /root/.ironclaw/.env + msg_ok "Configured IronClaw" + + msg_info "Creating Service" + cat </etc/init.d/ironclaw + #!/sbin/openrc-run + + name="IronClaw" + description="IronClaw AI Agent" + command="/usr/bin/dbus-run-session" + command_args="/usr/local/bin/ironclaw" + command_background=true + pidfile="/run/ironclaw.pid" + directory="/root" + supervise_daemon_args="--env-file /root/.ironclaw/.env" + + depend() { + need net postgresql + } + EOF + chmod +x /etc/init.d/ironclaw + $STD rc-update add ironclaw default + msg_ok "Created Service" +} + +run_os_setup motd_ssh customize diff --git a/install/loki-install.sh b/install/loki-install.sh index a47a5c4e3..d6dc2af4f 100644 --- a/install/loki-install.sh +++ b/install/loki-install.sh @@ -13,62 +13,126 @@ setting_up_container network_check update_os -setup_deb822_repo \ - "grafana" \ - "https://apt.grafana.com/gpg.key" \ - "https://apt.grafana.com" \ - "stable" \ - "main" +setup_deb_based() { + setup_deb822_repo \ + "grafana" \ + "https://apt.grafana.com/gpg.key" \ + "https://apt.grafana.com" \ + "stable" \ + "main" -msg_info "Installing Loki" -$STD apt install -y loki -mkdir -p /var/lib/loki/{chunks,boltdb-shipper-active,boltdb-shipper-cache} -chown -R loki /var/lib/loki -cat </etc/loki/config.yml -auth_enabled: false + msg_info "Installing Loki" + $STD apt install -y loki + mkdir -p /var/lib/loki/{chunks,boltdb-shipper-active,boltdb-shipper-cache} + chown -R loki /var/lib/loki + cat </etc/loki/config.yml + auth_enabled: false -server: - http_listen_port: 3100 - log_level: info + server: + http_listen_port: 3100 + log_level: info -common: - instance_addr: 127.0.0.1 - path_prefix: /var/lib/loki - storage: - filesystem: - chunks_directory: /var/lib/loki/chunks - rules_directory: /var/lib/loki/rules - replication_factor: 1 - ring: - kvstore: - store: inmemory + common: + instance_addr: 127.0.0.1 + path_prefix: /var/lib/loki + storage: + filesystem: + chunks_directory: /var/lib/loki/chunks + rules_directory: /var/lib/loki/rules + replication_factor: 1 + ring: + kvstore: + store: inmemory -schema_config: - configs: - - from: 2020-10-24 - store: tsdb - object_store: filesystem - schema: v13 - index: - prefix: index_ - period: 24h + schema_config: + configs: + - from: 2020-10-24 + store: tsdb + object_store: filesystem + schema: v13 + index: + prefix: index_ + period: 24h -query_range: - results_cache: - cache: - embedded_cache: - enabled: true - max_size_mb: 100 + query_range: + results_cache: + cache: + embedded_cache: + enabled: true + max_size_mb: 100 -limits_config: - metric_aggregation_enabled: true + limits_config: + metric_aggregation_enabled: true -ruler: - alertmanager_url: http://localhost:9093 -EOF -chown loki /etc/loki/config.yml -systemctl enable -q --now loki -msg_ok "Installed Loki" + ruler: + alertmanager_url: http://localhost:9093 + EOF + chown loki /etc/loki/config.yml + systemctl enable -q --now loki + msg_ok "Installed Loki" +} + +setup_alpine() { + msg_info "Installing Loki" + $STD apk add loki + $STD sed -i '/http_addr/s/127.0.0.1/0.0.0.0/g' /etc/conf.d/loki + mkdir -p /var/lib/loki/{chunks,boltdb-shipper-active,boltdb-shipper-cache} + chown -R loki:grafana /var/lib/loki + mkdir -p /var/log/loki + chown -R loki:grafana /var/log/loki + cat </etc/loki/loki-local-config.yaml + auth_enabled: false + + server: + http_listen_port: 3100 + log_level: info + + common: + instance_addr: 127.0.0.1 + path_prefix: /var/lib/loki + storage: + filesystem: + chunks_directory: /var/lib/loki/chunks + rules_directory: /var/lib/loki/rules + replication_factor: 1 + ring: + kvstore: + store: inmemory + + schema_config: + configs: + - from: 2020-10-24 + store: tsdb + object_store: filesystem + schema: v13 + index: + prefix: index_ + period: 24h + + query_range: + results_cache: + cache: + embedded_cache: + enabled: true + max_size_mb: 100 + + limits_config: + metric_aggregation_enabled: true + + ruler: + alertmanager_url: http://localhost:9093 + EOF + chown loki:grafana /etc/loki/loki-local-config.yaml + chmod 644 /etc/loki/loki-local-config.yaml + echo "output_log=\"\${output_log:-/var/log/loki/output.log}\"" >> /etc/init.d/loki + echo "error_log=\"\${error_log:-/var/log/loki/error.log}\"" >> /etc/init.d/loki + echo "start_stop_daemon_args=\"\${SSD_OPTS} -1 \${output_log} -2 \${error_log}\"" >> /etc/init.d/loki + $STD rc-update add loki default + $STD rc-service loki start + msg_ok "Installed Loki" +} + +run_os_setup motd_ssh customize diff --git a/install/mariadb-install.sh b/install/mariadb-install.sh index 242611ebf..8a5d200fc 100644 --- a/install/mariadb-install.sh +++ b/install/mariadb-install.sh @@ -13,37 +13,87 @@ setting_up_container network_check update_os -setup_mariadb +setup_deb_based() { + setup_mariadb -msg_info "Setup MariaDB" -sed -i 's/^# *\(port *=.*\)/\1/' /etc/mysql/my.cnf -sed -i 's/^bind-address/#bind-address/g' /etc/mysql/mariadb.conf.d/50-server.cnf -msg_ok "Setup MariaDB" + msg_info "Setup MariaDB" + sed -i 's/^# *\(port *=.*\)/\1/' /etc/mysql/my.cnf + sed -i 's/^bind-address/#bind-address/g' /etc/mysql/mariadb.conf.d/50-server.cnf + msg_ok "Setup MariaDB" -read -r -p "${TAB3}Would you like to add PhpMyAdmin? " prompt -if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then - msg_info "Installing phpMyAdmin" - $STD apt install -y \ - apache2 \ - php \ - php-mysqli \ - php-mbstring \ - php-zip \ - php-gd \ - php-json \ - php-curl + read -r -p "${TAB3}Would you like to add PhpMyAdmin? " prompt + if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then + msg_info "Installing phpMyAdmin" + $STD apt install -y \ + apache2 \ + php \ + php-mysqli \ + php-mbstring \ + php-zip \ + php-gd \ + php-json \ + php-curl - curl -fsSL "https://files.phpmyadmin.net/phpMyAdmin/5.2.2/phpMyAdmin-5.2.2-all-languages.tar.gz" -o "phpMyAdmin-5.2.2-all-languages.tar.gz" - mkdir -p /var/www/html/phpMyAdmin - tar xf phpMyAdmin-5.2.2-all-languages.tar.gz --strip-components=1 -C /var/www/html/phpMyAdmin - cp /var/www/html/phpMyAdmin/config.sample.inc.php /var/www/html/phpMyAdmin/config.inc.php - SECRET=$(openssl rand -base64 24) - sed -i "s#\$cfg\['blowfish_secret'\] = '';#\$cfg['blowfish_secret'] = '${SECRET}';#" /var/www/html/phpMyAdmin/config.inc.php - chmod 660 /var/www/html/phpMyAdmin/config.inc.php - chown -R www-data:www-data /var/www/html/phpMyAdmin - systemctl restart apache2 - msg_ok "Installed phpMyAdmin" -fi + curl -fsSL "https://files.phpmyadmin.net/phpMyAdmin/5.2.2/phpMyAdmin-5.2.2-all-languages.tar.gz" -o "phpMyAdmin-5.2.2-all-languages.tar.gz" + mkdir -p /var/www/html/phpMyAdmin + tar xf phpMyAdmin-5.2.2-all-languages.tar.gz --strip-components=1 -C /var/www/html/phpMyAdmin + cp /var/www/html/phpMyAdmin/config.sample.inc.php /var/www/html/phpMyAdmin/config.inc.php + SECRET=$(openssl rand -base64 24) + sed -i "s#\$cfg\['blowfish_secret'\] = '';#\$cfg['blowfish_secret'] = '${SECRET}';#" /var/www/html/phpMyAdmin/config.inc.php + chmod 660 /var/www/html/phpMyAdmin/config.inc.php + chown -R www-data:www-data /var/www/html/phpMyAdmin + systemctl restart apache2 + msg_ok "Installed phpMyAdmin" + fi +} + +setup_alpine() { + msg_info "Installing MariaDB" + $STD apk add --no-cache mariadb mariadb-client + $STD rc-update add mariadb default + msg_ok "Installed MariaDB" + + msg_info "Configuring MariaDB" + mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql >/dev/null 2>&1 + $STD rc-service mariadb start + msg_ok "MariaDB Configured" + + read -r -p "${TAB3}Would you like to install Adminer with lighttpd? : " prompt + if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then + msg_info "Installing Adminer and dependencies" + $STD apk add --no-cache \ + lighttpd \ + lighttpd-openrc \ + php83 \ + php83-cgi \ + php83-common \ + php83-curl \ + php83-gd \ + php83-mbstring \ + php83-mysqli \ + php83-mysqlnd \ + php83-openssl \ + php83-zip \ + php83-session \ + jq + + sed -i 's|# *include "mod_fastcgi.conf"|include "mod_fastcgi.conf"|' /etc/lighttpd/lighttpd.conf + sed -i 's|/usr/bin/php-cgi|/usr/bin/php-cgi83|g' /etc/lighttpd/mod_fastcgi.conf + mkdir -p /var/www/localhost/htdocs + ADMINER_VERSION=$(curl -fsSL https://api.github.com/repos/vrana/adminer/releases/latest | jq -r '.tag_name' | sed 's/^v//') + curl -fsSL "https://github.com/vrana/adminer/releases/download/v${ADMINER_VERSION}/adminer-${ADMINER_VERSION}.php" -o /var/www/localhost/htdocs/adminer.php + chown lighttpd:lighttpd /var/www/localhost/htdocs/adminer.php + chmod 755 /var/www/localhost/htdocs/adminer.php + msg_ok "Adminer Installed" + + msg_info "Starting Lighttpd" + $STD rc-update add lighttpd default + $STD rc-service lighttpd restart + msg_ok "Lighttpd Started" + fi +} + +run_os_setup motd_ssh customize diff --git a/install/node-red-install.sh b/install/node-red-install.sh index 5f8f25fe5..b9266d5ac 100644 --- a/install/node-red-install.sh +++ b/install/node-red-install.sh @@ -13,48 +13,99 @@ setting_up_container network_check update_os -msg_info "Installing Dependencies" -$STD apt install -y \ - git \ - ca-certificates -msg_ok "Installed Dependencies" +setup_deb_based() { + msg_info "Installing Dependencies" + $STD apt install -y \ + git \ + ca-certificates + msg_ok "Installed Dependencies" -NODE_VERSION="22" setup_nodejs + NODE_VERSION="22" setup_nodejs -msg_info "Installing Node-Red" -$STD npm install -g --unsafe-perm node-red -echo "journalctl -f -n 100 -u nodered -o cat" >/usr/bin/node-red-log -chmod +x /usr/bin/node-red-log -echo "systemctl stop nodered" >/usr/bin/node-red-stop -chmod +x /usr/bin/node-red-stop -echo "systemctl start nodered" >/usr/bin/node-red-start -chmod +x /usr/bin/node-red-start -echo "systemctl restart nodered" >/usr/bin/node-red-restart -chmod +x /usr/bin/node-red-restart -msg_ok "Installed Node-Red" + msg_info "Installing Node-Red" + $STD npm install -g --unsafe-perm node-red + echo "journalctl -f -n 100 -u nodered -o cat" >/usr/bin/node-red-log + chmod +x /usr/bin/node-red-log + echo "systemctl stop nodered" >/usr/bin/node-red-stop + chmod +x /usr/bin/node-red-stop + echo "systemctl start nodered" >/usr/bin/node-red-start + chmod +x /usr/bin/node-red-start + echo "systemctl restart nodered" >/usr/bin/node-red-restart + chmod +x /usr/bin/node-red-restart + msg_ok "Installed Node-Red" -msg_info "Creating Service" -service_path="/etc/systemd/system/nodered.service" -echo "[Unit] -Description=Node-RED -After=syslog.target network.target + msg_info "Creating Service" + service_path="/etc/systemd/system/nodered.service" + echo "[Unit] + Description=Node-RED + After=syslog.target network.target -[Service] -ExecStart=/usr/bin/node-red --max-old-space-size=128 -v -Restart=on-failure -KillSignal=SIGINT + [Service] + ExecStart=/usr/bin/node-red --max-old-space-size=128 -v + Restart=on-failure + KillSignal=SIGINT -SyslogIdentifier=node-red -StandardOutput=syslog + SyslogIdentifier=node-red + StandardOutput=syslog -WorkingDirectory=/root/ -User=root -Group=root + WorkingDirectory=/root/ + User=root + Group=root -[Install] -WantedBy=multi-user.target" >$service_path -systemctl enable -q --now nodered -msg_ok "Created Service" + [Install] + WantedBy=multi-user.target" >$service_path + systemctl enable -q --now nodered + msg_ok "Created Service" +} + +setup_alpine() { + msg_info "Installing Dependencies" + $STD apk add --no-cache \ + git \ + nodejs \ + npm + msg_ok "Installed Dependencies" + + msg_info "Creating Node-RED User" + adduser -D -H -s /sbin/nologin -G users nodered + msg_ok "Created Node-RED User" + + msg_info "Installing Node-RED" + $STD npm install -g --unsafe-perm node-red + msg_ok "Installed Node-RED" + + msg_info "Creating /home/nodered" + mkdir -p /home/nodered + chown -R nodered:users /home/nodered + chmod 750 /home/nodered + msg_ok "Created /home/nodered" + + msg_info "Creating Node-RED Service" + service_path="/etc/init.d/nodered" + + echo '#!/sbin/openrc-run + description="Node-RED Service" + + command="/usr/local/bin/node-red" + command_args="--max-old-space-size=128 -v" + command_user="nodered" + pidfile="/var/run/nodered.pid" + command_background="yes" + + depend() { + use net + }' >$service_path + + chmod +x $service_path + msg_ok "Created Node-RED Service" + + msg_info "Starting Node-RED" + $STD rc-update add nodered + $STD rc-service nodered start + msg_ok "Started Node-RED" +} + +run_os_setup motd_ssh customize diff --git a/install/ntfy-install.sh b/install/ntfy-install.sh index dbbac4af6..18b55e0d2 100644 --- a/install/ntfy-install.sh +++ b/install/ntfy-install.sh @@ -13,15 +13,29 @@ setting_up_container network_check update_os -msg_info "Setting up ntfy" -setup_deb822_repo \ - "ntfy" \ - "https://archive.ntfy.sh/apt/keyring.gpg" \ - "https://archive.ntfy.sh/apt/" \ - "stable" -$STD apt install -y ntfy -systemctl enable -q --now ntfy -msg_ok "Setup ntfy" +setup_deb_based() { + msg_info "Setting up ntfy" + setup_deb822_repo \ + "ntfy" \ + "https://archive.ntfy.sh/apt/keyring.gpg" \ + "https://archive.ntfy.sh/apt/" \ + "stable" + $STD apt install -y ntfy + systemctl enable -q --now ntfy + msg_ok "Setup ntfy" +} + +setup_alpine() { + msg_info "Installing ntfy" + $STD apk add --no-cache ntfy ntfy-openrc libcap + sed -i '/^listen-http/s/^\(.*\)$/#\1\n/' /etc/ntfy/server.yml + setcap 'cap_net_bind_service=+ep' /usr/bin/ntfy + $STD rc-update add ntfy default + $STD service ntfy start + msg_ok "Installed ntfy" +} + +run_os_setup motd_ssh customize diff --git a/install/postgresql-install.sh b/install/postgresql-install.sh index bc4e094a3..3c06507cd 100644 --- a/install/postgresql-install.sh +++ b/install/postgresql-install.sh @@ -13,124 +13,187 @@ setting_up_container network_check update_os -read -r -p "${TAB3}Enter PostgreSQL version (15/16/17/18): " ver -[[ $ver =~ ^(15|16|17|18)$ ]] || { - echo "Invalid version" - exit 64 +setup_deb_based() { + read -r -p "${TAB3}Enter PostgreSQL version (15/16/17/18): " ver + [[ $ver =~ ^(15|16|17|18)$ ]] || { + echo "Invalid version" + exit 64 + } + PG_VERSION=$ver setup_postgresql + + cat </etc/postgresql/$ver/main/pg_hba.conf + # PostgreSQL Client Authentication Configuration File + local all postgres peer + # TYPE DATABASE USER ADDRESS METHOD + # "local" is for Unix domain socket connections only + local all all md5 + # IPv4 local connections: + host all all 127.0.0.1/32 scram-sha-256 + host all all 0.0.0.0/24 md5 + # IPv6 local connections: + host all all ::1/128 scram-sha-256 + host all all 0.0.0.0/0 md5 + # Allow replication connections from localhost, by a user with the + # replication privilege. + local replication all peer + host replication all 127.0.0.1/32 scram-sha-256 + host replication all ::1/128 scram-sha-256 + EOF + + cat </etc/postgresql/$ver/main/postgresql.conf + # ----------------------------- + # PostgreSQL configuration file + # ----------------------------- + + #------------------------------------------------------------------------------ + # FILE LOCATIONS + #------------------------------------------------------------------------------ + + data_directory = '/var/lib/postgresql/$ver/main' + hba_file = '/etc/postgresql/$ver/main/pg_hba.conf' + ident_file = '/etc/postgresql/$ver/main/pg_ident.conf' + external_pid_file = '/var/run/postgresql/$ver-main.pid' + + #------------------------------------------------------------------------------ + # CONNECTIONS AND AUTHENTICATION + #------------------------------------------------------------------------------ + + # - Connection Settings - + + listen_addresses = '*' + port = 5432 + max_connections = 100 + unix_socket_directories = '/var/run/postgresql' + + # - SSL - + + ssl = on + ssl_cert_file = '/etc/ssl/certs/ssl-cert-snakeoil.pem' + ssl_key_file = '/etc/ssl/private/ssl-cert-snakeoil.key' + + #------------------------------------------------------------------------------ + # RESOURCE USAGE (except WAL) + #------------------------------------------------------------------------------ + + shared_buffers = 128MB + dynamic_shared_memory_type = posix + + #------------------------------------------------------------------------------ + # WRITE-AHEAD LOG + #------------------------------------------------------------------------------ + + max_wal_size = 1GB + min_wal_size = 80MB + + #------------------------------------------------------------------------------ + # REPORTING AND LOGGING + #------------------------------------------------------------------------------ + + # - What to Log - + + log_line_prefix = '%m [%p] %q%u@%d ' + log_timezone = 'Etc/UTC' + + #------------------------------------------------------------------------------ + # PROCESS TITLE + #------------------------------------------------------------------------------ + + cluster_name = '$ver/main' + + #------------------------------------------------------------------------------ + # CLIENT CONNECTION DEFAULTS + #------------------------------------------------------------------------------ + + # - Locale and Formatting - + + datestyle = 'iso, mdy' + timezone = 'Etc/UTC' + lc_messages = 'C' + lc_monetary = 'C' + lc_numeric = 'C' + lc_time = 'C' + default_text_search_config = 'pg_catalog.english' + + #------------------------------------------------------------------------------ + # CONFIG FILE INCLUDES + #------------------------------------------------------------------------------ + + include_dir = 'conf.d' + EOF + + systemctl restart postgresql + msg_ok "Installed PostgreSQL" + + read -r -p "${TAB3}Would you like to add Adminer? " prompt + if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then + msg_info "Installing Adminer" + $STD apt install -y adminer + $STD a2enconf adminer + systemctl reload apache2 + msg_ok "Installed Adminer" + fi } -PG_VERSION=$ver setup_postgresql -cat </etc/postgresql/$ver/main/pg_hba.conf -# PostgreSQL Client Authentication Configuration File -local all postgres peer -# TYPE DATABASE USER ADDRESS METHOD -# "local" is for Unix domain socket connections only -local all all md5 -# IPv4 local connections: -host all all 127.0.0.1/32 scram-sha-256 -host all all 0.0.0.0/24 md5 -# IPv6 local connections: -host all all ::1/128 scram-sha-256 -host all all 0.0.0.0/0 md5 -# Allow replication connections from localhost, by a user with the -# replication privilege. -local replication all peer -host replication all 127.0.0.1/32 scram-sha-256 -host replication all ::1/128 scram-sha-256 -EOF +setup_alpine() { + read -r -p "${TAB3}Enter PostgreSQL version (15/16/17): " ver + [[ $ver =~ ^(15|16|17)$ ]] || { echo "Invalid version"; exit 64; } -cat </etc/postgresql/$ver/main/postgresql.conf -# ----------------------------- -# PostgreSQL configuration file -# ----------------------------- + msg_info "Installing PostgreSQL ${ver}" + $STD apk add --no-cache postgresql${ver} postgresql${ver}-contrib postgresql${ver}-openrc sudo + msg_ok "Installed PostgreSQL ${ver}" -#------------------------------------------------------------------------------ -# FILE LOCATIONS -#------------------------------------------------------------------------------ + msg_info "Enabling PostgreSQL Service" + $STD rc-update add postgresql default + msg_ok "Enabled PostgreSQL Service" -data_directory = '/var/lib/postgresql/$ver/main' -hba_file = '/etc/postgresql/$ver/main/pg_hba.conf' -ident_file = '/etc/postgresql/$ver/main/pg_ident.conf' -external_pid_file = '/var/run/postgresql/$ver-main.pid' + msg_info "Starting PostgreSQL" + $STD rc-service postgresql start + msg_ok "Started PostgreSQL" -#------------------------------------------------------------------------------ -# CONNECTIONS AND AUTHENTICATION -#------------------------------------------------------------------------------ + msg_info "Configuring PostgreSQL for External Access" + conf_file="/etc/postgresql${ver}/postgresql.conf" + hba_file="/etc/postgresql${ver}/pg_hba.conf" + sed -i 's/^#listen_addresses =.*/listen_addresses = '\''*'\''/' "$conf_file" + sed -i '/^host\s\+all\s\+all\s\+127.0.0.1\/32\s\+md5/ s/.*/host all all 0.0.0.0\/0 md5/' "$hba_file" + $STD rc-service postgresql restart + msg_ok "Configured and Restarted PostgreSQL" -# - Connection Settings - + read -r -p "${TAB3}Would you like to install Adminer with lighttpd? : " prompt + if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then + msg_info "Installing Adminer and dependencies" + $STD apk add --no-cache \ + lighttpd \ + lighttpd-openrc \ + php83 \ + php83-cgi \ + php83-common \ + php83-curl \ + php83-gd \ + php83-mbstring \ + php83-pdo \ + php83-pgsql \ + php83-openssl \ + php83-zip \ + php83-session \ + jq -listen_addresses = '*' -port = 5432 -max_connections = 100 -unix_socket_directories = '/var/run/postgresql' + sed -i 's|# *include "mod_fastcgi.conf"|include "mod_fastcgi.conf"|' /etc/lighttpd/lighttpd.conf + sed -i 's|/usr/bin/php-cgi|/usr/bin/php-cgi83|g' /etc/lighttpd/mod_fastcgi.conf + mkdir -p /var/www/localhost/htdocs + ADMINER_VERSION=$(curl -fsSL https://api.github.com/repos/vrana/adminer/releases/latest | jq -r '.tag_name' | sed 's/^v//') + curl -fsSL "https://github.com/vrana/adminer/releases/download/v${ADMINER_VERSION}/adminer-${ADMINER_VERSION}.php" -o /var/www/localhost/htdocs/adminer.php + chown lighttpd:lighttpd /var/www/localhost/htdocs/adminer.php + chmod 755 /var/www/localhost/htdocs/adminer.php + msg_ok "Adminer Installed" -# - SSL - + msg_info "Starting Lighttpd" + $STD rc-update add lighttpd default + $STD rc-service lighttpd restart + msg_ok "Lighttpd Started" + fi +} -ssl = on -ssl_cert_file = '/etc/ssl/certs/ssl-cert-snakeoil.pem' -ssl_key_file = '/etc/ssl/private/ssl-cert-snakeoil.key' - -#------------------------------------------------------------------------------ -# RESOURCE USAGE (except WAL) -#------------------------------------------------------------------------------ - -shared_buffers = 128MB -dynamic_shared_memory_type = posix - -#------------------------------------------------------------------------------ -# WRITE-AHEAD LOG -#------------------------------------------------------------------------------ - -max_wal_size = 1GB -min_wal_size = 80MB - -#------------------------------------------------------------------------------ -# REPORTING AND LOGGING -#------------------------------------------------------------------------------ - -# - What to Log - - -log_line_prefix = '%m [%p] %q%u@%d ' -log_timezone = 'Etc/UTC' - -#------------------------------------------------------------------------------ -# PROCESS TITLE -#------------------------------------------------------------------------------ - -cluster_name = '$ver/main' - -#------------------------------------------------------------------------------ -# CLIENT CONNECTION DEFAULTS -#------------------------------------------------------------------------------ - -# - Locale and Formatting - - -datestyle = 'iso, mdy' -timezone = 'Etc/UTC' -lc_messages = 'C' -lc_monetary = 'C' -lc_numeric = 'C' -lc_time = 'C' -default_text_search_config = 'pg_catalog.english' - -#------------------------------------------------------------------------------ -# CONFIG FILE INCLUDES -#------------------------------------------------------------------------------ - -include_dir = 'conf.d' -EOF - -systemctl restart postgresql -msg_ok "Installed PostgreSQL" - -read -r -p "${TAB3}Would you like to add Adminer? " prompt -if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then - msg_info "Installing Adminer" - $STD apt install -y adminer - $STD a2enconf adminer - systemctl reload apache2 - msg_ok "Installed Adminer" -fi +run_os_setup motd_ssh customize diff --git a/install/prometheus-install.sh b/install/prometheus-install.sh index 3dee5990c..455ac53f8 100644 --- a/install/prometheus-install.sh +++ b/install/prometheus-install.sh @@ -13,36 +13,54 @@ setting_up_container network_check update_os -fetch_and_deploy_gh_release "prometheus" "prometheus/prometheus" "prebuild" "latest" "/usr/local/bin" "*linux-$(arch_resolve).tar.gz" +setup_deb_based() { + fetch_and_deploy_gh_release "prometheus" "prometheus/prometheus" "prebuild" "latest" "/usr/local/bin" "*linux-$(arch_resolve).tar.gz" -msg_info "Installing Prometheus" -mkdir -p /etc/prometheus -mkdir -p /var/lib/prometheus -mv /usr/local/bin/prometheus.yml /etc/prometheus/prometheus.yml -msg_ok "Installed Prometheus" + msg_info "Installing Prometheus" + mkdir -p /etc/prometheus + mkdir -p /var/lib/prometheus + mv /usr/local/bin/prometheus.yml /etc/prometheus/prometheus.yml + msg_ok "Installed Prometheus" -msg_info "Creating Service" -cat <<'EOF' >/etc/systemd/system/prometheus.service -[Unit] -Description=Prometheus -Wants=network-online.target -After=network-online.target + msg_info "Creating Service" + cat <<'EOF' >/etc/systemd/system/prometheus.service + [Unit] + Description=Prometheus + Wants=network-online.target + After=network-online.target -[Service] -User=root -Restart=always -Type=simple -ExecStart=/usr/local/bin/prometheus \ - --config.file=/etc/prometheus/prometheus.yml \ - --storage.tsdb.path=/var/lib/prometheus/ \ - --web.listen-address=0.0.0.0:9090 -ExecReload=/bin/kill -HUP $MAINPID + [Service] + User=root + Restart=always + Type=simple + ExecStart=/usr/local/bin/prometheus \ + --config.file=/etc/prometheus/prometheus.yml \ + --storage.tsdb.path=/var/lib/prometheus/ \ + --web.listen-address=0.0.0.0:9090 + ExecReload=/bin/kill -HUP $MAINPID -[Install] -WantedBy=multi-user.target -EOF -systemctl enable -q --now prometheus -msg_ok "Created Service" + [Install] + WantedBy=multi-user.target + EOF + systemctl enable -q --now prometheus + msg_ok "Created Service" +} + +setup_alpine() { + msg_info "Installing Prometheus" + $STD apk add --no-cache prometheus + msg_ok "Installed Prometheus" + + msg_info "Enabling Prometheus Service" + $STD rc-update add prometheus default + msg_ok "Enabled Prometheus Service" + + msg_info "Starting Prometheus" + $STD service prometheus start + msg_ok "Started Prometheus" +} + +run_os_setup motd_ssh customize diff --git a/install/rclone-install.sh b/install/rclone-install.sh index af3305a4c..9c0961f88 100644 --- a/install/rclone-install.sh +++ b/install/rclone-install.sh @@ -13,41 +13,92 @@ setting_up_container network_check update_os -msg_info "Installing Dependencies" -$STD apt install -y apache2-utils fuse3 -msg_ok "Installed Dependencies" +setup_deb_based() { + msg_info "Installing Dependencies" + $STD apt install -y apache2-utils fuse3 + msg_ok "Installed Dependencies" -fetch_and_deploy_gh_release "rclone" "rclone/rclone" "prebuild" "latest" "/opt/rclone" "rclone*linux-$(arch_resolve).zip" + fetch_and_deploy_gh_release "rclone" "rclone/rclone" "prebuild" "latest" "/opt/rclone" "rclone*linux-$(arch_resolve).zip" -msg_info "Installing rclone" -cd /opt/rclone -RCLONE_PASSWORD=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13) -$STD htpasswd -cb -B /opt/login.pwd admin "$RCLONE_PASSWORD" -cat <~/rclone.creds -rclone-Credentials -rclone User Name: admin -rclone Password: $RCLONE_PASSWORD -EOF -msg_ok "Installed rclone" + msg_info "Installing rclone" + cd /opt/rclone + RCLONE_PASSWORD=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13) + $STD htpasswd -cb -B /opt/login.pwd admin "$RCLONE_PASSWORD" + cat <~/rclone.creds + rclone-Credentials + rclone User Name: admin + rclone Password: $RCLONE_PASSWORD + EOF + msg_ok "Installed rclone" -msg_info "Creating Service" -cat </etc/systemd/system/rclone-web.service -[Unit] -Description=Rclone Web GUI -After=network-online.target + msg_info "Creating Service" + cat </etc/systemd/system/rclone-web.service + [Unit] + Description=Rclone Web GUI + After=network-online.target -[Service] -Type=simple -User=root -WorkingDirectory=/opt/rclone -ExecStart=/opt/rclone/rclone rcd --rc-web-gui --rc-web-gui-no-open-browser --rc-addr :3000 --rc-htpasswd /opt/login.pwd -Restart=on-failure + [Service] + Type=simple + User=root + WorkingDirectory=/opt/rclone + ExecStart=/opt/rclone/rclone rcd --rc-web-gui --rc-web-gui-no-open-browser --rc-addr :3000 --rc-htpasswd /opt/login.pwd + Restart=on-failure -[Install] -WantedBy=multi-user.target -EOF -systemctl enable -q --now rclone-web -msg_ok "Created Service" + [Install] + WantedBy=multi-user.target + EOF + systemctl enable -q --now rclone-web + msg_ok "Created Service" +} + +setup_alpine() { + msg_info "Installing dependencies" + $STD apk add --no-cache \ + apache2-utils fuse3 + msg_ok "Installed dependencies" + + msg_info "Installing rclone" + temp_file=$(mktemp) + mkdir -p /opt/rclone + RELEASE=$(curl -s https://api.github.com/repos/rclone/rclone/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') + curl -fsSL "https://github.com/rclone/rclone/releases/download/v${RELEASE}/rclone-v${RELEASE}-linux-$(arch_resolve).zip" -o "$temp_file" + $STD unzip -j "$temp_file" '*/**' -d /opt/rclone + cd /opt/rclone + RCLONE_PASSWORD=$(head -c 16 /dev/urandom | xxd -p -c 16) + $STD htpasswd -cb -B /opt/login.pwd admin "$RCLONE_PASSWORD" + cat <~/rclone.creds + rclone-Credentials + rclone User Name: admin + rclone Password: $RCLONE_PASSWORD + EOF + echo "${RELEASE}" >/opt/rclone_version.txt + rm -f "$temp_file" + msg_ok "Installed rclone" + + msg_info "Enabling rclone Service" + cat </etc/init.d/rclone + #!/sbin/openrc-run + description="rclone Service" + command="/opt/rclone/rclone" + command_args="rcd --rc-web-gui --rc-web-gui-no-open-browser --rc-addr :3000 --rc-htpasswd /opt/login.pwd" + command_background="true" + command_user="root" + pidfile="/var/run/rclone.pid" + + depend() { + use net + } + EOF + chmod +x /etc/init.d/rclone + $STD rc-update add rclone default + msg_ok "Enabled rclone Service" + + msg_info "Starting rclone" + $STD service rclone start + msg_ok "Started rclone" +} + +run_os_setup motd_ssh customize diff --git a/install/rustdeskserver-install.sh b/install/rustdeskserver-install.sh index 56b301cf6..5a10e0d1c 100644 --- a/install/rustdeskserver-install.sh +++ b/install/rustdeskserver-install.sh @@ -13,13 +13,120 @@ setting_up_container network_check update_os -fetch_and_deploy_gh_release "rustdesk-hbbr" "lejianwen/rustdesk-server" "binary" "latest" "/opt/rustdesk" "rustdesk-server-hbbr*$(arch_resolve).deb" -fetch_and_deploy_gh_release "rustdesk-hbbs" "lejianwen/rustdesk-server" "binary" "latest" "/opt/rustdesk" "rustdesk-server-hbbs*$(arch_resolve).deb" -fetch_and_deploy_gh_release "rustdesk-utils" "lejianwen/rustdesk-server" "binary" "latest" "/opt/rustdesk" "rustdesk-server-utils*$(arch_resolve).deb" -fetch_and_deploy_gh_release "rustdesk-api" "lejianwen/rustdesk-api" "binary" "latest" "/opt/rustdesk" "rustdesk-api-server*$(arch_resolve).deb" -systemctl enable -q --now rustdesk-hbbr -systemctl enable -q --now rustdesk-hbbs -systemctl enable -q --now rustdesk-api +setup_deb_based() { + fetch_and_deploy_gh_release "rustdesk-hbbr" "lejianwen/rustdesk-server" "binary" "latest" "/opt/rustdesk" "rustdesk-server-hbbr*$(arch_resolve).deb" + fetch_and_deploy_gh_release "rustdesk-hbbs" "lejianwen/rustdesk-server" "binary" "latest" "/opt/rustdesk" "rustdesk-server-hbbs*$(arch_resolve).deb" + fetch_and_deploy_gh_release "rustdesk-utils" "lejianwen/rustdesk-server" "binary" "latest" "/opt/rustdesk" "rustdesk-server-utils*$(arch_resolve).deb" + fetch_and_deploy_gh_release "rustdesk-api" "lejianwen/rustdesk-api" "binary" "latest" "/opt/rustdesk" "rustdesk-api-server*$(arch_resolve).deb" + systemctl enable -q --now rustdesk-hbbr + systemctl enable -q --now rustdesk-hbbs + systemctl enable -q --now rustdesk-api +} + +setup_alpine() { + RELEASE=$(curl -s https://api.github.com/repos/lejianwen/rustdesk-server/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') + msg_info "Installing RustDesk Server v${RELEASE}" + temp_file1=$(mktemp) + ARCH=$(arch_resolve "amd64" "arm64v8") + curl -fsSL "https://github.com/lejianwen/rustdesk-server/releases/download/${RELEASE}/rustdesk-server-linux-${ARCH}.zip" -o "$temp_file1" + $STD unzip "$temp_file1" + mv "$ARCH" /opt/rustdesk-server + mkdir -p /root/.config/rustdesk + cd /opt/rustdesk-server + ./rustdesk-utils genkeypair >/tmp/rustdesk_keys.txt + grep "Public Key" /tmp/rustdesk_keys.txt | awk '{print $3}' >/root/.config/rustdesk/id_ed25519.pub + grep "Secret Key" /tmp/rustdesk_keys.txt | awk '{print $3}' >/root/.config/rustdesk/id_ed25519 + chmod 600 /root/.config/rustdesk/id_ed25519 + chmod 644 /root/.config/rustdesk/id_ed25519.pub + rm /tmp/rustdesk_keys.txt + echo "${RELEASE}" >~/.rustdesk-server + msg_ok "Installed RustDesk Server v${RELEASE}" + + APIRELEASE=$(curl -s https://api.github.com/repos/lejianwen/rustdesk-api/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') + msg_info "Installing RustDesk API v${APIRELEASE}" + temp_file2=$(mktemp) + curl -fsSL "https://github.com/lejianwen/rustdesk-api/releases/download/v${APIRELEASE}/linux-$(arch_resolve).tar.gz" -o "$temp_file2" + $STD tar zxvf "$temp_file2" + mv release /opt/rustdesk-api + cd /opt/rustdesk-api + ADMINPASS=$(head -c 16 /dev/urandom | xxd -p -c 16) + $STD ./apimain reset-admin-pwd "$ADMINPASS" + cat <~/rustdesk.creds + RustDesk WebUI + + Username: admin + Password: $ADMINPASS + EOF + echo "${APIRELEASE}" >~/.rustdesk-api + msg_ok "Installed RustDesk API v${APIRELEASE}" + + msg_info "Enabling RustDesk Server Services" + cat </etc/init.d/rustdesk-server-hbbs + #!/sbin/openrc-run + description="RustDesk HBBS Service" + directory="/opt/rustdesk-server" + command="/opt/rustdesk-server/hbbs" + command_args="" + command_background="true" + command_user="root" + pidfile="/var/run/rustdesk-server-hbbs.pid" + output_log="/var/log/rustdesk-hbbs.log" + error_log="/var/log/rustdesk-hbbs.err" + + depend() { + use net + } + EOF + + cat </etc/init.d/rustdesk-server-hbbr + #!/sbin/openrc-run + description="RustDesk HBBR Service" + directory="/opt/rustdesk-server" + command="/opt/rustdesk-server/hbbr" + command_args="" + command_background="true" + command_user="root" + pidfile="/var/run/rustdesk-server-hbbr.pid" + output_log="/var/log/rustdesk-hbbr.log" + error_log="/var/log/rustdesk-hbbr.err" + + depend() { + use net + } + EOF + + cat </etc/init.d/rustdesk-api + #!/sbin/openrc-run + description="RustDesk API Service" + directory="/opt/rustdesk-api" + command="/opt/rustdesk-api/apimain" + command_args="" + command_background="true" + command_user="root" + pidfile="/var/run/rustdesk-api.pid" + output_log="/var/log/rustdesk-api.log" + error_log="/var/log/rustdesk-api.err" + + depend() { + use net + } + EOF + chmod +x /etc/init.d/rustdesk-server-hbbs + chmod +x /etc/init.d/rustdesk-server-hbbr + chmod +x /etc/init.d/rustdesk-api + $STD rc-update add rustdesk-server-hbbs default + $STD rc-update add rustdesk-server-hbbr default + $STD rc-update add rustdesk-api default + msg_ok "Enabled RustDesk Server Services" + + msg_info "Starting RustDesk Server" + $STD service rustdesk-server-hbbs start + $STD service rustdesk-server-hbbr start + $STD service rustdesk-api start + msg_ok "Started RustDesk Server" +} + +run_os_setup motd_ssh customize diff --git a/install/rustypaste-install.sh b/install/rustypaste-install.sh index 67c495058..a4250eaff 100644 --- a/install/rustypaste-install.sh +++ b/install/rustypaste-install.sh @@ -13,30 +13,73 @@ setting_up_container network_check update_os -fetch_and_deploy_gh_release "rustypaste" "orhun/rustypaste" "prebuild" "latest" "/opt/rustypaste" "*x86_64-unknown-linux-gnu.tar.gz" -fetch_and_deploy_gh_release "rustypaste-cli" "orhun/rustypaste-cli" "prebuild" "latest" "/usr/local/bin" "*x86_64-unknown-linux-gnu.tar.gz" +setup_deb_based() { + fetch_and_deploy_gh_release "rustypaste" "orhun/rustypaste" "prebuild" "latest" "/opt/rustypaste" "*x86_64-unknown-linux-gnu.tar.gz" + fetch_and_deploy_gh_release "rustypaste-cli" "orhun/rustypaste-cli" "prebuild" "latest" "/usr/local/bin" "*x86_64-unknown-linux-gnu.tar.gz" -msg_info "Setting up RustyPaste" -cd /opt/rustypaste -sed -i 's|^address = ".*"|address = "0.0.0.0:8000"|' config.toml -msg_ok "Set up RustyPaste" + msg_info "Setting up RustyPaste" + cd /opt/rustypaste + sed -i 's|^address = ".*"|address = "0.0.0.0:8000"|' config.toml + msg_ok "Set up RustyPaste" -msg_info "Creating Service" -cat </etc/systemd/system/rustypaste.service -[Unit] -Description=rustypaste Service -After=network.target + msg_info "Creating Service" + cat </etc/systemd/system/rustypaste.service + [Unit] + Description=rustypaste Service + After=network.target -[Service] -WorkingDirectory=/opt/rustypaste -ExecStart=/opt/rustypaste/rustypaste -Restart=always + [Service] + WorkingDirectory=/opt/rustypaste + ExecStart=/opt/rustypaste/rustypaste + Restart=always -[Install] -WantedBy=multi-user.target -EOF -systemctl enable -q --now rustypaste -msg_ok "Created Service" + [Install] + WantedBy=multi-user.target + EOF + systemctl enable -q --now rustypaste + msg_ok "Created Service" +} + +setup_alpine() { + msg_info "Installing RustyPaste" + $STD apk add --no-cache rustypaste --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community + msg_ok "Installed RustyPaste" + + msg_info "Configuring RustyPaste" + mkdir -p /var/lib/rustypaste + sed -i 's|^address = ".*"|address = "0.0.0.0:8000"|' /etc/rustypaste/config.toml + msg_ok "Configured RustyPaste" + + msg_info "Creating Service" + cat <<'EOF' >/etc/init.d/rustypaste + #!/sbin/openrc-run + + name="rustypaste" + description="RustyPaste - A minimal file upload/pastebin service" + command="/usr/bin/rustypaste" + command_args="" + command_user="root" + command_background=true + pidfile="/run/${RC_SVCNAME}.pid" + directory="/var/lib/rustypaste" + + depend() { + need net + after firewall + } + + start_pre() { + export CONFIG=/etc/rustypaste/config.toml + checkpath --directory --owner root:root --mode 0755 /var/lib/rustypaste + } + EOF + chmod +x /etc/init.d/rustypaste + $STD rc-update add rustypaste default + $STD rc-service rustypaste start + msg_ok "Created Service" +} + +run_os_setup motd_ssh customize diff --git a/install/syncthing-install.sh b/install/syncthing-install.sh index f4a347e52..332f6e368 100644 --- a/install/syncthing-install.sh +++ b/install/syncthing-install.sh @@ -13,20 +13,42 @@ setting_up_container network_check update_os -setup_deb822_repo \ - "syncthing" \ - "https://syncthing.net/release-key.gpg" \ - "https://apt.syncthing.net/" \ - "syncthing" \ - "stable-v2" +setup_deb_based() { + setup_deb822_repo \ + "syncthing" \ + "https://syncthing.net/release-key.gpg" \ + "https://apt.syncthing.net/" \ + "syncthing" \ + "stable-v2" -msg_info "Setting up Syncthing" -$STD apt install -y syncthing -systemctl enable -q --now syncthing@root -sleep 5 -sed -i "{s/127.0.0.1:8384/0.0.0.0:8384/g}" /root/.local/state/syncthing/config.xml -systemctl restart syncthing@root -msg_ok "Setup Syncthing" + msg_info "Setting up Syncthing" + $STD apt install -y syncthing + systemctl enable -q --now syncthing@root + sleep 5 + sed -i "{s/127.0.0.1:8384/0.0.0.0:8384/g}" /root/.local/state/syncthing/config.xml + systemctl restart syncthing@root + msg_ok "Setup Syncthing" +} + +setup_alpine() { + msg_info "Setup Syncthing" + $STD apk add --no-cache syncthing + rc-service syncthing start + sleep 3 + rc-service syncthing stop + sed -i "{s/127.0.0.1:8384/0.0.0.0:8384/g}" /var/lib/syncthing/.local/state/syncthing/config.xml + msg_ok "Setup Syncthing" + + msg_info "Enabling Syncthing Service" + $STD rc-update add syncthing default + msg_ok "Enabled Syncthing Service" + + msg_info "Starting Syncthing" + $STD rc-service syncthing start + msg_ok "Started Syncthing" +} + +run_os_setup motd_ssh customize diff --git a/install/teamspeak-server-install.sh b/install/teamspeak-server-install.sh index 110b4f3c5..25f5425c0 100644 --- a/install/teamspeak-server-install.sh +++ b/install/teamspeak-server-install.sh @@ -13,39 +13,91 @@ setting_up_container network_check update_os -RELEASE=$(curl -fsSL https://teamspeak.com/en/downloads/#server | grep -oP 'teamspeak3-server_linux_amd64-\K[0-9]+\.[0-9]+\.[0-9]+' | head -1) +setup_deb_based() { + RELEASE=$(curl -fsSL https://teamspeak.com/en/downloads/#server | grep -oP 'teamspeak3-server_linux_amd64-\K[0-9]+\.[0-9]+\.[0-9]+' | head -1) -msg_info "Setting up Teamspeak Server" -curl -fsSL "https://files.teamspeak-services.com/releases/server/${RELEASE}/teamspeak3-server_linux_amd64-${RELEASE}.tar.bz2" -o ts3server.tar.bz2 -tar -xf ./ts3server.tar.bz2 -mv teamspeak3-server_linux_amd64/ /opt/teamspeak-server/ -touch /opt/teamspeak-server/.ts3server_license_accepted -rm -f ~/ts3server.tar.bz* -echo "${RELEASE}" >~/.teamspeak-server -msg_ok "Setup Teamspeak Server" + msg_info "Setting up Teamspeak Server" + curl -fsSL "https://files.teamspeak-services.com/releases/server/${RELEASE}/teamspeak3-server_linux_amd64-${RELEASE}.tar.bz2" -o ts3server.tar.bz2 + tar -xf ./ts3server.tar.bz2 + mv teamspeak3-server_linux_amd64/ /opt/teamspeak-server/ + touch /opt/teamspeak-server/.ts3server_license_accepted + rm -f ~/ts3server.tar.bz* + echo "${RELEASE}" >~/.teamspeak-server + msg_ok "Setup Teamspeak Server" -msg_info "Creating service" -cat </etc/systemd/system/teamspeak-server.service -[Unit] -Description=TeamSpeak3 Server -Wants=network-online.target -After=network.target + msg_info "Creating service" + cat </etc/systemd/system/teamspeak-server.service + [Unit] + Description=TeamSpeak3 Server + Wants=network-online.target + After=network.target -[Service] -WorkingDirectory=/opt/teamspeak-server -User=root -Type=forking -ExecStart=/opt/teamspeak-server/ts3server_startscript.sh start -ExecStop=/opt/teamspeak-server/ts3server_startscript.sh stop -ExecReload=/opt/teamspeak-server/ts3server_startscript.sh restart -Restart=always -RestartSec=15 + [Service] + WorkingDirectory=/opt/teamspeak-server + User=root + Type=forking + ExecStart=/opt/teamspeak-server/ts3server_startscript.sh start + ExecStop=/opt/teamspeak-server/ts3server_startscript.sh stop + ExecReload=/opt/teamspeak-server/ts3server_startscript.sh restart + Restart=always + RestartSec=15 -[Install] -WantedBy=multi-user.target -EOF -systemctl enable -q --now teamspeak-server -msg_ok "Created service" + [Install] + WantedBy=multi-user.target + EOF + systemctl enable -q --now teamspeak-server + msg_ok "Created service" +} + +setup_alpine() { + msg_info "Installing dependencies" + $STD apk add --no-cache \ + ca-certificates \ + libstdc++ \ + libc6-compat + msg_ok "Installed dependencies" + + RELEASE=$(curl -fsSL https://teamspeak.com/en/downloads/#server | sed -n 's/.*teamspeak3-server_linux_amd64-\([0-9.]*[0-9]\).*/\1/p' | awk 'NR==1') + msg_info "Installing Teamspeak Server v${RELEASE}" + mkdir -p /opt/teamspeak-server + cd /opt/teamspeak-server + curl -fsSL "https://files.teamspeak-services.com/releases/server/${RELEASE}/teamspeak3-server_linux_amd64-${RELEASE}.tar.bz2" -o ts3server.tar.bz2 + tar xf ts3server.tar.bz2 --strip-components=1 + mkdir -p logs data lib + mv *.so lib + touch data/ts3server.sqlitedb data/query_ip_blacklist.txt data/query_ip_whitelist.txt .ts3server_license_accepted + echo "${RELEASE}" >~/.teamspeak-server + msg_ok "Installed TeamSpeak Server v${RELEASE}" + + msg_info "Enabling TeamSpeak Server Service" + cat </etc/init.d/teamspeak + #!/sbin/openrc-run + + name="TeamSpeak Server" + description="TeamSpeak 3 Server" + command="/opt/teamspeak-server/ts3server_startscript.sh" + command_args="start" + output_log="/var/log/teamspeak.out.log" + error_log="/var/log/teamspeak.err.log" + command_background=true + pidfile="/run/teamspeak-server.pid" + directory="/opt/teamspeak-server" + + depend() { + need net + use dns + } + EOF + chmod +x /etc/init.d/teamspeak + $STD rc-update add teamspeak default + msg_ok "Enabled TeamSpeak Server Service" + + msg_info "Starting TeamSpeak Server" + $STD service teamspeak start + msg_ok "Started TeamSpeak Server" +} + +run_os_setup motd_ssh customize diff --git a/install/tinyauth-install.sh b/install/tinyauth-install.sh index 85db46eb7..4838a9217 100644 --- a/install/tinyauth-install.sh +++ b/install/tinyauth-install.sh @@ -13,49 +13,111 @@ setting_up_container network_check update_os -msg_info "Installing Dependencies" -$STD apt install -y \ - openssl \ - apache2-utils -msg_ok "Installed Dependencies" +setup_deb_based() { + msg_info "Installing Dependencies" + $STD apt install -y \ + openssl \ + apache2-utils + msg_ok "Installed Dependencies" -fetch_and_deploy_gh_release "tinyauth" "steveiliop56/tinyauth" "singlefile" "latest" "/opt/tinyauth" "tinyauth-$(arch_resolve)" + fetch_and_deploy_gh_release "tinyauth" "steveiliop56/tinyauth" "singlefile" "latest" "/opt/tinyauth" "tinyauth-$(arch_resolve)" -msg_info "Setting up Tinyauth" -PASS=$(openssl rand -base64 8 | tr -dc 'a-zA-Z0-9' | head -c 8) -USER=$(htpasswd -Bbn "tinyauth" "${PASS}") -cat </opt/tinyauth/credentials.txt -Tinyauth Credentials -Username: tinyauth -Password: ${PASS} -EOF -msg_ok "Set up Tinyauth" + msg_info "Setting up Tinyauth" + PASS=$(openssl rand -base64 8 | tr -dc 'a-zA-Z0-9' | head -c 8) + USER=$(htpasswd -Bbn "tinyauth" "${PASS}") + cat </opt/tinyauth/credentials.txt + Tinyauth Credentials + Username: tinyauth + Password: ${PASS} + EOF + msg_ok "Set up Tinyauth" -read -r -p "${TAB3}Enter your Tinyauth subdomain (e.g. https://tinyauth.example.com): " app_url + read -r -p "${TAB3}Enter your Tinyauth subdomain (e.g. https://tinyauth.example.com): " app_url -msg_info "Creating Service" -cat </opt/tinyauth/.env -TINYAUTH_DATABASE_PATH=/opt/tinyauth/database.db -TINYAUTH_AUTH_USERS='${USER}' -TINYAUTH_APPURL=${app_url} -EOF -cat </etc/systemd/system/tinyauth.service -[Unit] -Description=Tinyauth Service -After=network.target + msg_info "Creating Service" + cat </opt/tinyauth/.env + TINYAUTH_DATABASE_PATH=/opt/tinyauth/database.db + TINYAUTH_AUTH_USERS='${USER}' + TINYAUTH_APPURL=${app_url} + EOF + cat </etc/systemd/system/tinyauth.service + [Unit] + Description=Tinyauth Service + After=network.target -[Service] -Type=simple -EnvironmentFile=/opt/tinyauth/.env -ExecStart=/opt/tinyauth/tinyauth -WorkingDirectory=/opt/tinyauth -Restart=on-failure + [Service] + Type=simple + EnvironmentFile=/opt/tinyauth/.env + ExecStart=/opt/tinyauth/tinyauth + WorkingDirectory=/opt/tinyauth + Restart=on-failure -[Install] -WantedBy=multi-user.target -EOF -systemctl enable -q --now tinyauth -msg_ok "Created Service" + [Install] + WantedBy=multi-user.target + EOF + systemctl enable -q --now tinyauth + msg_ok "Created Service" +} + +setup_alpine() { + msg_info "Installing Dependencies" + $STD apk add --no-cache openssl apache2-utils + msg_ok "Installed Dependencies" + + msg_info "Installing Tinyauth" + mkdir -p /opt/tinyauth + RELEASE=$(curl -s https://api.github.com/repos/tinyauthapp/tinyauth/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') + curl -fsSL "https://github.com/tinyauthapp/tinyauth/releases/download/v${RELEASE}/tinyauth-$(arch_resolve)" -o /opt/tinyauth/tinyauth + chmod +x /opt/tinyauth/tinyauth + PASS=$(openssl rand -base64 8 | tr -dc 'a-zA-Z0-9' | head -c 8) + USER=$(htpasswd -Bbn "tinyauth" "${PASS}") + + cat </opt/tinyauth/credentials.txt + Tinyauth Credentials + Username: tinyauth + Password: ${PASS} + EOF + echo "${RELEASE}" >~/.tinyauth + msg_ok "Installed Tinyauth" + + read -r -p "${TAB3}Enter your Tinyauth subdomain (e.g. https://tinyauth.example.com): " app_url + + cat </opt/tinyauth/.env + TINYAUTH_DATABASE_PATH=/opt/tinyauth/database.db + TINYAUTH_AUTH_USERS='${USER}' + TINYAUTH_APPURL=${app_url} + EOF + + msg_info "Creating Service" + cat <<'EOF' >/etc/init.d/tinyauth + #!/sbin/openrc-run + description="Tinyauth Service" + + set -a + ENV_FILE="/opt/tinyauth/.env" + [ -f "$ENV_FILE" ] && . "$ENV_FILE" + set +a + + command="/opt/tinyauth/tinyauth" + directory="/opt/tinyauth" + command_user="root" + command_background="true" + pidfile="/var/run/tinyauth.pid" + + depend() { + use net + } + EOF + chmod +x /etc/init.d/tinyauth + $STD rc-update add tinyauth default + msg_ok "Enabled Tinyauth Service" + + msg_info "Starting Tinyauth" + $STD service tinyauth start + msg_ok "Started Tinyauth" +} + +run_os_setup motd_ssh customize diff --git a/install/traefik-install.sh b/install/traefik-install.sh index 950fb8b79..a51b4d14d 100644 --- a/install/traefik-install.sh +++ b/install/traefik-install.sh @@ -13,85 +13,113 @@ setting_up_container network_check update_os -msg_info "Installing Dependencies" -$STD apt install -y apt-transport-https -msg_ok "Installed Dependencies" +setup_deb_based() { + msg_info "Installing Dependencies" + $STD apt install -y apt-transport-https + msg_ok "Installed Dependencies" -fetch_and_deploy_gh_release "traefik" "traefik/traefik" "prebuild" "latest" "/usr/bin" "traefik_v*_linux_$(arch_resolve).tar.gz" -mkdir -p /etc/traefik/{conf.d,ssl} + fetch_and_deploy_gh_release "traefik" "traefik/traefik" "prebuild" "latest" "/usr/bin" "traefik_v*_linux_$(arch_resolve).tar.gz" + mkdir -p /etc/traefik/{conf.d,ssl} -msg_info "Creating Traefik configuration" -cat </etc/traefik/traefik.yaml -providers: - file: - directory: /etc/traefik/conf.d/ + msg_info "Creating Traefik configuration" + cat </etc/traefik/traefik.yaml + providers: + file: + directory: /etc/traefik/conf.d/ -entryPoints: - web: - address: ':80' - http: - redirections: - entryPoint: - to: websecure - scheme: https - websecure: - address: ':443' - http: - tls: - certResolver: letsencrypt - traefik: - address: ':8080' + entryPoints: + web: + address: ':80' + http: + redirections: + entryPoint: + to: websecure + scheme: https + websecure: + address: ':443' + http: + tls: + certResolver: letsencrypt + traefik: + address: ':8080' -certificatesResolvers: - letsencrypt: - acme: - email: "foo@bar.com" - storage: /etc/traefik/ssl/acme.json - tlsChallenge: {} + certificatesResolvers: + letsencrypt: + acme: + email: "foo@bar.com" + storage: /etc/traefik/ssl/acme.json + tlsChallenge: {} -api: - dashboard: true - insecure: true + api: + dashboard: true + insecure: true -log: - filePath: /var/log/traefik/traefik.log - format: json - level: INFO + log: + filePath: /var/log/traefik/traefik.log + format: json + level: INFO -accessLog: - filePath: /var/log/traefik/traefik-access.log - format: json - filters: - statusCodes: - - "200" - - "400-599" - retryAttempts: true - minDuration: "10ms" - bufferingSize: 0 - fields: - headers: - defaultMode: drop - names: - User-Agent: keep -EOF -msg_ok "Created Traefik configuration" + accessLog: + filePath: /var/log/traefik/traefik-access.log + format: json + filters: + statusCodes: + - "200" + - "400-599" + retryAttempts: true + minDuration: "10ms" + bufferingSize: 0 + fields: + headers: + defaultMode: drop + names: + User-Agent: keep + EOF + msg_ok "Created Traefik configuration" -msg_info "Creating Service" -cat <<'EOF' >/etc/systemd/system/traefik.service -[Unit] -Description=Traefik is an open-source Edge Router that makes publishing your services a fun and easy experience + msg_info "Creating Service" + cat <<'EOF' >/etc/systemd/system/traefik.service + [Unit] + Description=Traefik is an open-source Edge Router that makes publishing your services a fun and easy experience -[Service] -Type=notify -ExecStart=/usr/bin/traefik --configFile=/etc/traefik/traefik.yaml -Restart=on-failure -ExecReload=/bin/kill -USR1 \$MAINPID + [Service] + Type=notify + ExecStart=/usr/bin/traefik --configFile=/etc/traefik/traefik.yaml + Restart=on-failure + ExecReload=/bin/kill -USR1 \$MAINPID -[Install] -WantedBy=multi-user.target -EOF -systemctl enable -q --now traefik -msg_ok "Created Service" + [Install] + WantedBy=multi-user.target + EOF + systemctl enable -q --now traefik + msg_ok "Created Service" +} + +setup_alpine() { + msg_info "Installing Dependencies" + $STD apk add ca-certificates + $STD update-ca-certificates + msg_ok "Installed Dependencies" + + msg_info "Installing Traefik" + $STD apk add traefik --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community + msg_ok "Installed Traefik" + + read -p "${TAB3}Enable Traefik WebUI (Port 8080)? [y/N]: " enable_webui + if [[ "$enable_webui" =~ ^[Yy]$ ]]; then + msg_info "Configuring Traefik WebUI" + sed -i 's/localhost//g' /etc/traefik/traefik.yaml + msg_ok "Configured Traefik WebUI" + fi + + msg_info "Enabling and starting Traefik service" + $STD rc-update add traefik default + sed -i '/^command=.*/i directory="/etc/traefik"' /etc/init.d/traefik + $STD rc-service traefik start + msg_ok "Traefik service started" +} + +run_os_setup motd_ssh customize diff --git a/install/transmission-install.sh b/install/transmission-install.sh index 5d0018c86..1523358c1 100644 --- a/install/transmission-install.sh +++ b/install/transmission-install.sh @@ -13,12 +13,34 @@ setting_up_container network_check update_os -msg_info "Installing Transmission" -$STD apt install -y transmission-daemon -systemctl stop transmission-daemon -sed -i '{s/"rpc-whitelist-enabled": true/"rpc-whitelist-enabled": false/g; s/"rpc-host-whitelist-enabled": true,/"rpc-host-whitelist-enabled": false,/g}' /etc/transmission-daemon/settings.json -systemctl start transmission-daemon -msg_ok "Installed Transmission" +setup_deb_based() { + msg_info "Installing Transmission" + $STD apt install -y transmission-daemon + systemctl stop transmission-daemon + sed -i '{s/"rpc-whitelist-enabled": true/"rpc-whitelist-enabled": false/g; s/"rpc-host-whitelist-enabled": true,/"rpc-host-whitelist-enabled": false,/g}' /etc/transmission-daemon/settings.json + systemctl start transmission-daemon + msg_ok "Installed Transmission" +} + +setup_alpine() { + msg_info "Installing Transmission" + $STD apk add --no-cache transmission-cli transmission-daemon + $STD rc-service transmission-daemon start + sleep 5 + $STD rc-service transmission-daemon stop + sed -i '{s/"rpc-whitelist-enabled": true/"rpc-whitelist-enabled": false/g; s/"rpc-host-whitelist-enabled": true,/"rpc-host-whitelist-enabled": false,/g}' /var/lib/transmission/config/settings.json + msg_ok "Installed Transmission" + + msg_info "Enabling Transmission Service" + $STD rc-update add transmission-daemon default + msg_ok "Enabled Transmission Service" + + msg_info "Starting Transmission" + $STD rc-service transmission-daemon start + msg_ok "Started Transmission" +} + +run_os_setup motd_ssh customize diff --git a/install/valkey-install.sh b/install/valkey-install.sh index e6aa2904b..2d7839503 100644 --- a/install/valkey-install.sh +++ b/install/valkey-install.sh @@ -13,65 +13,97 @@ setting_up_container network_check update_os -msg_info "Installing Valkey" -$STD apt update -$STD apt install -y valkey openssl -sed -i 's/^bind .*/bind 0.0.0.0/' /etc/valkey/valkey.conf +setup_deb_based() { + msg_info "Installing Valkey" + $STD apt update + $STD apt install -y valkey openssl + sed -i 's/^bind .*/bind 0.0.0.0/' /etc/valkey/valkey.conf -PASS="$(openssl rand -base64 48 | tr -dc 'a-zA-Z0-9' | head -c32)" -echo "requirepass $PASS" >>/etc/valkey/valkey.conf -echo "$PASS" >~/valkey.creds -chmod 600 ~/valkey.creds + PASS="$(openssl rand -base64 48 | tr -dc 'a-zA-Z0-9' | head -c32)" + echo "requirepass $PASS" >>/etc/valkey/valkey.conf + echo "$PASS" >~/valkey.creds + chmod 600 ~/valkey.creds -MEMTOTAL_MB=$(free -m | grep ^Mem: | awk '{print $2}') -# reserve 25% of a node type's maxmemory value for system use -MAXMEMORY_MB=$((MEMTOTAL_MB * 75 / 100)) + MEMTOTAL_MB=$(free -m | grep ^Mem: | awk '{print $2}') + # reserve 25% of a node type's maxmemory value for system use + MAXMEMORY_MB=$((MEMTOTAL_MB * 75 / 100)) -echo "" >>/etc/valkey/valkey.conf -echo "# Memory-optimized settings for small-scale deployments" >>/etc/valkey/valkey.conf -echo "maxmemory ${MAXMEMORY_MB}mb" >>/etc/valkey/valkey.conf -echo "maxmemory-policy allkeys-lru" >>/etc/valkey/valkey.conf -echo "maxmemory-samples 10" >>/etc/valkey/valkey.conf -msg_ok "Installed Valkey" + echo "" >>/etc/valkey/valkey.conf + echo "# Memory-optimized settings for small-scale deployments" >>/etc/valkey/valkey.conf + echo "maxmemory ${MAXMEMORY_MB}mb" >>/etc/valkey/valkey.conf + echo "maxmemory-policy allkeys-lru" >>/etc/valkey/valkey.conf + echo "maxmemory-samples 10" >>/etc/valkey/valkey.conf + msg_ok "Installed Valkey" -echo -read -r -p "${TAB3}Enable TLS for Valkey (Sentinel mode does not supported)? [y/N]: " prompt -if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then - read -r -p "${TAB3}Use TLS-only mode (disable TCP port 6379)? [y/N]: " tls_only - msg_info "Configuring TLS for Valkey..." + echo + read -r -p "${TAB3}Enable TLS for Valkey (Sentinel mode does not supported)? [y/N]: " prompt + if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then + read -r -p "${TAB3}Use TLS-only mode (disable TCP port 6379)? [y/N]: " tls_only + msg_info "Configuring TLS for Valkey..." - create_self_signed_cert "Valkey" - TLS_DIR="/etc/ssl/valkey" - TLS_CERT="$TLS_DIR/valkey.crt" - TLS_KEY="$TLS_DIR/valkey.key" - chown valkey:valkey "$TLS_CERT" "$TLS_KEY" + create_self_signed_cert "Valkey" + TLS_DIR="/etc/ssl/valkey" + TLS_CERT="$TLS_DIR/valkey.crt" + TLS_KEY="$TLS_DIR/valkey.key" + chown valkey:valkey "$TLS_CERT" "$TLS_KEY" - if [[ ${tls_only,,} =~ ^(y|yes)$ ]]; then - cat </etc/valkey/valkey.conf + if [[ ${tls_only,,} =~ ^(y|yes)$ ]]; then + cat </etc/valkey/valkey.conf -# TLS configuration generated by Proxmox VE Valkey helper-script -port 0 -tls-port 6379 -tls-cert-file $TLS_DIR/valkey.crt -tls-key-file $TLS_DIR/valkey.key -tls-auth-clients no -EOF - msg_ok "Enabled TLS-only mode on port 6379" - else - cat </etc/valkey/valkey.conf + # TLS configuration generated by Proxmox VE Valkey helper-script + port 0 + tls-port 6379 + tls-cert-file $TLS_DIR/valkey.crt + tls-key-file $TLS_DIR/valkey.key + tls-auth-clients no + EOF + msg_ok "Enabled TLS-only mode on port 6379" + else + cat </etc/valkey/valkey.conf -# TLS configuration generated by Proxmox VE Valkey helper-script -tls-port 6380 -tls-cert-file $TLS_DIR/valkey.crt -tls-key-file $TLS_DIR/valkey.key -tls-auth-clients no -EOF - msg_ok "Enabled TLS on port 6380 and TCP on 6379" - fi -fi + # TLS configuration generated by Proxmox VE Valkey helper-script + tls-port 6380 + tls-cert-file $TLS_DIR/valkey.crt + tls-key-file $TLS_DIR/valkey.key + tls-auth-clients no + EOF + msg_ok "Enabled TLS on port 6380 and TCP on 6379" + fi + fi -systemctl enable -q --now valkey-server -systemctl restart valkey-server + systemctl enable -q --now valkey-server + systemctl restart valkey-server +} + +setup_alpine() { + msg_info "Installing Valkey" + $STD apk add valkey valkey-openrc valkey-cli + sed -i 's/^bind .*/bind 0.0.0.0/' /etc/valkey/valkey.conf + + PASS="$(head -c 100 /dev/urandom | tr -dc 'a-zA-Z0-9' | head -c32)" + echo "requirepass $PASS" >>/etc/valkey/valkey.conf + echo "$PASS" >~/valkey.creds + chmod 600 ~/valkey.creds + + MEMTOTAL_MB=$(free -m | grep ^Mem: | awk '{print $2}') + MAXMEMORY_MB=$((MEMTOTAL_MB * 75 / 100)) + + cat </etc/valkey/valkey.conf + # Memory-optimized settings for small-scale deployments + maxmemory ${MAXMEMORY_MB}mb + maxmemory-policy allkeys-lru + maxmemory-samples 10 + EOF + msg_ok "Installed Valkey" + + # Note: Alpine's valkey package is compiled without TLS support + # For TLS, use the Debian-based valkey script instead + + $STD rc-update add valkey default + $STD rc-service valkey start +} + +run_os_setup motd_ssh customize diff --git a/install/vaultwarden-install.sh b/install/vaultwarden-install.sh index 9c2858148..3298724cb 100644 --- a/install/vaultwarden-install.sh +++ b/install/vaultwarden-install.sh @@ -13,92 +13,124 @@ setting_up_container network_check update_os -msg_info "Installing Dependencies" -$STD apt install -y \ - build-essential \ - pkgconf \ - libssl-dev \ - libmariadb-dev-compat \ - libpq-dev \ - argon2 \ - ssl-cert -msg_ok "Installed Dependencies" +setup_deb_based() { + msg_info "Installing Dependencies" + $STD apt install -y \ + build-essential \ + pkgconf \ + libssl-dev \ + libmariadb-dev-compat \ + libpq-dev \ + argon2 \ + ssl-cert + msg_ok "Installed Dependencies" -setup_rust -fetch_and_deploy_gh_release "vaultwarden" "dani-garcia/vaultwarden" "tarball" "latest" "/tmp/vaultwarden-src" + setup_rust + fetch_and_deploy_gh_release "vaultwarden" "dani-garcia/vaultwarden" "tarball" "latest" "/tmp/vaultwarden-src" -msg_info "Building Vaultwarden (Patience)" -cd /tmp/vaultwarden-src -VW_VERSION=$(get_latest_github_release "dani-garcia/vaultwarden") -export VW_VERSION -$STD cargo build --features "sqlite,mysql,postgresql" --release -msg_ok "Built Vaultwarden" + msg_info "Building Vaultwarden (Patience)" + cd /tmp/vaultwarden-src + VW_VERSION=$(get_latest_github_release "dani-garcia/vaultwarden") + export VW_VERSION + $STD cargo build --features "sqlite,mysql,postgresql" --release + msg_ok "Built Vaultwarden" -msg_info "Setting up Vaultwarden" -$STD addgroup --system vaultwarden -$STD adduser --system --home /opt/vaultwarden --shell /usr/sbin/nologin --no-create-home --gecos 'vaultwarden' --ingroup vaultwarden --disabled-login --disabled-password vaultwarden -mkdir -p /opt/vaultwarden/{bin,data,web-vault} -cp target/release/vaultwarden /opt/vaultwarden/bin/ -cd ~ && rm -rf /tmp/vaultwarden-src -msg_ok "Set up Vaultwarden" + msg_info "Setting up Vaultwarden" + $STD addgroup --system vaultwarden + $STD adduser --system --home /opt/vaultwarden --shell /usr/sbin/nologin --no-create-home --gecos 'vaultwarden' --ingroup vaultwarden --disabled-login --disabled-password vaultwarden + mkdir -p /opt/vaultwarden/{bin,data,web-vault} + cp target/release/vaultwarden /opt/vaultwarden/bin/ + cd ~ && rm -rf /tmp/vaultwarden-src + msg_ok "Set up Vaultwarden" -fetch_and_deploy_gh_release "vaultwarden_webvault" "dani-garcia/bw_web_builds" "prebuild" "latest" "/opt/vaultwarden/web-vault" "bw_web_*.tar.gz" + fetch_and_deploy_gh_release "vaultwarden_webvault" "dani-garcia/bw_web_builds" "prebuild" "latest" "/opt/vaultwarden/web-vault" "bw_web_*.tar.gz" -msg_info "Configuring Vaultwarden" -cat </opt/vaultwarden/.env -ADMIN_TOKEN='' -ROCKET_ADDRESS=0.0.0.0 -ROCKET_TLS='{certs="/opt/vaultwarden/ssl-cert-snakeoil.pem",key="/opt/vaultwarden/ssl-cert-snakeoil.key"}' -DATA_FOLDER=/opt/vaultwarden/data -DATABASE_MAX_CONNS=10 -WEB_VAULT_FOLDER=/opt/vaultwarden/web-vault -WEB_VAULT_ENABLED=true -EOF -mv /etc/ssl/certs/ssl-cert-snakeoil.pem /opt/vaultwarden/ -mv /etc/ssl/private/ssl-cert-snakeoil.key /opt/vaultwarden/ + msg_info "Configuring Vaultwarden" + cat </opt/vaultwarden/.env + ADMIN_TOKEN='' + ROCKET_ADDRESS=0.0.0.0 + ROCKET_TLS='{certs="/opt/vaultwarden/ssl-cert-snakeoil.pem",key="/opt/vaultwarden/ssl-cert-snakeoil.key"}' + DATA_FOLDER=/opt/vaultwarden/data + DATABASE_MAX_CONNS=10 + WEB_VAULT_FOLDER=/opt/vaultwarden/web-vault + WEB_VAULT_ENABLED=true + EOF + mv /etc/ssl/certs/ssl-cert-snakeoil.pem /opt/vaultwarden/ + mv /etc/ssl/private/ssl-cert-snakeoil.key /opt/vaultwarden/ -chown -R vaultwarden:vaultwarden /opt/vaultwarden/ -chown root:root /opt/vaultwarden/bin/vaultwarden -chmod +x /opt/vaultwarden/bin/vaultwarden -chown -R root:root /opt/vaultwarden/web-vault/ -chmod +r /opt/vaultwarden/.env -msg_ok "Configured Vaultwarden" + chown -R vaultwarden:vaultwarden /opt/vaultwarden/ + chown root:root /opt/vaultwarden/bin/vaultwarden + chmod +x /opt/vaultwarden/bin/vaultwarden + chown -R root:root /opt/vaultwarden/web-vault/ + chmod +r /opt/vaultwarden/.env + msg_ok "Configured Vaultwarden" -msg_info "Creating Service" -cat </etc/systemd/system/vaultwarden.service -[Unit] -Description=Bitwarden Server (Powered by Vaultwarden) -Documentation=https://github.com/dani-garcia/vaultwarden -After=network.target + msg_info "Creating Service" + cat </etc/systemd/system/vaultwarden.service + [Unit] + Description=Bitwarden Server (Powered by Vaultwarden) + Documentation=https://github.com/dani-garcia/vaultwarden + After=network.target -[Service] -User=vaultwarden -Group=vaultwarden -EnvironmentFile=-/opt/vaultwarden/.env -ExecStart=/opt/vaultwarden/bin/vaultwarden -LimitNOFILE=65535 -LimitNPROC=4096 -PrivateTmp=true -PrivateDevices=true -ProtectHome=true -ProtectSystem=strict -DevicePolicy=closed -ProtectControlGroups=yes -ProtectKernelModules=yes -ProtectKernelTunables=yes -RestrictNamespaces=yes -RestrictRealtime=yes -MemoryDenyWriteExecute=yes -LockPersonality=yes -WorkingDirectory=/opt/vaultwarden -ReadWriteDirectories=/opt/vaultwarden/data -AmbientCapabilities=CAP_NET_BIND_SERVICE + [Service] + User=vaultwarden + Group=vaultwarden + EnvironmentFile=-/opt/vaultwarden/.env + ExecStart=/opt/vaultwarden/bin/vaultwarden + LimitNOFILE=65535 + LimitNPROC=4096 + PrivateTmp=true + PrivateDevices=true + ProtectHome=true + ProtectSystem=strict + DevicePolicy=closed + ProtectControlGroups=yes + ProtectKernelModules=yes + ProtectKernelTunables=yes + RestrictNamespaces=yes + RestrictRealtime=yes + MemoryDenyWriteExecute=yes + LockPersonality=yes + WorkingDirectory=/opt/vaultwarden + ReadWriteDirectories=/opt/vaultwarden/data + AmbientCapabilities=CAP_NET_BIND_SERVICE -[Install] -WantedBy=multi-user.target -EOF -systemctl enable -q --now vaultwarden -msg_ok "Created Service" + [Install] + WantedBy=multi-user.target + EOF + systemctl enable -q --now vaultwarden + msg_ok "Created Service" +} + +setup_alpine() { + msg_info "Installing Dependencies" + $STD apk add --no-cache \ + openssl \ + argon2 + msg_ok "Installed Dependencies" + + msg_info "Installing Alpine-Vaultwarden" + $STD apk add --no-cache vaultwarden + sed -i 's|export WEB_VAULT_ENABLED=.*|export WEB_VAULT_ENABLED=true|' /etc/conf.d/vaultwarden + echo -e "export ADMIN_TOKEN=''" >>/etc/conf.d/vaultwarden + echo -e "export ROCKET_ADDRESS=0.0.0.0" >>/etc/conf.d/vaultwarden + echo -e "export ROCKET_TLS='{certs=\"/etc/ssl/certs/vaultwarden-selfsigned.crt\",key=\"/etc/ssl/private/vaultwarden-selfsigned.key\"}'" >>/etc/conf.d/vaultwarden + $STD openssl req -x509 -nodes -days 365 -newkey rsa:4096 -keyout /etc/ssl/private/vaultwarden-selfsigned.key -out /etc/ssl/certs/vaultwarden-selfsigned.crt -subj "/CN=localhost" -addext "subjectAltName=DNS:localhost" + chown vaultwarden:vaultwarden /etc/ssl/certs/vaultwarden-selfsigned.crt + chown vaultwarden:vaultwarden /etc/ssl/private/vaultwarden-selfsigned.key + msg_ok "Installed Alpine-Vaultwarden" + + msg_info "Installing Web-Vault" + $STD apk add --no-cache vaultwarden-web-vault + msg_ok "Installed Web-Vault" + + msg_info "Starting Alpine-Vaultwarden" + $STD rc-service vaultwarden start + $STD rc-update add vaultwarden default + msg_ok "Started Alpine-Vaultwarden" +} + +run_os_setup motd_ssh customize diff --git a/install/wireguard-install.sh b/install/wireguard-install.sh index b14d7e15f..c3a9a1e5d 100644 --- a/install/wireguard-install.sh +++ b/install/wireguard-install.sh @@ -13,71 +13,160 @@ setting_up_container network_check update_os -msg_info "Installing Dependencies" -$STD apt install -y git -msg_ok "Installed Dependencies" +setup_deb_based() { + msg_info "Installing Dependencies" + $STD apt install -y git + msg_ok "Installed Dependencies" -msg_info "Installing WireGuard" -$STD apt install -y wireguard wireguard-tools net-tools iptables -DEBIAN_FRONTEND=noninteractive apt -o Dpkg::Options::="--force-confnew" install -y iptables-persistent &>/dev/null -$STD netfilter-persistent reload -msg_ok "Installed WireGuard" + msg_info "Installing WireGuard" + $STD apt install -y wireguard wireguard-tools net-tools iptables + DEBIAN_FRONTEND=noninteractive apt -o Dpkg::Options::="--force-confnew" install -y iptables-persistent &>/dev/null + $STD netfilter-persistent reload + msg_ok "Installed WireGuard" -read -r -p "${TAB3}Would you like to add WGDashboard? " prompt -if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then - git clone -q https://github.com/WGDashboard/WGDashboard.git /etc/wgdashboard + read -r -p "${TAB3}Would you like to add WGDashboard? " prompt + if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then + git clone -q https://github.com/WGDashboard/WGDashboard.git /etc/wgdashboard - msg_info "Installing WGDashboard" - cd /etc/wgdashboard/src - chmod u+x wgd.sh - $STD ./wgd.sh install - . /etc/os-release - if [ "$VERSION_CODENAME" = "trixie" ]; then - echo "net.ipv4.ip_forward=1" >>/etc/sysctl.d/sysctl.conf - $STD sysctl -p /etc/sysctl.d/sysctl.conf - else - echo "net.ipv4.ip_forward=1" >>/etc/sysctl.conf - $STD sysctl -p /etc/sysctl.conf + msg_info "Installing WGDashboard" + cd /etc/wgdashboard/src + chmod u+x wgd.sh + $STD ./wgd.sh install + . /etc/os-release + if [ "$VERSION_CODENAME" = "trixie" ]; then + echo "net.ipv4.ip_forward=1" >>/etc/sysctl.d/sysctl.conf + $STD sysctl -p /etc/sysctl.d/sysctl.conf + else + echo "net.ipv4.ip_forward=1" >>/etc/sysctl.conf + $STD sysctl -p /etc/sysctl.conf + fi + msg_ok "Installed WGDashboard" + + msg_info "Create Example Config for WGDashboard" + private_key=$(wg genkey) + cat </etc/wireguard/wg0.conf + [Interface] + PrivateKey = ${private_key} + Address = 10.0.0.1/24 + SaveConfig = true + PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -A FORWARD -o wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE; + PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -D FORWARD -o wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE; + ListenPort = 51820 + EOF + msg_ok "Created Example Config for WGDashboard" + + msg_info "Creating Service" + cat </etc/systemd/system/wg-dashboard.service + [Unit] + After=syslog.target network-online.target + Wants=wg-quick.target + ConditionPathIsDirectory=/etc/wireguard + + [Service] + Type=forking + PIDFile=/etc/wgdashboard/src/gunicorn.pid + WorkingDirectory=/etc/wgdashboard/src + ExecStart=/etc/wgdashboard/src/wgd.sh start + ExecStop=/etc/wgdashboard/src/wgd.sh stop + ExecReload=/etc/wgdashboard/src/wgd.sh restart + TimeoutSec=120 + PrivateTmp=yes + Restart=always + + [Install] + WantedBy=multi-user.target + EOF + systemctl enable -q --now wg-dashboard + msg_ok "Created Service" + fi +} + +setup_alpine() { + msg_info "Installing Dependencies" + $STD apk add \ + iptables \ + openrc + msg_ok "Installed Dependencies" + + msg_info "Installing WireGuard" + $STD apk add --no-cache wireguard-tools + if [[ ! -L /etc/init.d/wg-quick.wg0 ]]; then + ln -s /etc/init.d/wg-quick /etc/init.d/wg-quick.wg0 fi - msg_ok "Installed WGDashboard" - msg_info "Create Example Config for WGDashboard" private_key=$(wg genkey) cat </etc/wireguard/wg0.conf -[Interface] -PrivateKey = ${private_key} -Address = 10.0.0.1/24 -SaveConfig = true -PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -A FORWARD -o wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE; -PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -D FORWARD -o wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE; -ListenPort = 51820 -EOF - msg_ok "Created Example Config for WGDashboard" + [Interface] + PrivateKey = ${private_key} + Address = 10.0.0.1/24 + SaveConfig = true + PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -A FORWARD -o wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE; + PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -D FORWARD -o wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE; + ListenPort = 51820 + EOF + echo "net.ipv4.ip_forward=1" >>/etc/sysctl.conf + $STD rc-update add sysctl + $STD sysctl -p /etc/sysctl.conf + msg_ok "Installed WireGuard" - msg_info "Creating Service" - cat </etc/systemd/system/wg-dashboard.service -[Unit] -After=syslog.target network-online.target -Wants=wg-quick.target -ConditionPathIsDirectory=/etc/wireguard + read -rp "${TAB3}Do you want to install WGDashboard? (y/N): " INSTALL_WGD + if [[ "$INSTALL_WGD" =~ ^[Yy]$ ]]; then + msg_info "Installing additional dependencies for WGDashboard" + $STD apk add --no-cache \ + python3 \ + py3-pip \ + git \ + sudo \ + musl-dev \ + linux-headers \ + gcc \ + python3-dev + msg_ok "Installed additional dependencies for WGDashboard" + msg_info "Installing WGDashboard" + git clone -q https://github.com/WGDashboard/WGDashboard.git /etc/wgdashboard + cd /etc/wgdashboard/src + chmod u+x wgd.sh + $STD ./wgd.sh install + msg_ok "Installed WGDashboard" -[Service] -Type=forking -PIDFile=/etc/wgdashboard/src/gunicorn.pid -WorkingDirectory=/etc/wgdashboard/src -ExecStart=/etc/wgdashboard/src/wgd.sh start -ExecStop=/etc/wgdashboard/src/wgd.sh stop -ExecReload=/etc/wgdashboard/src/wgd.sh restart -TimeoutSec=120 -PrivateTmp=yes -Restart=always + msg_info "Creating Service for WGDashboard" + cat </etc/init.d/wg-dashboard + #!/sbin/openrc-run -[Install] -WantedBy=multi-user.target -EOF - systemctl enable -q --now wg-dashboard - msg_ok "Created Service" -fi + description="WireGuard Dashboard Service" + + depend() { + need net + after firewall + } + + start() { + ebegin "Starting WGDashboard" + cd /etc/wgdashboard/src/ + ./wgd.sh start & + eend $? + } + + stop() { + ebegin "Stopping WGDashboard" + pkill -f "wgd.sh" + eend $? + } + EOF + chmod +x /etc/init.d/wg-dashboard + $STD rc-update add wg-dashboard default + $STD rc-service wg-dashboard start + msg_ok "Created Service for WGDashboard" + + fi + + msg_info "Starting Services" + $STD rc-update add wg-quick.wg0 default + $STD rc-service wg-quick.wg0 start + msg_ok "Started Services" +} + +run_os_setup motd_ssh customize diff --git a/install/zigbee2mqtt-install.sh b/install/zigbee2mqtt-install.sh index 4674bdc1d..6a7c062a4 100644 --- a/install/zigbee2mqtt-install.sh +++ b/install/zigbee2mqtt-install.sh @@ -13,43 +13,59 @@ setting_up_container network_check update_os -msg_info "Installing Dependencies" -$STD apt install -y \ - git \ - build-essential -msg_ok "Installed Dependencies" +setup_deb_based() { + msg_info "Installing Dependencies" + $STD apt install -y \ + git \ + build-essential + msg_ok "Installed Dependencies" -NODE_VERSION="24" NODE_MODULE="pnpm@$(curl -fsSL https://raw.githubusercontent.com/Koenkk/zigbee2mqtt/master/package.json | jq -r '.packageManager | split("@")[1]')" setup_nodejs -fetch_and_deploy_gh_release "Zigbee2MQTT" "Koenkk/zigbee2mqtt" "tarball" "latest" "/opt/zigbee2mqtt" + NODE_VERSION="24" NODE_MODULE="pnpm@$(curl -fsSL https://raw.githubusercontent.com/Koenkk/zigbee2mqtt/master/package.json | jq -r '.packageManager | split("@")[1]')" setup_nodejs + fetch_and_deploy_gh_release "Zigbee2MQTT" "Koenkk/zigbee2mqtt" "tarball" "latest" "/opt/zigbee2mqtt" -msg_info "Setting up Zigbee2MQTT" -mv /opt/zigbee2mqtt/data/configuration.example.yaml /opt/zigbee2mqtt/data/configuration.yaml -cd /opt/zigbee2mqtt -echo "packageImportMethod: hardlink" >>./pnpm-workspace.yaml -$STD pnpm install --no-frozen-lockfile -$STD pnpm build -msg_ok "Setup Zigbee2MQTT" + msg_info "Setting up Zigbee2MQTT" + mv /opt/zigbee2mqtt/data/configuration.example.yaml /opt/zigbee2mqtt/data/configuration.yaml + cd /opt/zigbee2mqtt + echo "packageImportMethod: hardlink" >>./pnpm-workspace.yaml + $STD pnpm install --no-frozen-lockfile + $STD pnpm build + msg_ok "Setup Zigbee2MQTT" -msg_info "Creating Service" -cat </etc/systemd/system/zigbee2mqtt.service -[Unit] -Description=zigbee2mqtt -After=network.target + msg_info "Creating Service" + cat </etc/systemd/system/zigbee2mqtt.service + [Unit] + Description=zigbee2mqtt + After=network.target -[Service] -Environment=NODE_ENV=production -ExecStart=/usr/bin/pnpm start -WorkingDirectory=/opt/zigbee2mqtt -StandardOutput=inherit -StandardError=inherit -Restart=always -User=root + [Service] + Environment=NODE_ENV=production + ExecStart=/usr/bin/pnpm start + WorkingDirectory=/opt/zigbee2mqtt + StandardOutput=inherit + StandardError=inherit + Restart=always + User=root -[Install] -WantedBy=multi-user.target -EOF -systemctl enable -q --now zigbee2mqtt -msg_ok "Created Service" + [Install] + WantedBy=multi-user.target + EOF + systemctl enable -q --now zigbee2mqtt + msg_ok "Created Service" +} + +setup_alpine() { + msg_info "Installing Alpine-Zigbee2MQTT" + mkdir -p /root/.z2m /etc/zigbee2mqtt + $STD apk add zigbee2mqtt + ln -s /etc/zigbee2mqtt/ /root/.z2m + chown -R root:root /etc/zigbee2mqtt /root/.z2m + sed -i -e 's/#datadir="\/var\/lib\/zigbee2mqtt"/datadir="\/etc\/zigbee2mqtt"/' -e 's/#command_user="zigbee2mqtt"/command_user="root"/' /etc/conf.d/zigbee2mqtt + $STD rc-update add zigbee2mqtt + $STD rc-service zigbee2mqtt restart + msg_ok "Installed Alpine-Zigbee2MQTT" +} + +run_os_setup motd_ssh customize