managarten/scripts/mac-mini/setup-cloudflared-service.sh
Till JS b1b9bbc269
Some checks are pending
CD Mac Mini / Detect Changes (push) Waiting to run
CD Mac Mini / Deploy (push) Blocked by required conditions
CI / Detect Changes (push) Waiting to run
CI / Validate (push) Waiting to run
CI / Build mana-search (push) Blocked by required conditions
CI / Build mana-sync (push) Blocked by required conditions
CI / Build mana-api-gateway (push) Blocked by required conditions
CI / Build mana-crawler (push) Blocked by required conditions
Docker Validate / Validate Dockerfiles (push) Waiting to run
Docker Validate / Build calendar-web (push) Blocked by required conditions
Docker Validate / Build quotes-web (push) Blocked by required conditions
Docker Validate / Build todo-backend (push) Blocked by required conditions
Docker Validate / Build todo-web (push) Blocked by required conditions
Docker Validate / Build mana-auth (push) Blocked by required conditions
Docker Validate / Build mana-sync (push) Blocked by required conditions
Docker Validate / Build mana-media (push) Blocked by required conditions
Mirror to Forgejo / Push to Forgejo (push) Waiting to run
chore: rename repo mana-monorepo → managarten
Phase-3-Rename des ehemaligen Multi-App-Monorepos zum eigenständigen
Produkt-Repo. Verein heißt mana e.V., Plattform-Domain bleibt mana.how,
apps/mana/ bleibt unverändert — nur der Repo-Container kriegt den
neuen Namen "managarten" (Garten der mana-Apps).

Geändert:
- package.json#name + #description
- README.md (Titel + erster Absatz)
- TROUBLESHOOTING.md
- alle Mac-Mini-Skripte (Pfade ~/projects/mana-monorepo → ~/projects/managarten)
- COMPOSE_PROJECT_NAME-default in scripts/mac-mini/status.sh
- .github/workflows/cd-macmini.yml + mirror-to-forgejo.yml
- apps/docs (astro.config.mjs + content)
- .claude/settings.local.json (Bash-Permission-Pfade)
- alle docs/*.md Pfad-Referenzen
- launchd plists, .env.macmini.example, infrastructure/

Forgejo-Repo + GitHub-Repo bereits via API umbenannt. Lokales
Verzeichnis-Rename + Mac-Mini-Cutover folgen separat.
2026-05-09 01:16:02 +02:00

79 lines
2.1 KiB
Bash
Executable file

#!/bin/bash
# Setup Cloudflared as a launchd service on macOS
# Run this script once on the Mac Mini to enable auto-start
set -e
TUNNEL_ID="bb0ea86d-8253-4a54-838b-107bb7945be9"
CONFIG_FILE="$HOME/projects/managarten/cloudflared-config.yml"
CREDENTIALS_FILE="$HOME/.cloudflared/${TUNNEL_ID}.json"
PLIST_FILE="$HOME/Library/LaunchAgents/com.cloudflare.cloudflared.plist"
echo "=== Cloudflared Service Setup ==="
echo ""
# Check if credentials exist
if [ ! -f "$CREDENTIALS_FILE" ]; then
echo "Error: Credentials file not found: $CREDENTIALS_FILE"
echo "Run 'cloudflared tunnel login' first"
exit 1
fi
# Check if config exists
if [ ! -f "$CONFIG_FILE" ]; then
echo "Error: Config file not found: $CONFIG_FILE"
exit 1
fi
# Create LaunchAgents directory if needed
mkdir -p ~/Library/LaunchAgents
# Create the plist file
cat > "$PLIST_FILE" << EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.cloudflare.cloudflared</string>
<key>ProgramArguments</key>
<array>
<string>/opt/homebrew/bin/cloudflared</string>
<string>tunnel</string>
<string>--config</string>
<string>${CONFIG_FILE}</string>
<string>run</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>StandardOutPath</key>
<string>/tmp/cloudflared.log</string>
<key>StandardErrorPath</key>
<string>/tmp/cloudflared.error.log</string>
</dict>
</plist>
EOF
echo "Created plist: $PLIST_FILE"
# Unload if already loaded
launchctl unload "$PLIST_FILE" 2>/dev/null || true
# Load the service
launchctl load "$PLIST_FILE"
echo ""
echo "=== Service Status ==="
launchctl list | grep cloudflared || echo "Service loaded"
echo ""
echo "Cloudflared is now running as a service."
echo ""
echo "Useful commands:"
echo " Check status: launchctl list | grep cloudflared"
echo " View logs: tail -f /tmp/cloudflared.log"
echo " Stop service: launchctl unload $PLIST_FILE"
echo " Start service: launchctl load $PLIST_FILE"
echo ""