Documentation
¶
Overview ¶
Package api wires the HTTP surface together: REST endpoints for auth and Docker operations, the WebSocket upgrade, and serving the embedded SPA.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PProfHandler ¶ added in v1.4.0
PProfHandler returns an http.Handler exposing Go's net/http/pprof endpoints under /debug/pprof.
It carries NO authentication or IP filtering by design: the caller MUST serve it only on a loopback-bound listener (see cmd/dockercmd's pprof server). That is deliberate — gating by client IP on the *main* router would be unsafe, because the app runs behind chi's RealIP middleware, which rewrites r.RemoteAddr from the (spoofable) X-Forwarded-For / X-Real-IP headers. A physically loopback-only listener can't be reached off-box regardless of headers, so it's the correct boundary for endpoints that leak goroutine stacks / heap layout and can stall the process (/profile).
Types ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server bundles all dependencies needed to serve HTTP.
func NewServer ¶
func NewServer(cfg config.Config, st *store.Store, authSvc *auth.Service, mw *auth.Middleware, dm *docker.Manager, hub *ws.Hub, mon *monitor.Monitor, hist history.Store, webFS fs.FS) *Server
NewServer constructs the API server.
func (*Server) OnRestart ¶ added in v1.5.0
func (s *Server) OnRestart(fn func())
OnRestart registers the hook that gracefully restarts the process (re-exec of the on-disk binary). main wires this only on platforms/run-modes that support it; without it the in-app restart endpoint returns 501.
func (*Server) StartImageUpdatePollLoop ¶ added in v1.7.0
StartImageUpdatePollLoop periodically checks every project's running services for a newer image at the registry (see NEXT.md's "Controlled image updates") and notifies once per newly-observed digest. This is detection + notification only — nothing here applies an update; see internal/docker's AugmentDigestDrift, which this reuses, for the same check already done on demand by the deploy preview. Runs until ctx is cancelled.
func (*Server) StartRetentionLoop ¶ added in v1.7.0
StartRetentionLoop purges history older than the configured retention once a day (first run shortly after startup, so a restart-heavy install still purges) until ctx is cancelled. What it deleted is logged and stored (see store.RetentionRun) so nobody has to wonder where old alerts went.
func (*Server) StartSelfUpdatePolicyLoop ¶ added in v1.7.0
StartSelfUpdatePolicyLoop periodically applies a newer release automatically when an admin has opted into it, following the same cache TTL as the manual update check (there's no point polling for a policy decision more often than the underlying GitHub check itself refreshes). Runs until ctx is cancelled.
Source Files
¶
- access_middleware.go
- alert_handlers.go
- alert_portability.go
- auth_handlers.go
- backup_handlers.go
- basepath.go
- client_ip.go
- container_lifecycle_handlers.go
- diagnostics_handlers.go
- docker_handlers.go
- domain_handlers.go
- events_handler.go
- exec_handler.go
- factor_handlers.go
- files_handlers.go
- health_handlers.go
- history_handler.go
- host_handlers.go
- ignored_cves_handlers.go
- image_handlers.go
- image_update_poller.go
- ldap_handlers.go
- maintenance_handlers.go
- mcp_admin_handlers.go
- mcp_projects.go
- mcp_token_handlers.go
- metrics.go
- middleware.go
- oauth_handlers.go
- parse_rules_handlers.go
- passkey_handlers.go
- policy_handlers.go
- pprof.go
- prefs_handlers.go
- project_handlers.go
- project_oplock.go
- project_revisions_handlers.go
- project_secret_env.go
- project_secret_handlers.go
- readdeadline.go
- recovery_bundle.go
- recovery_export.go
- recovery_import.go
- registry_handlers.go
- respond.go
- retention.go
- role_handlers.go
- rootfs.go
- selfupdate_policy.go
- server.go
- session_handlers.go
- settings_handlers.go
- smtp_handlers.go
- spa.go
- stack_handlers.go
- template_handlers.go
- update_handlers.go
- upload_spool.go
- user_handlers.go
- volume_files_handlers.go
- volume_handlers.go
- ws_handler.go