Documentation
¶
Overview ¶
Package system runs the platform's own components as system tasks on the controller node (D20, §5.0): Traefik, VictoriaMetrics, VictoriaLogs, and (next) the registry and BuildKit. Versions are pinned per SynCloud release.
Index ¶
Constants ¶
const ( ImageTraefik = "traefik:v3.7.13" ImageVictoriaMetrics = "victoriametrics/victoria-metrics:v1.153.0" ImageVictoriaLogs = "victoriametrics/victoria-logs:v1.53.0" ImageRegistry = "registry:3.1.2" ImageForgejo = "codeberg.org/forgejo/forgejo:13.0.5-rootless" // PostgresTag17 and PostgresTag18 tag the managed PostgreSQL image, // built from images/postgres per major version (make postgres-image). PostgresTag17 = "17-r3" PostgresTag18 = "18-r2" )
Release manifest: tested image versions for this SynCloud release.
const ( // PostgresRepository is the images' repository in the built-in // registry. Its project name is reserved. PostgresRepository = "syncloud-system/postgres" // PostgresLocalName is what make postgres-image tags local builds as. PostgresLocalName = "syncloud-postgres" )
The managed PostgreSQL images ship inside each release, not on a public registry: the release carries one archive per tag (PostgresArchive), and the controller loads it into its own registry the first time a database needs it. Nodes then pull it like any image built in the cluster.
const GitServerAddr = "127.0.0.1:3002"
GitServerAddr is where the built-in Git server listens (host network, loopback): Traefik and the controller reach it there.
const GitServerTaskID = "sys-git"
GitServerTaskID is the built-in Git server's system task.
const LocalNode = "ctl-0"
LocalNode is the controller's own node, which runs system tasks (§6.4).
const Network = "syncloud-system"
Network is the Docker bridge network system components share.
const RegistryAddr = "127.0.0.1:5000"
RegistryAddr is where Traefik (host network) reaches the registry.
const RegistryEventsPath = "/internal/registry/events"
RegistryEventsPath receives the registry's notifications (authenticated with TraefikToken in TraefikTokenHeader).
const TaskIDPrefix = "sys-"
TaskIDPrefix marks system tasks; unknown ones found on the node are removed.
const TopicTask = "system.task"
TopicTask carries a TaskView whenever a system task changes.
const TraefikTokenHeader = "X-Syncloud-Token"
TraefikTokenHeader carries Config.TraefikToken on config polls.
Variables ¶
var Components = []Component{ { TaskID: "sys-traefik", Name: "Traefik", Description: "Edge proxy: routes and TLS from the controller (§5.7)", // contains filtered or unexported fields }, { TaskID: "sys-registry", Name: "Registry", Description: "Private Docker registry with token auth (§5.9)", // contains filtered or unexported fields }, { TaskID: GitServerTaskID, Name: "Git server", Description: "Built-in Forgejo: private Git repositories (§5.8), optional", // contains filtered or unexported fields }, { TaskID: "sys-victoriametrics", Name: "VictoriaMetrics", Description: "Metrics store (§9.1)", // contains filtered or unexported fields }, { TaskID: "sys-victorialogs", Name: "VictoriaLogs", Description: "Central log store (§9.2)", // contains filtered or unexported fields }, }
var PostgresImages = map[string]string{ "17": "@registry/" + PostgresRepository + ":" + PostgresTag17, "18": "@registry/" + PostgresRepository + ":" + PostgresTag18, }
PostgresImages maps each offered PostgreSQL major version to its image.
var PostgresTags = map[string]string{"17": PostgresTag17, "18": PostgresTag18}
PostgresTags maps each offered major version to its image tag.
Functions ¶
func PostgresArchive ¶
PostgresArchive is the release file that carries an image tag for one CPU architecture (an OCI layout with gzip layers, as a tar.gz).
Types ¶
type Component ¶
type Component struct {
TaskID string
Name string
Description string
// contains filtered or unexported fields
}
Component describes one system task for the dashboard.
type Config ¶
type Config struct {
// ControllerURL is how Traefik (host network) reaches the controller API.
ControllerURL string
// HTTPAddr and HTTPSAddr are Traefik's public entrypoints (":80"/":443"; high ports in dev).
HTTPAddr string
HTTPSAddr string
// AdminAddr serves Traefik's ping and Prometheus metrics (loopback only).
AdminAddr string
// DatabaseEntrypoints are the public database entrypoints (name -> address).
DatabaseEntrypoints map[string]string
// TraefikToken authenticates Traefik to the controller's config endpoint.
TraefikToken string
// RegistryRealm is the token endpoint URL Docker clients are sent to.
RegistryRealm string
// RegistryTokenCert is the absolute path of the token issuer certificate.
RegistryTokenCert string
// RegistryReadOnly rejects pushes while garbage collection runs; pulls
// keep working.
RegistryReadOnly bool
// TraefikSettings adds the global static Traefik flags (§5.7).
TraefikSettings traefik.Settings
// GitServer runs the built-in Forgejo when set.
GitServer *GitServerConfig
}
type GitServerConfig ¶
type GitServerConfig struct {
// RootURL is its public address (https://git.<base-domain>/, or the
// loopback address before a base domain exists).
RootURL string
// SecretKey and InternalToken are Forgejo's own secrets, generated once.
SecretKey string
InternalToken string
// CADir holds the cluster's self-signed certificates (private networks)
// for Forgejo to trust, so its webhooks reach the dashboard ("" = none).
CADir string
}
GitServerConfig is the built-in Git server (Forgejo).
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func (*Manager) SetConfig ¶
SetConfig re-renders the specs (e.g. after a base domain change) and applies them; agents recreate only the containers whose spec changed.
func (*Manager) SetRegistryReadOnly ¶
SetRegistryReadOnly switches the registry in or out of read-only maintenance mode (the container is recreated).
type TaskView ¶
type TaskView struct {
TaskID string `json:"taskId"`
Name string `json:"name"`
Description string `json:"description"`
Image string `json:"image"`
Node string `json:"node"`
State string `json:"state"` // pending, pulling, starting, running, exited, failed, removed
Health string `json:"health"`
Error string `json:"error"`
ContainerID string `json:"containerId"`
StartedAt *time.Time `json:"startedAt"`
UpdatedAt time.Time `json:"updatedAt"`
}