commit 49c75768ba1e51ea8cefbaef7be165502d525451 Author: SDGDen Date: Wed Mar 4 06:03:45 2026 +0100 initial commit diff --git a/deploy.sh b/deploy.sh new file mode 100644 index 0000000..b0171ec --- /dev/null +++ b/deploy.sh @@ -0,0 +1,572 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Ensure script is run as root (required for apt + /etc) +if [[ "$EUID" -ne 0 ]]; then + echo "Please run as root (or use sudo)." >&2 + exit 1 +fi + +# what this script needs to do: + +# request all install parameters needed from user +# ---- User input ---- +read -rp "Admin email: " adminemail < /dev/tty +read -rsp "Admin password: " adminpass < /dev/tty +echo +read -rp "Timezone (e.g. Europe/Amsterdam): " timezone < /dev/tty +read -rp "Domain (e.g. example.com): " domain < /dev/tty + +# Public IP (tries multiple services) +publicip="$(curl -fsS https://api.ipify.org || curl -fsS https://ifconfig.me || echo "UNKNOWN")" + +# Local IP (first non-loopback) +localip="$(hostname -I | awk '{print $1}')" + +# generate random passwords for DB hosts and other secrets + +# ---- Random generators ---- +rand_hex() { openssl rand -hex 24; } +rand_b64() { openssl rand -base64 32; } + +ownclouddbpass="$(rand_hex)" +ownclouddbrootpass="$(rand_hex)" +convertxJWT="$(rand_hex)" +bookstackkey="$(rand_b64)" # base64 as requested +bookstackdbpass="$(rand_hex)" +bookstackdbrootpass="$(rand_hex)" +onlyofficeJWT="$(rand_hex)" + +# ---- Debug print (optional — remove in production) ---- +echo "Configuration summary:" +printf "%-25s %s\n" \ + "Admin email:" "$adminemail" \ + "Timezone:" "$timezone" \ + "Domain:" "$domain" \ + "Public IP:" "$publicip" \ + "Local IP:" "$localip" + + + + + +# install docker +echo "Updating apt and installing prerequisites..." +apt update +apt install -y ca-certificates curl + +echo "Setting up Docker GPG key..." +install -m 0755 -d /etc/apt/keyrings +curl -fsSL https://download.docker.com/linux/ubuntu/gpg \ + -o /etc/apt/keyrings/docker.asc +chmod a+r /etc/apt/keyrings/docker.asc + +echo "Adding Docker apt repository..." +. /etc/os-release + +cat > /etc/apt/sources.list.d/docker.sources < /opt/stacks/npm/compose.yml <: + - 80:80 # Public HTTP Port + - 443:443 # Public HTTPS Port + - 81:81 # Admin Web Port + # Add any other Stream port you want to expose + # - '21:21' # FTP + + environment: + TZ: $timezone + # Uncomment this if you want to change the location of + # the SQLite DB file within the container + # DB_SQLITE_FILE: "/data/database.sqlite" + + # Uncomment this if IPv6 is not enabled on your host + # DISABLE_IPV6: 'true' + + volumes: + - ./data:/data + - ./letsencrypt:/etc/letsencrypt +networks: + dockge_default: + external: true + + + +EOF + +# Uptime Kuma: +# needed: compose.yml +# variables needed: admin email, admin pass +cat > /opt/stacks/kuma/compose.yml < /opt/stacks/browser/compose.yml < /opt/stacks/site/compose.yml < /opt/stacks/owncloud/compose.yml < /opt/stacks/vaultwarden/compose.yml < /opt/stacks/wireguard/compose.yml < /opt/stacks/convertx/compose.yml < /opt/stacks/it-tools/compose.yml < /opt/stacks/bookstack/compose.yml < /opt/stacks/jellyfin/compose.yml < /opt/stacks/onlyoffice/compose.yml < /opt/stacks/dashboard/compose.yml </opt/stacks/dozzle/compose.yml </opt/stacks/pihole/compose.yml <