56 Semaphore Installation und Grundkonfiguration

56.1 Systemanforderungen

56.1.1 Unterstützte Betriebssysteme

Semaphore ist plattformübergreifend verfügbar und unterstützt:

56.1.2 Benötigte Datenbanken

Semaphore erfordert eine relationale Datenbank zur Persistierung:

Empfehlung: PostgreSQL für Produktionsumgebungen aufgrund besserer Performance und Stabilität.

56.1.3 Dependencies

56.1.3.1 Erforderliche Komponenten

56.1.3.2 Optional

56.1.4 Ressourcenvoraussetzungen

56.1.4.1 Minimale Anforderungen

56.1.4.2 Empfohlene Anforderungen

56.2 Deployment-Varianten

56.2.1 Direkte Installation per Binary

56.2.1.1 Vorteile

56.2.1.2 Nachteile

56.2.1.3 Installationsschritte

# Download der aktuellen Version
wget https://github.com/ansible-semaphore/semaphore/releases/latest/download/semaphore_linux_amd64

# Ausführbar machen und verschieben
chmod +x semaphore_linux_amd64
sudo mv semaphore_linux_amd64 /usr/local/bin/semaphore

# Verify installation
semaphore version

56.2.2 Installation über Docker-Container

56.2.2.1 Vorteile

56.2.2.2 Nachteile

56.2.2.3 Docker Compose Setup

version: '3'
services:
  semaphore:
    image: semaphoreui/semaphore:latest
    ports:
      - "3000:3000"
    environment:
      SEMAPHORE_DB_DIALECT: postgres
      SEMAPHORE_DB_HOST: postgres
      SEMAPHORE_DB_PORT: 5432
      SEMAPHORE_DB_USER: semaphore
      SEMAPHORE_DB_PASS: semaphore_password
      SEMAPHORE_DB_NAME: semaphore
      SEMAPHORE_ADMIN_PASSWORD: admin_password
      SEMAPHORE_ADMIN_NAME: admin
      SEMAPHORE_ADMIN_EMAIL: admin@example.com
    depends_on:
      - postgres
    volumes:
      - ./semaphore:/etc/semaphore

  postgres:
    image: postgres:13
    environment:
      POSTGRES_USER: semaphore
      POSTGRES_PASSWORD: semaphore_password
      POSTGRES_DB: semaphore
    volumes:
      - postgres_data:/var/lib/postgresql/data

volumes:
  postgres_data:

56.2.3 Bereitstellung in Kubernetes via Helm-Chart

56.2.3.1 Vorteile

56.2.3.2 Nachteile

56.2.3.3 Helm Installation

# Helm Repository hinzufügen
helm repo add semaphore https://ansible-semaphore.github.io/semaphore

# Chart installieren
helm install semaphore semaphore/semaphore \
  --set config.database.dialect=postgres \
  --set config.database.host=postgres-service \
  --set config.admin.name=admin \
  --set config.admin.email=admin@example.com

56.2.4 Deployment-Vergleich

Kriterium Binary Docker Kubernetes
Einfachheit Hoch Mittel Niedrig
Skalierbarkeit Niedrig Mittel Hoch
Wartungsaufwand Hoch Mittel Niedrig
Isolation Niedrig Hoch Sehr hoch
Performance Sehr hoch Hoch Mittel

56.3 Erste Einrichtung

56.3.1 Datenbank-Setup

56.3.1.1 PostgreSQL Konfiguration

-- Datenbank und Benutzer erstellen
CREATE DATABASE semaphore;
CREATE USER semaphore WITH PASSWORD 'secure_password';
GRANT ALL PRIVILEGES ON DATABASE semaphore TO semaphore;

-- Verbindung testen
\c semaphore semaphore

56.3.1.2 MySQL Konfiguration

-- Datenbank und Benutzer erstellen
CREATE DATABASE semaphore CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'semaphore'@'%' IDENTIFIED BY 'secure_password';
GRANT ALL PRIVILEGES ON semaphore.* TO 'semaphore'@'%';
FLUSH PRIVILEGES;

56.3.2 Konfigurationsdateien

56.3.2.1 Struktur und Speicherorte

/etc/semaphore/
├── config.json          # Hauptkonfiguration
├── credentials/          # Credential-Dateien
└── repositories/         # Git-Repository-Cache

56.3.2.2 Beispiel-Konfiguration

{
  "port": ":3000",
  "host": "0.0.0.0",
  "web_host": "https://semaphore.example.com",
  "cookie_hash": "generate-32-character-random-string",
  "cookie_encryption": "generate-32-character-random-string",
  "access_key_encryption": "generate-32-character-random-string",
  
  "db_dialect": "postgres",
  "db_host": "localhost:5432",
  "db_user": "semaphore",
  "db_pass": "secure_password",
  "db_name": "semaphore",
  
  "email_sender": "semaphore@example.com",
  "email_host": "smtp.example.com",
  "email_port": "587",
  
  "ldap_enable": false,
  "ssh_config_path": "/etc/semaphore/ssh_config",
  
  "telegram_chat": "",
  "telegram_token": "",
  
  "slack_url": "",
  
  "max_parallel_tasks": 10
}

56.3.2.3 Wichtigste Parameter

56.3.3 Admin-User Erstellung

56.3.3.1 Interaktive Konfiguration

# Initiales Setup starten
semaphore setup

# Folgende Eingaben werden abgefragt:
# - Database dialect (postgres/mysql)
# - Database connection details
# - Admin user credentials
# - Playbook path
# - Web host URL

56.3.3.2 Automatisierte Konfiguration

# Umgebungsvariablen setzen
export SEMAPHORE_DB_DIALECT=postgres
export SEMAPHORE_DB_HOST=localhost:5432
export SEMAPHORE_DB_USER=semaphore
export SEMAPHORE_DB_PASS=secure_password
export SEMAPHORE_DB_NAME=semaphore
export SEMAPHORE_ADMIN_PASSWORD=admin_password
export SEMAPHORE_ADMIN_NAME=admin
export SEMAPHORE_ADMIN_EMAIL=admin@example.com

# Setup ausführen
semaphore setup --non-interactive

56.3.4 Service-Start und erster Zugriff

56.3.4.1 Systemd Service (Linux)

# /etc/systemd/system/semaphore.service
[Unit]
Description=Semaphore Ansible Web UI
After=network.target

[Service]
Type=simple
User=semaphore
Group=semaphore
WorkingDirectory=/opt/semaphore
ExecStart=/usr/local/bin/semaphore service --config /etc/semaphore/config.json
Restart=always
RestartSec=5

[Install]
WantedBy=multi-user.target

56.3.4.2 Service-Management

# Service aktivieren und starten
sudo systemctl enable semaphore
sudo systemctl start semaphore

# Status überprüfen
sudo systemctl status semaphore

# Logs anzeigen
sudo journalctl -u semaphore -f

56.3.4.3 Erster Webzugriff

# Browser öffnen
http://localhost:3000

# Login mit Admin-Credentials
# Username: admin (oder konfigurierter Name)
# Password: admin_password (oder konfiguriertes Passwort)

56.4 Authentifizierung

56.4.1 Lokale Benutzerverwaltung

56.4.1.1 Charakteristika

56.4.1.2 Konfiguration

{
  "email_alert": true,
  "email_sender": "semaphore@example.com",
  "password_login_disable": false,
  "non_admin_can_create_project": false
}

56.4.2 LDAP-Integration

56.4.2.1 Vorteile

56.4.2.2 Konfiguration

{
  "ldap_enable": true,
  "ldap_host": "ldap.example.com:389",
  "ldap_bind_dn": "CN=semaphore,OU=ServiceAccounts,DC=example,DC=com",
  "ldap_bind_password": "service_password",
  "ldap_search_dn": "OU=Users,DC=example,DC=com",
  "ldap_search_filter": "(&(objectClass=user)(memberOf=CN=Semaphore-Users,OU=Groups,DC=example,DC=com))",
  "ldap_mapping_username": "sAMAccountName",
  "ldap_mapping_fullname": "displayName",
  "ldap_mapping_email": "mail"
}

56.4.3 OAuth/OpenID Connect

56.4.3.1 Unterstützte Provider

56.4.3.2 GitHub OAuth Konfiguration

{
  "git_hub_oauth": {
    "enabled": true,
    "client_id": "github_client_id",
    "client_secret": "github_client_secret",
    "redirect_url": "https://semaphore.example.com/auth/github/callback"
  }
}

56.4.4 Authentifizierungs-Vergleich

Methode Komplexität Sicherheit Integration Wartung
Lokal Niedrig Mittel Keine Hoch
LDAP Mittel Hoch Gut Mittel
OAuth/OIDC Mittel Hoch Sehr gut Niedrig

56.4.4.1 Empfehlungen