inertia: github.com/ubclaunchpad/inertia/daemon/inertiad/project Index | Files | Directories

package project

import "github.com/ubclaunchpad/inertia/daemon/inertiad/project"

Package project contains Inertia's build and project management code

Index

Package Files

data.go deployment.go doc.go model.go

type DeployOptions Uses

type DeployOptions struct {
    SkipUpdate bool
}

DeployOptions is used to configure how the deployment handles the deploy

type Deployer Uses

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 Uses

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

Deployment represents the deployed project

func NewDeployment Uses

func NewDeployment(
    projectDirectory string,
    persistDirectory string,

    databasePath string,
    databaseKeyPath string,

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

NewDeployment creates a new deployment

func (*Deployment) CompareRemotes Uses

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 Uses

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 Uses

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

Destroy shuts down the deployment and removes the repository

func (*Deployment) Down Uses

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

Down shuts down the deployment

func (*Deployment) GetBranch Uses

func (d *Deployment) GetBranch() string

GetBranch returns the currently deployed branch

func (*Deployment) GetBuildConfiguration Uses

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 Uses

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

GetDataManager returns the class managing deployment data

func (*Deployment) GetStatus Uses

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

GetStatus returns the status of the deployment

func (*Deployment) Initialize Uses

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

Initialize sets up deployment repository

func (*Deployment) Prune Uses

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

Prune clears unused Docker assets

func (*Deployment) SetConfig Uses

func (d *Deployment) SetConfig(cfg DeploymentConfig)

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

func (*Deployment) UpdateContainerHistory Uses

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

UpdateContainerHistory will update container bucket with recent build's metadata

func (*Deployment) Watch Uses

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

Watch watches for container stops

type DeploymentConfig Uses

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 Uses

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

DeploymentDataManager stores persistent deployment configuration

func NewDataManager Uses

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

NewDataManager instantiates a database associated with a deployment

func (*DeploymentDataManager) AddEnvVariable Uses

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 Uses

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 Uses

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

GetEnvVariables retrieves all stored environment variables

func (*DeploymentDataManager) GetNumOfDeployedProjects Uses

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

GetNumOfDeployedProjects returns number of projects currently deployed

func (*DeploymentDataManager) RemoveEnvVariables Uses

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

RemoveEnvVariables removes previously set env variables

func (*DeploymentDataManager) UpdateProjectBuildData Uses

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

UpdateProjectBuildData updates existing project bkt with recent build's metadata

type DeploymentMetadata Uses

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

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

Directories

PathSynopsis
mocksCode 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.