pwcompose

package
v2.78.0 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2022 License: Apache-2.0, MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NginxContainerName = "pathwar-agent-nginx"
	ProxyNetworkName   = "pathwar-proxy-network"
)
View Source
const (
	InstanceKeyLabel = labelPrefix + "instance-key"
)

Variables

This section is empty.

Functions

func Clean

func Clean(ctx context.Context, cli *client.Client, opts CleanOpts) error

Clean can cleanup specific containers, all the images, all the volumes, and the pathwar's nginx front-end

func ComposeBinBytes added in v2.75.0

func ComposeBinBytes() ([]byte, error)

func DownAll

func DownAll(ctx context.Context, cli *client.Client, logger *zap.Logger) error

DownAll cleans up everything related to Pathwar except images (containers, volumes, networks)

func PS

func PS(ctx context.Context, depth int, cli *client.Client, logger *zap.Logger) error

func Prepare

func Prepare(opts PrepareOpts) (string, error)

func Purge

func Purge(ctx context.Context, cli *client.Client, logger *zap.Logger) error

Purge cleans up everything related to Pathwar (containers, volumes, images, networks)

func Up

func Up(ctx context.Context, cli *client.Client, opts UpOpts) (map[string]Service, error)

Up starts a prepared challenge nolint:gocyclo

Types

type CleanOpts

type CleanOpts struct {
	ContainerIDs  []string
	RemoveImages  bool
	RemoveVolumes bool
	RemoveNginx   bool
	Logger        *zap.Logger
}

func NewCleanOpts

func NewCleanOpts() CleanOpts

type ContainersInfo

type ContainersInfo struct {
	RunningFlavors    map[string]challengeFlavors
	RunningContainers map[string]container
	NginxContainer    container
	NginxNetwork      types.NetworkResource
}

func GetContainersInfo

func GetContainersInfo(ctx context.Context, cli *client.Client) (*ContainersInfo, error)

type PathwarConfig

type PathwarConfig struct {
	Version  string
	Networks map[string]network
	Volumes  map[string]volume
	Services map[string]Service
	Pathwar  struct {
		Challenge pwdb.Challenge       `yaml:"challenge" json:"challenge"`
		Flavor    pwdb.ChallengeFlavor `yaml:"flavor" json:"flavor"`
	} `yaml:"x-pathwar" json:"pathwar"`
}

type PrepareOpts

type PrepareOpts struct {
	ChallengeDir string
	Prefix       string
	NoPush       bool
	JSON         bool
	Version      string
	Logger       *zap.Logger
}

func NewPrepareOpts

func NewPrepareOpts() PrepareOpts

type Service

type Service struct {
	ContainerName                             string            `yaml:"container_name,omitempty"`
	Image                                     string            `yaml:",omitempty"`
	Networks, Ports, Expose, Volumes, Command []string          `yaml:",omitempty"`
	VolumesFrom                               []string          `yaml:"volumes_from,omitempty"`
	DependsOn                                 []string          `yaml:"depends_on,omitempty"`
	CapAdd                                    []string          `yaml:"cap_add,omitempty"`
	Build                                     string            `yaml:",omitempty"`
	Entrypoint                                []string          `yaml:",omitempty"`
	Restart                                   string            `yaml:",omitempty"`
	Environment                               map[string]string `yaml:",omitempty"`
	Labels                                    map[string]string `yaml:"labels,omitempty"`
	Links                                     []string          `yaml:"links,omitempty"`
}

func (Service) ChallengeID

func (s Service) ChallengeID() string

type UpOpts

type UpOpts struct {
	PreparedCompose string
	InstanceKey     string
	ForceRecreate   bool
	ProxyNetworkID  string
	PwinitConfig    *pwinit.InitConfig
	Logger          *zap.Logger
}

func NewUpOpts

func NewUpOpts() UpOpts

Jump to

Keyboard shortcuts

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