81 lines
2.4 KiB
Bash
81 lines
2.4 KiB
Bash
#!/bin/bash
|
|
# =============================================================================
|
|
# INFOMANIAK SERVER SETUP
|
|
# Server: 185.143.102.153 (hofmanns.ai)
|
|
# Run as: debian user
|
|
# =============================================================================
|
|
|
|
set -e
|
|
|
|
echo "=========================================="
|
|
echo " HOFMANNS.AI - INFOMANIAK SERVER SETUP"
|
|
echo "=========================================="
|
|
|
|
# 1. Update System
|
|
echo "[1/6] System Update..."
|
|
sudo apt update && sudo apt upgrade -y
|
|
|
|
# 2. Install Docker (falls noch nicht)
|
|
echo "[2/6] Docker Check..."
|
|
if ! command -v docker &> /dev/null; then
|
|
curl -fsSL https://get.docker.com | sudo sh
|
|
sudo usermod -aG docker debian
|
|
echo "Docker installed. Please logout and login again, then re-run this script."
|
|
exit 0
|
|
fi
|
|
|
|
# 3. Install Docker Compose
|
|
echo "[3/6] Docker Compose Check..."
|
|
if ! command -v docker-compose &> /dev/null; then
|
|
sudo apt install -y docker-compose-plugin
|
|
fi
|
|
|
|
# 4. Create directories
|
|
echo "[4/6] Creating directories..."
|
|
mkdir -p ~/hofmanns-auth/{authentik,rustdesk,nginx/conf.d,nginx/ssl,nginx/html}
|
|
|
|
# 5. Copy config files
|
|
echo "[5/6] Copying config files..."
|
|
cp docker-compose.yml ~/hofmanns-auth/
|
|
cp .env.example ~/hofmanns-auth/.env
|
|
cp -r nginx/* ~/hofmanns-auth/nginx/
|
|
|
|
# 6. Generate secrets
|
|
echo "[6/6] Generating secrets..."
|
|
cd ~/hofmanns-auth
|
|
|
|
# Generate Authentik secret
|
|
AUTHENTIK_SECRET=$(openssl rand 60 | base64 -w 0)
|
|
sed -i "s/CHANGE_ME_RUN_openssl_rand_60_base64/$AUTHENTIK_SECRET/" .env
|
|
|
|
# Generate PostgreSQL password
|
|
PG_PASSWORD=$(openssl rand -base64 32)
|
|
sed -i "s/CHANGE_ME_SECURE_PASSWORD_HERE/$PG_PASSWORD/" .env
|
|
|
|
echo ""
|
|
echo "=========================================="
|
|
echo " SETUP COMPLETE!"
|
|
echo "=========================================="
|
|
echo ""
|
|
echo " NEXT STEPS:"
|
|
echo ""
|
|
echo " 1. SSL Zertifikate erstellen (Let's Encrypt):"
|
|
echo " sudo certbot certonly --standalone -d auth.hofmanns.ai"
|
|
echo " sudo cp /etc/letsencrypt/live/auth.hofmanns.ai/* ~/hofmanns-auth/nginx/ssl/"
|
|
echo ""
|
|
echo " 2. Services starten:"
|
|
echo " cd ~/hofmanns-auth"
|
|
echo " docker compose up -d"
|
|
echo ""
|
|
echo " 3. Authentik Initial Setup:"
|
|
echo " https://auth.hofmanns.ai/if/flow/initial-setup/"
|
|
echo ""
|
|
echo " 4. RustDesk Key anzeigen:"
|
|
echo " cat ~/hofmanns-auth/rustdesk/id_ed25519.pub"
|
|
echo ""
|
|
echo " PORTS:"
|
|
echo " - 80/443 → Nginx (Authentik Proxy)"
|
|
echo " - 9000 → Authentik (intern)"
|
|
echo " - 21115-21119 → RustDesk"
|
|
echo ""
|