stretcher

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2014 License: MIT Imports: 19 Imported by: 0

README

stretcher

A deployment tool with consul event.

example manifest

src: s3://example.com/app.tar.gz
checksum: e0840daaa97cd2cf2175f9e5d133ffb3324a2b93
dest: /home/stretcher/app
commands:
  pre:
    - echo 'staring deploy'
  post:
    - echo 'deploy done'

run

stretcher agent

A stretcher agent is designed as running under "consul watch" and will be kicked by consul event.

When you use S3 URL, export AWS_CONFIG_FILE environment variable.

$ export AWS_CONFIG_FILE=/path/to/.aws/config
$ consul watch -type event -name deploy /path/to/stretcher
  • -name: your deployment identifiy name.
deployment process
  1. Create tar(or tar.gz) archive for deployment.
  2. Upload the archive file to remote server (S3 or HTTP(S)).
  3. Create a manifest file (YAML) and upload it to remote server.
  • src: archive URL.
  • checksum: archive file's checksum. (md5, sha1, sha256 or sha512 hex format)
  • dest: destination directory path.
  • commands:
    • pre: commands to be executed at before the archive extracted.
    • post: commands to be executed at after the archive extracted.
  1. Create a consul event.
$ consul event -name deploy s3://example.com/deploy-20141117-112233.yml
  • -name: same as stretcher agent event name.
  • payload: manifest URL.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AWSAuth   aws.Auth
	AWSRegion aws.Region
)

Functions

func LoadAWSConfigFile

func LoadAWSConfigFile(file string) error

func Run

func Run()

Types

type Commands

type Commands struct {
	Pre  []string `yaml:"pre"`
	Post []string `yaml:"post"`
}

type ConsulEvent

type ConsulEvent struct {
	ID      string `json:"ID"`
	Name    string `json:"Name"`
	Payload string `json:"Payload"`
	LTime   int    `json:"LTime"`
}

func ParseConsulEvents

func ParseConsulEvents(in io.Reader) (*ConsulEvent, error)

func (ConsulEvent) PayloadString

func (ev ConsulEvent) PayloadString() string

type ConsulEvents

type ConsulEvents []ConsulEvent

type Manifest

type Manifest struct {
	Src      string   `yaml:"src"`
	CheckSum string   `yaml:"checksum"`
	Dest     string   `yaml:"dest"`
	Commands Commands `yaml:"commands"`
}

func ParseManifest

func ParseManifest(data []byte) (*Manifest, error)

func (*Manifest) Deploy

func (m *Manifest) Deploy() error

func (*Manifest) InvokePostDeployCommands

func (m *Manifest) InvokePostDeployCommands() error

func (*Manifest) InvokePreDeployCommands

func (m *Manifest) InvokePreDeployCommands() error

Directories

Path Synopsis
cmd
stretcher command

Jump to

Keyboard shortcuts

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