Documentation
¶
Index ¶
- Variables
- type Blueprint
- type Deployment
- type DeploymentStore
- type HealthCheck
- type Instance
- type InstanceStore
- type NodeRole
- type RemoteObj
- type Role
- type Runtime
- type RuntimeObj
- type Service
- type ServiceStore
- type ServiceType
- type Source
- type Status
- type TaskResult
- type TaskResultStore
- type User
- type UserStore
Constants ¶
This section is empty.
Variables ¶
View Source
var RoleLevel = map[Role]int{ RoleOwner: 3, RoleAdmin: 2, RoleDeveloper: 1, RoleViewer: 0, }
Functions ¶
This section is empty.
Types ¶
type Blueprint ¶
type Blueprint struct {
Name string `json:"name" db:"name"`
Desc string `json:"description" db:"description"`
Source Source `json:"source" db:"source"`
Type ServiceType `json:"type" db:"type"`
Runtime RuntimeObj `json:"runtime" db:"runtime"`
Remote RemoteObj `json:"remote" db:"remote"`
RunCmd string `json:"run_cmd,omitempty" db:"run_cmd"`
BuildCmd string `json:"build_cmd,omitempty" db:"build_cmd"`
Port int `json:"port" db:"port"`
WorkingDir string `json:"working_dir,omitempty" db:"working_dir"`
StaticDir string `json:"static_dir,omitempty" db:"static_dir"`
Image string `json:"image,omitempty" db:"image"`
EnvVars map[string]string `json:"env_vars,omitempty" db:"env_vars"`
Secrets map[string]string `json:"secrets,omitempty" db:"secrets"`
Status string `json:"status" db:"status"`
ProjectID *string `json:"project_id,omitempty" db:"project_id"`
HealthCheck *HealthCheck `json:"health_check,omitempty" db:"health_check"`
}
type Deployment ¶
type Deployment struct {
ID string `json:"id" db:"id"`
Name string `json:"name" db:"name"`
UserId *string `json:"user_id,omitempty" db:"user_id"`
Blueprint Blueprint `json:"config" db:"config"`
Status Status `json:"status" db:"status"`
Metadata string `json:"metadata" db:"metadata"`
CreatedAt time.Time `json:"created_at" db:"created_at"`
UpdatedAt time.Time `json:"updated_at" db:"updated_at"`
}
type DeploymentStore ¶
type DeploymentStore interface {
UpsertDeployment(ctx context.Context, d *Deployment) error
GetDeployment(ctx context.Context, id string) (*Deployment, error)
ListDeployments(ctx context.Context, limit, offset int) ([]*Deployment, error)
UpdateDeploymentStatus(ctx context.Context, id string, status string) error
}
type HealthCheck ¶ added in v0.6.21
type Instance ¶
type Instance struct {
ID string `json:"id" db:"id"`
BootstrapToken string `json:"bootstrap_token" db:"bootstrap_token"`
AccessToken string `json:"access_token" db:"access_token"`
InstanceID string `json:"instance_id" db:"instance_id"`
Issuer string `json:"issuer" db:"issuer"`
Audience string `json:"audience" db:"audience"`
RegisteredAt time.Time `json:"registered_at" db:"registered_at"`
LastInstalledAt time.Time `json:"last_installed_at" db:"last_installed_at"`
}
Instance table for this dployr server
type InstanceStore ¶
type InstanceStore interface {
GetInstance(ctx context.Context) (*Instance, error)
RegisterInstance(ctx context.Context, i *Instance) error
UpdateLastInstalledAt(ctx context.Context) error
SetBootstrapToken(ctx context.Context, token string) error
GetBootstrapToken(ctx context.Context) (string, error)
SetAccessToken(ctx context.Context, token string) error
GetAccessToken(ctx context.Context) (string, error)
}
InstanceStore provides access to the instance record stored in SQLite.
type Role ¶
type Role string
const ( RoleOwner Role = "owner" // uninstall dployr, manage admins RoleAdmin Role = "admin" // delete infrastructure, secrets, users, proxies; manage deployr versions; shell access RoleDeveloper Role = "developer" // deploy apps, view logs, view events, view resource graph RoleViewer Role = "viewer" // view services )
owner > admin > developer > viewer
func (Role) IsPermitted ¶
type RuntimeObj ¶
type Service ¶
type Service struct {
ID string `json:"id" db:"id"`
Name string `json:"name" db:"name"`
Description string `json:"description" db:"description"`
Source Source `json:"source" db:"source"`
Type ServiceType `json:"type" db:"type"`
Runtime Runtime `json:"runtime" db:"runtime"`
RuntimeVersion string `json:"runtime_version,omitempty" db:"runtime_version"`
RunCmd string `json:"run_cmd,omitempty" db:"run_cmd"`
BuildCmd string `json:"build_cmd,omitempty" db:"build_cmd"`
Port int `json:"port"`
WorkingDir string `json:"working_dir,omitempty" db:"working_dir"`
StaticDir string `json:"static_dir,omitempty" db:"static_dir"`
Image string `json:"image,omitempty" db:"image"`
EnvVars map[string]string `json:"env_vars,omitempty"`
Secrets map[string]string `json:"secrets,omitempty"`
Remote string `json:"remote,omitempty" db:"remote_url"`
Branch string `json:"branch" db:"remote_branch"`
CommitHash string `json:"commit_hash" db:"remote_commit_hash"`
DeploymentId string `json:"-" db:"deployment_id"`
Blueprint *Blueprint `json:"blueprint,omitempty"`
CreatedAt time.Time `json:"created_at" db:"created_at"`
UpdatedAt time.Time `json:"updated_at" db:"updated_at"`
}
type ServiceStore ¶
type ServiceType ¶ added in v0.6.0
type ServiceType string
const ( TypeStatic ServiceType = "static" TypeWorker ServiceType = "worker" TypeWeb ServiceType = "web" TypeJob ServiceType = "job" )
type TaskResult ¶
type TaskResult struct {
ID string `db:"id"`
Status string `db:"status"`
Result any `db:"result"`
Error string `db:"error"`
}
TaskResult represents the outcome of executing a remote task.
type TaskResultStore ¶
type TaskResultStore interface {
// ListUnsent returns all results that have not yet been marked as synced.
ListUnsent(ctx context.Context) ([]*TaskResult, error)
// SaveResults persists new task results as unsynced.
SaveResults(ctx context.Context, results []*TaskResult) error
// MarkSynced marks the given result IDs as synced.
MarkSynced(ctx context.Context, ids []string) error
}
TaskResultStore provides access to persisted task results.
type UserStore ¶
type UserStore interface {
FindOrCreateUser(email string, role Role) (*User, error)
GetUserByEmail(ctx context.Context, email string) (*User, error)
UpdateUserRole(ctx context.Context, email string, role Role) error
HasOwner() (bool, error) // Returns true if owner exists
GetRole(ctx context.Context, email string) (Role, error)
}
Click to show internal directories.
Click to hide internal directories.