How uservseatb/apinfra works
apinfra is a single-host, pull-model GitOps agent for Docker Compose applications, managed Nginx routing, and automatic TLS. Each run loads host settings and the selected namespace from Git, validates configuration before making changes, applies Docker state, processes ingress and certificates, then prunes unused images. The graph follows the documented cycle and sampled composition root; several subsystem internals are unsampled, so their detailed calls are omitted rather than inferred.
Main entry points: update.go Service wiring · deployment/service.go Update cycle · docker/service.go Compose orchestration · git_source.go Git config loader
Components 21
Agent runtime
- Update entrypoint
cmd/main.go - Service wiring
internal/app/update.go
Desired state
- Host configuration
internal/config/host.go - Git config loader
internal/infrastructure/adapters/git_source.go - Git repository access
internal/git/repo.go - Project settings
internal/config/settings.go
Deployment
- Update cycle
internal/domain/deployment/service.go - Compose orchestration
internal/domain/docker/service.go - Compose validation
internal/domain/docker/compose.go
Ingress and TLS
- Ingress routing
internal/domain/nginx/service.go - Nginx rendering
internal/domain/nginx/render.go - Certificate management
internal/domain/certmanagement/service.go - ACME providers
internal/acme/client.go
Host adapters
- Stack filesystem
internal/infrastructure/stack_fs.go - Docker and CLI adapter
internal/infrastructure/adapters/cli_runner.go - Virtual-host filesystem
internal/infrastructure/vhost_fs.go - ACME adapter
internal/infrastructure/adapters/acme_bridge.go - Certificate state
internal/infrastructure/adapters/yaml_repo.go - Host layout
internal/infrastructure/layout.go - Event records
internal/events/events.go
Other components
- Host operator
Connections 27
- Host operator → Update entrypoint: starts run
- Update entrypoint → Service wiring: runs update
cmd/main.go - Service wiring → Host configuration: loads settings
internal/app/update.go - Service wiring → Update cycle: executes cycle
internal/app/update.go - Service wiring → Compose orchestration: wires service
internal/app/update.go - Service wiring → Git config loader: wires source
internal/app/update.go - Service wiring → Host layout: wires layout
internal/app/update.go - Service wiring → Certificate management: wires service
internal/app/update.go - Service wiring → ACME adapter: wires adapter
internal/app/update.go - Service wiring → Certificate state: wires repository
internal/app/update.go - Service wiring → Ingress routing: wires ingress
internal/app/update.go - Git config loader → Git repository access: loads clone
internal/infrastructure/adapters/git_source.go - Git config loader → Project settings: reads projects
internal/infrastructure/adapters/git_source.go - Update cycle → Host layout: prepares directories
internal/domain/deployment/service.go - Update cycle → Git config loader: loads workspace
internal/domain/deployment/service.go - Update cycle → Compose orchestration: validates and applies
internal/domain/deployment/service.go - Update cycle → Ingress routing: processes routing
internal/domain/deployment/service.go - Update cycle → Compose orchestration: prunes images
internal/domain/deployment/service.go - Compose orchestration → Compose validation: validates projects
internal/domain/docker/service.go - Ingress routing → Nginx rendering: renders configuration
internal/domain/nginx/render.go - Certificate management → ACME adapter: issues certificates
internal/infrastructure/adapters/acme_bridge.go - ACME adapter → ACME providers: calls client
internal/infrastructure/adapters/acme_bridge.go - Certificate management → Certificate state: persists state
internal/infrastructure/adapters/yaml_repo.go - Update cycle → Event records: records activity
- Compose orchestration → Stack filesystem: writes stacks
- Compose orchestration → Docker and CLI adapter: runs Compose
- Ingress routing → Virtual-host filesystem: writes host files