Documentation ¶
Index ¶
- Constants
- Variables
- type Container
- func (i *Container) DockerContainerName() string
- func (i *Container) DockerImageVertexName() string
- func (i *Container) GetImageNameWithTag() string
- func (i *Container) GetVersion() string
- func (i *Container) HasFeature(featureType string) bool
- func (i *Container) HasFeatureIn(featureTypes []string) bool
- func (i *Container) HasTag(tag string) bool
- func (i *Container) HasTagIn(tags []string) bool
- func (i *Container) IsBusy() bool
- func (i *Container) IsRunning() bool
- func (i *Container) LaunchOnStartup() bool
- func (i *Container) ResetDefaultEnv()
- type ContainerAdapterPort
- type ContainerEnvAdapterPort
- type ContainerEnvVariables
- type ContainerLogsAdapterPort
- type ContainerRunnerAdapterPort
- type ContainerSearchQuery
- type ContainerServiceAdapterPort
- type ContainerSettings
- type ContainerSettingsAdapterPort
- type ContainerUpdate
- type DatabaseEnvironment
- type DatabaseEnvironmentNames
- type DatabaseFeature
- type DownloadProgress
- type DownloadProgressGroup
- type EventContainerCreated
- type EventContainerDeleted
- type EventContainerLoaded
- type EventContainerLog
- type EventContainerStatusChange
- type EventContainersChange
- type EventContainersLoaded
- type EventContainersStopped
- type Features
- type LogLine
- type LogLineMessage
- type LogLineMessageDownload
- type LogLineMessageDownloads
- type LogLineMessageString
- type Service
- type ServiceAdapterPort
- type ServiceClone
- type ServiceDependency
- type ServiceEnv
- type ServiceMethodDocker
- type ServiceMethodRelease
- type ServiceMethodScript
- type ServiceMethods
- type ServiceUpdate
- type ServiceV1
- type ServiceVersioning
- type URL
- type Version
Constants ¶
View Source
const ( ContainerStatusOff = "off" ContainerStatusBuilding = "building" ContainerStatusStarting = "starting" ContainerStatusRunning = "running" ContainerStatusStopping = "stopping" ContainerStatusError = "error" )
View Source
const ( ErrCodeContainerUuidInvalid router.ErrCode = "container_uuid_invalid" ErrCodeContainerUuidMissing router.ErrCode = "container_uuid_missing" ErrCodeContainerNotFound router.ErrCode = "container_not_found" ErrCodeContainerAlreadyRunning router.ErrCode = "container_already_running" ErrCodeContainerStillRunning router.ErrCode = "container_still_running" ErrCodeContainerNotRunning router.ErrCode = "container_not_running" ErrCodeFailedToGetContainer router.ErrCode = "failed_to_get_container" ErrCodeFailedToStartContainer router.ErrCode = "failed_to_start_container" ErrCodeFailedToStopContainer router.ErrCode = "failed_to_stop_container" ErrCodeFailedToDeleteContainer router.ErrCode = "failed_to_delete_container" ErrCodeFailedToGetContainerLogs router.ErrCode = "failed_to_get_logs" ErrCodeFailedToUpdateServiceContainer router.ErrCode = "failed_to_update_service_container" ErrCodeFailedToGetVersions router.ErrCode = "failed_to_get_versions" ErrCodeFailedToWaitContainer router.ErrCode = "failed_to_wait_container" ErrCodeFailedToSetLaunchOnStartup router.ErrCode = "failed_to_set_launch_on_startup" ErrCodeFailedToSetDisplayName router.ErrCode = "failed_to_set_display_name" ErrCodeFailedToSetDatabase router.ErrCode = "failed_to_set_database" ErrCodeFailedToSetVersion router.ErrCode = "failed_to_set_version" ErrCodeFailedToSetTags router.ErrCode = "failed_to_set_tags" ErrCodeFailedToSetEnv router.ErrCode = "failed_to_set_env" ErrCodeFailedToCheckForUpdates router.ErrCode = "failed_to_check_for_updates" ErrCodeServiceIdMissing router.ErrCode = "service_id_missing" ErrCodeServiceNotFound router.ErrCode = "service_not_found" ErrCodeFailedToInstallService router.ErrCode = "failed_to_install_service" )
View Source
const ( EventNameContainersChange = "change" EventNameContainerStatusChange = "status_change" EventNameContainerStdout = "stdout" EventNameContainerStderr = "stderr" EventNameContainerDownload = "download" )
View Source
const ( LogKindOut = "out" LogKindErr = "err" LogKindDownload = "download" LogKindDownloads = "downloads" LogKindVertexOut = "vertex_out" LogKindVertexErr = "vertex_err" )
View Source
const (
ContainerInstallMethodDocker = "docker"
)
Variables ¶
View Source
var ( ErrContainerNotFound = errors.New("container not found") ErrContainerStillRunning = errors.New("container still running") )
View Source
var ErrBufferEmpty = errors.New("the buffer is empty")
View Source
var (
ErrServiceNotFound = errors.New("the service was not found")
)
Functions ¶
This section is empty.
Types ¶
type Container ¶
type Container struct { ContainerSettings Service Service `json:"service"` UUID uuid.UUID `json:"uuid"` Status string `json:"status"` Env ContainerEnvVariables `json:"environment,omitempty"` Update *ContainerUpdate `json:"update,omitempty"` ServiceUpdate ServiceUpdate `json:"service_update,omitempty"` CacheVersions []string `json:"cache_versions,omitempty"` }
func (*Container) DockerContainerName ¶
func (*Container) DockerImageVertexName ¶
func (*Container) GetImageNameWithTag ¶
func (*Container) GetVersion ¶
func (*Container) HasFeature ¶
func (*Container) HasFeatureIn ¶
func (*Container) LaunchOnStartup ¶
func (*Container) ResetDefaultEnv ¶
func (i *Container) ResetDefaultEnv()
type ContainerAdapterPort ¶
type ContainerEnvAdapterPort ¶
type ContainerEnvAdapterPort interface { Save(uuid uuid.UUID, env ContainerEnvVariables) error Load(uuid uuid.UUID) (ContainerEnvVariables, error) }
type ContainerEnvVariables ¶
type ContainerLogsAdapterPort ¶
type ContainerLogsAdapterPort interface { Register(uuid uuid.UUID) error Unregister(uuid uuid.UUID) error UnregisterAll() error Push(uuid uuid.UUID, line LogLine) Pop(uuid uuid.UUID) (LogLine, error) // LoadBuffer will load the latest logs kept in memory. LoadBuffer(uuid uuid.UUID) ([]LogLine, error) }
type ContainerRunnerAdapterPort ¶
type ContainerRunnerAdapterPort interface { Delete(inst *Container) error Start(inst *Container, setStatus func(status string)) (stdout io.ReadCloser, stderr io.ReadCloser, err error) Stop(inst *Container) error Info(inst Container) (map[string]any, error) WaitCondition(inst *Container, cond types.WaitContainerCondition) error CheckForUpdates(inst *Container) error HasUpdateAvailable(inst Container) (bool, error) GetAllVersions(inst Container) ([]string, error) }
type ContainerSearchQuery ¶
type ContainerSettings ¶
type ContainerSettings struct { // Method indicates how the container is installed. // It can be by script, release or docker. InstallMethod *string `json:"install_method,omitempty" yaml:"install_method,omitempty"` // LaunchOnStartup indicates if the container needs to start automatically when Vertex starts. // The default value is true. LaunchOnStartup *bool `json:"launch_on_startup,omitempty" yaml:"launch_on_startup,omitempty"` // DisplayName is a custom name for the container. DisplayName string `json:"display_name" yaml:"display_name"` // Databases describes the databases used by the container. // The key is the database ID, and the value is the database container UUID. Databases map[string]uuid.UUID `json:"databases,omitempty" yaml:"databases,omitempty"` // Version is the version of the program. Version *string `json:"version,omitempty" yaml:"version,omitempty"` // Tags are the tags assigned to the container. Tags []string `json:"tags,omitempty" yaml:"tags,omitempty"` }
type ContainerSettingsAdapterPort ¶
type ContainerSettingsAdapterPort interface { Save(uuid uuid.UUID, settings ContainerSettings) error Load(uuid uuid.UUID) (ContainerSettings, error) }
type ContainerUpdate ¶
type DatabaseEnvironment ¶
type DatabaseEnvironment struct { // DisplayName is a readable name for the user. DisplayName string `yaml:"display_name" json:"display_name"` // The database Types. Can be redis, postgres... Types []string `yaml:"types" json:"types"` // The database environment names. Names DatabaseEnvironmentNames `yaml:"names" json:"names"` }
type DatabaseFeature ¶
type DatabaseFeature struct { // The database Type. Can be redis, postgres... Type string `yaml:"type" json:"type"` // The database Category. Can be 'sql', 'redis'... Category string `yaml:"category" json:"category"` // The database Port. Must be the name // of an environment variable. Port string `yaml:"port" json:"port"` // The Username to connect to the database. Must be the name // of an environment variable. Username *string `yaml:"username" json:"username"` // The Password to connect to the database. Must be the name // of an environment variable. Password *string `yaml:"password" json:"password"` }
type DownloadProgress ¶
type DownloadProgressGroup ¶
type DownloadProgressGroup []*DownloadProgress
type EventContainerCreated ¶
type EventContainerCreated struct{}
type EventContainerDeleted ¶
type EventContainerLoaded ¶
type EventContainerLoaded struct {
Container *Container
}
type EventContainerLog ¶
type EventContainerLog struct { ContainerUUID uuid.UUID Kind string Message LogLineMessage }
type EventContainersChange ¶
type EventContainersChange struct{}
type EventContainersLoaded ¶
type EventContainersLoaded struct {
Count int
}
type EventContainersStopped ¶
type EventContainersStopped struct{}
type Features ¶
type Features struct { // The database feature describes the database made available // by this service. Databases *[]DatabaseFeature `yaml:"databases" json:"databases"` }
type LogLine ¶
type LogLine struct { Id int `json:"id"` Kind string `json:"kind"` Message LogLineMessage `json:"message"` }
type LogLineMessage ¶
type LogLineMessage interface {
String() string
}
type LogLineMessageDownload ¶
type LogLineMessageDownload struct {
*DownloadProgress
}
func NewLogLineMessageDownload ¶
func NewLogLineMessageDownload(p *DownloadProgress) *LogLineMessageDownload
func (*LogLineMessageDownload) MarshalJSON ¶
func (m *LogLineMessageDownload) MarshalJSON() ([]byte, error)
func (*LogLineMessageDownload) String ¶
func (m *LogLineMessageDownload) String() string
type LogLineMessageDownloads ¶
type LogLineMessageDownloads struct {
*DownloadProgressGroup
}
func NewLogLineMessageDownloads ¶
func NewLogLineMessageDownloads(p *DownloadProgress) *LogLineMessageDownloads
func (*LogLineMessageDownloads) MarshalJSON ¶
func (m *LogLineMessageDownloads) MarshalJSON() ([]byte, error)
func (*LogLineMessageDownloads) Merge ¶
func (m *LogLineMessageDownloads) Merge(progress *DownloadProgress)
func (*LogLineMessageDownloads) String ¶
func (m *LogLineMessageDownloads) String() string
type LogLineMessageString ¶
type LogLineMessageString struct {
Value string `json:"value"`
}
func NewLogLineMessageString ¶
func NewLogLineMessageString(s string) *LogLineMessageString
func (*LogLineMessageString) String ¶
func (m *LogLineMessageString) String() string
type Service ¶
type Service struct { ServiceVersioning `yaml:",inline"` // ID is the identifier of the service. It must be unique. ID string `yaml:"id" json:"id"` // Name is the displayed name of the service. Name string `yaml:"name" json:"name"` // Repository is the url of the repository, if it is an external repository. Repository *string `yaml:"repository,omitempty" json:"repository,omitempty"` // Description describes the service in a few words. Description string `yaml:"description" json:"description"` // Color is the main color of the service. Color *string `yaml:"color,omitempty" json:"color,omitempty"` // Icon is the icon link of the service, located in ./live/services/icons/. Icon *string `yaml:"icon,omitempty" json:"icon,omitempty"` // Features describes some features of the service to help Vertex. Features *Features `yaml:"features,omitempty" json:"features,omitempty"` // Env defines all parameterizable environment variables. Env []ServiceEnv `yaml:"environment,omitempty" json:"environment,omitempty"` // Databases defines all databases used by the service. Databases map[string]DatabaseEnvironment `yaml:"databases,omitempty" json:"databases,omitempty"` // URLs defines all service urls. URLs []URL `yaml:"urls,omitempty" json:"urls,omitempty"` // Methods defines different methods to install the service. Methods ServiceMethods `yaml:"methods" json:"methods"` }
func (*Service) UnmarshalYAML ¶
type ServiceAdapterPort ¶
type ServiceAdapterPort interface { // Get a service with its id. Returns ErrServiceNotFound if // the service was not found. Get(id string) (Service, error) GetScript(id string) ([]byte, error) // GetRaw gets a service by id, without any processing. // Returns ErrServiceNotFound if the service was not found. GetRaw(id string) (interface{}, error) // GetAll gets all available services. GetAll() []Service // Reload the adapter Reload() error }
type ServiceClone ¶
type ServiceClone struct {
Repository string `yaml:"repository" json:"repository"`
}
type ServiceDependency ¶
type ServiceDependency struct{}
type ServiceEnv ¶
type ServiceEnv struct { // Type is the environment variable type. // It can be: port, string, url. Type string `yaml:"type" json:"type"` // Name is the environment variable name that will be used by the service. Name string `yaml:"name" json:"name"` // DisplayName is a readable name for the user. DisplayName string `yaml:"display_name" json:"display_name"` // Secret is true if the value should not be read. Secret *bool `yaml:"secret,omitempty" json:"secret,omitempty"` // Default defines a default value. Default string `yaml:"default,omitempty" json:"default,omitempty"` // Description describes this variable to the user. Description string `yaml:"description" json:"description"` }
type ServiceMethodDocker ¶
type ServiceMethodDocker struct { // Image is the Docker image to run. Image *string `yaml:"image,omitempty" json:"image,omitempty"` // Clone describes the repository to clone if some files are needed to run the script. Clone *ServiceClone `yaml:"clone,omitempty" json:"clone,omitempty"` // Dockerfile is the name of the Dockerfile if the repository is cloned. Dockerfile *string `yaml:"dockerfile,omitempty" json:"dockerfile,omitempty"` // Ports is a map containing docker port as a key, and output port as a value. // The output port is automatically adjusted with PORT environment variables. Ports *map[string]string `yaml:"ports,omitempty" json:"ports,omitempty"` // Volumes is a map containing output folder as a key, and input folder from Docker // as a string value. Volumes *map[string]string `yaml:"volumes,omitempty" json:"volumes,omitempty"` // Environment is a map containing docker environment variable as a key, and // its corresponding service environment name as a value. Environment *map[string]string `yaml:"environment,omitempty" json:"environment,omitempty"` // Capabilities is an array containing all additional Docker capabilities. Capabilities *[]string `yaml:"capabilities,omitempty" json:"capabilities,omitempty"` // Sysctls allows to modify kernel parameters. Sysctls *map[string]string `yaml:"sysctls,omitempty" json:"sysctls,omitempty"` // Cmd is the command to run in the container. Cmd *string `yaml:"command,omitempty" json:"command,omitempty"` }
type ServiceMethodRelease ¶
type ServiceMethodRelease struct { // Dependencies lists all dependencies needed before running the service. Dependencies *map[string]ServiceDependency `yaml:"dependencies,omitempty" json:"dependencies,omitempty"` }
type ServiceMethodScript ¶
type ServiceMethodScript struct { // Filename is the name of the file to run to start the service. Filename string `yaml:"file" json:"file"` // Clone describes the repository to clone if some files are needed to run the script. Clone *ServiceClone `yaml:"clone,omitempty" json:"clone,omitempty"` // Dependencies lists all dependencies needed before running the service. Dependencies *map[string]ServiceDependency `yaml:"dependencies,omitempty" json:"dependencies,omitempty"` }
type ServiceMethods ¶
type ServiceMethods struct { // Script is a method to launch the service with a shell script. Script *ServiceMethodScript `yaml:"script,omitempty" json:"script,omitempty"` // Release is a method to download and launch the service with // precompiled binaries from GitHub. Release *ServiceMethodRelease `yaml:"release,omitempty" json:"release,omitempty"` // Docker is a method to run the service with Docker. Docker *ServiceMethodDocker `yaml:"docker,omitempty" json:"docker,omitempty"` }
type ServiceUpdate ¶
type ServiceUpdate struct {
Available bool `json:"available"`
}
type ServiceVersioning ¶
type ServiceVersioning struct { // Version of the service format used. Version Version `yaml:"version" json:"version"` }
type URL ¶
type URL struct { // Name is the name displayed to the used describing this URL. Name string `yaml:"name" json:"name"` // Port is the port where this url is supposed to be. // Note that this port is mapped to the default value of an environment definition if possible, // but the port here doesn't change with the environment. Port string `yaml:"port" json:"port"` // HomeRoute allows to specify a route to change the home path. HomeRoute *string `yaml:"home,omitempty" json:"home,omitempty"` // PingRoute allows to specify a route to change the ping path. PingRoute *string `yaml:"ping,omitempty" json:"ping,omitempty"` // Kind is the type of url. // It can be: client, server. Kind string `yaml:"kind" json:"kind"` }
Click to show internal directories.
Click to hide internal directories.