Files
nixos-core/up.sh
T
kiskaadee ef72e3ea0f refactor(core): decouple applications to separate deployments and streamline core control plane
This commit restructures the homeserver repository to isolate the core gateway and management tools (Control Plane) from user applications (Data Plane). This allows applications to have independent lifecycles and CI/CD pipelines, preventing git history contamination.

- Relocated user applications (excalidraw, gitea, jellyfin, learning-hub, mermaid, ollama) to an external deployments directory.
- Moved homepage to the root directory as a core server component and removed the empty apps directory.
- Streamlined up.sh and down.sh to deploy and stop only core services and homepage, removing --infra-only parameters.
- Replaced all hardcoded domain names with a configurable global DOMAIN environment variable in docker-compose files.
- Used Authelia templating ({{ env "DOMAIN" }}) in configuration.yml to dynamically resolve SSO cookie domains and redirection URLs.
- Updated up.sh and down.sh helpers to explicitly pass env files via --env-file flags, resolving compose interpolation warnings.
- Created a declarative NixOS module (infra/nixos/dynu-ddns.nix) to orchestrate the Dynu DDNS update script.
- Created Authelia .env-example template for setup reproducibility.
- Refactored .gitignore to exclude obsolete app cache rules and keep it minimal to core secrets, volumes, and logs.
- Updated documentation (README, architecture, roadmap, usability) to document decoupled deployments and public/SSO service templates.
2026-06-14 23:33:35 -05:00

48 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)
if [ ! -f infra/core/letsencrypt/acme.json ]; then
echo "Initializing letsencrypt/acme.json..."
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
fi
# --- 2. HELPER FUNCTIONS ---
start_stack() {
local stack_path=$1
shift
local env_flags=()
for env_file in "$@"; do
if [ -f "$env_file" ]; then
env_flags+=("--env-file" "$env_file")
fi
done
if [ -f "$stack_path/docker-compose.yml" ]; then
echo "Starting stack: $stack_path..."
docker compose -f "$stack_path/docker-compose.yml" "${env_flags[@]}" up -d
else
echo "Warning: No docker-compose.yml found in $stack_path"
fi
}
# --- 3. DEPLOY CONTROL PLANE & PORTAL ---
echo "=== Deploying Control Plane ==="
start_stack "infra/core" "infra/core/.env"
start_stack "infra/authelia" "infra/core/.env" "infra/authelia/.env"
start_stack "infra/portainer"
start_stack "infra/watchtower"
start_stack "infra/diun"
start_stack "infra/dozzle"
echo "=== Deploying Homepage Portal ==="
start_stack "homepage" "infra/core/.env"
echo ""
echo "Hardened Private Cloud Deployment Complete."