domain

package
v1.5.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 3, 2024 License: MIT Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvPrefix = "NS_"

	EnvMariaDBHostnameKey = EnvPrefix + "MARIADB_HOSTNAME"
	EnvMariaDBPortKey     = EnvPrefix + "MARIADB_PORT"
	EnvMariaDBUserKey     = EnvPrefix + "MARIADB_USER"
	EnvMariaDBPasswordKey = EnvPrefix + "MARIADB_PASSWORD"
	EnvMariaDBDatabaseKey = EnvPrefix + "MARIADB_DATABASE"

	EnvMongoDBHostnameKey = EnvPrefix + "MONGODB_HOSTNAME"
	EnvMongoDBPortKey     = EnvPrefix + "MONGODB_PORT"
	EnvMongoDBUserKey     = EnvPrefix + "MONGODB_USER"
	EnvMongoDBPasswordKey = EnvPrefix + "MONGODB_PASSWORD"
	EnvMongoDBDatabaseKey = EnvPrefix + "MONGODB_DATABASE"
)

All environment variables injected by neoshowcase must have NS_ prefix

View Source
const BuilderStaticArtifactName = "website.tar.gz"
View Source
const IDLength = 22

Variables

View Source
var EmptyCommit = strings.Repeat("0", 40)
View Source
var (
	// ErrFileNotFound ファイルが存在しない
	ErrFileNotFound = errors.New("not found")
)

Functions

func Base64EncodedPublicKey

func Base64EncodedPublicKey(pubKey ssh2.PublicKey) string

func ContainsDomain added in v0.4.0

func ContainsDomain(source, target string) bool

func DBName

func DBName(applicationID string) string

func DeleteArtifact

func DeleteArtifact(s Storage, artifactID string) error

func DeleteBuildLog

func DeleteBuildLog(s Storage, buildID string) error

func EncodePrivateKeyPem added in v0.6.0

func EncodePrivateKeyPem(privKey ed25519.PrivateKey) (string, error)

func GetArtifact

func GetArtifact(s Storage, artifactID string) (r io.ReadCloser, err error)

func GetBuildLog

func GetBuildLog(s Storage, buildID string) ([]byte, error)

func GitAuthMethod

func GitAuthMethod(repo *Repository, fallbackKey *ssh.PublicKeys) (transport.AuthMethod, error)

func IntoPublicKey added in v1.1.0

func IntoPublicKey(pk PrivateKey) (*ssh.PublicKeys, error)

func NewID

func NewID() string

NewID 22文字のランダムな文字列を生成

func ParseArgs added in v0.10.0

func ParseArgs(s string) ([]string, error)

func SaveArtifact

func SaveArtifact(s Storage, artifactID string, src io.Reader) error

SaveArtifact Artifactをtar形式で保存する

func SaveBuildLog

func SaveBuildLog(s Storage, buildID string, src io.Reader) error

func ValidateDomain

func ValidateDomain(domain string) error

func ValidatePossibleWildcardDomain added in v0.4.0

func ValidatePossibleWildcardDomain(domain string) error

func ValidateWildcardDomain

func ValidateWildcardDomain(domain string) error

Types

type AdditionalLink struct {
	Name string `mapstructure:"name" yaml:"name"`
	URL  string `mapstructure:"url" yaml:"url"`
}

type AppMetric added in v0.15.0

type AppMetric struct {
	Time  time.Time
	Value float64
}

type Application

type Application struct {
	ID               string
	Name             string
	RepositoryID     string
	RefName          string
	Commit           string
	DeployType       DeployType
	Running          bool
	Container        ContainerState
	ContainerMessage string
	CurrentBuild     string
	CreatedAt        time.Time
	UpdatedAt        time.Time

	Config           ApplicationConfig
	Websites         []*Website
	PortPublications []*PortPublication
	OwnerIDs         []string
}

func (*Application) Apply

func (a *Application) Apply(args *UpdateApplicationArgs)

func (*Application) IsOwner

func (a *Application) IsOwner(user *User) bool

func (*Application) SelfValidate

func (a *Application) SelfValidate() error

func (*Application) Validate

func (a *Application) Validate(
	actor *User,
	existingApps []*Application,
	domains AvailableDomainSlice,
	ports AvailablePortSlice,
) error

func (*Application) WebsiteConflicts

func (a *Application) WebsiteConflicts(existing []*Application, actor *User) bool

type ApplicationConfig

type ApplicationConfig struct {
	BuildConfig BuildConfig
}

func (*ApplicationConfig) Hash added in v0.13.0

func (c *ApplicationConfig) Hash(env []*Environment) string

func (*ApplicationConfig) Validate

func (c *ApplicationConfig) Validate(deployType DeployType) error

type ApplicationRepository

type ApplicationRepository interface {
	GetApplications(ctx context.Context, cond GetApplicationCondition) ([]*Application, error)
	GetApplication(ctx context.Context, id string) (*Application, error)
	CreateApplication(ctx context.Context, app *Application) error
	UpdateApplication(ctx context.Context, id string, args *UpdateApplicationArgs) error
	BulkUpdateState(ctx context.Context, states []*Container) error
	DeleteApplication(ctx context.Context, id string) error
}

type Artifact

type Artifact struct {
	ID        string
	Name      string
	BuildID   string
	Size      int64
	CreatedAt time.Time
	DeletedAt optional.Of[time.Time]
}

func NewArtifact

func NewArtifact(buildID string, name string, size int64) *Artifact

type ArtifactRepository

type ArtifactRepository interface {
	GetArtifact(ctx context.Context, id string) (*Artifact, error)
	GetArtifacts(ctx context.Context, cond GetArtifactCondition) ([]*Artifact, error)
	CreateArtifact(ctx context.Context, artifact *Artifact) error
	UpdateArtifact(ctx context.Context, id string, args UpdateArtifactArgs) error
	HardDeleteArtifacts(ctx context.Context, cond GetArtifactCondition) error
}

type AuthenticationType

type AuthenticationType int
const (
	AuthenticationTypeOff AuthenticationType = iota
	AuthenticationTypeSoft
	AuthenticationTypeHard
)

type AvailableDomain

type AvailableDomain struct {
	Domain         string
	ExcludeDomains []string
	AuthAvailable  bool
	AlreadyBound   bool // Actual availability (whether domain is bound to a specific app or not)
}

func (*AvailableDomain) IsAlreadyBound added in v0.20.1

func (a *AvailableDomain) IsAlreadyBound(existing []*Application) bool

func (*AvailableDomain) Match added in v0.4.0

func (a *AvailableDomain) Match(fqdn string) bool

func (*AvailableDomain) Validate

func (a *AvailableDomain) Validate() error

type AvailableDomainSlice

type AvailableDomainSlice []*AvailableDomain

func (AvailableDomainSlice) IsAuthAvailable added in v0.4.0

func (s AvailableDomainSlice) IsAuthAvailable(fqdn string) bool

func (AvailableDomainSlice) IsAvailable

func (s AvailableDomainSlice) IsAvailable(fqdn string) bool

type AvailablePort added in v0.3.0

type AvailablePort struct {
	StartPort int
	EndPort   int
	Protocol  PortPublicationProtocol
}

func (*AvailablePort) Validate added in v0.3.0

func (ap *AvailablePort) Validate() error

type AvailablePortSlice added in v0.3.0

type AvailablePortSlice []*AvailablePort

func (AvailablePortSlice) IsAvailable added in v0.3.0

func (s AvailablePortSlice) IsAvailable(port int, protocol PortPublicationProtocol) bool

type AvatarBaseURL added in v0.4.6

type AvatarBaseURL string

type Backend

type Backend interface {
	Start(ctx context.Context) error
	Dispose(ctx context.Context) error

	AvailableDomains() AvailableDomainSlice
	AvailablePorts() AvailablePortSlice
	ListenContainerEvents() (sub <-chan *ContainerEvent, unsub func())
	Synchronize(ctx context.Context, s *DesiredState) error
	GetContainer(ctx context.Context, appID string) (*Container, error)
	ListContainers(ctx context.Context) ([]*Container, error)
	AttachContainer(ctx context.Context, appID string, stdin io.Reader, stdout, stderr io.Writer) error
	ExecContainer(ctx context.Context, appID string, cmd []string, stdin io.Reader, stdout, stderr io.Writer) error
}

type Build

type Build struct {
	ID            string
	Commit        string
	ConfigHash    string
	Status        BuildStatus
	ApplicationID string
	QueuedAt      time.Time
	StartedAt     optional.Of[time.Time]
	UpdatedAt     optional.Of[time.Time]
	FinishedAt    optional.Of[time.Time]
	Retriable     bool
	Artifacts     []*Artifact               // for static app
	RuntimeImage  optional.Of[RuntimeImage] // for runtime app if exists
}

func NewBuild

func NewBuild(app *Application, env []*Environment) *Build

func (*Build) GetWebsiteArtifact added in v0.10.1

func (b *Build) GetWebsiteArtifact() (artifact *Artifact, ok bool)

type BuildConfig

type BuildConfig interface {
	BuildType() BuildType
	Validate() error

	MariaDB() bool
	MongoDB() bool

	GetRuntimeConfig() RuntimeConfig
	GetStaticConfig() StaticConfig
	// contains filtered or unexported methods
}

type BuildConfigRuntimeBuildpack

type BuildConfigRuntimeBuildpack struct {
	RuntimeConfig
	Context string
	// contains filtered or unexported fields
}

func (*BuildConfigRuntimeBuildpack) BuildType

func (bc *BuildConfigRuntimeBuildpack) BuildType() BuildType

func (*BuildConfigRuntimeBuildpack) Validate

func (bc *BuildConfigRuntimeBuildpack) Validate() error

type BuildConfigRuntimeCmd

type BuildConfigRuntimeCmd struct {
	RuntimeConfig
	BaseImage string
	BuildCmd  string
	// contains filtered or unexported fields
}

func (*BuildConfigRuntimeCmd) BuildType

func (bc *BuildConfigRuntimeCmd) BuildType() BuildType

func (*BuildConfigRuntimeCmd) Validate

func (bc *BuildConfigRuntimeCmd) Validate() error

type BuildConfigRuntimeDockerfile

type BuildConfigRuntimeDockerfile struct {
	RuntimeConfig
	DockerfileName string
	Context        string
	// contains filtered or unexported fields
}

func (*BuildConfigRuntimeDockerfile) BuildType

func (bc *BuildConfigRuntimeDockerfile) BuildType() BuildType

func (*BuildConfigRuntimeDockerfile) Validate

func (bc *BuildConfigRuntimeDockerfile) Validate() error

type BuildConfigStaticBuildpack added in v0.10.0

type BuildConfigStaticBuildpack struct {
	StaticConfig
	Context string
	// contains filtered or unexported fields
}

func (*BuildConfigStaticBuildpack) BuildType added in v0.10.0

func (bc *BuildConfigStaticBuildpack) BuildType() BuildType

func (*BuildConfigStaticBuildpack) Validate added in v0.10.0

func (bc *BuildConfigStaticBuildpack) Validate() error

type BuildConfigStaticCmd

type BuildConfigStaticCmd struct {
	StaticConfig
	BaseImage string
	BuildCmd  string
	// contains filtered or unexported fields
}

func (*BuildConfigStaticCmd) BuildType

func (bc *BuildConfigStaticCmd) BuildType() BuildType

func (*BuildConfigStaticCmd) Validate

func (bc *BuildConfigStaticCmd) Validate() error

type BuildConfigStaticDockerfile

type BuildConfigStaticDockerfile struct {
	StaticConfig
	DockerfileName string
	Context        string
	// contains filtered or unexported fields
}

func (*BuildConfigStaticDockerfile) BuildType

func (bc *BuildConfigStaticDockerfile) BuildType() BuildType

func (*BuildConfigStaticDockerfile) Validate

func (bc *BuildConfigStaticDockerfile) Validate() error

type BuildRepository

type BuildRepository interface {
	GetBuilds(ctx context.Context, cond GetBuildCondition) ([]*Build, error)
	GetLatestBuilds(ctx context.Context, appIDIn []string) ([]*Build, error)
	GetBuild(ctx context.Context, buildID string) (*Build, error)
	CreateBuild(ctx context.Context, build *Build) error
	UpdateBuild(ctx context.Context, cond GetBuildCondition, args UpdateBuildArgs) (int64, error)
	MarkCommitAsRetriable(ctx context.Context, applicationID string, commit string) error
	DeleteBuilds(ctx context.Context, cond GetBuildCondition) error
}

type BuildStatus

type BuildStatus int
const (
	BuildStatusQueued BuildStatus = iota
	BuildStatusBuilding
	BuildStatusSucceeded
	BuildStatusFailed
	BuildStatusCanceled
	BuildStatusSkipped
)

func (BuildStatus) IsFinished

func (t BuildStatus) IsFinished() bool

type BuildType

type BuildType int
const (
	BuildTypeRuntimeBuildpack BuildType = iota
	BuildTypeRuntimeCmd
	BuildTypeRuntimeDockerfile
	BuildTypeStaticBuildpack
	BuildTypeStaticCmd
	BuildTypeStaticDockerfile
)

func (BuildType) DeployType

func (b BuildType) DeployType() DeployType

type BuilderSystemInfo added in v1.1.0

type BuilderSystemInfo struct {
	SSHKey      PrivateKey
	ImageConfig builder.ImageConfig
}

type BuildpackHelperServiceClient added in v1.1.0

type BuildpackHelperServiceClient interface {
	CopyFileTree(ctx context.Context, destination string, tarStream io.Reader) error
	Exec(
		ctx context.Context,
		workDir string,
		cmd []string,
		envs map[string]string,
		logWriter io.Writer,
	) (code int, err error)
}

type CommitAuthorSignature added in v1.3.0

type CommitAuthorSignature struct {
	Name  string
	Email string
	Date  time.Time
}

type Container

type Container struct {
	ApplicationID string
	State         ContainerState
	Message       string
}

type ContainerEvent

type ContainerEvent struct {
	ApplicationID string
}

type ContainerLog

type ContainerLog struct {
	Time time.Time
	Log  string
}

type ContainerLogger

type ContainerLogger interface {
	LogLimit() int
	Get(ctx context.Context, app *Application, before time.Time, limit int) ([]*ContainerLog, error)
	Stream(ctx context.Context, app *Application, begin time.Time) (<-chan *ContainerLog, error)
}

type ContainerState

type ContainerState int
const (
	ContainerStateMissing ContainerState = iota
	ContainerStateStarting
	ContainerStateRestarting
	ContainerStateRunning
	ContainerStateExited
	ContainerStateErrored
	ContainerStateUnknown
)

type ControllerBuilderService

type ControllerBuilderService interface {
	pbconnect.ControllerBuilderServiceHandler
	ListenBuilderIdle() (sub <-chan struct{}, unsub func())
	ListenBuildSettled() (sub <-chan struct{}, unsub func())
	StartBuilds(ctx context.Context, buildIDs []string)
	CancelBuild(buildID string)
}

type ControllerBuilderServiceClient

type ControllerBuilderServiceClient interface {
	GetBuilderSystemInfo(ctx context.Context) (*BuilderSystemInfo, error)
	PingBuild(ctx context.Context, buildID string) error
	StreamBuildLog(ctx context.Context, buildID string, send <-chan []byte) error
	SaveArtifact(ctx context.Context, artifact *Artifact, body []byte) error
	SaveBuildLog(ctx context.Context, buildID string, body []byte) error
	SaveRuntimeImage(ctx context.Context, buildId string, size int64) error
	ConnectBuilder(ctx context.Context, onRequest func(req *pb.BuilderRequest), response <-chan *pb.BuilderResponse) error
}

type ControllerGiteaIntegrationService added in v0.22.0

type ControllerGiteaIntegrationService interface {
	pbconnect.ControllerGiteaIntegrationServiceHandler
	Broadcast(req *pb.GiteaIntegrationRequest)
}

type ControllerGiteaIntegrationServiceClient added in v0.22.0

type ControllerGiteaIntegrationServiceClient interface {
	Connect(ctx context.Context, onRequest func(req *pb.GiteaIntegrationRequest)) error
}

type ControllerSSGenService

type ControllerSSGenService interface {
	pbconnect.ControllerSSGenServiceHandler
	BroadcastSSGen(req *pb.SSGenRequest)
}

type ControllerSSGenServiceClient

type ControllerSSGenServiceClient interface {
	ConnectSSGen(ctx context.Context, onRequest func(req *pb.SSGenRequest)) error
}

type ControllerServiceClient

type ControllerServiceClient interface {
	GetSystemInfo(ctx context.Context) (*SystemInfo, error)

	FetchRepository(ctx context.Context, repositoryID string) error
	RegisterBuild(ctx context.Context, appID string) error
	SyncDeployments(ctx context.Context) error
	StreamBuildLog(ctx context.Context, buildID string) (<-chan *pb.BuildLog, error)
	CancelBuild(ctx context.Context, buildID string) error
}

type CreateArgs

type CreateArgs struct {
	// Database データベース/ユーザー名
	Database string
	// Password アクセスパスワード
	Password string
}

CreateArgs データベース作成引数

type CreateUserArgs

type CreateUserArgs struct {
	Name string
}

type DeleteArgs

type DeleteArgs struct {
	// Database データベース/ユーザー名
	Database string
}

DeleteArgs データベース削除引数

type DeployType

type DeployType int
const (
	DeployTypeRuntime DeployType = iota
	DeployTypeStatic
)

type DesiredState

type DesiredState struct {
	Runtime     []*RuntimeDesiredState
	StaticSites []*StaticSite
}

type Environment

type Environment struct {
	ApplicationID string
	Key           string
	Value         string
	System        bool
}

func (*Environment) GetKV added in v0.11.0

func (e *Environment) GetKV() (string, string)

func (*Environment) Validate added in v1.3.0

func (e *Environment) Validate() error

type EnvironmentRepository

type EnvironmentRepository interface {
	GetEnv(ctx context.Context, cond GetEnvCondition) ([]*Environment, error)
	SetEnv(ctx context.Context, env *Environment) error
	DeleteEnv(ctx context.Context, cond GetEnvCondition) error
}

type GetApplicationCondition

type GetApplicationCondition struct {
	IDIn         optional.Of[[]string]
	RepositoryID optional.Of[string]
	UserID       optional.Of[string]
	DeployType   optional.Of[DeployType]
	Running      optional.Of[bool]
}

type GetArtifactCondition

type GetArtifactCondition struct {
	ApplicationID optional.Of[string]
	IsDeleted     optional.Of[bool]
}

type GetBuildCondition

type GetBuildCondition struct {
	ID            optional.Of[string]
	IDIn          optional.Of[[]string]
	ApplicationID optional.Of[string]
	Commit        optional.Of[string]
	CommitIn      optional.Of[[]string]
	ConfigHash    optional.Of[string]
	Status        optional.Of[BuildStatus]
	Retriable     optional.Of[bool]
	Offset        optional.Of[int]
	Limit         optional.Of[int]
	SortAsc       optional.Of[bool]
}

type GetEnvCondition

type GetEnvCondition struct {
	ApplicationIDIn optional.Of[[]string]
	ApplicationID   optional.Of[string]
	Key             optional.Of[string]
}

type GetRepositoryCondition

type GetRepositoryCondition struct {
	IDs                optional.Of[[]string]
	URLs               optional.Of[[]string]
	CreatableOrOwnedBy optional.Of[string]
	PublicOrOwnedBy    optional.Of[string]
	UserID             optional.Of[string]
}

type GetUserCondition

type GetUserCondition struct {
	Admin optional.Of[bool]
}

type GetUserKeyCondition

type GetUserKeyCondition struct {
	UserIDs optional.Of[[]string]
}

type GitRepositoryRepository

type GitRepositoryRepository interface {
	GetRepositories(ctx context.Context, condition GetRepositoryCondition) ([]*Repository, error)
	GetRepository(ctx context.Context, id string) (*Repository, error)
	CreateRepository(ctx context.Context, repo *Repository) error
	UpdateRepository(ctx context.Context, id string, args *UpdateRepositoryArgs) error
	DeleteRepository(ctx context.Context, id string) error
}

type MariaDBManager

type MariaDBManager interface {
	GetHost() (host string, port int)
	// Create データベースが存在しない場合、作成します
	Create(ctx context.Context, args CreateArgs) error
	// Delete データベースが存在する場合、削除します
	Delete(ctx context.Context, args DeleteArgs) error
	// IsExist データベースが存在するか確認します
	IsExist(ctx context.Context, dbname string) (bool, error)
	Close(ctx context.Context) error
}

MariaDBManager MariaDBマネージャー

type MetricsService added in v0.15.0

type MetricsService interface {
	AvailableNames() []string
	Get(ctx context.Context, name string, app *Application, before time.Time, limit time.Duration) ([]*AppMetric, error)
}

type MongoDBManager

type MongoDBManager interface {
	GetHost() (host string, port int)
	// Create データベースが存在しない場合、作成します
	Create(ctx context.Context, args CreateArgs) error
	// Delete データベースが存在する場合、削除します
	Delete(ctx context.Context, args DeleteArgs) error
	// IsExist データベースが存在するか確認します
	IsExist(ctx context.Context, dbname string) (bool, error)
	Close(ctx context.Context) error
}

MongoDBManager Mongoマネージャー

type PortPublication added in v0.3.0

type PortPublication struct {
	InternetPort    int
	ApplicationPort int
	Protocol        PortPublicationProtocol
}

func (*PortPublication) Compare added in v0.4.1

func (p *PortPublication) Compare(other *PortPublication) bool

func (*PortPublication) ConflictsWith added in v0.3.0

func (p *PortPublication) ConflictsWith(existing []*Application) bool

func (*PortPublication) Validate added in v0.3.0

func (p *PortPublication) Validate() error

type PortPublicationProtocol added in v0.3.0

type PortPublicationProtocol string
const (
	PortPublicationProtocolTCP PortPublicationProtocol = "tcp"
	PortPublicationProtocolUDP PortPublicationProtocol = "udp"
)

type PrivateKey added in v1.1.0

type PrivateKey []byte

type PubSub

type PubSub[E any] struct {
	// contains filtered or unexported fields
}

PubSub is a simple pub-sub for single event type. A zero-value PubSub is ready for use.

func (*PubSub[E]) Publish

func (p *PubSub[E]) Publish(event E)

func (*PubSub[E]) Subscribe

func (p *PubSub[E]) Subscribe() (sub <-chan E, unsub func())

type Repository

type Repository struct {
	ID       string
	Name     string
	URL      string
	Auth     optional.Of[RepositoryAuth]
	OwnerIDs []string
}

func NewRepository added in v0.5.0

func NewRepository(name, url string, auth optional.Of[RepositoryAuth], ownerIDs []string) *Repository

func (*Repository) Apply

func (r *Repository) Apply(args *UpdateRepositoryArgs)

func (*Repository) CanCreateApp added in v0.11.5

func (r *Repository) CanCreateApp(user *User) bool

func (*Repository) HTMLURL added in v0.15.7

func (r *Repository) HTMLURL() string

HTMLURL returns human-readable HTML page URL. Since there is no 'official' mapping from git-readable URL to human-readable HTML URL, the conversion is done heuristically.

func (*Repository) IsOwner

func (r *Repository) IsOwner(user *User) bool

func (*Repository) ResolveRefs added in v0.12.4

func (r *Repository) ResolveRefs(ctx context.Context, fallbackKey *ssh.PublicKeys) (refToCommit map[string]string, err error)

func (*Repository) Validate

func (r *Repository) Validate() error

type RepositoryAuth

type RepositoryAuth struct {
	Method   RepositoryAuthMethod
	Username string
	Password string
	SSHKey   string
}

func (*RepositoryAuth) Validate

func (r *RepositoryAuth) Validate() error

type RepositoryAuthMethod

type RepositoryAuthMethod int
const (
	RepositoryAuthMethodBasic RepositoryAuthMethod = iota
	RepositoryAuthMethodSSH
)

type RepositoryCommit added in v1.3.0

type RepositoryCommit struct {
	Hash      string
	Author    CommitAuthorSignature
	Committer CommitAuthorSignature
	Message   string
	Error     bool
}

func ToErroredRepositoryCommit added in v1.3.0

func ToErroredRepositoryCommit(hash string) *RepositoryCommit

func ToRepositoryCommit added in v1.3.0

func ToRepositoryCommit(c *object.Commit) *RepositoryCommit

type RepositoryCommitRepository added in v1.3.0

type RepositoryCommitRepository interface {
	GetCommits(ctx context.Context, hashes []string) ([]*RepositoryCommit, error)
	RecordCommit(ctx context.Context, commit *RepositoryCommit) error
}

type RuntimeConfig added in v0.3.5

type RuntimeConfig struct {
	UseMariaDB bool
	UseMongoDB bool
	Entrypoint string
	Command    string
}

func (*RuntimeConfig) GetRuntimeConfig added in v0.10.0

func (rc *RuntimeConfig) GetRuntimeConfig() RuntimeConfig

func (*RuntimeConfig) GetStaticConfig added in v0.10.0

func (rc *RuntimeConfig) GetStaticConfig() StaticConfig

func (*RuntimeConfig) MariaDB added in v0.3.5

func (rc *RuntimeConfig) MariaDB() bool

func (*RuntimeConfig) MongoDB added in v0.3.5

func (rc *RuntimeConfig) MongoDB() bool

func (*RuntimeConfig) Validate added in v0.3.5

func (rc *RuntimeConfig) Validate() error

type RuntimeDesiredState

type RuntimeDesiredState struct {
	App       *Application
	ImageName string
	ImageTag  string
	Envs      map[string]string
}

type RuntimeImage added in v1.5.0

type RuntimeImage struct {
	BuildID   string
	Size      int64
	CreatedAt time.Time
}

func NewRuntimeImage added in v1.5.0

func NewRuntimeImage(buildID string, size int64) *RuntimeImage

type RuntimeImageRepository added in v1.5.0

type RuntimeImageRepository interface {
	CreateRuntimeImage(ctx context.Context, image *RuntimeImage) error
	DeleteRuntimeImagesByAppID(ctx context.Context, appId string) error
}

type SSHConfig

type SSHConfig struct {
	Host string `mapstructure:"host" yaml:"host"`
	Port int    `mapstructure:"port" yaml:"port"`
}

type StartBuildRequest added in v1.1.0

type StartBuildRequest struct {
	Repo  *Repository
	App   *Application
	Envs  []*Environment
	Build *Build
}

type StaticConfig added in v0.3.5

type StaticConfig struct {
	ArtifactPath string
	SPA          bool
}

func (*StaticConfig) GetRuntimeConfig added in v0.10.0

func (sc *StaticConfig) GetRuntimeConfig() RuntimeConfig

func (*StaticConfig) GetStaticConfig added in v0.10.0

func (sc *StaticConfig) GetStaticConfig() StaticConfig

func (*StaticConfig) MariaDB added in v0.3.5

func (sc *StaticConfig) MariaDB() bool

func (*StaticConfig) MongoDB added in v0.3.5

func (sc *StaticConfig) MongoDB() bool

func (*StaticConfig) Validate added in v0.10.0

func (sc *StaticConfig) Validate() error

type StaticServer added in v0.7.0

type StaticServer interface {
	Start(ctx context.Context) error
	Reconcile(sites []*StaticSite) error
	Shutdown(ctx context.Context) error
}

type StaticServerDocumentRootPath

type StaticServerDocumentRootPath string

type StaticSite

type StaticSite struct {
	Application *Application
	Website     *Website
	ArtifactID  string
	SPA         bool
}

func GetActiveStaticSites

func GetActiveStaticSites(ctx context.Context, appRepo ApplicationRepository, buildRepo BuildRepository) ([]*StaticSite, error)

type Storage

type Storage interface {
	Save(filename string, src io.Reader) error
	Open(filename string) (io.ReadCloser, error)
	Delete(filename string) error
}

Storage ストレージインターフェース

type StorageConfig

type StorageConfig struct {
	Type  string `mapstructure:"type" yaml:"type"`
	Local struct {
		// Dir 保存ディレクトリ
		Dir string `mapstructure:"dir" yaml:"dir"`
	} `mapstructure:"local" yaml:"local"`
	S3 struct {
		// Bucket バケット名
		Bucket       string `mapstructure:"bucket" yaml:"bucket"`
		Endpoint     string `mapstructure:"endpoint" yaml:"endpoint"`
		Region       string `mapstructure:"region" yaml:"region"`
		AccessKey    string `mapstructure:"accessKey" yaml:"accessKey"`
		AccessSecret string `mapstructure:"accessSecret" yaml:"accessSecret"`
	} `mapstructure:"s3" yaml:"s3"`
	Swift struct {
		// UserName ユーザー名
		UserName string `mapstructure:"username" yaml:"username"`
		// APIKey APIキー(パスワード)
		APIKey string `mapstructure:"apiKey" yaml:"apiKey"`
		// TenantName テナント名
		TenantName string `mapstructure:"tenantName" yaml:"tenantName"`
		// TenantID テナントID
		TenantID string `mapstructure:"tenantId" yaml:"tenantId"`
		// Container コンテナ名
		Container string `mapstructure:"container" yaml:"container"`
		// AuthURL 認証エンドポイント
		AuthURL string `mapstructure:"authUrl" yaml:"authUrl"`
	} `mapstructure:"swift" yaml:"swift"`
}

type SystemInfo added in v0.10.1

type SystemInfo struct {
	PublicKey  string
	PrivateKey *ssh.PublicKeys
	SSHInfo    struct {
		Host string
		Port int
	}
	AvailableDomains AvailableDomainSlice
	AvailablePorts   AvailablePortSlice
	AdditionalLinks  []*AdditionalLink
	Version          string
	Revision         string
}

type UpdateApplicationArgs

type UpdateApplicationArgs struct {
	Name             optional.Of[string]
	RepositoryID     optional.Of[string]
	RefName          optional.Of[string]
	Commit           optional.Of[string]
	Running          optional.Of[bool]
	Container        optional.Of[ContainerState]
	ContainerMessage optional.Of[string]
	CurrentBuild     optional.Of[string]
	UpdatedAt        optional.Of[time.Time]
	Config           optional.Of[ApplicationConfig]
	Websites         optional.Of[[]*Website]
	PortPublications optional.Of[[]*PortPublication]
	OwnerIDs         optional.Of[[]string]
}

type UpdateArtifactArgs

type UpdateArtifactArgs struct {
	DeletedAt optional.Of[time.Time]
}

type UpdateBuildArgs

type UpdateBuildArgs struct {
	Status     optional.Of[BuildStatus]
	StartedAt  optional.Of[time.Time]
	UpdatedAt  optional.Of[time.Time]
	FinishedAt optional.Of[time.Time]
}

type UpdateRepositoryArgs

type UpdateRepositoryArgs struct {
	Name     optional.Of[string]
	URL      optional.Of[string]
	Auth     optional.Of[optional.Of[RepositoryAuth]]
	OwnerIDs optional.Of[[]string]
}

type User

type User struct {
	ID    string
	Name  string
	Admin bool
}

func NewUser

func NewUser(name string) *User

func (*User) AvatarURL added in v0.4.6

func (u *User) AvatarURL(baseURL AvatarBaseURL) string

type UserKey

type UserKey struct {
	ID        string
	UserID    string
	PublicKey string
	Name      string
	CreatedAt time.Time
}

func NewUserKey

func NewUserKey(userID string, publicKey string, name string) (*UserKey, error)

func (*UserKey) MarshalKey

func (u *UserKey) MarshalKey() []byte

func (*UserKey) Validate

func (u *UserKey) Validate() error

type UserRepository

type UserRepository interface {
	EnsureUser(ctx context.Context, name string) (*User, error)
	EnsureUsers(ctx context.Context, names []string) ([]*User, error)
	GetUsers(ctx context.Context, cond GetUserCondition) ([]*User, error)
	GetUserKeys(ctx context.Context, cond GetUserKeyCondition) ([]*UserKey, error)
	CreateUserKey(ctx context.Context, key *UserKey) error
	DeleteUserKey(ctx context.Context, keyID string, userID string) error
}

type Website

type Website struct {
	ID             string
	FQDN           string
	PathPrefix     string
	StripPrefix    bool
	HTTPS          bool
	H2C            bool
	HTTPPort       int
	Authentication AuthenticationType
}

func (*Website) Compare added in v0.4.1

func (w *Website) Compare(other *Website) bool

func (*Website) Equals

func (w *Website) Equals(target *Website) bool

func (*Website) Normalize added in v0.19.5

func (w *Website) Normalize()

func (*Website) Validate

func (w *Website) Validate() error

type WildcardDomains

type WildcardDomains []string

func (WildcardDomains) TLSTargetDomain

func (wd WildcardDomains) TLSTargetDomain(website *Website) string

func (WildcardDomains) Validate

func (wd WildcardDomains) Validate() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL