Documentation
¶
Overview ¶
Package serverrelease finds, verifies and downloads a released Checkend server: a GitHub release of Checkend/checkend with a signed manifest (checkend-release.json, format 1), the Worker bundle, the migrations and the digest of the Docker image. `ce server install` installs only a release that this package verified.
The order of the checks: the SSH signature (`ssh-keygen -Y sign`, namespace checkend-server-release) of the exact manifest bytes with a trusted key, then the manifest, then its tag and commit against the GitHub release, then each asset by its size and SHA-256 when it is downloaded.
Index ¶
Constants ¶
const DefaultAPI = "https://api.github.com/repos/Checkend/checkend"
DefaultAPI is the GitHub API of the server repo.
const ImageRepository = "ghcr.io/checkend/checkend"
ImageRepository is the only image repository that a manifest can name.
const Namespace = "checkend-server-release"
Namespace is the SSH signature namespace of a server release manifest. The manifest is signed with `ssh-keygen -Y sign -n checkend-server-release` (the CLI releases use another namespace and another key).
const NoRelease = "No Checkend server release is published yet."
NoRelease is the message when no server release has a manifest yet.
Variables ¶
var ProxyRepositories = map[string]string{
"caddy": "docker.io/library/caddy",
"cloudflared": "docker.io/cloudflare/cloudflared",
}
ProxyRepositories are the only repositories that a proxy image can have.
var TrustedKeys = map[string]string{
"server-2026": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPLnE0XiMd0q3TgIYSsvGK3FPZZGVMvE/8DCkNm3y3fy",
}
TrustedKeys are the public keys that sign the server releases: key ID to an ed25519 key as `ssh-keygen` prints it ("ssh-ed25519 AAAA…"). A new key is added here before its first release; an old key stays until no supported release uses it.
Functions ¶
Types ¶
type Asset ¶
type Asset struct {
Name string `json:"asset"`
SHA256 string `json:"sha256"`
Size int64 `json:"size"`
}
Asset is a file of the release, checked by its size and SHA-256.
type Binding ¶
type Binding struct {
Type string `json:"type"`
Name string `json:"name"`
Required bool `json:"required"`
}
Binding is a binding of the Worker. Optional bindings can be offered by the installer.
type Image ¶
type Image struct {
Repository string `json:"repository"`
Tag string `json:"tag"`
Digest string `json:"digest"`
Platforms []string `json:"platforms"`
}
Image is the Docker image of the release.
type Manifest ¶
type Manifest struct {
Format int `json:"format"`
Version string `json:"version"`
Tag string `json:"tag"`
Commit string `json:"commit"`
PublishedAt string `json:"published_at"`
MinCLIVersion string `json:"min_cli_version"`
Migrations struct {
Asset
Latest string `json:"latest"`
Count int `json:"count"`
} `json:"migrations"`
Worker struct {
Asset
MainModule string `json:"main_module"`
Modules []Module `json:"modules"`
CompatibilityDate string `json:"compatibility_date"`
CompatibilityFlags []string `json:"compatibility_flags"`
Bindings []Binding `json:"bindings"`
Crons []string `json:"crons"`
Observability bool `json:"observability"`
} `json:"worker"`
Image Image `json:"image"`
Settings map[string]Setting `json:"settings"`
// Proxies are the pinned images of the HTTPS proxies of `ce install ssh` (optional):
// "caddy" and "cloudflared".
Proxies map[string]string `json:"proxies,omitempty"`
}
Manifest is checkend-release.json, format 1.
type Release ¶
type Release struct {
Manifest Manifest
// Signer is the ID of the key that signed the manifest.
Signer string
// contains filtered or unexported fields
}
Release is a verified release.
type Setting ¶
type Setting struct {
Secret bool `json:"secret"`
MinLength int `json:"min_length,omitempty"`
Format string `json:"format,omitempty"`
}
Setting is a setting of the server. Secrets never have a default value.
func (*Setting) UnmarshalJSON ¶
UnmarshalJSON refuses a setting with a default value: the manifest never has one for a secret.
type Source ¶
type Source struct {
// API is the GitHub API of the repo (DefaultAPI).
API string
// Keys are the trusted keys (TrustedKeys).
Keys map[string]string
// CLIVersion is the version of this CLI, for min_cli_version.
CLIVersion string
HTTP *http.Client
}
Source is where the releases come from.