Documentation
¶
Overview ¶
Package appexport renders an app as plain Docker Compose plus an env template so leaving Levelrail never needs Levelrail. Secret values are never part of the input type; the caller classifies env before export.
Index ¶
Constants ¶
const SecretPlaceholder = "CHANGE_ME"
SecretPlaceholder stands in for every value that must not leave the server.
Variables ¶
var ErrInvalidName = errors.New("appexport: invalid service or variable name")
ErrInvalidName marks a service key or env name that cannot be written to compose or .env without breaking the file structure.
Functions ¶
Types ¶
type File ¶
File is one produced file.
func Render ¶
Render produces docker-compose.yml, .env.example and README.md, sorted and byte-stable for the same input.
func RenderProject ¶
func RenderProject(in ProjectInput) ([]File, error)
RenderProject composes a project into one docker-compose.yml, .env.example and volumes.json (and a .env only when secrets were explicitly included). Whatever cannot be expressed is listed in the compose header.
type Probe ¶
type Probe struct {
Path string
Scheme string
TCP bool
Exec []string
Interval string
Timeout string
Failures int
}
Probe is the readiness probe of a service.
type ProjectInput ¶
type ProjectInput struct {
Name string
Services []Service
// Databases are managed database names that are not exported as services.
Databases []string
// IncludeSecrets also writes a .env holding Service.SecretValues. The
// default is placeholders only.
IncludeSecrets bool
}
ProjectInput is a whole project: every app service filed under it, keyed uniquely across apps, plus the databases that this export leaves out.
type Service ¶
type Service struct {
Key string
Image string
Command []string
Entrypoint []string
Port int
Domains []string
Env map[string]string
SecretEnv []string
Refs map[string]string
Volumes []Volume
BindMounts []BindMount
Ports []Port
Health *Probe
DependsOn []string
DependsOnHealthy []string
Restart string
MemoryBytes int64
NanoCPUs int64
PullPolicy string
FilePaths []string
// Unsupported lists settings the caller could not express in compose; a
// project export prints them in its header instead of dropping them.
Unsupported []string
// SecretValues holds opt-in plaintext for secret keys, used only by a
// project export that was explicitly asked to include secrets.
SecretValues map[string]string
}
Service is one container of the app. Env holds only non-secret values as stored; SecretEnv and Refs hold names and descriptions, never values.