project

package
v1.40.2 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Project

type Project struct {
	Name      string
	Directory string
	Preview   []preview.Feature
	// contains filtered or unexported fields
}

func FromFile

func FromFile(fs afero.Fs, filepath string) (*Project, error)

FromFile - Loads a nitric project from a nitric.yaml file If no filepath is provided, the default location './nitric.yaml' is used

func (*Project) BuildServices added in v1.34.0

func (p *Project) BuildServices(fs afero.Fs) (chan ServiceBuildUpdate, error)

BuildServices - Builds all the services in the project

func (*Project) CollectServicesRequirements added in v1.34.0

func (p *Project) CollectServicesRequirements() ([]*collector.ServiceRequirements, error)

func (*Project) GetServices added in v1.34.0

func (p *Project) GetServices() []Service

func (*Project) RunServices added in v1.34.0

func (p *Project) RunServices(localCloud *cloud.LocalCloud, stop <-chan bool, updates chan<- ServiceRunUpdate) error

RunServices - Runs all the services as containers use the stop channel to stop all running services

func (*Project) RunServicesWithCommand added in v1.34.0

func (p *Project) RunServicesWithCommand(localCloud *cloud.LocalCloud, stop <-chan bool, updates chan<- ServiceRunUpdate) error

RunServices - Runs all the services locally using a startup command use the stop channel to stop all running services

type ProjectConfiguration added in v1.34.0

type ProjectConfiguration struct {
	Name      string                          `yaml:"name"`
	Directory string                          `yaml:"-"`
	Services  []ServiceConfiguration          `yaml:"services"`
	Runtimes  map[string]RuntimeConfiguration `yaml:"runtimes,omitempty"`
	Preview   []preview.Feature               `yaml:"preview,omitempty"`
}

func ConfigurationFromFile added in v1.34.0

func ConfigurationFromFile(fs afero.Fs, filePath string) (*ProjectConfiguration, error)

func (ProjectConfiguration) ToFile added in v1.34.0

func (p ProjectConfiguration) ToFile(fs afero.Fs, filepath string) error

type RunContainerOption added in v1.34.0

type RunContainerOption func(*runContainerOptions)

func WithEnvVars added in v1.34.0

func WithEnvVars(envVars map[string]string) RunContainerOption

func WithNitricEnvironment added in v1.34.0

func WithNitricEnvironment(environment string) RunContainerOption

func WithNitricHost added in v1.34.0

func WithNitricHost(host string) RunContainerOption

func WithNitricPort added in v1.34.0

func WithNitricPort(port string) RunContainerOption

type RuntimeConfiguration added in v1.34.0

type RuntimeConfiguration struct {
	// Template dockerfile to use as the base for the custom runtime
	Dockerfile string
	// Additional args to pass to the custom runtime
	Args map[string]string
}

type Service added in v1.34.0

type Service struct {
	Name string
	Type string
	// contains filtered or unexported fields
}

func (*Service) BuildImage added in v1.34.0

func (s *Service) BuildImage(fs afero.Fs, logs io.Writer) error

func (*Service) GetAbsoluteFilePath added in v1.34.0

func (s *Service) GetAbsoluteFilePath() (string, error)

func (*Service) GetFilePath added in v1.34.0

func (s *Service) GetFilePath() string

func (*Service) Run added in v1.34.0

func (s *Service) Run(stop <-chan bool, updates chan<- ServiceRunUpdate, env map[string]string) error

Run - runs the service using the provided command, typically not in a container.

func (*Service) RunContainer added in v1.34.0

func (s *Service) RunContainer(stop <-chan bool, updates chan<- ServiceRunUpdate, opts ...RunContainerOption) error

RunContainer - Runs a container for the service, blocking until the container exits

type ServiceBuildStatus added in v1.34.0

type ServiceBuildStatus string
const (
	ServiceBuildStatus_InProgress ServiceBuildStatus = "In Progress"
	ServiceBuildStatus_Complete   ServiceBuildStatus = "Complete"
	ServiceBuildStatus_Error      ServiceBuildStatus = "Error"
)

type ServiceBuildUpdate added in v1.34.0

type ServiceBuildUpdate struct {
	ServiceName string
	Message     string
	Status      ServiceBuildStatus
	Err         error
}

type ServiceConfiguration added in v1.34.0

type ServiceConfiguration struct {
	// This is the string version
	Match string `yaml:"match"`

	// This is the custom runtime version (is custom if not nil, we auto-detect a standard language runtime)
	Runtime string `yaml:"runtime"`

	// This allows specifying a particular service type (e.g. "Job"), this is optional and custom service types can be defined for each stack
	Type string `yaml:"type"`

	// This is a command that will be use to run these services when using nitric start
	Start string `yaml:"start"`
}

type ServiceRunStatus added in v1.34.0

type ServiceRunStatus string
const (
	ServiceRunStatus_Running ServiceRunStatus = "Running"
	ServiceRunStatus_Done    ServiceRunStatus = "Done"
	ServiceRunStatus_Error   ServiceRunStatus = "Error"
)

type ServiceRunUpdate added in v1.34.0

type ServiceRunUpdate struct {
	ServiceName string
	Label       string
	Message     string
	Status      ServiceRunStatus
	Err         error
}

type ServiceRunUpdateWriter added in v1.34.0

type ServiceRunUpdateWriter struct {
	// contains filtered or unexported fields
}

func (*ServiceRunUpdateWriter) Write added in v1.34.0

func (s *ServiceRunUpdateWriter) Write(data []byte) (int, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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