Documentation ¶
Index ¶
- Constants
- Variables
- func ExposeAllEnv(stackName string, compose *composetypes.Config, appEnv AppEnv)
- func GetAllFilesInDirectory(directory string) ([]fs.FileInfo, error)
- func GetAllFoldersInDirectory(directory string) ([]string, error)
- func GetAppComposeConfig(recipe string, opts stack.Deploy, appEnv AppEnv) (*composetypes.Config, error)
- func GetAppNames() ([]string, error)
- func GetAppServiceNames(appName string) ([]string, error)
- func GetAppStatuses(apps []App, MachineReadable bool) (map[string]map[string]string, error)
- func GetComposeFiles(recipe string, appEnv AppEnv) ([]string, error)
- func GetLabel(compose *composetypes.Config, stackName string, label string) string
- func GetServers() ([]string, error)
- func GetTimeoutFromLabel(compose *composetypes.Config, stackName string) (int, error)
- func ReadAbraShCmdNames(abraSh string) ([]string, error)
- func ReadAbraShEnvVars(abraSh string) (map[string]string, error)
- func ReadEnvWithModifiers(filePath string) (AppEnv, AppModifiers, error)
- func ReadServerNames() ([]string, error)
- func SanitiseAppName(name string) string
- func ServiceFilter(stack, service string, exact bool) string
- func SetChaosLabel(compose *composetypes.Config, stackName string, chaos bool)
- func SetChaosVersionLabel(compose *composetypes.Config, stackName string, chaosVersion string)
- func SetRecipeLabel(compose *composetypes.Config, stackName string, recipe string)
- func SetUpdateLabel(compose *composetypes.Config, stackName string, appEnv AppEnv)
- func StackName(appName string) string
- func TemplateAppEnvSample(recipeName, appName, server, domain string) error
- type App
- type AppEnv
- type AppFile
- type AppFiles
- type AppModifiers
- type AppName
- type ByName
- type ByRecipe
- type ByServer
- type ByServerAndRecipe
- type EnvVar
Constants ¶
const MAX_DOCKER_SECRET_LENGTH = 64
const MAX_SANITISED_APP_NAME_LENGTH = 45
Variables ¶
var ABRA_DIR = getBaseDir()
var BACKUP_DIR = path.Join(ABRA_DIR, "backups")
var BackupbotLabel = "coop-cloud.backupbot.enabled"
var CATALOGUE_DIR = path.Join(ABRA_DIR, "catalogue")
var CATALOGUE_JSON_REPO_NAME = "recipes-catalogue-json"
var RECIPES_DIR = path.Join(ABRA_DIR, "recipes")
var RECIPES_JSON = path.Join(ABRA_DIR, "catalogue", "recipes.json")
var REPOS_BASE_URL = "https://git.coopcloud.tech/coop-cloud"
var SERVERS_DIR = path.Join(ABRA_DIR, "servers")
var SSH_URL_TEMPLATE = "ssh://git@git.coopcloud.tech:2222/coop-cloud/%s.git"
var VENDOR_DIR = path.Join(ABRA_DIR, "vendor")
Functions ¶
func ExposeAllEnv ¶
func ExposeAllEnv(stackName string, compose *composetypes.Config, appEnv AppEnv)
ExposeAllEnv exposes all env variables to the app container
func GetAllFilesInDirectory ¶
GetAllFilesInDirectory returns filenames of all files in directory
func GetAllFoldersInDirectory ¶
GetAllFoldersInDirectory returns both folder and symlink paths
func GetAppComposeConfig ¶
func GetAppComposeConfig(recipe string, opts stack.Deploy, appEnv 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 GetAppServiceNames ¶
GetAppServiceNames retrieves a list of app service names.
func GetAppStatuses ¶
GetAppStatuses queries servers to check the deployment status of given apps.
func GetComposeFiles ¶
GetComposeFiles gets the list of compose files for an app (or recipe if you don't already have an app) which should be merged into a composetypes.Config while respecting the COMPOSE_FILE env var.
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 ¶
ReadAbraShCmdNames reads the names of commands.
func ReadAbraShEnvVars ¶
ReadAbraShEnvVars reads env vars from an abra.sh recipe file.
func ReadEnvWithModifiers ¶
func ReadEnvWithModifiers(filePath string) (AppEnv, AppModifiers, error)
ReadEnv loads an app envivornment and their modifiers in two different maps.
func ReadServerNames ¶
ReadServerNames retrieves all server names.
func SanitiseAppName ¶
SanitiseAppName makes a app name usable with Docker by replacing illegal characters.
func ServiceFilter ¶
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 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 ¶
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 ¶
TemplateAppEnvSample copies the example env file for the app into the users env files.
Types ¶
type App ¶
App reprents an app with its env file read into memory
func GetApp ¶
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 ¶
GetApps returns a slice of Apps with their env files read from a given slice of AppFiles.
func (App) Filters ¶
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.
type AppFiles ¶
AppFiles is a slice of appfiles
func LoadAppFiles ¶
LoadAppFiles gets all app files for a given set of servers or all servers.
type AppModifiers ¶
AppModifiers is a map of modifiers in an apps env config
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)