projectlib

package
v0.0.0-...-7c4f5c2 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2018 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateApplication

func CreateApplication(basedir string, name string) error

CreateApplication creates a single application with a Dockerfile

func CreateProject

func CreateProject(basedir string) error

CreateProject initiales a directory with the files and folders required for a riot project

Types

type AppBuild

type AppBuild struct {
	NodeSelector string             `yaml:"buildsOn"`
	Args         map[string]*string `yaml:"args"`
	DontPush     bool               `yaml:"dontPush"`
}

AppBuild contains all settings related to an application build

type AppRun

type AppRun struct {
	Priviliged bool              `yaml:"priviliged"`
	Volumes    map[string]string `yaml:"volumes"`
	Ports      map[string]string `yaml:"ports"`
}

AppRun configures an application during runtime

type Application

type Application struct {
	Name               string
	DeploymentSelector []string `yaml:"deploysTo"`
	BuildCfg           AppBuild `yaml:"build"`
	Image              string   `yaml:"image"`
	RunCfg             AppRun   `yaml:"run"`
}

Application represnts a single app in a riot project

func LoadApp

func LoadApp(basedir string) (*Application, error)

LoadApp loads the application manifest from an application folder

func (*Application) Build

func (app *Application) Build(env Environment) (string, error)

Build builds the image of an application or returns the preconfigured one if there is no Dockerfile

func (*Application) Deploy

func (app *Application) Deploy(node Node, env Environment, lock RiotLock) (*RiotLock, error)

Deploy installs an application on a node

func (*Application) GetBuildNode

func (app *Application) GetBuildNode(env Environment) (Node, error)

GetBuildNode returns the node on which we should build the application image

func (*Application) SelectDeploymentTargets

func (app *Application) SelectDeploymentTargets(env Environment) ([]Node, error)

SelectDeploymentTargets selects all nodes in an environment to which an application ought to be deployed

type Environment

type Environment interface {
	GetRegistry() RegistryCfg
	GetNodes() []Node
	GetApplications() ([]Application, error)
	GetApplication(name string) (Application, error)
	Validate() ([]Issue, error)
	GetBaseDir() string
	SelectNodes(selector string) ([]Node, error)
	AddNode(node Node)
	Save() error
}

Environment is the core configuration of a riot project

func LoadEnv

func LoadEnv(basedir string) (Environment, error)

LoadEnv loads the environment description of a riot project from the basedir

type Issue

type Issue struct {
	Description string
	IsFatal     bool
}

Issue reports a single problem found in a project configuration

func (Issue) String

func (issue Issue) String() string

type Node

type Node struct {
	Name   string   `yaml:"name"`
	Host   string   `yaml:"host"`
	Labels []string `yaml:"labels"`
}

Node represents a single device on which we can deploy an application to

func (*Node) GetDockerClient

func (node *Node) GetDockerClient(ctx context.Context, env Environment) (*client.Client, error)

GetDockerClient builds a Docker client for a particular node

func (Node) HasAppRunning

func (node Node) HasAppRunning(imageName string, env Environment) (bool, error)

HasAppRunning checks if an application is currently deployed on a node

func (*Node) IsAvailable

func (node *Node) IsAvailable() bool

IsAvailable checks if a node is available for container deployment

type RegistryCfg

type RegistryCfg struct {
	Host     string `yaml:"host"`
	Username string `yaml:"user"`
	Password string `yaml:"password"`
}

RegistryCfg configures access to a docker registry

func (RegistryCfg) GetAuthString

func (reg RegistryCfg) GetAuthString() (string, error)

GetAuthString computes the base64 authorization string needed for docker registry requests

type RiotLock

type RiotLock struct {
	Versions   map[string]string            `yaml:"versions"`
	Deployment map[string]map[string]string `yaml:"deployment"`
}

RiotLock locks an application to a specific image version

func LoadLock

func LoadLock(basedir string) (RiotLock, error)

LoadLock loads a riot.lock file for a project

func (*RiotLock) AddDeployment

func (lock *RiotLock) AddDeployment(app string, node string, version string)

func (*RiotLock) GetDeployment

func (lock *RiotLock) GetDeployment(app string, node string) (string, bool)

func (RiotLock) Save

func (lock RiotLock) Save(basedir string) error

Save stores a riot lock in a project

Jump to

Keyboard shortcuts

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