Documentation ¶
Index ¶
- Constants
- Variables
- func ChangePassword(ctx context.Context, db gorm.DB, username string, oldPassword string, ...) error
- func ChangeProxyType(db *gorm.DB, server *Server, proxyType ProxyType) error
- func ChangeSSHPort(db *gorm.DB, server *Server, newPort int) error
- func ChangeServerIP(db *gorm.DB, server *Server, newIp string) error
- func CreateApplicationServiceResourceStat(_ context.Context, db gorm.DB, appStats []*ApplicationServiceResourceStat) error
- func CreateServer(db *gorm.DB, server *Server) error
- func CreateServerLog(db *gorm.DB, serverLog *ServerLog) error
- func DeleteAnalyticsServiceToken(ctx context.Context, db gorm.DB, serverId uint) error
- func DeleteBuildArgsByDeploymentId(ctx context.Context, db gorm.DB, deploymentId string) error
- func DeleteBuildLogsByDeploymentId(ctx context.Context, db gorm.DB, deploymentId string) error
- func DeleteEnvironmentVariablesByApplicationId(ctx context.Context, db gorm.DB, applicationId string) error
- func DeletePersistentVolumeBackupsByPersistentVolumeId(ctx context.Context, db gorm.DB, persistentVolumeId uint, dataDir string, ...) error
- func DeletePersistentVolumeBindingsByApplicationId(ctx context.Context, db gorm.DB, applicationId string) error
- func DeletePersistentVolumeRestoresByPersistentVolumeId(ctx context.Context, db gorm.DB, persistentVolumeId uint, dataDir string) error
- func DeleteServer(db *gorm.DB, id uint) error
- func DeleteUser(ctx context.Context, db gorm.DB, id uint) error
- func DisableTotp(ctx context.Context, db gorm.DB, username string) error
- func FetchAllExposedTCPPorts(ctx context.Context, db gorm.DB) ([]int, error)
- func FetchAllExposedUDPPorts(ctx context.Context, db gorm.DB) ([]int, error)
- func FetchDisabledDeploymentServerHostNames(db *gorm.DB) ([]string, error)
- func FetchServerIDByHostName(db *gorm.DB, hostName string) (uint, error)
- func FetchServerLogContentByID(db *gorm.DB, id uint) (string, error)
- func FindCurrentDeployedDeploymentIDByApplicationId(ctx context.Context, db gorm.DB, id string) (string, error)
- func FindLatestDeploymentIDByApplicationId(ctx context.Context, db gorm.DB, id string) (string, error)
- func IsAnyActiveProxyServerOffline(db *gorm.DB) (bool, error)
- func IsDeploymentFailed(ctx context.Context, db gorm.DB, id string) (bool, error)
- func IsExistApplicationName(_ context.Context, db gorm.DB, dockerManager containermanger.Manager, ...) (bool, error)
- func IsExistPersistentVolume(_ context.Context, db gorm.DB, name string, ...) (bool, error)
- func IsPreparedServerExists(db *gorm.DB) (bool, error)
- func MarkServerAsOffline(db *gorm.DB, server *Server) error
- func MarkServerAsOnline(db *gorm.DB, server *Server) error
- func NoOfPreparedServers(db *gorm.DB) (int, error)
- func NoOfServers(db *gorm.DB) (int, error)
- func UpdateServer(db *gorm.DB, server *Server) error
- func ValidateAnalyticsServiceToken(ctx context.Context, db gorm.DB, id string, token string) (verified bool, serverHostName string, err error)
- type AnalyticsServiceToken
- type AppBasicAuthAccessControlList
- type AppBasicAuthAccessControlUser
- func (u *AppBasicAuthAccessControlUser) Create(_ context.Context, db *gorm.DB) error
- func (u *AppBasicAuthAccessControlUser) Delete(_ context.Context, db *gorm.DB) error
- func (u *AppBasicAuthAccessControlUser) FindById(_ context.Context, db *gorm.DB, id uint) error
- func (u *AppBasicAuthAccessControlUser) Update(_ context.Context, db *gorm.DB) error
- type Application
- func (application *Application) Create(ctx context.Context, db gorm.DB, dockerManager containermanger.Manager, ...) error
- func (application *Application) DockerProxyServiceName() string
- func (application *Application) FindById(_ context.Context, db gorm.DB, id string) error
- func (application *Application) FindByName(_ context.Context, db gorm.DB, name string) error
- func (application *Application) HardDelete(ctx context.Context, db gorm.DB, _ containermanger.Manager) error
- func (application *Application) IsApplicationDeleted(_ context.Context, db gorm.DB) (bool, error)
- func (application *Application) MarkAsSleeping(ctx context.Context, db gorm.DB) error
- func (application *Application) MarkAsWake(ctx context.Context, db gorm.DB) error
- func (application *Application) RebuildApplication(ctx context.Context, db gorm.DB) (deploymentId string, error error)
- func (application *Application) RegenerateWebhookToken(ctx context.Context, db gorm.DB) error
- func (application *Application) ReplicaCount() uint
- func (application *Application) SoftDelete(ctx context.Context, db gorm.DB, _ containermanger.Manager) error
- func (application *Application) Update(ctx context.Context, db gorm.DB, _ containermanger.Manager) (*ApplicationUpdateResult, error)
- func (application *Application) UpdateGroup(ctx context.Context, db gorm.DB, groupId *string) error
- type ApplicationCustomHealthCheck
- type ApplicationDeploymentInfo
- type ApplicationGroup
- func (applicationGroup *ApplicationGroup) Create(_ context.Context, db gorm.DB) error
- func (applicationGroup *ApplicationGroup) Delete(_ context.Context, db gorm.DB) error
- func (applicationGroup *ApplicationGroup) FindById(ctx context.Context, db gorm.DB, id string) error
- func (applicationGroup *ApplicationGroup) IsAnyApplicationAssociatedWithGroup(ctx context.Context, db gorm.DB) (bool, error)
- type ApplicationReservedResource
- type ApplicationResourceLimit
- type ApplicationServiceNetStat
- type ApplicationServiceResourceStat
- type ApplicationUpdateResult
- type BackupStatus
- type BackupType
- type BuildArg
- type CIFSConfig
- type ConfigMount
- type ConsoleTarget
- type ConsoleToken
- type Deployment
- func FindCurrentDeployedDeploymentByApplicationId(ctx context.Context, db gorm.DB, id string) (*Deployment, error)
- func FindDeploymentsByApplicationId(ctx context.Context, db gorm.DB, id string) ([]*Deployment, error)
- func FindDeploymentsByGitCredentialId(ctx context.Context, db gorm.DB, id uint) ([]*Deployment, error)
- func FindDeploymentsByImageRegistryCredentialId(ctx context.Context, db gorm.DB, id uint) ([]*Deployment, error)
- func FindLatestDeploymentByApplicationId(ctx context.Context, db gorm.DB, id string) (*Deployment, error)
- func (deployment *Deployment) Create(ctx context.Context, db gorm.DB) error
- func (deployment *Deployment) Delete(ctx context.Context, db gorm.DB) error
- func (deployment *Deployment) DeployableDockerImageURI(remoteRegistryPrefix string) string
- func (deployment *Deployment) FindById(ctx context.Context, db gorm.DB, id string) error
- func (deployment *Deployment) GitRepositoryURL() string
- func (deployment *Deployment) Update(ctx context.Context, db gorm.DB) (*DeploymentUpdateResult, error)
- func (deployment *Deployment) UpdateStatus(ctx context.Context, db gorm.DB, status DeploymentStatus) error
- type DeploymentLog
- type DeploymentMode
- type DeploymentStatus
- type DeploymentUpdateResult
- type DockerProxyConfig
- type DockerProxyPermission
- type DockerProxyPermissionType
- type Domain
- func (domain *Domain) Create(_ context.Context, db gorm.DB) error
- func (domain *Domain) Delete(_ context.Context, db gorm.DB) error
- func (domain *Domain) FindById(_ context.Context, db gorm.DB, id uint) error
- func (domain *Domain) IsIPv4() bool
- func (domain *Domain) Update(_ context.Context, db gorm.DB) error
- func (domain *Domain) UpdateSSLStatus(_ context.Context, db gorm.DB, status DomainSSLStatus) error
- type DomainSSLStatus
- type EnvironmentVariable
- type GitCredential
- func (gitCredential *GitCredential) Create(ctx context.Context, db gorm.DB) error
- func (gitCredential *GitCredential) Delete(ctx context.Context, db gorm.DB) error
- func (gitCredential *GitCredential) FindById(ctx context.Context, db gorm.DB, id uint) error
- func (gitCredential *GitCredential) Update(ctx context.Context, db gorm.DB) error
- type GitType
- type ImageRegistryCredential
- func (imageRegistryCredential *ImageRegistryCredential) Create(ctx context.Context, db gorm.DB) error
- func (imageRegistryCredential *ImageRegistryCredential) Delete(ctx context.Context, db gorm.DB) error
- func (imageRegistryCredential *ImageRegistryCredential) FindById(ctx context.Context, db gorm.DB, id uint) error
- func (imageRegistryCredential *ImageRegistryCredential) Update(ctx context.Context, db gorm.DB) error
- type IngressRule
- func FetchIngressRulesWithTargetPortAndProtocolOnly(ctx context.Context, db gorm.DB, applicationId string) ([]*IngressRule, error)
- func FindAllIngressRules(ctx context.Context, db gorm.DB) ([]*IngressRule, error)
- func FindIngressRulesByApplicationID(ctx context.Context, db gorm.DB, applicationID string) ([]*IngressRule, error)
- func FindIngressRulesByDomainID(ctx context.Context, db gorm.DB, domainID uint) ([]*IngressRule, error)
- func (ingressRule *IngressRule) Create(ctx context.Context, db gorm.DB, restrictedPorts []int) error
- func (ingressRule *IngressRule) Delete(ctx context.Context, db gorm.DB, force bool) error
- func (ingressRule *IngressRule) DisableAuthentication(ctx context.Context, db gorm.DB) error
- func (ingressRule *IngressRule) FindById(ctx context.Context, db gorm.DB, id uint) error
- func (ingressRule *IngressRule) IsValidNewIngressRule(ctx context.Context, db gorm.DB, restrictedPorts []int) error
- func (ingressRule *IngressRule) ProtectUsingBasicAuth(ctx context.Context, db gorm.DB, appBasicAuthAccessControlListID uint) error
- func (ingressRule *IngressRule) Update(ctx context.Context, db gorm.DB) error
- func (ingressRule *IngressRule) UpdateHttpsRedirectStatus(ctx context.Context, db gorm.DB, enabled bool) error
- func (ingressRule *IngressRule) UpdateStatus(ctx context.Context, db gorm.DB, status IngressRuleStatus) error
- func (ingressRule *IngressRule) ValidateForHttpsRedirectEnableRequest(ctx context.Context, db gorm.DB) (bool, error)
- type IngressRuleAuthentication
- type IngressRuleAuthenticationType
- type IngressRuleStatus
- type IngressRuleTargetType
- type NFSConfig
- type PersistentVolume
- func (persistentVolume *PersistentVolume) Create(ctx context.Context, db gorm.DB, ...) error
- func (persistentVolume *PersistentVolume) Delete(_ context.Context, db gorm.DB) error
- func (persistentVolume *PersistentVolume) FindById(_ context.Context, db gorm.DB, id uint) error
- func (persistentVolume *PersistentVolume) FindByName(_ context.Context, db gorm.DB, name string) error
- func (persistentVolume *PersistentVolume) Update(_ context.Context, _ gorm.DB, _ containermanger.Manager) error
- func (persistentVolume *PersistentVolume) ValidateDeletion(_ context.Context, db gorm.DB) error
- type PersistentVolumeBackup
- func (persistentVolumeBackup *PersistentVolumeBackup) Create(ctx context.Context, db gorm.DB) error
- func (persistentVolumeBackup *PersistentVolumeBackup) Delete(ctx context.Context, db gorm.DB, dataDir string, ...) error
- func (persistentVolumeBackup *PersistentVolumeBackup) FindById(ctx context.Context, db gorm.DB, id uint) error
- func (persistentVolumeBackup *PersistentVolumeBackup) Update(ctx context.Context, db gorm.DB) error
- type PersistentVolumeBinding
- type PersistentVolumeRestore
- func (persistentVolumeRestore *PersistentVolumeRestore) Create(ctx context.Context, db gorm.DB) error
- func (persistentVolumeRestore *PersistentVolumeRestore) Delete(ctx context.Context, db gorm.DB, dataDir string) error
- func (persistentVolumeRestore *PersistentVolumeRestore) FindById(ctx context.Context, db gorm.DB, id uint) error
- func (persistentVolumeRestore *PersistentVolumeRestore) Update(ctx context.Context, db gorm.DB, dataDir string) error
- type PersistentVolumeType
- type ProtocolType
- type ProxyConfig
- type ProxyType
- type RedirectRule
- func (redirectRule *RedirectRule) Create(ctx context.Context, db gorm.DB) error
- func (redirectRule *RedirectRule) Delete(ctx context.Context, db gorm.DB, force bool) error
- func (redirectRule *RedirectRule) FindById(ctx context.Context, db gorm.DB, id uint) error
- func (redirectRule *RedirectRule) Update(ctx context.Context, db gorm.DB) error
- func (redirectRule *RedirectRule) UpdateStatus(ctx context.Context, db gorm.DB, status RedirectRuleStatus) error
- type RedirectRuleStatus
- type RestoreStatus
- type RestoreType
- type Server
- func FetchAllOnlineServers(db *gorm.DB) ([]Server, error)
- func FetchAllProxyServers(db *gorm.DB) ([]Server, error)
- func FetchAllProxyServersIrrespectiveOfStatus(db *gorm.DB) ([]Server, error)
- func FetchAllServers(db *gorm.DB) ([]Server, error)
- func FetchBackupProxyServers(db *gorm.DB) ([]Server, error)
- func FetchProxyActiveServers(db *gorm.DB) ([]Server, error)
- func FetchRandomActiveProxyServer(db *gorm.DB) (Server, error)
- func FetchServerByID(db *gorm.DB, id uint) (*Server, error)
- func FetchSwarmManager(db *gorm.DB) (Server, error)
- func FetchSwarmManagerExceptServer(db *gorm.DB, serverId uint) (Server, error)
- type ServerDiskStat
- type ServerDiskStats
- type ServerLog
- type ServerMemoryStat
- type ServerNetStat
- type ServerResourceStat
- func FetchLatestServerResourceAnalytics(_ context.Context, db gorm.DB, serverId uint) (*ServerResourceStat, error)
- func FetchServerDiskUsage(_ context.Context, db gorm.DB, serverId uint) ([]*ServerResourceStat, error)
- func FetchServerResourceAnalytics(_ context.Context, db gorm.DB, serverId uint, tillTime uint) ([]*ServerResourceStat, error)
- type ServerStatus
- type SwarmMode
- type UpstreamType
- type User
- func CreateUser(ctx context.Context, db gorm.DB, user User) (User, error)
- func FindAllUsers(ctx context.Context, db gorm.DB) ([]User, error)
- func FindUserByID(ctx context.Context, db gorm.DB, id uint) (User, error)
- func FindUserByUsername(ctx context.Context, db gorm.DB, username string) (User, error)
- type UserRole
Constants ¶
const IPV4Regex = `^(?:\b(?:[0-9]{1,3}\.){3}[0-9]{1,3}\b)$`
IPV4Regex : regex for IPv4
Variables ¶
var DebianDependenciesInstallCommands = map[string]string{
"init": "apt -y update",
"awk": "apt install -y gawk",
"curl": "apt install -y curl",
"unzip": "apt install -y unzip",
"git": "apt install -y git",
"tar": "apt install -y tar",
"iproute": "apt install -y iproute2",
"nfs": "apt install -y nfs-common && systemctl stop rpcbind.socket && systemctl stop rpcbind && systemctl disable rpcbind.socket && systemctl disable rpcbind",
"cifs": "apt install -y cifs-utils",
"rsync": "apt install -y rsync",
"docker": "curl -fsSL get.docker.com | sh -",
}
var DependencyCheckCommands = map[string]string{
"init": "echo hi",
"awk": "which awk",
"curl": "which curl",
"unzip": "which unzip",
"git": "which git",
"tar": "which tar",
"iproute": "which ip",
"nfs": "which nfsstat",
"cifs": "which mount.cifs",
"rsync": "which rsync",
"docker": "which docker",
}
var FedoraDependenciesInstallCommands = map[string]string{
"init": "dnf -y update",
"awk": "dnf install -y gawk",
"curl": "dnf install -y curl",
"unzip": "dnf install -y unzip",
"git": "dnf install -y git",
"tar": "dnf install -y tar",
"iproute": "dnf install -y iproute",
"nfs": "dnf install -y nfs-utils && systemctl stop rpcbind.socket && systemctl stop rpcbind && systemctl disable rpcbind.socket && systemctl disable rpcbind",
"cifs": "dnf install -y cifs-utils",
"rsync": "dnf install -y rsync",
"docker": "curl -fsSL get.docker.com | sh -",
}
var IngressRuleDeletingError = errors.New("ingress rule is deleting")
var RequiredServerDependencies = []string{
"init",
"awk",
"curl",
"unzip",
"git",
"tar",
"iproute",
"nfs",
"cifs",
"rsync",
"docker",
}
Functions ¶
func ChangePassword ¶
func ChangePassword(ctx context.Context, db gorm.DB, username string, oldPassword string, newPassword string) error
ChangePassword : change user password
func ChangeProxyType ¶
ChangeProxyType changes the proxy type of server in the database
func ChangeSSHPort ¶
ChangeSSHPort changes the SSH port of a server in the database
func ChangeServerIP ¶
ChangeServerIP changes the IP of a server in the database
func CreateServer ¶
CreateServer creates a new server in the database
func CreateServerLog ¶
CreateServerLog is a function to create a new server log in the database.
func DeletePersistentVolumeBackupsByPersistentVolumeId ¶
func DeletePersistentVolumeBackupsByPersistentVolumeId(ctx context.Context, db gorm.DB, persistentVolumeId uint, dataDir string, config system_config.S3BackupConfig) error
func DeleteServer ¶
DeleteServer deletes a server from the database
func DeleteUser ¶
DeleteUser : delete user by id
func DisableTotp ¶
DisableTotp : disable Totp for user
func FetchAllExposedTCPPorts ¶
func FetchAllExposedUDPPorts ¶
func FetchDisabledDeploymentServerHostNames ¶
FetchDisabledDeploymentServerHostNames fetches the hostnames of all servers that are not in deployment mode
func FetchServerIDByHostName ¶
FetchServerIDByHostName fetches a server by its hostname from the database
func FetchServerLogContentByID ¶
FetchServerLogContentByID is a function to fetch the content of a server log from the database by its id.
func IsAnyActiveProxyServerOffline ¶
IsAnyActiveProxyServerOffline checks if any active proxy server is offline
func IsDeploymentFailed ¶
func IsExistApplicationName ¶
func IsExistPersistentVolume ¶
func IsPreparedServerExists ¶
IsPreparedServerExists checks if a prepared server exists in the database
func MarkServerAsOffline ¶
MarkServerAsOffline marks a server as offline in the database
func MarkServerAsOnline ¶
MarkServerAsOnline marks a server as online in the database
func NoOfPreparedServers ¶
NoOfPreparedServers returns the number of prepared servers in the database
func NoOfServers ¶
NoOfServers returns the number of servers in the database
func UpdateServer ¶
UpdateServer updates a server in the database
Types ¶
type AnalyticsServiceToken ¶
type AnalyticsServiceToken struct { ID string `json:"id" gorm:"primaryKey"` Token string `json:"token" gorm:"unique"` ServerID uint `json:"server_id"` CreatedAt time.Time `json:"created_at"` }
func RotateAnalyticsServiceToken ¶
func RotateAnalyticsServiceToken(ctx context.Context, db gorm.DB, serverId uint) (*AnalyticsServiceToken, error)
RotateAnalyticsServiceToken : delete existing token and create a new token. [Recommended to use transaction]
func (*AnalyticsServiceToken) IDToken ¶
func (token *AnalyticsServiceToken) IDToken() (string, error)
type AppBasicAuthAccessControlList ¶
type AppBasicAuthAccessControlList struct { ID uint `json:"id" gorm:"primaryKey"` Name string `json:"name"` GeneratedName string `json:"generated_name" gorm:"unique"` Users []AppBasicAuthAccessControlUser `json:"users" gorm:"foreignKey:AppBasicAuthAccessControlListID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` IngressRules []IngressRule `json:"ingress_rules" gorm:"foreignKey:AppBasicAuthAccessControlListID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` }
type AppBasicAuthAccessControlUser ¶
type AppBasicAuthAccessControlUser struct { ID uint `json:"id" gorm:"primaryKey"` Username string `json:"username"` PlainTextPassword string `gorm:"-"` EncryptedPassword string `json:"encrypted_password"` AppBasicAuthAccessControlListID uint `json:"app_basic_auth_access_control_list_id"` }
type Application ¶
type Application struct { ID string `json:"id" gorm:"primaryKey"` Name string `json:"name" gorm:"unique"` // ApplicationGroupID - if set, this application will be part of the application group ApplicationGroupID *string `json:"application_group_id"` // Environment Variables // On change of environment variables, deployment will be triggered by force update EnvironmentVariables []EnvironmentVariable `json:"environment_variables" gorm:"foreignKey:ApplicationID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` // Config Mounts // On change of config mounts, deployment will be triggered by force update ConfigMounts []ConfigMount `json:"config_mounts" gorm:"foreignKey:ApplicationID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` // Persistent Volumes // On change of persistent volumes, deployment will be triggered by force update PersistentVolumeBindings []PersistentVolumeBinding `json:"persistent_volume_bindings" gorm:"foreignKey:ApplicationID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` // No of replicas to be deployed DeploymentMode DeploymentMode `json:"deployment_mode"` Replicas uint `json:"replicas"` // Deployments Deployments []Deployment `json:"deployments" gorm:"foreignKey:ApplicationID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` // Latest Deployment LatestDeployment Deployment `json:"-"` // Ingress Rules IngressRules []IngressRule `json:"ingress_rules" gorm:"foreignKey:ApplicationID"` // Command Command string `json:"command"` // Capabilities Capabilities pq.StringArray `json:"capabilities" gorm:"type:text[]"` // Sysctls Sysctls pq.StringArray `json:"sysctls" gorm:"type:text[]"` // Resource Limit ResourceLimit ApplicationResourceLimit `json:"resource_limit" gorm:"embedded;embeddedPrefix:resource_limit_"` // Reserved Resource ReservedResource ApplicationReservedResource `json:"reserved_resource" gorm:"embedded;embeddedPrefix:reserved_resource_"` // ConsoleTokens ConsoleTokens []ConsoleToken `json:"console_tokens" gorm:"foreignKey:ApplicationID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` // Is deleted - soft delete - will be deleted from database in background IsDeleted bool `json:"is_deleted" gorm:"default:false"` // Webhook token WebhookToken string `json:"webhook_token"` // Sleeping IsSleeping bool `json:"is_sleeping" gorm:"default:false"` // Resource Stats ResourceStats []ApplicationServiceResourceStat `json:"resource_stats" gorm:"foreignKey:ApplicationID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` // PreferredServerHostnames - if set, we will schedule deployments to this server PreferredServerHostnames pq.StringArray `json:"preferred_server_hostnames" gorm:"type:text[]"` // CustomHealthCheck - if set, we will use this custom health check CustomHealthCheck ApplicationCustomHealthCheck `json:"custom_health_check" gorm:"embedded;embeddedPrefix:custom_health_check_"` // DockerProxy configuration DockerProxy DockerProxyConfig `json:"docker_proxy" gorm:"embedded;embeddedPrefix:docker_proxy_"` }
Application hold information about application
func FindAllApplications ¶
func (*Application) Create ¶
func (application *Application) Create(ctx context.Context, db gorm.DB, dockerManager containermanger.Manager, codeTarballDir string) error
func (*Application) DockerProxyServiceName ¶
func (application *Application) DockerProxyServiceName() string
func (*Application) FindByName ¶
func (*Application) HardDelete ¶
func (application *Application) HardDelete(ctx context.Context, db gorm.DB, _ containermanger.Manager) error
func (*Application) IsApplicationDeleted ¶
func (*Application) MarkAsSleeping ¶
func (*Application) MarkAsWake ¶
func (*Application) RebuildApplication ¶
func (*Application) RegenerateWebhookToken ¶
func (*Application) ReplicaCount ¶
func (application *Application) ReplicaCount() uint
ReplicaCount : get replica count
func (*Application) SoftDelete ¶
func (application *Application) SoftDelete(ctx context.Context, db gorm.DB, _ containermanger.Manager) error
func (*Application) Update ¶
func (application *Application) Update(ctx context.Context, db gorm.DB, _ containermanger.Manager) (*ApplicationUpdateResult, error)
func (*Application) UpdateGroup ¶
type ApplicationCustomHealthCheck ¶
type ApplicationCustomHealthCheck struct { Enabled bool `json:"enabled" gorm:"default:false"` TestCommand string `json:"test_command"` IntervalSeconds uint64 `json:"interval_seconds" gorm:"default:10"` // Time between running the check in seconds TimeoutSeconds uint64 `json:"timeout_seconds" gorm:"default:5"` // Maximum time to allow one check to run in seconds StartPeriodSeconds uint64 `json:"start_period_seconds" gorm:"default:5"` // Start period for the container to initialize before counting retries towards unstable StartIntervalSeconds uint64 `json:"start_interval_seconds" gorm:"default:5"` // Time between running the check during the start period Retries uint64 `json:"retries" gorm:"default:0"` // Consecutive failures needed to report unhealthy }
func (*ApplicationCustomHealthCheck) Equal ¶
func (c *ApplicationCustomHealthCheck) Equal(other *ApplicationCustomHealthCheck) bool
type ApplicationGroup ¶
type ApplicationGroup struct { ID string `json:"id" gorm:"primaryKey"` Name string `json:"name"` Logo string `json:"logo"` StackContent string `json:"stack_content"` Applications []Application `json:"applications" gorm:"foreignKey:ApplicationGroupID;constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"` }
ApplicationGroup hold information about application-group
func (*ApplicationGroup) IsAnyApplicationAssociatedWithGroup ¶
type ApplicationReservedResource ¶
type ApplicationReservedResource struct {
MemoryMB int `json:"memory_mb" gorm:"default:0"`
}
type ApplicationResourceLimit ¶
type ApplicationResourceLimit struct {
MemoryMB int `json:"memory_mb" gorm:"default:0"`
}
type ApplicationServiceResourceStat ¶
type ApplicationServiceResourceStat struct { ID uint `json:"id" gorm:"primaryKey"` ApplicationID string `json:"application_id"` ServiceCpuTime uint64 `json:"service_cpu_time"` SystemCpuTime uint64 `json:"system_cpu_time"` CpuUsagePercent uint8 `json:"cpu_used_percent"` ReportingServerCount uint `json:"reporting_server_count"` // to help in calculating average UsedMemoryMB uint64 `json:"used_memory_mb"` NetStat ApplicationServiceNetStat `json:"network" gorm:"embedded;embeddedPrefix:network_"` RecordedAt time.Time `json:"recorded_at"` }
ApplicationServiceResourceStat struct to hold service resource stats
func FetchApplicationServiceResourceAnalytics ¶
func FetchApplicationServiceResourceAnalytics(_ context.Context, db gorm.DB, applicationId string, tillTime uint) ([]*ApplicationServiceResourceStat, error)
FetchApplicationServiceResourceAnalytics fetches the application service resource analytics
type ApplicationUpdateResult ¶
type ApplicationUpdateResult struct { RebuildRequired bool ReloadRequired bool DeploymentId string }
ApplicationUpdateResult : result of application update
type BackupStatus ¶
type BackupStatus string
BackupStatus : status of backup
const ( BackupPending BackupStatus = "pending" BackupFailed BackupStatus = "failed" BackupSuccess BackupStatus = "success" )
type BackupType ¶
type BackupType string
BackupType : type of backup
const ( LocalBackup BackupType = "local" S3Backup BackupType = "s3" )
type BuildArg ¶
type BuildArg struct { ID uint `json:"id" gorm:"primaryKey"` DeploymentID string `json:"deployment_id"` Key string `json:"key"` Value string `json:"value"` }
BuildArg hold information about build args
type CIFSConfig ¶
type CIFSConfig struct { Host string `json:"host"` Username string `json:"username"` Password string `json:"password"` FileMode string `json:"file_mode"` DirMode string `json:"dir_mode"` Uid int `json:"uid" gorm:"default:0"` Gid int `json:"gid" gorm:"default:0"` }
CIFSConfig : configuration for CIFS Storage
type ConfigMount ¶
type ConfigMount struct { ID uint `json:"id" gorm:"primaryKey"` ApplicationID string `json:"application_id"` ConfigID string `json:"config_id"` Content string `json:"content"` MountingPath string `json:"mounting_path"` Uid uint `json:"uid" gorm:"default:0"` Gid uint `json:"gid" gorm:"default:0"` FileMode uint `json:"file_mode" gorm:"default:444"` }
ConfigMount hold information of config mount
func (*ConfigMount) UpdateConfigID ¶
type ConsoleTarget ¶
type ConsoleTarget string
ConsoleTarget : type of console target
const ( ConsoleTargetTypeServer ConsoleTarget = "server" ConsoleTargetTypeApplication ConsoleTarget = "application" )
type ConsoleToken ¶
type ConsoleToken struct { ID string `json:"id" gorm:"primaryKey"` Target ConsoleTarget `json:"target_type"` ServerID *uint `json:"server_id"` ApplicationID *string `json:"application_id"` Token string `json:"token" gorm:"unique"` ExpiresAt time.Time `json:"expires_at"` }
ConsoleToken hold information about console auth tokens, used in establishing websocket connection Note this If Target == ConsoleTargetTypeServer, ServerID denote which server to ssh into If Target == ConsoleTargetTypeApplication, ApplicationID denote which application to connect to and ServerID denote which server to connect to. In case of ConsoleTargetTypeApplication, we will connect to ServerID and try to ssh into the application container If ServerID server has no container for the application, we will return error
func FindConsoleToken ¶
func GenerateConsoleTokenForServer ¶
func GenerateConsoleTokenForServer(db gorm.DB, serverId uint) (*ConsoleToken, error)
type Deployment ¶
type Deployment struct { ID string `json:"id" gorm:"primaryKey"` ApplicationID string `json:"application_id"` UpstreamType UpstreamType `json:"upstream_type"` // Fields for UpstreamType = Git GitCredentialID *uint `json:"git_credential_id"` GitProvider string `json:"git_provider"` GitType GitType `json:"git_type" gorm:"default:'http'"` RepositoryOwner string `json:"repository_owner"` RepositoryName string `json:"repository_name"` RepositoryBranch string `json:"repository_branch"` GitEndpoint string `json:"git_endpoint"` GitSshUser string `json:"git_ssh_user"` CodePath string `json:"code_path"` CommitHash string `json:"commit_hash"` CommitMessage string `json:"commit_message"` // Fields for UpstreamType = SourceCode SourceCodeCompressedFileName string `json:"source_code_compressed_file_name"` // Fields for UpstreamType = Image DockerImage string `json:"docker_image"` ImageRegistryCredentialID *uint `json:"image_registry_credential_id"` // Common Fields BuildArgs []BuildArg `json:"build_args" gorm:"foreignKey:DeploymentID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` Dockerfile string `json:"dockerfile"` // Logs Logs []DeploymentLog `json:"logs" gorm:"foreignKey:DeploymentID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` // Deployment Status Status DeploymentStatus `json:"status"` // Created At CreatedAt time.Time `json:"created_at"` }
Deployment hold information about deployment of application
func (*Deployment) DeployableDockerImageURI ¶
func (deployment *Deployment) DeployableDockerImageURI(remoteRegistryPrefix string) string
func (*Deployment) GitRepositoryURL ¶
func (deployment *Deployment) GitRepositoryURL() string
func (*Deployment) Update ¶
func (deployment *Deployment) Update(ctx context.Context, db gorm.DB) (*DeploymentUpdateResult, error)
Update : it will works like a total ledger always recreate deployment, no update [except status] fetch latest deployment the `deployment` object seem to be updated by the caller and ID should be the old one
func (*Deployment) UpdateStatus ¶
func (deployment *Deployment) UpdateStatus(ctx context.Context, db gorm.DB, status DeploymentStatus) error
type DeploymentLog ¶
type DeploymentLog struct { ID uint `json:"id" gorm:"primaryKey"` DeploymentID string `json:"deployment_id"` Content string `json:"content"` CreatedAt time.Time `json:"created_at"` }
DeploymentLog hold logs of deployment
type DeploymentMode ¶
type DeploymentMode string
DeploymentMode : mode of deployment of application (replicated or global)
const ( DeploymentModeReplicated DeploymentMode = "replicated" DeploymentModeGlobal DeploymentMode = "global" )
type DeploymentStatus ¶
type DeploymentStatus string
DeploymentStatus : status of the deployment
const ( DeploymentStatusPending DeploymentStatus = "pending" DeploymentStatusDeployPending DeploymentStatus = "deployPending" DeploymentStatusDeployed DeploymentStatus = "deployed" DeploymentStatusStopped DeploymentStatus = "stopped" DeploymentStatusFailed DeploymentStatus = "failed" DeploymentStalled DeploymentStatus = "stalled" )
type DeploymentUpdateResult ¶
DeploymentUpdateResult : result of deployment update
type DockerProxyConfig ¶
type DockerProxyConfig struct { Enabled bool `json:"enabled" gorm:"default:false"` Permission DockerProxyPermission `json:"permissions" gorm:"embedded;embeddedPrefix:permission_"` }
func (*DockerProxyConfig) Equal ¶
func (d *DockerProxyConfig) Equal(other *DockerProxyConfig) bool
type DockerProxyPermission ¶
type DockerProxyPermission struct { Ping DockerProxyPermissionType `json:"ping" gorm:"default:read"` Version DockerProxyPermissionType `json:"version" gorm:"default:none"` Info DockerProxyPermissionType `json:"info" gorm:"default:none"` Events DockerProxyPermissionType `json:"events" gorm:"default:none"` Auth DockerProxyPermissionType `json:"auth" gorm:"default:none"` Secrets DockerProxyPermissionType `json:"secrets" gorm:"default:none"` Build DockerProxyPermissionType `json:"build" gorm:"default:none"` Commit DockerProxyPermissionType `json:"commit" gorm:"default:none"` Configs DockerProxyPermissionType `json:"configs" gorm:"default:none"` Containers DockerProxyPermissionType `json:"containers" gorm:"default:none"` Distribution DockerProxyPermissionType `json:"distribution" gorm:"default:none"` Exec DockerProxyPermissionType `json:"exec" gorm:"default:none"` Grpc DockerProxyPermissionType `json:"grpc" gorm:"default:none"` Images DockerProxyPermissionType `json:"images" gorm:"default:none"` Networks DockerProxyPermissionType `json:"networks" gorm:"default:none"` Nodes DockerProxyPermissionType `json:"nodes" gorm:"default:none"` Plugins DockerProxyPermissionType `json:"plugins" gorm:"default:none"` Services DockerProxyPermissionType `json:"services" gorm:"default:none"` Session DockerProxyPermissionType `json:"session" gorm:"default:none"` Swarm DockerProxyPermissionType `json:"swarm" gorm:"default:none"` System DockerProxyPermissionType `json:"system" gorm:"default:none"` Tasks DockerProxyPermissionType `json:"tasks" gorm:"default:none"` Volumes DockerProxyPermissionType `json:"volumes" gorm:"default:none"` }
type DockerProxyPermissionType ¶
type DockerProxyPermissionType string
const ( // DockerProxyNoPermission no request will be allowed DockerProxyNoPermission DockerProxyPermissionType = "none" // DockerProxyReadPermission only [GET, HEAD] requests will be allowed DockerProxyReadPermission DockerProxyPermissionType = "read" // DockerProxyReadWritePermission all requests will be allowed [GET, HEAD, POST, PUT, DELETE, OPTIONS] DockerProxyReadWritePermission DockerProxyPermissionType = "read_write" )
type Domain ¶
type Domain struct { ID uint `json:"id" gorm:"primaryKey"` Name string `json:"name" gorm:"unique"` SSLStatus DomainSSLStatus `json:"ssl_status"` SSLPrivateKey string `json:"ssl_private_key"` SSLFullChain string `json:"ssl_full_chain"` SSLIssuedAt time.Time `json:"ssl_issued_at"` SSLExpiredAt time.Time `json:"ssl_expired_at"` SSLIssuer string `json:"ssl_issuer"` SslAutoRenew bool `json:"ssl_auto_renew" gorm:"default:false"` IngressRules []IngressRule `json:"ingress_rules" gorm:"foreignKey:DomainID"` RedirectRules []RedirectRule `json:"redirect_rules" gorm:"foreignKey:DomainID"` }
Domain hold information about domain
func (*Domain) UpdateSSLStatus ¶
type DomainSSLStatus ¶
type DomainSSLStatus string
DomainSSLStatus : status of the ssl certificate for a domain
const ( DomainSSLStatusNone DomainSSLStatus = "none" DomainSSLStatusPending DomainSSLStatus = "pending" DomainSSLStatusFailed DomainSSLStatus = "failed" DomainSSLStatusIssued DomainSSLStatus = "issued" )
type EnvironmentVariable ¶
type EnvironmentVariable struct { ID uint `json:"id" gorm:"primaryKey"` ApplicationID string `json:"application_id"` Key string `json:"key"` Value string `json:"value"` }
EnvironmentVariable hold information about environment variable
type GitCredential ¶
type GitCredential struct { ID uint `json:"id" gorm:"primaryKey"` Name string `json:"name"` Type GitType `json:"type" gorm:"default:'http'"` Username string `json:"username"` Password string `json:"password"` SshPrivateKey string `json:"ssh_private_key"` SshPublicKey string `json:"ssh_public_key"` Deployments []Deployment `json:"deployments" gorm:"foreignKey:GitCredentialID;constraint:OnUpdate:CASCADE,OnDelete:SET NULL;" ` }
GitCredential credential for git client
func FindAllGitCredentials ¶
type ImageRegistryCredential ¶
type ImageRegistryCredential struct { ID uint `json:"id" gorm:"primaryKey"` Url string `json:"url"` Username string `json:"username"` Password string `json:"password"` Deployments []Deployment `json:"deployments" gorm:"foreignKey:ImageRegistryCredentialID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"` }
ImageRegistryCredential credential for docker image registry
type IngressRule ¶
type IngressRule struct { ID uint `json:"id" gorm:"primaryKey"` DomainID *uint `json:"domain_id,omitempty" gorm:"default:null"` Protocol ProtocolType `json:"protocol"` Port uint `json:"port"` // external port TargetPort uint `json:"target_port"` // port of the application TargetType IngressRuleTargetType `json:"target_type" gorm:"default:'application'"` ApplicationID *string `json:"application_id"` ExternalService string `json:"external_service"` HttpsRedirect bool `json:"https_redirect" gorm:"default:false"` Authentication IngressRuleAuthentication `json:"authentication" gorm:"embedded;embeddedPrefix:authentication_"` Status IngressRuleStatus `json:"status"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
IngressRule hold information about Ingress rule for service
func FindAllIngressRules ¶
func (*IngressRule) DisableAuthentication ¶
func (*IngressRule) IsValidNewIngressRule ¶
func (*IngressRule) ProtectUsingBasicAuth ¶
func (*IngressRule) UpdateHttpsRedirectStatus ¶
func (*IngressRule) UpdateStatus ¶
func (ingressRule *IngressRule) UpdateStatus(ctx context.Context, db gorm.DB, status IngressRuleStatus) error
func (*IngressRule) ValidateForHttpsRedirectEnableRequest ¶
type IngressRuleAuthentication ¶
type IngressRuleAuthentication struct { AuthType IngressRuleAuthenticationType `json:"auth_type" gorm:"default:'none'"` AppBasicAuthAccessControlListID *uint `json:"app_basic_auth_access_control_list_id" gorm:"default:null"` }
IngressRuleAuthentication hold information about ingress rule authentication
type IngressRuleAuthenticationType ¶
type IngressRuleAuthenticationType string
IngressRuleAuthenticationType type of authentication for ingress rule
const ( IngressRuleNoAuthentication IngressRuleAuthenticationType = "none" IngressRuleBasicAuthentication IngressRuleAuthenticationType = "basic" )
type IngressRuleStatus ¶
type IngressRuleStatus string
IngressRuleStatus : status of the ingress rule
const ( IngressRuleStatusPending IngressRuleStatus = "pending" IngressRuleStatusApplied IngressRuleStatus = "applied" IngressRuleStatusFailed IngressRuleStatus = "failed" IngressRuleStatusDeleting IngressRuleStatus = "deleting" )
type IngressRuleTargetType ¶
type IngressRuleTargetType string
IngressRuleTargetType : type of target for ingress rule
const ( ApplicationIngressRule IngressRuleTargetType = "application" ExternalServiceIngressRule IngressRuleTargetType = "externalService" )
type NFSConfig ¶
type NFSConfig struct { Host string `json:"host,omitempty"` Path string `json:"path,omitempty"` Version int `json:"version,omitempty"` }
NFSConfig : configuration for NFS Storage
type PersistentVolume ¶
type PersistentVolume struct { ID uint `json:"id" gorm:"primaryKey"` Name string `json:"name" gorm:"unique"` Type PersistentVolumeType `json:"type" gorm:"default:'local'"` NFSConfig NFSConfig `json:"nfs_config" gorm:"embedded;embeddedPrefix:nfs_config_"` CIFSConfig CIFSConfig `json:"cifs_config" gorm:"embedded;embeddedPrefix:cifs_config_"` PersistentVolumeBindings []PersistentVolumeBinding `json:"persistent_volume_bindings" gorm:"foreignKey:PersistentVolumeID"` PersistentVolumeBackups []PersistentVolumeBackup `json:"persistent_volume_backups" gorm:"foreignKey:PersistentVolumeID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"` PersistentVolumeRestores []PersistentVolumeRestore `json:"persistent_volume_restores" gorm:"foreignKey:PersistentVolumeID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"` }
PersistentVolume hold information about persistent volume
func (*PersistentVolume) FindByName ¶
func (*PersistentVolume) Update ¶
func (persistentVolume *PersistentVolume) Update(_ context.Context, _ gorm.DB, _ containermanger.Manager) error
func (*PersistentVolume) ValidateDeletion ¶
type PersistentVolumeBackup ¶
type PersistentVolumeBackup struct { ID uint `json:"id" gorm:"primaryKey"` Type BackupType `json:"type"` Status BackupStatus `json:"status"` File string `json:"file"` FileSizeMB float64 `json:"file_size_mb"` PersistentVolumeID uint `json:"persistent_volume_id"` CreatedAt time.Time `json:"created_at"` CompletedAt time.Time `json:"completed_at"` }
PersistentVolumeBackup hold information about persistent volume backup
func (*PersistentVolumeBackup) Delete ¶
func (persistentVolumeBackup *PersistentVolumeBackup) Delete(ctx context.Context, db gorm.DB, dataDir string, config system_config.S3BackupConfig) error
type PersistentVolumeBinding ¶
type PersistentVolumeBinding struct { ID uint `json:"id" gorm:"primaryKey"` ApplicationID string `json:"application_id"` PersistentVolumeID uint `json:"persistent_volume_id"` MountingPath string `json:"mounting_path"` }
PersistentVolumeBinding hold information about persistent volume binding
type PersistentVolumeRestore ¶
type PersistentVolumeRestore struct { ID uint `json:"id" gorm:"primaryKey"` Type RestoreType `json:"type"` File string `json:"file"` Status RestoreStatus `json:"status"` PersistentVolumeID uint `json:"persistent_volume_id"` CreatedAt time.Time `json:"created_at"` CompletedAt time.Time `json:"completed_at"` }
PersistentVolumeRestore hold information about persistent volume restore
type PersistentVolumeType ¶
type PersistentVolumeType string
PersistentVolumeType : type of persistent volume
const ( PersistentVolumeTypeLocal PersistentVolumeType = "local" PersistentVolumeTypeNFS PersistentVolumeType = "nfs" PersistentVolumeTypeCIFS PersistentVolumeType = "cifs" )
type ProtocolType ¶
type ProtocolType string
ProtocolType : type of protocol for ingress rule
const ( HTTPProtocol ProtocolType = "http" HTTPSProtocol ProtocolType = "https" TCPProtocol ProtocolType = "tcp" UDPProtocol ProtocolType = "udp" )
type ProxyConfig ¶
type ProxyConfig struct { Enabled bool `json:"enabled" gorm:"default:false"` SetupRunning bool `json:"setup_running" gorm:"default:false"` // just to show warning to user, that's it Type ProxyType `json:"type" gorm:"default:'active'"` }
ProxyConfig : hold information about proxy configuration
type RedirectRule ¶
type RedirectRule struct { ID uint `json:"id" gorm:"primaryKey"` DomainID uint `json:"domain_id"` Protocol ProtocolType `json:"protocol"` RedirectURL string `json:"redirect_url"` Status RedirectRuleStatus `json:"status"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
RedirectRule hold information about Redirect rules for domain
func FindAllRedirectRules ¶
func (*RedirectRule) UpdateStatus ¶
func (redirectRule *RedirectRule) UpdateStatus(ctx context.Context, db gorm.DB, status RedirectRuleStatus) error
type RedirectRuleStatus ¶
type RedirectRuleStatus string
RedirectRuleStatus : status of the redirect rule
const ( RedirectRuleStatusPending RedirectRuleStatus = "pending" RedirectRuleStatusApplied RedirectRuleStatus = "applied" RedirectRuleStatusFailed RedirectRuleStatus = "failed" RedirectRuleStatusDeleting RedirectRuleStatus = "deleting" )
type RestoreStatus ¶
type RestoreStatus string
RestoreStatus : status of restore
const ( RestorePending RestoreStatus = "pending" RestoreFailed RestoreStatus = "failed" RestoreSuccess RestoreStatus = "success" )
type RestoreType ¶
type RestoreType string
RestoreType : type of restore
const (
LocalRestore RestoreType = "local"
)
type Server ¶
type Server struct { ID uint `json:"id" gorm:"primaryKey"` IP string `json:"ip" gorm:"unique"` HostName string `json:"host_name"` User string `json:"user"` SSHPort int `json:"ssh_port" gorm:"default:22"` MaintenanceMode bool `json:"maintenance_mode" gorm:"default:false"` ScheduleDeployments bool `json:"schedule_deployments" gorm:"default:true"` DockerUnixSocketPath string `json:"docker_unix_socket_path"` SwarmMode SwarmMode `json:"swarm_mode"` ProxyConfig ProxyConfig `json:"proxy_config" gorm:"embedded;embeddedPrefix:proxy_"` Status ServerStatus `json:"status"` LastPing time.Time `json:"last_ping"` Logs []ServerLog `json:"logs" gorm:"foreignKey:ServerID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` ConsoleTokens []ConsoleToken `json:"console_tokens" gorm:"foreignKey:ServerID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` AnalyticsServiceToken *AnalyticsServiceToken `json:"analytics_service_token" gorm:"foreignKey:ServerID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` ResourceStats []ServerResourceStat `json:"resource_stats" gorm:"foreignKey:ServerID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` }
Server hold information about server
func FetchAllOnlineServers ¶
FetchAllOnlineServers fetches all servers from the database
func FetchAllProxyServers ¶
FetchAllProxyServers fetches all proxy servers from the database
func FetchAllProxyServersIrrespectiveOfStatus ¶
FetchAllProxyServersIrrespectiveOfStatus fetches all proxy servers from the database irrespective of status
func FetchAllServers ¶
FetchAllServers fetches all servers from the database
func FetchBackupProxyServers ¶
FetchBackupProxyServers fetches all backup servers from the database
func FetchProxyActiveServers ¶
FetchProxyActiveServers fetches all active servers from the database
func FetchRandomActiveProxyServer ¶
FetchRandomActiveProxyServer fetches a random active server from the database
func FetchServerByID ¶
FetchServerByID fetches a server by its ID from the database
func FetchSwarmManager ¶
FetchSwarmManager fetches the swarm manager from the database
func FetchSwarmManagerExceptServer ¶
FetchSwarmManagerExceptServer fetches the swarm manager from the database except the given server
func (*Server) IsLocalhost ¶
IsLocalhost check if the domain is localhost
type ServerDiskStat ¶
type ServerDiskStats ¶
type ServerDiskStats []ServerDiskStat
func FetchLatestServerDiskUsage ¶
func FetchLatestServerDiskUsage(_ context.Context, db gorm.DB, serverId uint) (*ServerDiskStats, *time.Time, error)
FetchLatestServerDiskUsage fetches the latest server disk usage
func (*ServerDiskStats) Scan ¶
func (d *ServerDiskStats) Scan(value interface{}) error
Scan implement value scanner interface for gorm
type ServerLog ¶
type ServerLog struct { *gorm.Model ID uint `json:"id" gorm:"primaryKey"` ServerID uint `json:"serverID"` Title string `json:"title"` // can be empty, but will be useful if we want to Content string `json:"content"` }
ServerLog hold logs of server
func FetchServerLogByID ¶
FetchServerLogByID is a function to fetch a single server log from the database by its id.
func FetchServerLogByServerID ¶
FetchServerLogByServerID is a function to fetch all server logs from the database by server id. This will not send the log content.
type ServerMemoryStat ¶
type ServerNetStat ¶
type ServerResourceStat ¶
type ServerResourceStat struct { ID uint `json:"id" gorm:"primaryKey"` ServerID uint `json:"server_id"` CpuUsagePercent uint8 `json:"cpu_used_percent"` MemStat ServerMemoryStat `json:"memory" gorm:"embedded;embeddedPrefix:memory_"` DiskStats ServerDiskStats `json:"disks"` NetStat ServerNetStat `json:"network" gorm:"embedded;embeddedPrefix:network_"` RecordedAt time.Time `json:"recorded_at"` }
ServerResourceStat struct to hold host resource stats
func FetchLatestServerResourceAnalytics ¶
func FetchLatestServerResourceAnalytics(_ context.Context, db gorm.DB, serverId uint) (*ServerResourceStat, error)
FetchLatestServerResourceAnalytics fetches the latest server resource analytics
func FetchServerDiskUsage ¶
func FetchServerDiskUsage(_ context.Context, db gorm.DB, serverId uint) ([]*ServerResourceStat, error)
FetchServerDiskUsage fetches the server disk usage of last 24 hours
func FetchServerResourceAnalytics ¶
func FetchServerResourceAnalytics(_ context.Context, db gorm.DB, serverId uint, tillTime uint) ([]*ServerResourceStat, error)
FetchServerResourceAnalytics fetches the server resource analytics
type ServerStatus ¶
type ServerStatus string
ServerStatus : status of the server
const ( ServerNeedsSetup ServerStatus = "needs_setup" ServerPreparing ServerStatus = "preparing" ServerOnline ServerStatus = "online" ServerOffline ServerStatus = "offline" )
type UpstreamType ¶
type UpstreamType string
UpstreamType : type of source for the codebase of the application
const ( UpstreamTypeGit UpstreamType = "git" UpstreamTypeSourceCode UpstreamType = "sourceCode" UpstreamTypeImage UpstreamType = "image" )
type User ¶
type User struct { ID uint `json:"id" gorm:"primaryKey"` Username string `json:"username" gorm:"unique"` Role UserRole `json:"role" gorm:"default:'user'"` PasswordHash string `json:"password_hash"` TotpEnabled bool `json:"totp_enabled" gorm:"default:false"` TotpSecret string `json:"totp_secret"` }
User hold information about user
func CreateUser ¶
CreateUser : create user
func FindAllUsers ¶
FindAllUsers : find all users
func FindUserByID ¶
FindUserByID : find user by id
func FindUserByUsername ¶
FindUserByUsername : find user by username
func (*User) CheckPassword ¶
CheckPassword : check password for user
func (*User) GenerateJWT ¶
GenerateJWT : generate jwt token for user
func (*User) SetPassword ¶
SetPassword : set password for user
Source Files ¶
- analytics.operations.go
- analytics_service_token.operations.go
- app_basic_auth_access_control_list.go
- app_basic_auth_access_control_user.go
- application.operations.go
- application_group.operations.go
- build_args.operations.go
- config_mount.operations.go
- console_token.operations.go
- deployment.operations.go
- deployment_logs.operations.go
- domain.operations.go
- environment_variable.operations.go
- git_credential.operations.go
- image_registry_credential.operations.go
- ingress_rule.operations.go
- models.go
- pv.operations.go
- pv_backup.operations.go
- pv_binding.operations.go
- pv_restore.operations.go
- redirect_rule.oprations.go
- server.operations.go
- server_log.operations.go
- types.go
- user.operations.go
- utils.go