project

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2020 License: MIT Imports: 25 Imported by: 3

Documentation

Overview

Package project contains Inertia's build and project management code

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DeployOptions

type DeployOptions struct {
	SkipUpdate bool
}

DeployOptions is used to configure how the deployment handles the deploy

type Deployer

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

type Deployment

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

Deployment represents the deployed project

func NewDeployment

func NewDeployment(
	projectDirectory string,
	persistDirectory string,

	databasePath string,
	databaseKeyPath string,

	builder build.ContainerBuilder,
) (*Deployment, error)

NewDeployment creates a new deployment

func (*Deployment) CompareRemotes

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 (*Deployment) Deploy

func (d *Deployment) Deploy(
	cli *docker.Client,
	out io.Writer,
	opts DeployOptions,
) (func() error, error)

Deploy will update, build, and deploy the project

func (*Deployment) Destroy

func (d *Deployment) Destroy(cli *docker.Client, out io.Writer) error

Destroy shuts down the deployment and removes the repository

func (*Deployment) Down

func (d *Deployment) Down(cli *docker.Client, out io.Writer) error

Down shuts down the deployment

func (*Deployment) GetBranch

func (d *Deployment) GetBranch() string

GetBranch returns the currently deployed branch

func (*Deployment) GetBuildConfiguration

func (d *Deployment) GetBuildConfiguration() (*build.Config, error)

GetBuildConfiguration returns the build used to build this project. Returns config without env values if error.

func (*Deployment) GetDataManager

func (d *Deployment) GetDataManager() (manager *DeploymentDataManager, found bool)

GetDataManager returns the class managing deployment data

func (*Deployment) GetStatus

func (d *Deployment) GetStatus(cli *docker.Client) (api.DeploymentStatus, error)

GetStatus returns the status of the deployment

func (*Deployment) Initialize added in v0.4.2

func (d *Deployment) Initialize(cfg DeploymentConfig, out io.Writer) error

Initialize sets up deployment repository

func (*Deployment) Prune added in v0.4.1

func (d *Deployment) Prune(cli *docker.Client, out io.Writer) error

Prune clears unused Docker assets

func (*Deployment) SetConfig

func (d *Deployment) SetConfig(cfg DeploymentConfig)

SetConfig updates the deployment's configuration. Only supports ProjectName, Branch, and BuildType for now.

func (*Deployment) UpdateContainerHistory added in v0.6.0

func (d *Deployment) UpdateContainerHistory(cli *docker.Client) error

UpdateContainerHistory will update container bucket with recent build's metadata

func (*Deployment) Watch added in v0.4.2

func (d *Deployment) Watch(client *docker.Client) (<-chan string, <-chan error)

Watch watches for container stops

type DeploymentConfig

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

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

DeploymentDataManager stores persistent deployment configuration

func NewDataManager added in v0.5.0

func NewDataManager(dbPath string, keyPath string) (*DeploymentDataManager, error)

NewDataManager instantiates a database associated with a deployment

func (*DeploymentDataManager) AddEnvVariable

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 (*DeploymentDataManager) AddProjectBuildData added in v0.6.0

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 (*DeploymentDataManager) GetEnvVariables

func (c *DeploymentDataManager) GetEnvVariables(decrypt bool) ([]string, error)

GetEnvVariables retrieves all stored environment variables

func (*DeploymentDataManager) GetNumOfDeployedProjects added in v0.6.0

func (c *DeploymentDataManager) GetNumOfDeployedProjects(projectName string) (int, error)

GetNumOfDeployedProjects returns number of projects currently deployed

func (*DeploymentDataManager) RemoveEnvVariables added in v0.5.0

func (c *DeploymentDataManager) RemoveEnvVariables(names ...string) error

RemoveEnvVariables removes previously set env variables

func (*DeploymentDataManager) UpdateProjectBuildData added in v0.6.0

func (c *DeploymentDataManager) UpdateProjectBuildData(projectName string,
	mdata DeploymentMetadata) error

UpdateProjectBuildData updates existing project bkt with recent build's metadata

type DeploymentMetadata added in v0.6.0

type DeploymentMetadata struct {
	Hash            string
	ContainerID     string
	ContainerStatus string
	StartedAt       string
}

DeploymentMetadata is used to store metadata relevant to the most recent deployment

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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