Files
nixos-core/up.sh
T
kiskaadee 2469ce31de refactor(arch): reorganize services into apps and infra layers
This commit performs a major overhaul of the homeserver architecture,
transitioning from a flat service structure to a layered approach that
separates user-facing applications from core infrastructure.

Key Changes:
- Reorganized directory structure:
  - Moved application services (Gitea, Ollama, Excalidraw, etc.) to 'apps/'.
  - Moved core infrastructure (Traefik, Authelia, Portainer, etc.) to 'infra/'.
- Replaced the custom Python dashboard with 'homepage' for centralized
  service discovery and health monitoring.
- Expanded infrastructure capabilities:
  - Integrated Authelia for centralized authentication and SSO.
  - Added Portainer for container management and Watchtower for updates.
  - Implemented Diun for image update notifications.
- Modernized gateway configuration:
  - Relocated Traefik configuration to 'infra/core/'.
  - Standardized environment variables via 'infra/core/.env-example'.
- Optimized lifecycle management:
  - Rewrote 'up.sh' and 'down.sh' to handle the new directory hierarchy
    with support for '--infra-only' deployments.
- Security and Documentation:
  - Added SECURITY.md and updated README.md to reflect the new architecture.
  - Hardened .gitignore to exclude application logs and sensitive data.
2026-05-12 18:06:01 -05:00

50 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
# --- 1. NETWORK & PERMISSIONS ---
docker network inspect proxy-net >/dev/null 2>&1 || docker network create proxy-net
docker network inspect socket-net >/dev/null 2>&1 || docker network create socket-net
# SSL Permissions (Moved to infra/core)
sudo mkdir -p infra/core/letsencrypt
sudo touch infra/core/letsencrypt/acme.json
sudo chmod 600 infra/core/letsencrypt/acme.json
sudo chown root:root infra/core/letsencrypt/acme.json
# --- 2. HELPER FUNCTIONS ---
start_stack() {
local stack_path=$1
if [ -f "$stack_path/docker-compose.yml" ]; then
echo "Starting stack: $stack_path..."
docker compose -f "$stack_path/docker-compose.yml" up -d
else
echo "Warning: No docker-compose.yml found in $stack_path"
fi
}
# --- 3. INFRASTRUCTURE LAYER (Control Plane) ---
echo "=== Deploying Infrastructure Layer ==="
start_stack "infra/core"
start_stack "infra/authelia"
start_stack "infra/portainer"
start_stack "infra/watchtower"
start_stack "infra/diun"
start_stack "infra/dozzle"
echo "Infrastructure is ready."
echo ""
# --- 4. APPLICATION LAYER (Data Plane) ---
if [[ "$1" == "--infra-only" ]]; then
echo "Skipping Application Layer as requested."
else
echo "=== Deploying Application Layer ==="
# Dynamically start all apps in the apps/ directory
for app_dir in apps/*/; do
start_stack "${app_dir%/}"
done
echo "Applications are ready."
fi
echo ""
echo "Hardened Private Cloud Deployment Complete."
echo "Usage: ./up.sh [--infra-only]"