dev

package
v0.0.0-...-60aa128 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2020 License: BSD-3-Clause Imports: 42 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Booting is the thread that will boot
	Booting = iota
	// Running are the threads that are running
	Running
	// Dead are any dead threads
	Dead
)
View Source
const DefaultAddress = ":9253"
View Source
const DefaultThreads = 5

DefaultThreads specifies the amount of threads that will be consumed by default

Variables

View Source
var ErrUnexpectedExit = errors.New("unexpected exit")

ErrUnexpectedExit is the error thrown when the app crashes during a request

View Source
var ErrUnknownApp = errors.New("unknown app")

ErrUnknownApp is thrown when an application cannot be found in config

Functions

func ConfigureResolver

func ConfigureResolver(domains []string, port int) error

func GeneratePort

func GeneratePort() int

GeneratePort outputs a random port number in the range of 3001-3999 that will be passed as $PORT to the `docker-compose` process for a given application.

func InstallIntoSystem

func InstallIntoSystem(listenPort, tlsPort int, dir, domains, timeout string) error

func NewCertCache

func NewCertCache() *certCache

func Setup

func Setup() error

func SetupOurCert

func SetupOurCert() error

func Stop

func Stop() error

func TrustCert

func TrustCert(cert string) error

func Uninstall

func Uninstall(domains []string)

Types

type App

type App struct {
	Name    string
	Scheme  string
	Host    string
	Port    int
	Command *exec.Cmd
	Public  bool
	Events  *Events
	// contains filtered or unexported fields
}

App represents a running `docker-compose` project

func (*App) Address

func (a *App) Address() string

Address returns the URL to this app.

func (*App) Kill

func (a *App) Kill(reason string) error

Kill terminates the process the app is running on

func (*App) Log

func (a *App) Log() string

Log outputs log messages to STDOUT

func (*App) SetAddress

func (a *App) SetAddress(scheme, host string, port int)

SetAddress configures the URL that the app is running on

func (*App) Status

func (a *App) Status() int

Status returns whether the app is currently running

func (*App) WaitTilReady

func (a *App) WaitTilReady() error

WaitTilReady listens on the App's `readyChan` for the app to come up and returns when it can serve requests.

type AppPool

type AppPool struct {
	Dir      string
	IdleTime time.Duration
	Debug    bool
	Events   *Events

	AppClosed func(*App)
	// contains filtered or unexported fields
}

AppPool is the collection of Apps that docker-dev controls

func (*AppPool) App

func (pool *AppPool) App(name string) (*App, error)

App looks up an app in the pool or adds it.

func (*AppPool) ForApps

func (pool *AppPool) ForApps(f func(*App))

ForApps runs the callback function for each app that exists

func (*AppPool) LaunchApp

func (pool *AppPool) LaunchApp(name, dir string) (*App, error)

LaunchApp boots the app with docker-compose and proxies requests to it

func (*AppPool) Purge

func (pool *AppPool) Purge()

Purge kills all apps

type DNSResponder

type DNSResponder struct {
	Address string
}

func (*DNSResponder) Serve

func (d *DNSResponder) Serve(domains []string) error

type Events

type Events struct {
	// contains filtered or unexported fields
}

func (*Events) Add

func (e *Events) Add(name string, args ...interface{}) string

func (*Events) WriteTo

func (e *Events) WriteTo(w io.Writer) (int64, error)

type HTTPServer

type HTTPServer struct {
	Address    string
	TLSAddress string
	Pool       *AppPool
	Debug      bool
	Events     *Events
	// contains filtered or unexported fields
}

func (*HTTPServer) AppClosed

func (h *HTTPServer) AppClosed(app *App)

func (*HTTPServer) Serve

func (h *HTTPServer) Serve() error

func (*HTTPServer) ServeHTTP

func (h *HTTPServer) ServeHTTP(w http.ResponseWriter, req *http.Request)

func (*HTTPServer) ServeTLS

func (h *HTTPServer) ServeTLS() error

func (*HTTPServer) Setup

func (h *HTTPServer) Setup()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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