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, name, internalHostDomain string, ...) error
- func EnsureNetworkExists(state *State)
- func GetCrux(state *State, args *ArgsFlags) containerbuilder.Builder
- func GetCruxPostgres(state *State, args *ArgsFlags) containerbuilder.Builder
- func GetCruxUI(state *State, args *ArgsFlags) containerbuilder.Builder
- func GetKratos(state *State, args *ArgsFlags) containerbuilder.Builder
- func GetKratosPostgres(state *State, args *ArgsFlags) containerbuilder.Builder
- func GetMailSlurper(state *State, args *ArgsFlags) containerbuilder.Builder
- func GetTraefik(state *State, args *ArgsFlags) containerbuilder.Builder
- func InitCLI() *ucli.App
- 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 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)
- func TryImage(dockerImage, specialTag string) string
- type ArgsFlags
- type ContainerSettings
- type Containers
- type Options
- type SettingsFile
- type State
Constants ¶
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" )
UpCommand and DownCommand is the magic words we use to bring up/down the stack
Variables ¶
This section is empty.
Functions ¶
func CheckSettings ¶
CheckSettings makes sure your state is correct
func CopyTraefikConfiguration ¶
func CopyTraefikConfiguration(ctx context.Context, name, internalHostDomain string, cruxPort, cruxUIPort uint) error
CopyTraefikConfiguration copies a config file to Traefik Container
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 GetCruxPostgres ¶
func GetCruxPostgres(state *State, args *ArgsFlags) containerbuilder.Builder
GetCruxPostgres returns crux's Postgres services' containers
func GetCruxUI ¶
func GetCruxUI(state *State, args *ArgsFlags) containerbuilder.Builder
GetCruxUI returns a configured crux-ui service
func GetKratos ¶
func GetKratos(state *State, args *ArgsFlags) containerbuilder.Builder
GetKratos returns Kratos services' containers
func GetKratosPostgres ¶
func GetKratosPostgres(state *State, args *ArgsFlags) containerbuilder.Builder
GetKratosPostgres returns crux's Postgres services' containers
func GetMailSlurper ¶
func GetMailSlurper(state *State, args *ArgsFlags) containerbuilder.Builder
GetMailSlurper returns the mailslurper service's container
func GetTraefik ¶
func GetTraefik(state *State, args *ArgsFlags) containerbuilder.Builder
GetTraefik returns a traefik services container
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 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 { SettingsWrite bool SettingsExists bool SettingsFilePath string Command string ImageTag string Prefix string SpecialImageTag string DisableForcepull bool CruxDisabled bool CruxUIDisabled bool LocalAgent bool FullyContainerized bool Network string 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 CruxPostgres ContainerSettings KratosPostgres ContainerSettings MailSlurper ContainerSettings }
Containers contain container/service specific settings
type Options ¶
type Options struct { TimeZone string `yaml:"timezone" env-default:"UTC"` CruxAgentGrpcPort uint `yaml:"crux-agentgrpc-port" env-default:"5000"` CruxHTTPPort uint `yaml:"crux-http-port" env-default:"1848"` CruxUIPort uint `yaml:"crux-ui-port" env-default:"3000"` CruxSecret string `yaml:"crux-secret"` CruxPostgresPort uint `yaml:"cruxPostgresPort" env-default:"5432"` CruxPostgresDB string `yaml:"cruxPostgresDB" env-default:"crux"` CruxPostgresUser string `yaml:"cruxPostgresUser" env-default:"crux"` CruxPostgresPassword string `yaml:"cruxPostgresPassword"` TraefikWebPort uint `yaml:"traefikWebPort" env-default:"8000"` TraefikUIPort uint `yaml:"traefikUIPort" env-default:"8080"` TraefikDockerSocket string `yaml:"traefikDockerSocket" env-default:"/var/run/docker.sock"` TraefikIsDockerSocketNamedPipe bool `yaml:"traefikIsDockerSocketNamedPipe" env-default:"false"` KratosAdminPort uint `yaml:"kratosAdminPort" env-default:"4434"` KratosPublicPort uint `yaml:"kratosPublicPort" env-default:"4433"` KratosPostgresPort uint `yaml:"kratosPostgresPort" env-default:"5433"` KratosPostgresDB string `yaml:"kratosPostgresDB" env-default:"kratos"` KratosPostgresUser string `yaml:"kratosPostgresUser" env-default:"kratos"` KratosPostgresPassword string `yaml:"kratosPostgresPassword"` KratosSecret string `yaml:"kratosSecret"` MailSlurperSMTPPort uint `yaml:"mailSlurperSMTPPort" env-default:"1025"` MailSlurperUIPort uint `yaml:"mailSlurperUIPort" env-default:"4436"` MailSlurperAPIPort uint `yaml:"mailSlurperAPIPort" env-default:"4437"` MailFromName string `yaml:"mailFromName" env-default:"dyrector.io - Platform"` MailFromEmail string `yaml:"mailFromEmail" env-default:"noreply@example.com"` }
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 SettingsFile SettingsFile InternalHostDomain string *Containers }
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