compose

package
v0.8.22 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 17, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package compose turns a docker compose file into what Jokku runs: one app whose process types are the file's services, each with its own image.

The file is read with compose-go, the loader docker compose itself uses, so interpolation (${VAR}, with the app's config vars and the repo's .env), profiles (COMPOSE_PROFILES), extends within the file and the many short and long syntaxes behave as in Docker. What Jokku cannot run (host networking, privileged containers, secrets, host paths) is refused with a message rather than half emulated.

Every path the file names must stay inside the pushed source: the deploy runs as root on the control node and must never read anything else.

Index

Constants

This section is empty.

Variables

View Source
var DefaultFiles = []string{"compose.yaml", "compose.yml", "docker-compose.yaml", "docker-compose.yml"}

DefaultFiles are looked for, in order, when no compose file is set.

Functions

This section is empty.

Types

type Copy

type Copy struct {
	Src string `json:"src"`
	Dst string `json:"dst"`
}

Copy is a file or directory of the source (Src, relative to the root) baked into the image at Dst.

type Mount

type Mount struct {
	Volume string // Jokku volume name
	Path   string
	// External volumes must already exist; others are created on deploy.
	External bool
}

Mount puts a Jokku volume at Path.

type Plan

type Plan struct {
	File     string // the compose file, relative to the source root
	Services map[string]*Service
	// Web is the service that gets HTTP traffic: the one named web, or the
	// only one publishing ports. "" when none does.
	Web string
	// Notes are things in the file Jokku ignores, for the deploy log.
	Notes []string
}

Plan is a compose file, translated.

func Load

func Load(ctx context.Context, root, dir, file, app string, vars map[string]string) (*Plan, error)

Load reads the compose file in dir, a directory inside root (the unpacked source), with vars filling in ${VAR}. file is relative to dir; "" finds one of DefaultFiles. app names the project.

func (*Plan) Volumes

func (p *Plan) Volumes() []Mount

Volumes lists the Jokku volumes the plan mounts.

type Service

type Service struct {
	Name string

	// Image is pulled when Context is empty; otherwise Dockerfile (or
	// Inline) is built in Context with Args, up to Stage.
	Image      string
	Context    string // absolute
	Dockerfile string // absolute
	Inline     string
	Args       map[string]string
	Stage      string
	Copies     []Copy // files of the source baked into an Image, from bind mounts

	Entrypoint []string // nil: the image's
	Command    []string // nil: the image's
	Env        []string // KEY=value, sorted
	User       string
	WorkingDir string
	Port       int // 0: the image's EXPOSE, if any
	Published  bool
	Replicas   int
	CPUs       int // 0: Jokku's default
	MemoryMB   int // 0: Jokku's default
	Restart    string
	StopSecs   int
	StopSignal string
	DependsOn  []string
	NoCheck    bool // healthcheck disabled
	Mounts     []Mount
}

Service is one service, as a Jokku process type.

func (*Service) BuildKey

func (s *Service) BuildKey(root string) string

BuildKey describes how the service's image is made, with paths relative to root so it compares across deploys. Two services with the same key share one build.

func (*Service) Built

func (s *Service) Built() bool

Built reports whether the service's image is built from source.

Jump to

Keyboard shortcuts

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