managarten/scripts/mac-mini
Till JS 62d9eb1f2b fix(infra): update status page, prometheus, and cloudflared for unified app
All web app subdomains (chat.mana.how, todo.mana.how, etc.) were removed
when the unified app launched, but monitoring configs still referenced them.
Update blackbox targets to use mana.how/route URLs, remove stale API backend
routes from cloudflared, clean up CORS origins, and fix status page generator
to handle route-based URLs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 14:59:15 +02:00
..
launchd fix(infra): update status page, prometheus, and cloudflared for unified app 2026-04-03 14:59:15 +02:00
backup-databases.sh feat(mac-mini): add stability improvements 2026-02-12 13:33:44 +01:00
build-app.sh chore: remove all NestJS backend references, replace with Hono/Bun 2026-03-31 16:52:25 +02:00
build-landings.sh refactor: rename ManaDeck to Cards across entire monorepo 2026-04-01 11:45:21 +02:00
check-disk-space.sh feat(monitoring): auto-prune Docker + node_modules, 15-min disk check interval 2026-03-30 20:14:13 +02:00
configure-ollama.sh feat: add Ollama memory optimization, LLM metrics, and chat streaming 2026-03-24 09:41:33 +01:00
deploy-v2.sh refactor: rename ManaDeck to Cards across entire monorepo 2026-04-01 11:45:21 +02:00
deploy.sh fix(infra): update status page, prometheus, and cloudflared for unified app 2026-04-03 14:59:15 +02:00
ensure-containers-running.sh chore: replace all mana-core-auth references with mana-auth 2026-03-28 18:05:31 +01:00
health-check.sh feat(mana-video-gen): add AI video generation service with LTX-Video 2026-04-02 01:17:47 +02:00
init-deploy-tracking.sql feat(infra): add deploy tracking with PostgreSQL, Pushgateway & Grafana dashboard 2026-03-20 17:08:03 +01:00
memory-baseline.sh fix(infra): use DOCKER_CMD variable in memory-baseline.sh 2026-03-29 15:12:44 +02:00
migrate-to-colima.sh fix: make colima migration resilient to TSDB file changes 2026-03-28 22:25:34 +01:00
move-colima-to-external-ssd.sh feat(monitoring): disk metrics via Pushgateway, Loki in Master Overview, Colima move script 2026-03-30 20:03:33 +02:00
notifications.env.example feat(mac-mini): add notification system for health checks 2026-01-23 13:18:04 +01:00
push-schemas.sh feat(infra+ui): deploy script v2, schema push, SyncIndicator component 2026-03-28 18:02:06 +01:00
README.md fix(infra): update status page, prometheus, and cloudflared for unified app 2026-04-03 14:59:15 +02:00
restart.sh fix(mac-mini): add PATH export for Docker CLI in all scripts 2026-01-23 12:17:24 +01:00
setup-autostart.sh feat(mac-mini): add auto-start and management scripts 2026-01-23 11:48:24 +01:00
setup-cloudflared-service.sh feat: add multi-arch Docker builds and Mac Mini deployment 2026-01-22 19:17:37 +01:00
setup-docker-logging.sh feat(mac-mini): add stability improvements 2026-02-12 13:33:44 +01:00
setup-forgejo.sh feat(infra): add Forgejo for self-hosted Git + CI/CD 2026-03-28 03:00:50 +01:00
setup-image-gen.sh fix(infra): update status page, prometheus, and cloudflared for unified app 2026-04-03 14:59:15 +02:00
setup-matrix.sh feat(matrix): add self-hosted Matrix infrastructure for GDPR compliance 2026-01-28 00:20:12 +00:00
setup-notifications.sh feat(mac-mini): add notification system for health checks 2026-01-23 13:18:04 +01:00
setup-ssh-client.sh feat: add SSH access via Cloudflare Tunnel 2026-01-22 19:27:39 +01:00
setup-stt.sh fix(infra): update status page, prometheus, and cloudflared for unified app 2026-04-03 14:59:15 +02:00
setup-tts-bot.sh feat(matrix): add TTS bot for text-to-speech conversion 2026-01-29 16:03:26 +01:00
setup-tts.sh fix(infra): update status page, prometheus, and cloudflared for unified app 2026-04-03 14:59:15 +02:00
setup-umami-db.sh refactor: change Umami analytics URL from analytics.mana.how to stats.mana.how 2026-01-23 16:11:24 +01:00
startup.sh fix(builds): repair inventar settings import and add skilltree storage service 2026-03-31 16:56:37 +02:00
status.sh feat(mana-video-gen): add AI video generation service with LTX-Video 2026-04-02 01:17:47 +02:00
stop.sh fix(mac-mini): add PATH export for Docker CLI in all scripts 2026-01-23 12:17:24 +01:00
tune-tcp.sh feat(skilltree): add achievement system with 26 achievements + monetization report 2026-03-24 12:17:43 +01:00
weekly-report.sh feat(monitoring): add alerting stack and maintenance scripts 2026-02-12 13:46:57 +01:00

Mac Mini Server Scripts

Scripts for managing the ManaCore production environment on Mac Mini.

Quick Start (After System Update)

# 1. SSH into Mac Mini (from your local machine)
ssh mac-mini

# 2. Navigate to project
cd ~/projects/manacore-monorepo

# 3. Setup auto-start (only needed once)
./scripts/mac-mini/setup-autostart.sh

# 4. Check status
./scripts/mac-mini/status.sh

Scripts Overview

Script Purpose
setup-autostart.sh Configure automatic startup on boot (run once)
setup-stt.sh Setup STT service (Whisper + Voxtral)
startup.sh Main startup script (called by launchd)
health-check.sh Check all services health
status.sh Show full system status
restart.sh Restart all Docker containers
stop.sh Stop all Docker containers
deploy.sh Pull latest images and deploy

First-Time Setup

1. Prerequisites on Mac Mini

# Install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

# Install required tools
brew install cloudflared git docker

# Install Docker Desktop
# Download from: https://www.docker.com/products/docker-desktop/

2. Clone Repository

mkdir -p ~/projects
cd ~/projects
git clone https://github.com/Memo-2023/manacore-monorepo.git
cd manacore-monorepo

3. Configure Cloudflare Tunnel

# Login to Cloudflare
cloudflared tunnel login

# The tunnel is already created (ID: bb0ea86d-8253-4a54-838b-107bb7945be9)
# Credentials should be at: ~/.cloudflared/bb0ea86d-8253-4a54-838b-107bb7945be9.json

4. Configure Environment

# Copy and edit the environment file
cp .env.macmini.example .env.macmini
nano .env.macmini

5. Enable Auto-Start

# This sets up all launchd services
./scripts/mac-mini/setup-autostart.sh

6. Configure Docker Desktop

Open Docker Desktop and enable:

  • Settings > General > Start Docker Desktop when you sign in

Daily Operations

Check Status

./scripts/mac-mini/status.sh

Run Health Check

./scripts/mac-mini/health-check.sh

Restart Services

# Normal restart
./scripts/mac-mini/restart.sh

# Pull latest images and restart
./scripts/mac-mini/restart.sh --pull

# Force recreate containers
./scripts/mac-mini/restart.sh --force

View Logs

# Startup log
tail -f /tmp/manacore-startup.log

# Health check log
tail -f /tmp/manacore-health.log

# Cloudflare tunnel log
tail -f /tmp/cloudflared.log

# Specific container logs
docker logs -f mana-core-auth
docker logs -f chat-backend

Stop Services

./scripts/mac-mini/stop.sh

LaunchD Services

Three services are configured to run automatically:

Service Label Purpose
Cloudflared com.cloudflare.cloudflared Tunnel to Cloudflare
Docker Startup com.manacore.docker-startup Start containers on boot
Health Check com.manacore.health-check Check every 5 minutes
STT Service com.manacore.stt Speech-to-Text (Whisper + Voxtral)

Manual Service Control

# Check status
launchctl list | grep -E 'cloudflare|manacore'

# Restart a service
launchctl kickstart -k gui/$(id -u)/com.manacore.docker-startup

# Stop a service
launchctl unload ~/Library/LaunchAgents/com.manacore.docker-startup.plist

# Start a service
launchctl load ~/Library/LaunchAgents/com.manacore.docker-startup.plist

Troubleshooting

Docker not starting

# Check if Docker Desktop is running
docker info

# Start Docker Desktop manually
open -a Docker

Cloudflare tunnel not connecting

# Check cloudflared status
pgrep -x cloudflared

# View tunnel logs
tail -50 /tmp/cloudflared.log

# Restart tunnel
launchctl kickstart -k gui/$(id -u)/com.cloudflare.cloudflared

Container health check failing

# Check specific container
docker logs <container-name>

# Restart specific container
docker restart <container-name>

# Check database connectivity
docker exec manacore-postgres pg_isready -U postgres

Services not starting on boot

# Re-run setup
./scripts/mac-mini/setup-autostart.sh

# Check launchd errors
launchctl error <exit-code>

# Verify plist files
plutil ~/Library/LaunchAgents/com.manacore.*.plist

Push Notifications (Optional)

To receive notifications when health checks fail:

  1. Create a topic at ntfy.sh
  2. Add to your shell profile:
    export NTFY_TOPIC=your-topic-name
    
  3. Subscribe on your phone using the ntfy app

URLs

Once running, services are available at:

Service URL
Unified App https://mana.how
Auth API https://auth.mana.how
API Gateway https://api.mana.how
Forgejo (Git) https://git.mana.how
Grafana https://grafana.mana.how
Status Page https://status.mana.how
GlitchTip https://glitchtip.mana.how
Umami https://stats.mana.how
SSH ssh mac-mini (via cloudflared)

Native Services (non-Docker)

Ollama (LLM)

Ollama runs natively on Mac Mini for LLM inference:

# Check status
curl http://localhost:11434/api/tags

# List models
ollama list

# Pull a model
ollama pull gemma3:4b

STT Service (Speech-to-Text)

The STT service provides Whisper and Voxtral transcription:

# Setup (first time)
./scripts/mac-mini/setup-stt.sh

# Check status
curl http://localhost:3020/health

# Transcribe audio
curl -X POST http://localhost:3020/transcribe \
  -F "file=@audio.mp3" \
  -F "language=de"

# View logs
tail -f /tmp/manacore-stt.log

Available endpoints:

  • POST /transcribe - Whisper transcription (recommended)
  • POST /transcribe/voxtral - Voxtral transcription
  • POST /transcribe/auto - Auto-select model
  • GET /health - Health check
  • GET /models - List available models