Documentation
¶
Overview ¶
Package cli is the package behind dyo command line executable
Index ¶
- Constants
- func CheckSettings(state *State, args *ArgsFlags)
- func CopyTraefikConfiguration(ctx context.Context, containerName string, ...) error
- func DockerPullProgressDisplayer(header string, respIn io.ReadCloser) error
- func EnsureNetworkExists(state *State)
- func GetCrux(state *State, args *ArgsFlags) containerbuilder.Builder
- func GetCruxUI(state *State, args *ArgsFlags) containerbuilder.Builder
- func GetGenerateCommand() *ucli.Command
- func GetKratos(state *State, args *ArgsFlags) containerbuilder.Builder
- func GetMailSlurper(state *State, args *ArgsFlags) containerbuilder.Builder
- func GetMultidatabase(state *State, args *ArgsFlags) containerbuilder.Builder
- func GetTraefik(state *State, args *ArgsFlags) containerbuilder.Builder
- func InitCLI() *ucli.App
- func LoadEnvFile(envFile string) []string
- func NotifyOnce(name string, notifyFunc func())
- func PrintInfo(state *State, args *ArgsFlags)
- func PrintWelcomeMessage(settingsPath string)
- func ProcessCommand(ctx context.Context, initialState *State, args *ArgsFlags)
- func RenderTraefikHostRules(hosts ...string) string
- func SaveSettings(state *State, args *ArgsFlags)
- func SettingsExists(settingsPath string) bool
- func SettingsFileLocation(settingsPath string) string
- func SettingsPath() string
- func StartContainers(stack *dyrectorioStack)
- func StopContainers(ctx context.Context, args *ArgsFlags)
- type ArgsFlags
- type ContainerSettings
- type Containers
- type Options
- type SettingsFile
- type State
Constants ¶
const ( FlagDisableCrux = "disable-crux" FlagDisableCruxUI = "disable-crux-ui" FlagLocalAgent = "local-agent" FlagWrite = "write" FlagDebug = "debug" FlagPreferLocalImages = "prefer-local-images" FlagConfigPath = "config" FlagHosts = "host" FlagPrefix = "prefix" FlagImageTag = "image-tag" FlagSilent = "silent" FlagExpectContainerEnv = "expect-container-env" FlagNetwork = "network" FlagEnvFile = "env-file" )
flags
const ( // SettingsFileName is the filename we use for storing configuration SettingsFileName = "settings.yaml" // CLIDirName is the directory where we save the configuration file under the users configuration directory CLIDirName = "dyo-cli" )
const ( UpCommand = "up" DownCommand = "down" VersionCommand = "version" )
commands
const (
GenerateCommand = "generate"
)
Variables ¶
This section is empty.
Functions ¶
func CheckSettings ¶
CheckSettings makes sure your state is correct
func CopyTraefikConfiguration ¶
func CopyTraefikConfiguration(ctx context.Context, containerName string, traefikTmplConfig traefikFileProviderData) error
CopyTraefikConfiguration copies a config file to Traefik Container
func DockerPullProgressDisplayer ¶
func DockerPullProgressDisplayer(header string, respIn io.ReadCloser) error
func EnsureNetworkExists ¶
func EnsureNetworkExists(state *State)
EnsureNetworkExists makes sure the container network exists
func GetCrux ¶
func GetCrux(state *State, args *ArgsFlags) containerbuilder.Builder
GetCrux services: db migrations and crux api service
func GetCruxUI ¶
func GetCruxUI(state *State, args *ArgsFlags) containerbuilder.Builder
GetCruxUI returns a configured crux-ui service
func GetGenerateCommand ¶
func GetKratos ¶
func GetKratos(state *State, args *ArgsFlags) containerbuilder.Builder
GetKratos returns Kratos services' containers
func GetMailSlurper ¶
func GetMailSlurper(state *State, args *ArgsFlags) containerbuilder.Builder
GetMailSlurper returns the mailslurper service's container
func GetMultidatabase ¶
func GetMultidatabase(state *State, args *ArgsFlags) containerbuilder.Builder
GetMultidatabase returns platform's Postgres services' containers
func GetTraefik ¶
func GetTraefik(state *State, args *ArgsFlags) containerbuilder.Builder
GetTraefik returns a traefik services container
func LoadEnvFile ¶
func NotifyOnce ¶
func NotifyOnce(name string, notifyFunc func())
NotifyOnce makes sure user only gets some information only once
func PrintInfo ¶
PrintInfo tells the user not to use in prod and prints postgres information if crux is disabled
func PrintWelcomeMessage ¶
func PrintWelcomeMessage(settingsPath string)
PrintWelcomeMessage prints a welcome mesage before the command runs
func ProcessCommand ¶
ProcessCommand is the main control function
func RenderTraefikHostRules ¶
func SaveSettings ¶
SaveSettings saves the settings
func SettingsExists ¶
SettingsExists is a check if the settings file is exists
func SettingsFileLocation ¶
SettingsFileLocation is assembling the location of the settings file
func SettingsPath ¶
func SettingsPath() string
SettingsPath returns the full path to the settingsfile
func StartContainers ¶
func StartContainers(stack *dyrectorioStack)
StartContainers is for creating and starting containers
func StopContainers ¶
StopContainers is a cleanup for "down" command, prefix can be provided with for multi removal
Types ¶
type ArgsFlags ¶
type ArgsFlags struct {
EnvFile string
Network string
SettingsFilePath string
Command string
ImageTag string
Prefix string
Hosts []string
CruxDisabled bool
CruxUIDisabled bool
LocalAgent bool
PreferLocalImages bool
SettingsWrite bool
FullyContainerized bool
SettingsExists bool
Silent bool
}
ArgsFlags are commandline arguments
type ContainerSettings ¶
ContainerSettings are container specific settings
type Containers ¶
type Containers struct {
Crux ContainerSettings
CruxMigrate ContainerSettings
CruxUI ContainerSettings
Traefik ContainerSettings
Kratos ContainerSettings
KratosMigrate ContainerSettings
Multidatabase ContainerSettings
MailSlurper ContainerSettings
}
Containers contain container/service specific settings
type Options ¶
type Options struct {
RootPostgresPassword string `yaml:"rootPostgresPassword"`
RootPostgresUser string `yaml:"rootPostgresUser" env-default:"root"`
KratosPostgresDB string `yaml:"kratosPostgresDB" env-default:"kratos"`
KratosPostgresUser string `yaml:"kratosPostgresUser" env-default:"kratos_user"`
KratosPostgresPassword string `yaml:"kratosPostgresPassword"`
TraefikDockerSocket string `yaml:"traefikDockerSocket" env-default:"/var/run/docker.sock"`
MailFromName string `yaml:"mailFromName" env-default:"dyrector.io - Platform"`
CruxSecret string `yaml:"crux-secret"`
CruxEncryptionKey string `yaml:"crux-encryption-key"`
KratosSecret string `yaml:"kratosSecret"`
CruxPostgresDB string `yaml:"cruxPostgresDB" env-default:"crux"`
CruxPostgresUser string `yaml:"cruxPostgresUser" env-default:"crux_user"`
CruxPostgresPassword string `yaml:"cruxPostgresPassword"`
TimeZone string `yaml:"timezone" env-default:"UTC"`
MailFromEmail string `yaml:"mailFromEmail" env-default:"noreply@example.com"`
TraefikWebPort uint `yaml:"traefikWebPort" env-default:"8000"`
CruxUIPort uint `yaml:"crux-ui-port" env-default:"3000"`
KratosPublicPort uint `yaml:"kratosPublicPort" env-default:"4433"`
TraefikUIPort uint `yaml:"traefikUIPort" env-default:"8080"`
CruxHTTPPort uint `yaml:"crux-http-port" env-default:"1848"`
CruxAgentGrpcPort uint `yaml:"crux-agentgrpc-port" env-default:"5000"`
MailSlurperUIPort uint `yaml:"mailSlurperUIPort" env-default:"4436"`
MailSlurperSMTPPort uint `yaml:"mailSlurperSMTPPort" env-default:"1025"`
MultidatabasePostgresPort uint `yaml:"multidatabasePostgresPort" env-default:"5432"`
MailSlurperAPIPort uint `yaml:"mailSlurperAPIPort" env-default:"4437"`
KratosAdminPort uint `yaml:"kratosAdminPort" env-default:"4434"`
TraefikIsDockerSocketNamedPipe bool `yaml:"traefikIsDockerSocketNamedPipe" env-default:"false"`
}
Options are "globals" for the SettingsFile struct
type SettingsFile ¶
type SettingsFile struct {
// version as in image tag like "latest" or "stable"
Version string `yaml:"version" env-default:"stable"`
Network string `yaml:"network-name" env-default:"dyo-stable"`
Prefix string `yaml:"prefix" env-default:"dyo-stable"`
Options
}
SettingsFile will be read/written as this struct
type State ¶
type State struct {
Ctx context.Context
*Containers
InternalHostDomain string
EnvFile []string
SettingsFile SettingsFile
}
State itself exists per-execution, settingsFile is persisted freedesktop spec folders used by default, $XDG_CONFIG_HOME
func DisabledServiceSettings ¶
DisabledServiceSettings modifies the setting if the crux-ui is disabled
func LoadDefaultsOnEmpty ¶
LoadDefaultsOnEmpty There are options which are not filled out by default, we need to initialize values
func SettingsFileDefaults ¶
SettingsFileDefaults creating, reading and parsing the settings.yaml