haus

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2015 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Overview

Package haus reads a yaml file describing docker architecture and generates from templates docker-compose and RepoTsar files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Name         string
	Email        string
	Path         string
	Pwd          string
	Hausrepo     string
	Environments map[string]Environment
	Variables    map[string]string
}

Config represents the configurations in haus config file.

func ReadConfig

func ReadConfig(filename string, usrcfgfile string, branch string, path string, variables map[string]string) (*Config, error)

ReadConfig reads the config file from the supplied full path and returns a Config and error.

type DockerCfg

type DockerCfg struct {
	Build          string   `yaml:"build,omitempty"`
	Cap_add        []string `yaml:"cap_add,omitempty"`
	Cap_drop       []string `yaml:"cap_drop,omitempty"`
	Command        string   `yaml:"command,omitempty"`
	Cpu_shares     string   `yaml:"cpu_shares,omitempty"`
	Dns            []string `yaml:"dns,omitempty"`
	Dns_search     []string `yaml:"dns_search,omitempty"`
	Domainname     string   `yaml:"domainname,omitempty"`
	Entrypoint     []string `yaml:"entrypoint,omitempty"`
	Env_file       []string `yaml:"env_file,omitempty"`
	Environment    []string `yaml:"environment,omitempty"`
	Expose         []string `yaml:"expose,omitempty"`
	External_links []string `yaml:"external_links,omitempty"`
	Hostname       string   `yaml:"hostname,omitempty"`
	Image          string   `yaml:"image,omitempty"`
	Links          []string `yaml:"links,omitempty"`
	Mem_limit      string   `yaml:"mem_limit,omitempty"`
	Net            string   `yaml:"net,omitempty"`
	Ports          []string `yaml:"ports,omitempty"`
	Privileged     string   `yaml:"privileged,omitempty"`
	Restart        string   `yaml:"restart,omitempty"`
	Stdin_open     string   `yaml:"stdin_open,omitempty"`
	Tty            string   `yaml:"tty,omitempty"`
	User           string   `yaml:"user,omitempty"`
	Volumes        []string `yaml:"volumes,omitempty"`
	Volumes_from   []string `yaml:"volumes_from,omitempty"`
	Working_dir    string   `yaml:"working_dir,omitempty"`
}

DockerCfg represents a single docker-compose config.

type DockerYml

type DockerYml struct {
	Cfg map[string]DockerCfg
}

DockerYml represents a collection of docker-compose configs to be turned into YAML.

func (*DockerYml) AddCfg

func (y *DockerYml) AddCfg(d map[string]DockerCfg)

AddCfg adds a map[string]DockerCfg to DockerYml.

func (*DockerYml) Cfgs

func (y *DockerYml) Cfgs() map[string]DockerCfg

Cfgs returns map[string]DockerCfg from DockerYml.

func (*DockerYml) WriteYml

func (y *DockerYml) WriteYml(filename string) (string, error)

WriteYml writes out Cfgs to yaml file. Hand it full path to yaml file you wish to write out. Returns string of yaml text.

type Environment

type Environment struct {
	Name         string
	Requirements []string
	Variables    map[string]string
}

Environment represents a single environment from the haus config file.

type Haus

type Haus struct {
	Config Config
}

Haus represents an instance of the haus application.

func (*Haus) Run

func (h *Haus) Run() error

Run starts the process of the haus application and returns error.

type ParsedTmpl

type ParsedTmpl struct {
	Repotsar map[string]Repo
	Docker   map[string]DockerCfg
}

ParsedTmpl represents a collection of Repo and DockerCfgs created from haus templates.

type Repo

type Repo struct {
	URL    string
	Path   string
	Branch string
	Link   string
}

Repo represents a single git repo definition.

func (*Repo) CloneRepo

func (r *Repo) CloneRepo(n string) error

CloneRepo clones a git repo, hand it a repo name, returns error.

func (r *Repo) CreateLink() error

CreateLink creates symlink defined in Repo. Returns error.

type RepoYml

type RepoYml struct {
	Signature Signature
	Repos     map[string]Repo
}

RepoYml represents a collection of repos configs to be turned into YAML.

func (*RepoYml) AddCfg

func (y *RepoYml) AddCfg(r map[string]Repo)

AddCfg adds a map[string]Repo to RepoYml.

func (*RepoYml) WriteYml

func (y *RepoYml) WriteYml(filename string) (string, error)

WriteYml writes out Cfgs to yaml file. Hand it full path to yaml file you wish to write out. Returns string of yaml text.

type Signature

type Signature struct {
	Name  string
	Email string
}

Signature represents the values to be use in a git signature.

type Template

type Template struct {
	Path      string
	Pwd       string
	Image     string
	Name      string
	Branch    string
	Version   string
	Variables map[string]string
	Env       map[string]string
	Parsed    *ParsedTmpl
}

Template represents a single instance of a haus template file.

func (*Template) DockerCfgs

func (t *Template) DockerCfgs() (map[string]DockerCfg, error)

DockerCfgs returns DockerCfgs stored in Template.

func (*Template) Parse

func (t *Template) Parse() (ParsedTmpl, error)

Parse processes template files to create Repo and DockerCfgs, returns a ParsedTmpl.

func (*Template) RepoTsarCfgs

func (t *Template) RepoTsarCfgs() (map[string]Repo, error)

RepoTsarCfgs returns RepoTsarCfgs stored in Template.

Jump to

Keyboard shortcuts

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