How sdslabs/shogun-cd works
Shogun-CD is a self-hosted Git-based continuous-delivery service. Operators define YAML pipelines and targets in a manifest repository; repository changes, CI webhooks, or UI/API requests trigger ordered deployment steps. The backend indexes definitions, executes steps against remote hosts, and records run history, while the UI exposes pipeline, run, target, and webhook workflows. SSH/SFTP deployment, YAML mutation, encrypted secrets, and PostgreSQL-backed history are documented capabilities; some implementation links rely on the README because their source was not excerpted.
Main entry points: store.go Persistence · engine.go Pipeline Engine · orchestrator.go Orchestrator · step.go Pipeline Steps
Components 23
User and API
- Web UI
ui/src/app/app.tsx - HTTP API
api/http/server.go - API Routes
api/http/routes.go - Pipeline Controller
api/http/controllers/pipelines.go - Webhook Controller
api/http/controllers/webhooks.go
Repository and Definitions
- Definition Indexer
internal/orchestrator/indexer.go - Git Service
internal/git/service.go - Target Loader
internal/target/loader.go
Pipeline Execution
- Webhook Service
internal/webhooks/service.go - Orchestrator
internal/orchestrator/orchestrator.go - Pipeline Service
internal/pipeline/service.go - Pipeline Engine
internal/pipeline/engine.go - Pipeline Steps
internal/pipeline/steps/step.go
External Services
- SSH/SFTP Client
internal/sshclient/sshmanager.go - Deployment Hosts
- PostgreSQL
- Manifest Repository
Identity and State
- Secret Service
internal/secrets - Encryption
internal/encryption/service.go - User Service
internal/users/service.go - Persistence
internal/store/store.go
Other components
- Operator
- CI System
Connections 30
- Operator → Web UI: uses
- Web UI → HTTP API: requests
- HTTP API → API Routes: registers
api/http/server.go - API Routes → Pipeline Controller: routes runs
api/http/routes.go - API Routes → Webhook Controller: routes hooks
api/http/routes.go - Pipeline Controller → Orchestrator: starts run
api/http/controllers/pipelines.go - CI System → Webhook Controller: sends hook
- Webhook Controller → Webhook Service: resolves hook
api/http/controllers/webhooks.go - Webhook Service → Orchestrator: triggers run
internal/webhooks/service.go - Manifest Repository → Git Service: hosts definitions
- Orchestrator → Git Service: coordinates Git
internal/orchestrator/orchestrator.go - Orchestrator → Pipeline Service: runs pipelines
internal/orchestrator/orchestrator.go - Orchestrator → Target Loader: loads targets
internal/orchestrator/orchestrator.go - Git Service → Definition Indexer: provides repository
- Definition Indexer → Manifest Repository: indexes YAML
- Pipeline Service → Pipeline Engine: executes pipeline
internal/pipeline/engine.go - Pipeline Engine → Pipeline Steps: executes steps
internal/pipeline/engine.go - Pipeline Engine → SSH/SFTP Client: creates client
internal/pipeline/engine.go - Pipeline Engine → Persistence: records run steps
internal/pipeline/engine.go - Pipeline Engine → Deployment Hosts: deploys remotely
- SSH/SFTP Client → Deployment Hosts: connects SSH/SFTP
- Pipeline Steps → Deployment Hosts: syncs and executes
- Pipeline Steps → Git Service: pushes mutations
- Pipeline Steps → Secret Service: accesses secrets
- Secret Service → Encryption: encrypts secrets
- Secret Service → Persistence: persists secrets
- User Service → Persistence: reads and writes users
internal/users/service.go - Persistence → PostgreSQL: persists data
- Pipeline Controller → Persistence: fetches run history
api/http/controllers/pipelines.go - Webhook Service → Persistence: stores hooks