Zum Hauptinhalt springen

Zurรผck zum Devlog

Mittwoch, 11. Mรคrz 2026

Infrastructure

6 Commits

5 min Lesezeit

CD Pipeline mit Self-Hosted GitHub Actions Runner

Continuous Deployment Pipeline mit self-hosted GitHub Actions Runner auf dem Mac Mini, Auto-Deploy bei Push auf main und Docker-Fixes.

T

Till Schneider

Autor

Infrastruktur-Tag mit 6 Commits fรผr die Deployment-Pipeline:

  • CD Pipeline - GitHub Actions mit self-hosted Runner
  • Auto-Deploy - Automatisches Deployment bei Push auf main
  • SSH Setup - Dokumentation fรผr Mac Mini Runner
  • Docker Fixes - PATH und Dockerfile-Korrekturen

CD Pipeline: Self-Hosted GitHub Actions Runner

Continuous Deployment direkt auf dem Mac Mini Production Server via self-hosted GitHub Actions Runner.

Architektur

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  GitHub Repository                                    โ”‚
โ”‚  Push to main                                         โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                       โ”‚ Webhook
                       โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Mac Mini (mana.how)                                  โ”‚
โ”‚                                                       โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                 โ”‚
โ”‚  โ”‚  GitHub Actions Runner          โ”‚                 โ”‚
โ”‚  โ”‚  (self-hosted, always-on)       โ”‚                 โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                 โ”‚
โ”‚                   โ”‚                                   โ”‚
โ”‚                   โ–ผ                                   โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                 โ”‚
โ”‚  โ”‚  Deploy Script                  โ”‚                 โ”‚
โ”‚  โ”‚  1. git pull                    โ”‚                 โ”‚
โ”‚  โ”‚  2. pnpm install                โ”‚                 โ”‚
โ”‚  โ”‚  3. docker compose build        โ”‚                 โ”‚
โ”‚  โ”‚  4. docker compose up -d        โ”‚                 โ”‚
โ”‚  โ”‚  5. health check                โ”‚                 โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                 โ”‚
โ”‚                                                       โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                 โ”‚
โ”‚  โ”‚  Docker Services                โ”‚                 โ”‚
โ”‚  โ”‚  matrix, mana-core-auth,        โ”‚                 โ”‚
โ”‚  โ”‚  bots, web-apps, ...            โ”‚                 โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                 โ”‚
โ”‚                                                       โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

GitHub Actions Workflow

# .github/workflows/deploy.yml
name: Deploy to Mac Mini

on:
  push:
    branches: [main]

jobs:
  deploy:
    runs-on: self-hosted
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Pull latest changes
        run: git pull origin main

      - name: Install dependencies
        run: pnpm install --frozen-lockfile

      - name: Build & Deploy
        run: |
          docker compose -f docker-compose.macmini.yml build
          docker compose -f docker-compose.macmini.yml up -d

      - name: Health Check
        run: ./scripts/mac-mini/health-check.sh

Auto-Deploy bei Push auf main

Jeder Push auf main lรถst automatisch ein Deployment aus.

Deploy-Flow

SchrittDauerBeschreibung
Checkout~2sRepository auschecken
Pull~5sNeueste ร„nderungen ziehen
Install~30sDependencies installieren
Build~2minDocker Images bauen
Deploy~30sContainer neu starten
Health Check~10sServices รผberprรผfen
Gesamt~3minEnd-to-End Deployment

Notifications

- name: Notify on failure
  if: failure()
  run: |
    curl -X POST "$MATRIX_WEBHOOK_URL" \
      -H "Content-Type: application/json" \
      -d '{"body": "โŒ Deployment failed: ${{ github.sha }}"}'

SSH Setup Dokumentation

Dokumentation fรผr die Einrichtung des GitHub Actions Runners auf dem Mac Mini.

Runner Installation

# Auf dem Mac Mini
mkdir ~/actions-runner && cd ~/actions-runner
curl -o actions-runner.tar.gz -L https://github.com/actions/runner/releases/download/v2.321.0/actions-runner-osx-arm64-2.321.0.tar.gz
tar xzf actions-runner.tar.gz

# Runner konfigurieren
./config.sh --url https://github.com/your-org/manacore-monorepo \
            --token YOUR_TOKEN \
            --labels self-hosted,macOS,ARM64

# Als Service installieren
./svc.sh install
./svc.sh start

LaunchDaemon

<!-- ~/Library/LaunchAgents/com.github.actions-runner.plist -->
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.github.actions-runner</string>
    <key>RunAtLoad</key>
    <true/>
    <key>KeepAlive</key>
    <true/>
    <key>WorkingDirectory</key>
    <string>/Users/till/actions-runner</string>
    <key>ProgramArguments</key>
    <array>
        <string>./runsvc.sh</string>
    </array>
</dict>
</plist>

Docker PATH Fix

Der GitHub Actions Runner hatte keinen Zugriff auf Docker im PATH.

Problem

Error: docker: command not found

Lรถsung

# .env fรผr den Runner
echo 'PATH=/usr/local/bin:/opt/homebrew/bin:$PATH' >> ~/actions-runner/.env

matrix-web Dockerfile Fix

Das matrix-web Dockerfile fehlte die shared-pwa Package Dependency.

Problem

ERROR: Could not resolve @manacore/shared-pwa
Build failed during Docker multi-stage build

Lรถsung

# Dockerfile - shared-pwa Package mit kopieren
COPY packages/shared-pwa ./packages/shared-pwa

Mac Mini Docs Update

Dokumentation mit aktivem Runner-Status aktualisiert.

Neue Sektion

## GitHub Actions Runner

Status: โœ… Aktiv
Labels: self-hosted, macOS, ARM64
Auto-Start: Ja (LaunchDaemon)

Zusammenfassung

BereichCommitsHighlights
CD Pipeline2Workflow + Auto-Deploy
SSH Docs1Runner Setup Dokumentation
Docker PATH1Runner Environment Fix
Dockerfile1shared-pwa Dependency Fix
Mac Mini Docs1Runner Status Update

Nรคchste Schritte

  1. Staging Environment - Preview Deployments fรผr PRs
  2. Rollback - Automatisches Rollback bei Health-Check-Failure
  3. Build Cache - Docker Layer Caching optimieren
  4. Monitoring - Deployment-Metriken in Grafana

Tags

#ci-cd #github-actions #mac-mini #self-hosted-runner #docker #deployment