gitserver

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: 23 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 gitserver runs the optional built-in Git server (§5.8): Forgejo as a system task on the controller node, served at git.<base-domain>. When it is turned on, the controller creates its administrator, mints an API token and registers it as the Git connection "git", so services can build from its repositories with webhooks and commit statuses like any other host.

Index

Constants

View Source
const (

	// ConnectionName is the Git connection of the built-in server.
	ConnectionName = "git"
	// AdminUser is its administrator ("admin" is reserved by Forgejo).
	AdminUser = "syncloud"
)

Variables

View Source
var ErrInUse = errors.New("services still build from the built-in Git server: disconnect them first")

ErrInUse means services still build from the built-in server.

Functions

This section is empty.

Types

type Manager

type Manager struct {

	// Conns, Exec and Sys are set before Run.
	Conns *gitconn.Manager
	Exec  *execrelay.Relay
	Sys   *system.Manager
	// Endpoints returns the dashboard's current addresses.
	Endpoints func() domain.Endpoints
	// OnChange re-renders the system tasks and certificate hosts.
	OnChange func()
	// API is where the controller reaches the server (loopback).
	API string
	// CADir is where the cluster's self-signed certificates are written for
	// the server to trust ("" = none); TrustPEM returns them ("" = none,
	// e.g. once ACME issued real ones).
	CADir    string
	TrustPEM func() string
	// contains filtered or unexported fields
}

func New

func New(st *store.Store, box *secrets.Box, endpoints func() domain.Endpoints, log *slog.Logger) *Manager

func (*Manager) Config

func (m *Manager) Config() *system.GitServerConfig

Config is the system task configuration (nil when off).

func (*Manager) Credentials

func (m *Manager) Credentials() (string, string, bool)

Credentials returns the administrator's sign-in.

func (*Manager) Host

func (m *Manager) Host() string

Host is git.<base-domain> while the server is on and a domain is set.

func (*Manager) Kick

func (m *Manager) Kick()

Kick re-checks the server now (after a domain change, for example).

func (*Manager) Load

func (m *Manager) Load(ctx context.Context) error

Load reads the stored state (call before the system tasks start).

func (*Manager) RootURL

func (m *Manager) RootURL() string

RootURL is the server's public address.

func (*Manager) Run

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

Run provisions the server whenever it is on and not ready yet, and keeps the connection's address in step with the domain.

func (*Manager) SetEnabled

func (m *Manager) SetEnabled(ctx context.Context, on bool) error

SetEnabled turns the server on or off. Turning it off keeps its data volume, so turning it on again brings the repositories back.

func (*Manager) Status

func (m *Manager) Status() Status

type Status

type Status struct {
	Enabled    bool   `json:"enabled"`
	State      string `json:"state"` // off | starting | provisioning | ready | failed
	URL        string `json:"url"`
	Image      string `json:"image"`
	AdminUser  string `json:"adminUser"`
	Connection string `json:"connection"`
	Problem    string `json:"problem,omitempty"`
}

Status is the server as the API shows it.

Jump to

Keyboard shortcuts

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