procfile

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2017 License: BSD-2-Clause Imports: 7 Imported by: 18

README

Procfile

This is a Go library for parsing the Procfile format.

Formats

Standard

The standard Procfile format is what you're probably most familiar with, which maps a process name to the command to run. An example of a standard Procfile might look like:

web: ./bin/web
worker: ./bin/worker

The standard Procfile format is specified in https://devcenter.heroku.com/articles/procfile.

Extended

The extended Procfile format is Empire specific and implements a subset of the attributes defined in the docker-compose.yml format. The extended Procfile format gives you more control, and allows you to configure additional settings. An example of an extended Procfile might look like:

web:
  command: ./bin/web
scheduled-job:
  command: ./bin/scheduled-job
  cron: '0/2 * * * ? *'
Attributes

Command

Specifies the command that should be run when executing this process.

command: ./bin/web

Cron

When provided, signifies that the process is a scheduled process. The value should be a valid cron expression.

cron: * * * * * * // Run once every minute

Noservice

When provided, signifies that the process is an "operational" one off command. These processes will not get any AWS resources attached to them.

This can be used to alias a common command, or by enforcing whitelisting of commands for emp run.

noservice: true

Ports

This allows you to define what ports to expose, and what protocol to expose them with. This works similarly to the ports: attribute in docker-compose.yml.

ports:
  # Map port 80 on the container, as port 80 on the load balancer, using the default protocol.
  - "80"
  # Map port 8080 on the container, as port 80 on the load balancer, using the default protocol.
  - "80:8080"
  # Map port 5678 on the container, as port 5678 on the load balancer, using the tcp protocol.
  - "5678":
      protocol: "tcp"

Environment

This allows you to set process specific environment variables. If these are set with emp set, the value within the Procfile will take precendence.

environment:
  EMPIRE_X_LOAD_BALANCER_TYPE: "alb"

See documentation about deploying an application for a list of other supported environment variables.

ECS

This allows you to specify any ECS specific properties, like placement strategies and constraints:

ecs:
  placement_constraints:
    - type: memberOf
      expression: "attribute:ecs.instance-type =~ t2.*"
  placement_strategy:
    - type: spread
      field: "attribute:ecs.availability-zone"

See http://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-placement.html for details.

Documentation

Overview

Package procfile provides methods for parsing standard and extended Procfiles.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Marshal added in v0.10.1

func Marshal(p Procfile) ([]byte, error)

Marshal marshals the Procfile to yaml format.

Types

type ECS added in v0.13.0

type ECS struct {
	PlacementConstraints []*ecs.PlacementConstraint `yaml:"placement_constraints"`
	PlacementStrategy    []*ecs.PlacementStrategy   `yaml:"placement_strategy"`
}

ECS specific options.

type ExtendedProcfile added in v0.10.1

type ExtendedProcfile map[string]Process

ExtendedProcfile represents the extended Procfile format.

type Port added in v0.12.0

type Port struct {
	Host      int
	Container int
	Protocol  string
}

Port represents a port mapping.

func ParsePort added in v0.12.0

func ParsePort(s string) (p Port, err error)

ParsePort parses a string into a Port.

func (*Port) UnmarshalYAML added in v0.12.0

func (p *Port) UnmarshalYAML(unmarshal func(interface{}) error) error

type Process added in v0.10.1

type Process struct {
	Command     interface{}       `yaml:"command"`
	Cron        *string           `yaml:"cron,omitempty"`
	NoService   bool              `yaml:"noservice,omitempty"`
	Ports       []Port            `yaml:"ports,omitempty"`
	Environment map[string]string `yaml:"environment,omitempty"`
	ECS         *ECS              `yaml:"ecs,omitempty"`
}

type Procfile

type Procfile interface {
	// contains filtered or unexported methods
}

Procfile is a Go representation of process configuration.

func Parse added in v0.10.1

func Parse(r io.Reader) (Procfile, error)

Parse parses the Procfile by reading from r.

func ParseProcfile

func ParseProcfile(b []byte) (Procfile, error)

ParseProcfile takes a byte slice representing a YAML Procfile and parses it into a Procfile.

type StandardProcfile added in v0.10.1

type StandardProcfile map[string]string

StandardProcfile represents a standard Procfile.

Directories

Path Synopsis
internal
yaml
Package yaml implements YAML support for the Go language.
Package yaml implements YAML support for the Go language.

Jump to

Keyboard shortcuts

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