system

package
v0.2.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2026 License: Apache-2.0 Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package system runs the platform's own components as system tasks on the controller node (D20, §5.0): Traefik, the registry, the optional Git server, VictoriaMetrics and VictoriaLogs. Versions are pinned per SynCloud release.

Index

Constants

View Source
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.

View Source
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.

View Source
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.

View Source
const GitServerTaskID = "sys-git"

GitServerTaskID is the built-in Git server's system task.

View Source
const LocalNode = "ctl-0"

LocalNode is the controller's own node, which runs system tasks (§6.4).

View Source
const Network = "syncloud-system"

Network is the Docker bridge network system components share.

View Source
const RegistryAddr = "127.0.0.1:5000"

RegistryAddr is where Traefik (host network) reaches the registry.

View Source
const RegistryCopyAddr = "127.0.0.1:5002"

RegistryCopyAddr is the temporary registry that images are copied into while the registry switches storage (Phase 19); only the controller uses it.

View Source
const RegistryCopyTaskID = "sys-registry-copy"

RegistryCopyTaskID is that temporary registry's system task.

View Source
const RegistryEntrypointAddr = "127.0.0.1:5003"

RegistryEntrypointAddr is Traefik's loopback entrypoint for the registry: connections to the registry host on 443 are passed to it, so pushes get a longer read timeout than the public entrypoints.

View Source
const RegistryEventsPath = "/internal/registry/events"

RegistryEventsPath receives the registry's notifications (authenticated with TraefikToken in TraefikTokenHeader).

View Source
const TaskIDPrefix = "sys-"

TaskIDPrefix marks system tasks; unknown ones found on the node are removed.

View Source
const TopicTask = "system.task"

TopicTask carries a TaskView whenever a system task changes.

View Source
const TraefikTokenHeader = "X-Syncloud-Token"

TraefikTokenHeader carries Config.TraefikToken on config polls.

Variables

View Source
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: RegistryCopyTaskID, Name: "Registry copy", Description: "Temporary registry while images move to new storage (Phase 19)",
		// 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
	},
}
View Source
var PostgresImages = map[string]string{
	"17": "@registry/" + PostgresRepository + ":" + PostgresTag17,
	"18": "@registry/" + PostgresRepository + ":" + PostgresTag18,
}

PostgresImages maps each offered PostgreSQL major version to its image.

View Source
var PostgresTags = map[string]string{"17": PostgresTag17, "18": PostgresTag18}

PostgresTags maps each offered major version to its image tag.

Functions

func PostgresArchive

func PostgresArchive(tag, arch string) string

PostgresArchive is the release file that carries an image tag for one CPU architecture (an OCI layout with gzip layers, as a tar.gz).

func Specs

func Specs(c Config) []*agentv1.TaskSpec

Specs returns every system task spec for this release.

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
	// RegistryS3 keeps the registry's images in S3 (nil = the local volume).
	RegistryS3 *RegistryS3
	// RegistryCopy runs the temporary registry on the storage being
	// switched to (nil = none).
	RegistryCopy *RegistryCopy
	// 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 NewManager(gw *agentgw.Gateway, bus *events.Bus, log *slog.Logger, cfg Config) *Manager

func (*Manager) Hooks

func (m *Manager) Hooks() agentgw.Hooks

Hooks returns the gateway hooks the manager needs.

func (*Manager) List

func (m *Manager) List() []TaskView

List returns system tasks in manifest order.

func (*Manager) NodeID

func (m *Manager) NodeID() string

NodeID is the controller node's ID ("" until it connects).

func (*Manager) Run

func (m *Manager) Run(ctx context.Context)

Run periodically re-applies all system tasks until ctx ends.

func (*Manager) SetConfig

func (m *Manager) SetConfig(cfg Config)

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

func (m *Manager) SetRegistryReadOnly(ro bool)

SetRegistryReadOnly switches the registry in or out of read-only maintenance mode (the container is recreated).

func (*Manager) Task

func (m *Manager) Task(id string) (TaskView, bool)

Task returns one system task's current view.

type RegistryCopy added in v0.1.9

type RegistryCopy struct{ S3 *RegistryS3 }

RegistryCopy is the temporary registry's storage (S3 nil = the local volume).

type RegistryS3 added in v0.1.9

type RegistryS3 struct {
	URL             string // http(s)://host[:port]
	Region          string
	AccessKeyID     string
	SecretAccessKey string
	PathStyle       bool
	Bucket          string
	Prefix          string // "" = the bucket root
}

RegistryS3 is a bucket (and optional prefix) the registry keeps its images in, with the S3 endpoint's credentials. Layer downloads are redirected to presigned S3 URLs, so nodes fetch layers from the bucket.

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"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL