@startuml
title Deployment-Workflow

actor "Entwickler\n(Laptop)" as dev
participant "GitHub\n(remote)" as github
participant "Raspberry Pi\n(SSH)" as pi
participant "Docker\nCompose" as docker

== Code-Änderung deployen ==
dev -> github : git push origin master

dev -> pi : SSH (über Tailscale)
pi -> github : git pull
note right of pi
  Bei Remote liegt immer ein Commit vor
  → git stash && git pull --rebase && git stash pop
end note

dev -> pi : docker compose up --build -d <service>
note right of pi
  --build: rebuild Image (Code-Änderungen einschließen)
  -d: detached
  NICHT: docker compose restart
  (nimmt keine Code-Änderungen mit!)
end note

pi -> docker : Build Image + Start Container
docker --> dev : Service läuft

== Neuen Service hinzufügen ==
dev -> pi : docker compose up --build -d <neuer-service>
note right of pi
  Service muss in docker-compose.yml definiert sein
  mit Traefik labels (PathPrefix, strip-prefix, Port)
end note

@enduml
