import "github.com/ubclaunchpad/inertia/daemon/inertiad/project"
Package project contains Inertia's build and project management code
data.go deployment.go doc.go model.go
DeployOptions is used to configure how the deployment handles the deploy
type Deployer interface { Deploy(*docker.Client, io.Writer, DeployOptions) (func() error, error) Initialize(cfg DeploymentConfig, out io.Writer) error Down(*docker.Client, io.Writer) error Destroy(*docker.Client, io.Writer) error Prune(*docker.Client, io.Writer) error GetStatus(*docker.Client) (api.DeploymentStatus, error) SetConfig(DeploymentConfig) GetBranch() string CompareRemotes(string) error UpdateContainerHistory(cli *docker.Client) error GetDataManager() (*DeploymentDataManager, bool) Watch(*docker.Client) (<-chan string, <-chan error) }
Deployer manages the deployed user project
go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 -o ./mocks/deployer.go ./deployment.go Deployer
type Deployment struct {
// contains filtered or unexported fields
}
Deployment represents the deployed project
func NewDeployment( projectDirectory string, persistDirectory string, databasePath string, databaseKeyPath string, builder build.ContainerBuilder, ) (*Deployment, error)
NewDeployment creates a new deployment
func (d *Deployment) CompareRemotes(remoteURL string) error
CompareRemotes will compare the remote of the deployment with given remote URL and return nil if they don't conflict
func (d *Deployment) Deploy( cli *docker.Client, out io.Writer, opts DeployOptions, ) (func() error, error)
Deploy will update, build, and deploy the project
Destroy shuts down the deployment and removes the repository
Down shuts down the deployment
func (d *Deployment) GetBranch() string
GetBranch returns the currently deployed branch
func (d *Deployment) GetBuildConfiguration() (*build.Config, error)
GetBuildConfiguration returns the build used to build this project. Returns config without env values if error.
func (d *Deployment) GetDataManager() (manager *DeploymentDataManager, found bool)
GetDataManager returns the class managing deployment data
func (d *Deployment) GetStatus(cli *docker.Client) (api.DeploymentStatus, error)
GetStatus returns the status of the deployment
func (d *Deployment) Initialize(cfg DeploymentConfig, out io.Writer) error
Initialize sets up deployment repository
Prune clears unused Docker assets
func (d *Deployment) SetConfig(cfg DeploymentConfig)
SetConfig updates the deployment's configuration. Only supports ProjectName, Branch, and BuildType for now.
func (d *Deployment) UpdateContainerHistory(cli *docker.Client) error
UpdateContainerHistory will update container bucket with recent build's metadata
Watch watches for container stops
type DeploymentConfig struct { ProjectName string BuildType string BuildFilePath string RemoteURL string Branch string PemFilePath string IntermediaryContainers []string // TODO: maybe improve format for generic notifiers SlackNotificationURL string }
DeploymentConfig is used to configure Deployment
type DeploymentDataManager struct {
// contains filtered or unexported fields
}
DeploymentDataManager stores persistent deployment configuration
func NewDataManager(dbPath string, keyPath string) (*DeploymentDataManager, error)
NewDataManager instantiates a database associated with a deployment
func (c *DeploymentDataManager) AddEnvVariable(name, value string, encrypt bool) error
AddEnvVariable adds a new environment variable that will be applied to all project containers
func (c *DeploymentDataManager) AddProjectBuildData(projectName string, mdata DeploymentMetadata) error
AddProjectBuildData stores and tracks metadata from successful builds TODO: Change name, error check, only insert project mdata inside private helper 'update build'
func (c *DeploymentDataManager) GetEnvVariables(decrypt bool) ([]string, error)
GetEnvVariables retrieves all stored environment variables
func (c *DeploymentDataManager) GetNumOfDeployedProjects(projectName string) (int, error)
GetNumOfDeployedProjects returns number of projects currently deployed
func (c *DeploymentDataManager) RemoveEnvVariables(names ...string) error
RemoveEnvVariables removes previously set env variables
func (c *DeploymentDataManager) UpdateProjectBuildData(projectName string, mdata DeploymentMetadata) error
UpdateProjectBuildData updates existing project bkt with recent build's metadata
type DeploymentMetadata struct { Hash string ContainerID string ContainerStatus string StartedAt string }
DeploymentMetadata is used to store metadata relevant to the most recent deployment
Path | Synopsis |
---|---|
mocks | Code generated by counterfeiter. |
Package project imports 25 packages (graph) and is imported by 3 packages. Updated 2021-01-02. Refresh now. Tools for package owners.