farmer

package
v0.0.0-...-82c42ee Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2019 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CreatedState = "create"
	RunningState = "running"
	StagingState = "staging"
)
View Source
const (
	TimeFormat = "2006-01-02 15:04:05"

	FarmerPreMessage = "----> Farmer: "
)
View Source
const (
	ProductionType = "production"
	StagingType    = "staging"
	TestType       = "test"
)
View Source
const (
	ScriptCreate = "create"
	ScriptDeploy = "deploy"
	ScriptTest   = "test"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Box

type Box struct {
	ID        int    `gorm:"primary_key"`
	Name      string `sql:"type:varchar(64);" json:"name"`
	Directory string `sql:"type:varchar(255);not null" json:"directory"`
	State     string `sql:"type:varchar(32);not null; default:'creating'" json:"state"`
	Revision  int    `sql:"default:0" json:"revision"`

	OutputStream io.Writer `sql:"-" json:"-"`
	ErrorStream  io.Writer `sql:"-" json:"-"`

	ProductionID int
	Production   Release
	StagingID    int
	Staging      Release
	TestID       int
	Test         Release
	KeepReleases int       `sql:"default:1" json:"keep_releases"`
	Releases     []Release `json:"-"`

	Domains []Domain `json:"domains"`

	UpdateTime string `sql:"type:char(64);not null" json:"update_time"`
}

func FetchAllBox

func FetchAllBox() ([]*Box, error)

func FindBoxById

func FindBoxById(id int) (*Box, error)

func FindBoxByName

func FindBoxByName(name string) (*Box, error)

func (*Box) AddDomain

func (box *Box) AddDomain(url string, port string) error

func (*Box) DeleteDomain

func (box *Box) DeleteDomain(url string) error

func (*Box) Destroy

func (b *Box) Destroy() error

func (*Box) Release

func (b *Box) Release(repoUrl string, pathspec string) error

func (*Box) SetState

func (b *Box) SetState(state string) error

func (*Box) Setup

func (b *Box) Setup() error

Create box basement

type Container

type Container struct {
	FarmerConfig
	IP       string `sql:"-" json:"-"`
	Hostname string `sql:"-" json:"hostname"`
}

type Domain

type Domain struct {
	ID    uint   `gorm:"primary_key" json:"-"`
	BoxID int    `sql:"index" json:"-"`
	Url   string `sql:"type:varchar(255);" json:"url"`
	Port  string `sql:"type:varchar(8);" json:"port"`
}

type FarmerConfig

type FarmerConfig struct {
	Image   string            `sql:"type:varchar(128);not null" json:"image"`
	Home    string            `sql:"default:'/app'" json:"home"`
	Ports   []string          `sql:"-" json:"ports"`
	Env     []string          `sql:"-" json:"-"`
	Shared  []string          `sql:"-" json:"-"`
	Scripts map[string]string `sql:"-" json:"-"`
}

type Release

type Release struct {
	ID             int    `gorm:"primary_key"`
	ContainerID    string `sql:"type:varchar(64)" json:"container_id"`
	BoxID          int    `sql:"index" json:"-"`
	Box            *Box   `sql:"-" json:"-"`
	CodeDirectory  string `sql:"type:varchar(255);not null" json:"-"`
	ShareDirectory string `sql:"type:varchar(255);not null" json:"-"`
	RepoUrl        string `sql:"type:varchar(255);not null" json:"repo_url"`
	Pathspec       string `sql:"type:varchar(255);not null" json:"pathspec"`
	Type           string `sql:"type:varchar(16)" json:"type"`

	Container
	CreatedAt string `sql:"type:varchar(32);not null" json:"created_at"`
}

func NewRelease

func NewRelease(box *Box, repoUrl string, pathspec string) (Release, error)

func (*Release) Destroy

func (r *Release) Destroy(volume bool) error

func (*Release) Inspect

func (r *Release) Inspect() error

Jump to

Keyboard shortcuts

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