server

package
v0.50.0 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrLogFileNotFound = errors.New("log file not found")
)

Functions

func GetConfigDir added in v0.11.0

func GetConfigDir() (string, error)

func GetWorkspaceLogsDir added in v0.11.0

func GetWorkspaceLogsDir(configDir string) (string, error)

func IsLogFileNotFound added in v0.47.0

func IsLogFileNotFound(err error) bool

func Save added in v0.11.0

func Save(c Config) error

Types

type Config added in v0.11.0

type Config struct {
	ProvidersDir              string         `json:"providersDir" validate:"required"`
	RegistryUrl               string         `json:"registryUrl" validate:"required"`
	Id                        string         `json:"id" validate:"required"`
	ServerDownloadUrl         string         `json:"serverDownloadUrl" validate:"required"`
	Frps                      *FRPSConfig    `json:"frps,omitempty" validate:"optional"`
	ApiPort                   uint32         `json:"apiPort" validate:"required"`
	HeadscalePort             uint32         `json:"headscalePort" validate:"required"`
	BinariesPath              string         `json:"binariesPath" validate:"required"`
	LogFile                   *LogFileConfig `json:"logFile" validate:"required"`
	DefaultProjectImage       string         `json:"defaultProjectImage" validate:"required"`
	DefaultProjectUser        string         `json:"defaultProjectUser" validate:"required"`
	BuilderImage              string         `json:"builderImage" validate:"required"`
	LocalBuilderRegistryPort  uint32         `json:"localBuilderRegistryPort" validate:"required"`
	LocalBuilderRegistryImage string         `json:"localBuilderRegistryImage" validate:"required"`
	BuilderRegistryServer     string         `json:"builderRegistryServer" validate:"required"`
	BuildImageNamespace       string         `json:"buildImageNamespace" validate:"optional"`
	SamplesIndexUrl           string         `json:"samplesIndexUrl" validate:"optional"`

} // @name ServerConfig

func GetConfig added in v0.11.0

func GetConfig() (*Config, error)

type FRPSConfig added in v0.11.0

type FRPSConfig struct {
	Domain   string `json:"domain" validate:"required"`
	Port     uint32 `json:"port" validate:"required"`
	Protocol string `json:"protocol" validate:"required"`

} // @name FRPSConfig

type ILocalContainerRegistry added in v0.17.0

type ILocalContainerRegistry interface {
	Start() error
	Stop() error
	Purge() error
}

type LogFileConfig added in v0.45.0

type LogFileConfig struct {
	Path       string `json:"path" validate:"required"`
	MaxSize    int    `json:"maxSize" validate:"required"`
	MaxBackups int    `json:"maxBackups" validate:"required"`
	MaxAge     int    `json:"maxAge" validate:"required"`
	LocalTime  bool   `json:"localTime" validate:"optional"`
	Compress   bool   `json:"compress" validate:"optional"`

} // @name LogFileConfig

type NetworkKey added in v0.11.0

type NetworkKey struct {
	Key string `json:"key" validate:"required"`

} // @name NetworkKey

type Server added in v0.11.0

type Server struct {
	Id string

	Version                  string
	TailscaleServer          TailscaleServer
	ProviderTargetService    providertargets.IProviderTargetService
	ContainerRegistryService containerregistries.IContainerRegistryService
	BuildService             builds.IBuildService
	ProjectConfigService     projectconfig.IProjectConfigService
	LocalContainerRegistry   ILocalContainerRegistry
	WorkspaceService         workspaces.IWorkspaceService
	ApiKeyService            apikeys.IApiKeyService
	GitProviderService       gitproviders.IGitProviderService
	ProviderManager          manager.IProviderManager
	ProfileDataService       profiledata.IProfileDataService
	TelemetryService         telemetry.TelemetryService
	// contains filtered or unexported fields
}

func GetInstance added in v0.11.0

func GetInstance(serverConfig *ServerInstanceConfig) *Server

func (*Server) FetchSamples added in v0.27.0

func (s *Server) FetchSamples() ([]sample.Sample, *http.Response, error)

func (*Server) GetBinaryPath added in v0.11.0

func (s *Server) GetBinaryPath(binaryName, binaryVersion string) (string, error)

Check if the requested binary is already downloaded, if not, download it

func (*Server) GetLogFiles added in v0.47.0

func (s *Server) GetLogFiles() ([]string, error)

func (*Server) GetLogReader added in v0.11.0

func (s *Server) GetLogReader(logFileQuery string) (io.Reader, error)

func (*Server) Initialize added in v0.36.0

func (s *Server) Initialize() error

func (*Server) Purge added in v0.25.0

func (s *Server) Purge(ctx context.Context, force bool) []error

func (*Server) Start added in v0.11.0

func (s *Server) Start() error

type ServerInstanceConfig added in v0.11.0

type ServerInstanceConfig struct {
	Config                   Config
	Version                  string
	TailscaleServer          TailscaleServer
	ProviderTargetService    providertargets.IProviderTargetService
	ContainerRegistryService containerregistries.IContainerRegistryService
	BuildService             builds.IBuildService
	ProjectConfigService     projectconfig.IProjectConfigService
	LocalContainerRegistry   ILocalContainerRegistry
	WorkspaceService         workspaces.IWorkspaceService
	ApiKeyService            apikeys.IApiKeyService
	GitProviderService       gitproviders.IGitProviderService
	ProviderManager          manager.IProviderManager
	ProfileDataService       profiledata.IProfileDataService
	TelemetryService         telemetry.TelemetryService
}

type TailscaleServer added in v0.11.0

type TailscaleServer interface {
	Connect() error
	CreateAuthKey() (string, error)
	CreateUser() error
	HTTPClient() *http.Client
	Start(errChan chan error) error
	Stop() error
	Purge() error
}

Jump to

Keyboard shortcuts

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