Documentation
¶
Overview ¶
Package scaffold writes a first rig.yaml from what a directory already has: compose files, Kubernetes manifests, and services in Go, Python, Node, Java or Rust, plus infrastructure presets.
Index ¶
- Variables
- func ImportCompose(path, dir string) (map[string]*spec.Service, error)
- func ImportManifests(path, _ string) (map[string]*spec.Service, error)
- func NewPlugin(dir, name, lang string) ([]string, error)
- func Presets() []string
- type Candidate
- type Component
- type Options
- type Plan
- type Port
- type Service
- type Suite
Constants ¶
This section is empty.
Variables ¶
var Langs = []string{"go", "python", "ts", "bash", "yaml"}
Langs are the plugin templates: a server in Go, Python or TypeScript, scripts, or YAML alone.
Functions ¶
func ImportCompose ¶
ImportCompose reads a compose file's services as rig services under their compose names, so a docker runtime with compose: finds their containers. ${VARS} fill from the environment, then the compose file's .env.
func ImportManifests ¶
ImportManifests makes a service of every Deployment, StatefulSet and DaemonSet under path, named after the workload, so the manifests stay the only definition: a Kubernetes runtime without manifests: deploys from these folders.
Types ¶
type Candidate ¶
type Candidate struct {
Kind string // go, python, node, rust, java, dotnet, ruby, dockerfile, compose, manifest, helm, goland, container, tests
Name string
Where string
Service *Service
Suite *Suite
Manifests string
// Import is the imports: entry ({kind, path}) that brings Service from its own file instead of a copy.
Import [2]string
}
Candidate is something rig init --deep found that could go into rig.yaml: a service to run, a test suite, or a folder of manifests.
func Deep ¶
Deep walks every folder under root and lists what could run there, without building anything: Go main packages and test packages, Python/Node/Rust/Java/.NET/Ruby entry points, Dockerfiles, compose services, Kubernetes workloads, Helm charts, GoLand run configurations, and the containers running on this machine. Names are unique; the first find of a name wins.
type Plan ¶
type Plan struct {
Project string
Services []*Service
Components []Component
Suites []Suite
Manifests []string
// Imports are imports: entries ({kind: path}), the files that stay the services' definition.
Imports [][2]string
Godev bool
// OTel is where services send traces, when a tracing backend that takes OTLP is there.
OTel string
// Notes say what was found where, for the summary.
Notes []string
}
type Service ¶
type Service struct {
Name, Role, Image string
// Go is a main package to build; Dockerfile and Context a docker build.
Go, Dockerfile, Context string
Run []string
RunDir string
Ports []Port
Env [][2]string
DependsOn []string
// Docker is the docker runtime's section: compose's entrypoint, command and volumes.
DockerCommand, DockerArgs, Volumes []string
From string
// Adopt is a running container rig takes over (docker: {container: ...}) instead of making one.
Adopt string
// Section groups it on the Services screen (sections:), by what rig init --deep found it as.
Section string
// Imported comes from a compose file or manifests rig.yaml imports: only what they lack is written.
Imported bool
}