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
- Variables
- type DumpInfo
- type Manager
- func (m *Manager) Answering(ctx context.Context) bool
- func (m *Manager) Config() *system.GitServerConfig
- func (m *Manager) Credentials() (string, string, bool)
- func (m *Manager) Dump(ctx context.Context) (DumpInfo, error)
- func (m *Manager) DumpState() (at, tried time.Time, err error)
- func (m *Manager) Dumps(ctx context.Context) ([]DumpInfo, error)
- func (m *Manager) Host() string
- func (m *Manager) Kick()
- func (m *Manager) Load(ctx context.Context) error
- func (m *Manager) PublicHost() string
- func (m *Manager) RestoreDump(ctx context.Context, name string) error
- func (m *Manager) RootURL() string
- func (m *Manager) Run(ctx context.Context)
- func (m *Manager) SetEnabled(ctx context.Context, on bool) error
- func (m *Manager) Status() Status
- type Status
Constants ¶
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 ¶
var ErrDumping = errors.New("a dump is already running")
ErrDumping means another dump is under way.
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.
var ErrNoStorage = errors.New("no recovery storage: set up the controller's backups with an S3 connection first")
ErrNoStorage means the controller's backups have no recovery storage.
Functions ¶
This section is empty.
Types ¶
type DumpInfo ¶ added in v1.1.0
type DumpInfo struct {
Name string `json:"name"`
Size int64 `json:"size"`
CreatedAt time.Time `json:"createdAt"`
}
DumpInfo is one stored dump.
type Manager ¶
type Manager struct {
// Hold reports whether a kind of work waits for a recovery (Phase 29c);
// may be nil.
Hold func(kind string) bool
// DumpHeld holds back dumps until a recovery has loaded the server.
DumpHeld func() bool
// Frozen reports whether a move is copying the server: it then takes
// nothing from outside (Phase 29d); may be nil.
Frozen func() bool
// Standby holds back every write outside the cluster while this
// controller does not own it (Phase 29c); may be nil.
Standby func() (string, bool)
// 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
// Storage is the recovery storage the dumps go to; S3 reaches an S3
// connection; OnKey runs when the dump key is made (Phase 29b).
Storage func() (backup.Storage, bool)
S3 func(ctx context.Context, endpointID string) (*minio.Client, error)
OnKey func()
// WorkDir is where a dump is prepared while it is loaded ("": the
// system's temporary folder).
WorkDir string
// contains filtered or unexported fields
}
func (*Manager) Config ¶
func (m *Manager) Config() *system.GitServerConfig
Config is the system task configuration (nil when off).
func (*Manager) Credentials ¶
Credentials returns the administrator's sign-in.
func (*Manager) DumpState ¶ added in v1.1.0
DumpState is when the last dump in the current storage succeeded, when one was last tried and why it failed (for the protection page).
func (*Manager) Kick ¶
func (m *Manager) Kick()
Kick re-checks the server now (after a domain change, for example).
func (*Manager) PublicHost ¶ added in v1.1.0
PublicHost is the name the server is reached at from outside ("" while a move copies it).
func (*Manager) RestoreDump ¶ added in v1.1.0
RestoreDump loads a dump (empty name: the newest) into the running server, which must have no repositories.
func (*Manager) Run ¶
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 ¶
SetEnabled turns the server on or off. Turning it off keeps its data volume, so turning it on again brings the repositories back.
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.