app

package
v0.0.0-...-b313b0a Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2024 License: GPL-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckEnv

func CheckEnv(app App) ([]envfile.EnvVar, error)

func ExposeAllEnv

func ExposeAllEnv(stackName string, compose *composetypes.Config, appEnv envfile.AppEnv)

ExposeAllEnv exposes all env variables to the app container

func GetAppComposeConfig

func GetAppComposeConfig(recipe string, opts stack.Deploy, appEnv envfile.AppEnv) (*composetypes.Config, error)

GetAppComposeConfig retrieves a compose specification for a recipe. This specification is the result of a merge of all the compose.**.yml files in the recipe repository.

func GetAppNames

func GetAppNames() ([]string, error)

GetAppNames retrieves a list of app names.

func GetAppServiceNames

func GetAppServiceNames(appName string) ([]string, error)

GetAppServiceNames retrieves a list of app service names.

func GetAppStatuses

func GetAppStatuses(apps []App, MachineReadable bool) (map[string]map[string]string, error)

GetAppStatuses queries servers to check the deployment status of given apps.

func GetLabel

func GetLabel(compose *composetypes.Config, stackName string, label string) string

GetLabel reads docker labels in the format of "coop-cloud.${STACK_NAME}.${LABEL}" from the local compose files

func GetTimeoutFromLabel

func GetTimeoutFromLabel(compose *composetypes.Config, stackName string) (int, error)

GetTimeoutFromLabel reads the timeout value from docker label "coop-cloud.${STACK_NAME}.TIMEOUT" and returns 50 as default value

func ReadAbraShCmdNames

func ReadAbraShCmdNames(abraSh string) ([]string, error)

ReadAbraShCmdNames reads the names of commands.

func SanitiseAppName

func SanitiseAppName(name string) string

SanitiseAppName makes a app name usable with Docker by replacing illegal characters.

func ServiceFilter

func ServiceFilter(stack, service string, exact bool) string

ServiceFilter creates a filter string for filtering a service in the docker container runtime. When exact match is true, it uses regex to match the string exactly.

func SetChaosLabel

func SetChaosLabel(compose *composetypes.Config, stackName string, chaos bool)

SetChaosLabel adds the label 'coop-cloud.${STACK_NAME}.chaos=true/false' to the app container to signal if the app is deployed in chaos mode

func SetChaosVersionLabel

func SetChaosVersionLabel(compose *composetypes.Config, stackName string, chaosVersion string)

SetChaosVersionLabel adds the label 'coop-cloud.${STACK_NAME}.chaos-version=$(GIT_COMMIT)' to the app container

func SetRecipeLabel

func SetRecipeLabel(compose *composetypes.Config, stackName string, recipe string)

SetRecipeLabel adds the label 'coop-cloud.${STACK_NAME}.recipe=${RECIPE}' to the app container to signal which recipe is connected to the deployed app

func SetUpdateLabel

func SetUpdateLabel(compose *composetypes.Config, stackName string, appEnv envfile.AppEnv)

SetUpdateLabel adds env ENABLE_AUTO_UPDATE as label to enable/disable the auto update process for this app. The default if this variable is not set is to disable the auto update process.

func StackName

func StackName(appName string) string

StackName gets whatever the docker safe (uses the right delimiting character, e.g. "_") stack name is for the app. In general, you don't want to use this to show anything to end-users, you want use a.Name instead.

func TemplateAppEnvSample

func TemplateAppEnvSample(r recipe.Recipe, appName, server, domain string) error

TemplateAppEnvSample copies the example env file for the app into the users env files.

Types

type App

type App struct {
	Name   AppName
	Recipe recipe.Recipe
	Domain string
	Env    envfile.AppEnv
	Server string
	Path   string
}

App reprents an app with its env file read into memory

func Get

func Get(appName string) (App, error)

Get retrieves an app

func GetApp

func GetApp(apps AppFiles, name AppName) (App, error)

GetApp loads an apps settings, reading it from file, in preparation to use it. It should only be used when ready to use the env file to keep IO operations down.

func GetApps

func GetApps(appFiles AppFiles, recipeFilter string) ([]App, error)

GetApps returns a slice of Apps with their env files read from a given slice of AppFiles.

func NewApp

func NewApp(env envfile.AppEnv, name string, appFile AppFile) (App, error)

NewApp creates new App object

func ReadAppEnvFile

func ReadAppEnvFile(appFile AppFile, name AppName) (App, error)

func (App) Filters

func (a App) Filters(appendServiceNames, exactMatch bool, services ...string) (filters.Args, error)

Filters retrieves app filters for querying the container runtime. By default it filters on all services in the app. It is also possible to pass an otional list of service names, which get filtered instead.

Due to upstream issues, filtering works different depending on what you're querying. So, for example, secrets don't work with regex! The caller needs to implement their own validation that the right secrets are matched. In order to handle these cases, we provide the `appendServiceNames` / `exactMatch` modifiers.

func (App) StackName

func (a App) StackName() string

See documentation of config.StackName

func (App) WriteRecipeVersion

func (a App) WriteRecipeVersion(version string, dryRun bool) error

type AppFile

type AppFile struct {
	Path   string
	Server string
}

AppFile represents app env files on disk without reading the contents

type AppFiles

type AppFiles map[AppName]AppFile

AppFiles is a slice of appfiles

func LoadAppFiles

func LoadAppFiles(servers ...string) (AppFiles, error)

LoadAppFiles gets all app files for a given set of servers or all servers.

type AppName

type AppName = string

AppName is AppName

type ByName

type ByName []App

ByName sort a slice of Apps

func (ByName) Len

func (a ByName) Len() int

func (ByName) Less

func (a ByName) Less(i, j int) bool

func (ByName) Swap

func (a ByName) Swap(i, j int)

type ByRecipe

type ByRecipe []App

ByRecipe sort a slice of Apps

func (ByRecipe) Len

func (a ByRecipe) Len() int

func (ByRecipe) Less

func (a ByRecipe) Less(i, j int) bool

func (ByRecipe) Swap

func (a ByRecipe) Swap(i, j int)

type ByServer

type ByServer []App

ByServer sort a slice of Apps

func (ByServer) Len

func (a ByServer) Len() int

func (ByServer) Less

func (a ByServer) Less(i, j int) bool

func (ByServer) Swap

func (a ByServer) Swap(i, j int)

type ByServerAndRecipe

type ByServerAndRecipe []App

ByServerAndRecipe sort a slice of Apps

func (ByServerAndRecipe) Len

func (a ByServerAndRecipe) Len() int

func (ByServerAndRecipe) Less

func (a ByServerAndRecipe) Less(i, j int) bool

func (ByServerAndRecipe) Swap

func (a ByServerAndRecipe) Swap(i, j int)

Jump to

Keyboard shortcuts

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