niseroku

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2024 License: Apache-2.0 Imports: 71 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Name           = "niseroku"
	ConfigFileName = Name + ".toml"
)
View Source
const (
	ProxyControlResponseMaxSize = 1048576
)

Variables

View Source
var (
	DefaultGitPort      = 2403
	DefaultHttpPort     = 80
	DefaultHttpsPort    = 443
	DefaultAppEndPort   = 4400
	DefaultAppStartPort = 4200

	DefaultRunAsUser  = "www-data"
	DefaultRunAsGroup = "www-data"

	DefaultBuildPack = "https://github.com/go-enjin/enjenv-heroku-buildpack.git"

	DefaultSlugStartupTimeout   = 5 * time.Minute
	DefaultOriginRequestTimeout = time.Minute
	DefaultReadyIntervalTimeout = time.Second

	DefaultRateLimitTTL        time.Duration = 8760 * time.Hour
	DefaultRateLimitMax        float64       = 150.0
	DefaultRateLimitBurst      int           = 150
	DefaultRateLimitMaxDelay   time.Duration = 2 * time.Second
	DefaultRateLimitDelayScale int           = 10
)
View Source
var (
	RxLogFileName = regexp.MustCompile(`(?:/|^)([^/]+?)\.?(access|info|error|)\.log$`)

	RxSlugArchiveName = regexp.MustCompile(`(?:/|^)([^/]+?)--([a-f0-9]+)\.zip$`)
	RxSlugRunningName = regexp.MustCompile(`(?:/|^)([^/]+?)--([a-f0-9]+).([a-f0-9]{10})(\.pid|\.port|)$`)

	RxSockCommand         = regexp.MustCompile(`^\s*([a-z][-.a-z0-9]+?)\s*$`)
	RxSockCommandWithArgs = regexp.MustCompile(`^\s*([a-z][-.a-z0-9]+?)\s+(.+?)\s*$`)

	RxTangoTags = regexp.MustCompile(`<.+?>`)
)
View Source
var DefaultConfigLocations = []string{
	"/etc/niseroku/" + ConfigFileName,
	"./" + ConfigFileName,
}
View Source
var (
	DefaultStatusWatchTtyPath = "/dev/tty"
)
View Source
var (
	DefaultStatusWatchUpdateFrequency = time.Second
)
View Source
var RxDebFileName = regexp.MustCompile(`^\s*(.+?)_(.+?)_(.+?)\.u?deb\s*$`)
View Source
var RxDscFileName = regexp.MustCompile(`^\s*(.+?)_(.+?)\.dsc\s*$`)
View Source
var RxExportLine = regexp.MustCompile(`^\s*export (.+?)=(['"]?)(.+?)(['"]?)\s*$`)
View Source
var RxRepreproList = regexp.MustCompile(`^\s*([^|]+)\|([^|]+)\|([^|]+):\s*(\S+)\s*(\S+)\s*$`)

Functions

func ApplyComments

func ApplyComments(content string, comments TomlComments) (modified string, err error)

func CheckAB

func CheckAB[V interface{}](a, b V, check bool) (v V)

func DecomposeUrl

func DecomposeUrl(r *http.Request) (full, scheme, host string, port int)

func LoadApplications

func LoadApplications(config *Config) (foundApps map[string]*Application, err error)

func WriteDefaultConfig

func WriteDefaultConfig(niserokuConfig string) (err error)

Types

type AppOrigin

type AppOrigin struct {
	Scheme string `toml:"scheme,omitempty"`
	Host   string `toml:"host,omitempty"`
}

func (AppOrigin) Dial

func (o AppOrigin) Dial(port int) (conn net.Conn, err error)

func (AppOrigin) Dialer

func (o AppOrigin) Dialer() (dialer *net.Dialer)

func (AppOrigin) NetIP

func (o AppOrigin) NetIP() (ip net.IP)

func (AppOrigin) String

func (o AppOrigin) String() (baseUrl string)

type AppTimeouts

type AppTimeouts struct {
	SlugStartup   *time.Duration `toml:"slug-startup,omitempty"`
	ReadyInterval *time.Duration `toml:"ready-interval,omitempty"`
	OriginRequest *time.Duration `toml:"origin-request,omitempty"`
}

func (AppTimeouts) String

func (t AppTimeouts) String() (s string)

type Application

type Application struct {
	Maintenance bool     `toml:"maintenance,omitempty"`
	Domains     []string `toml:"domains,omitempty"`

	AptPackage *AptPackageConfig `toml:"apt-package,omitempty"`
	AptEnjin   *AptEnjinConfig   `toml:"apt-enjin,omitempty"`

	Workers map[string]int `toml:"workers,omitempty"`

	Timeouts AppTimeouts `toml:"timeouts,omitempty"`

	Settings map[string]interface{} `toml:"settings,omitempty"`

	Origin AppOrigin `toml:"origin"`

	ThisSlug string `toml:"this-slug,omitempty"`
	NextSlug string `toml:"next-slug,omitempty"`

	Name      string           `toml:"-"`
	Slugs     map[string]*Slug `toml:"-"`
	Config    *Config          `toml:"-"`
	Source    string           `toml:"-"`
	GitRepo   *git.Repository  `toml:"-"`
	RepoPath  string           `toml:"-"`
	ErrorLog  string           `toml:"-"`
	AccessLog string           `toml:"-"`
	NoticeLog string           `toml:"-"`

	AptBasePath       string `toml:"-"`
	AptArchivesPath   string `toml:"-"`
	AptRepositoryPath string `toml:"-"`

	DeployFile string `toml:"-"`

	sync.RWMutex
	// contains filtered or unexported fields
}

func NewApplication

func NewApplication(source string, config *Config) (app *Application, err error)

func (*Application) ApplySettings

func (a *Application) ApplySettings(envDir string) (err error)

func (*Application) Cleanup

func (a *Application) Cleanup()

func (*Application) Deploy

func (a *Application) Deploy() (err error)

func (*Application) GetGpgHome

func (a *Application) GetGpgHome() (home string)

func (*Application) GetNextSlug

func (a *Application) GetNextSlug() (slug *Slug)

func (*Application) GetSlugWorkerByPid

func (a *Application) GetSlugWorkerByPid(pid int) (si *SlugWorker)

func (*Application) GetThisSlug

func (a *Application) GetThisSlug() (slug *Slug)

func (*Application) GetWebWorkers

func (a *Application) GetWebWorkers() (count int)

func (*Application) GetWorkers

func (a *Application) GetWorkers(procType string) (count int)

func (*Application) ImportGpgSecrets

func (a *Application) ImportGpgSecrets(other *Application) (info map[string][]string, err error)

func (*Application) Invoke

func (a *Application) Invoke() (err error)

func (*Application) IsDeploying

func (a *Application) IsDeploying() (locked bool)

func (*Application) IsRunningReady added in v0.1.2

func (a *Application) IsRunningReady() (runningReady bool)

func (*Application) Load

func (a *Application) Load() (err error)

func (*Application) LoadAllSlugs

func (a *Application) LoadAllSlugs() (err error)

func (*Application) LogAccessF

func (a *Application) LogAccessF(status int, remoteAddr string, r *http.Request, start time.Time)

func (*Application) LogError

func (a *Application) LogError(err error)

func (*Application) LogErrorF

func (a *Application) LogErrorF(format string, argv ...interface{})

func (*Application) LogInfoF

func (a *Application) LogInfoF(format string, argv ...interface{})

func (*Application) OsEnviron

func (a *Application) OsEnviron() (environment env.Env)

func (*Application) OsEnvironAptEnjinOnly

func (a *Application) OsEnvironAptEnjinOnly() (aptEnv env.Env)

func (*Application) PrepareGpgSecrets

func (a *Application) PrepareGpgSecrets() (err error)

func (*Application) PurgeGpgSecrets

func (a *Application) PurgeGpgSecrets() (err error)

func (*Application) Save

func (a *Application) Save(keepCustomComments bool) (err error)

func (*Application) SendSignal

func (a *Application) SendSignal(sig process.Signal) (err error)

func (*Application) SendStopSignal

func (a *Application) SendStopSignal() (err error)

func (*Application) SetupRepo

func (a *Application) SetupRepo() (err error)

func (*Application) String

func (a *Application) String() string

type AptEnjinConfig

type AptEnjinConfig struct {
	Enable    bool                      `toml:"enable,omitempty"`
	SiteKey   string                    `toml:"site-key,omitempty"`
	SiteName  string                    `toml:"site-name,omitempty"`
	SiteMail  string                    `toml:"site-mail,omitempty"`
	SiteMaint string                    `toml:"site-maint,omitempty"`
	SiteUrl   string                    `toml:"site-url,omitempty"`
	GpgKeys   map[string][]string       `toml:"gpg-keys,omitempty"`
	Flavours  map[string][]Distribution `toml:"flavours,omitempty"`
}

type AptPackageConfig

type AptPackageConfig struct {
	AptEnjin  string `toml:"apt-enjin,omitempty"`
	Flavour   string `toml:"flavour,omitempty"`
	Codename  string `toml:"codename,omitempty"`
	Component string `toml:"component,omitempty"`
}

type Command

type Command struct {
	system.CCommand
	// contains filtered or unexported fields
}

func New

func New() (s *Command)

func (*Command) ExtraCommands

func (c *Command) ExtraCommands(app *cli.App) (commands []*cli.Command)

func (*Command) Init

func (c *Command) Init(this interface{})

func (*Command) Prepare

func (c *Command) Prepare(ctx *cli.Context) (err error)

type Config

type Config struct {
	BindAddr     string `toml:"bind-addr"`
	EnableSSL    bool   `toml:"enable-ssl"`
	AccountEmail string `toml:"account-email"`
	BuildPack    string `toml:"buildpack-path"`
	LogFile      string `toml:"log-file"`

	KeepSlugs bool `toml:"keep-slugs"`

	SlugNice int `toml:"slug-nice"`

	RestartSlugsOnStart bool `toml:"restart-slugs-on-start"`

	IncludeSlugs IncludeSlugsConfig `toml:"include-slugs"`

	Timeouts TimeoutsConfig `toml:"timeouts"`

	ProxyLimit RateLimit `toml:"proxy-limit"`

	Ports PortsConfig `toml:"ports"`
	RunAs RunAsConfig `toml:"run-as"`
	Paths PathsConfig `toml:"paths"`

	Source   string `toml:"-"`
	NeedRoot bool   `toml:"-"`

	Users        []*User                 `toml:"-"`
	Applications map[string]*Application `toml:"-"`
	PortLookup   map[int]*Application    `toml:"-"`
	ReservePorts map[int]*Application    `toml:"-"`
	DomainLookup map[string]*Application `toml:"-"`

	sync.RWMutex
	// contains filtered or unexported fields
}

func LoadConfig

func LoadConfig(niserokuConfig string) (config *Config, err error)

func (*Config) CallProxyControlCommand

func (c *Config) CallProxyControlCommand(name string, argv ...string) (response string, err error)

func (*Config) DialProxyControl

func (c *Config) DialProxyControl() (conn net.Conn, err error)

func (*Config) GetAllRunningPorts

func (c *Config) GetAllRunningPorts() (ports map[int]*Application)

func (*Config) GetTomlValue

func (c *Config) GetTomlValue(key string) (v interface{})

func (*Config) IsGitRepositoryRunning

func (c *Config) IsGitRepositoryRunning() (running bool)

func (*Config) IsReverseProxyRunning

func (c *Config) IsReverseProxyRunning() (running bool)

func (*Config) MergeConfig

func (c *Config) MergeConfig(cfg *Config) (err error)

func (*Config) PrepareDirectories

func (c *Config) PrepareDirectories() (err error)

func (*Config) Reload

func (c *Config) Reload() (err error)

func (*Config) RunAsChown

func (c *Config) RunAsChown(paths ...string) (err error)

func (*Config) RunAsGetUidGid

func (c *Config) RunAsGetUidGid() (uid, gid int, err error)

func (*Config) Save

func (c *Config) Save(keepCustomComments bool) (err error)

func (*Config) SetTomlValue

func (c *Config) SetTomlValue(key string, v string) (err error)

func (*Config) SignalGitRepository

func (c *Config) SignalGitRepository(sig process.Signal) (sent bool)

func (*Config) SignalReloadGitRepository

func (c *Config) SignalReloadGitRepository() (sent bool)

func (*Config) SignalReloadReverseProxy

func (c *Config) SignalReloadReverseProxy() (sent bool)

func (*Config) SignalReverseProxy

func (c *Config) SignalReverseProxy(sig process.Signal) (sent bool)

func (*Config) SignalStopGitRepository

func (c *Config) SignalStopGitRepository() (sent bool)

func (*Config) SignalStopReverseProxy

func (c *Config) SignalStopReverseProxy() (sent bool)

func (*Config) WriteProxyControl

func (c *Config) WriteProxyControl(conn net.Conn, name string, argv ...string) (response string, err error)

type Distribution

type Distribution struct {
	Label         string   `toml:"label,omitempty"`
	Origin        string   `toml:"origin,omitempty"`
	Version       string   `toml:"version,omitempty"`
	Description   string   `toml:"description,omitempty"`
	Codename      string   `toml:"codename,omitempty"`
	Components    []string `toml:"components,omitempty"`
	Architectures []string `toml:"architectures,omitempty"`
	SignWith      string   `toml:"sign-with,omitempty"`
	Contents      string   `toml:"contents,omitempty"`
	Tracking      string   `toml:"tracking,omitempty"`
}

func (Distribution) String

func (d Distribution) String() (conf string)

type Distributions

type Distributions []Distribution

func (Distributions) String

func (d Distributions) String() (conf string)

type GitRepository

type GitRepository struct {
	service.Service
	// contains filtered or unexported fields
}

func NewGitRepository

func NewGitRepository(config *Config) (gr *GitRepository)

func (*GitRepository) Bind

func (gr *GitRepository) Bind() (err error)

func (*GitRepository) Reload

func (gr *GitRepository) Reload() (err error)

func (*GitRepository) Serve

func (gr *GitRepository) Serve() (err error)

func (*GitRepository) Stop

func (gr *GitRepository) Stop() (err error)

type IncludeSlugsConfig

type IncludeSlugsConfig struct {
	OnStart bool `toml:"on-start"`
	OnStop  bool `toml:"on-stop"`
}

type ParsedDebianFile added in v0.1.11

type ParsedDebianFile struct {
	Type    string
	File    string
	Name    string
	Arch    string
	RawVer  string
	Version version.Version
}

func ParseDebianDebFilename

func ParseDebianDebFilename(file string) (parsed *ParsedDebianFile, ok bool)

func ParseDebianDscFilename

func ParseDebianDscFilename(file string) (parsed *ParsedDebianFile, ok bool)

type ParsedProxyLimits

type ParsedProxyLimits struct {
	TotalRequest int64
	TotalDelayed int64

	Delayed ParsedProxyLimitsData
	Request ParsedProxyLimitsData
}

type ParsedProxyLimitsData

type ParsedProxyLimitsData struct {
	Apps  map[string]int64
	Addrs map[string]int64
	Hosts map[string]int64
	Ports map[string]int64
}

func NewProxyLimitsData

func NewProxyLimitsData() ParsedProxyLimitsData

type PathsConfig

type PathsConfig struct {
	Etc string `toml:"etc"`
	Var string `toml:"var"`
	Tmp string `toml:"tmp"`

	EtcApps     string `toml:"-"` // EtcApps contains all app.toml files
	EtcUsers    string `toml:"-"` // EtcUsers contains all the user.toml files
	TmpRun      string `toml:"-"` // TmpRun is used when running enjenv slugs
	TmpClone    string `toml:"-"` // TmpClone is used during deployment for buildpack clones
	TmpBuild    string `toml:"-"` // TmpBuild is used during deployment for app build directories
	VarLogs     string `toml:"-"` // VarLogs is where slug log files are stored
	VarRepos    string `toml:"-"` // VarRepos is where git repos are stored
	VarCache    string `toml:"-"` // VarCache is where build cache directories as stored
	VarSlugs    string `toml:"-"` // VarSlugs is where slug archives are stored
	VarAptRoot  string `toml:"-"` // VarAptRoot is the path to the apt-repository and apt-archives shared directories
	VarSettings string `toml:"-"` // VarSettings is where slug env directories are stored

	AptSecrets string `toml:"-"` // AptSecrets is where gpg signing keys are stored

	RepoSecrets string `toml:"-"` // RepoSecrets is where ssh-keys are stored
	RepoPidFile string `toml:"-"` // RepoPidFile is the path for the git-repository service process ID file

	ProxyPidFile string `toml:"-"` // ProxyPidFile is the path for the reverse-proxy service process ID file
	ProxySecrets string `toml:"-"` // ProxySecrets is where ssl-certs are stored
	ProxyRpcSock string `toml:"-"` // ProxyRpcSock is the path for local unix socket file
}

type PortsConfig

type PortsConfig struct {
	Git      int `toml:"git"`
	Http     int `toml:"http"`
	Https    int `toml:"https"`
	AppStart int `toml:"app-start"`
	AppEnd   int `toml:"app-end"`
}

type RateLimit

type RateLimit struct {
	TTL        time.Duration `toml:"ttl"`
	Max        float64       `toml:"max"`
	Burst      int           `toml:"burst"`
	MaxDelay   time.Duration `toml:"max-delay"`
	DelayScale int           `toml:"delay-scale"`
	LogAllowed bool          `toml:"log-allowed"`
	LogDelayed bool          `toml:"log-delayed"`
	LogLimited bool          `toml:"log-limited"`
}

type RepreproListEntry

type RepreproListEntry struct {
	Codename     string
	Component    string
	Architecture string
	Name         string
	RawVer       string
	Version      version.Version
}

type ReverseProxy

type ReverseProxy struct {
	service.Service
	// contains filtered or unexported fields
}

func NewReverseProxy

func NewReverseProxy(config *Config) (rp *ReverseProxy)

func (*ReverseProxy) Bind

func (rp *ReverseProxy) Bind() (err error)

func (*ReverseProxy) GetAppDomain

func (rp *ReverseProxy) GetAppDomain(r *http.Request) (domain string, app *Application, ok bool)

func (*ReverseProxy) HandleSock

func (rp *ReverseProxy) HandleSock(conn net.Conn)

func (*ReverseProxy) ProxyHttpHandler

func (rp *ReverseProxy) ProxyHttpHandler() (h http.Handler)

func (*ReverseProxy) Reload

func (rp *ReverseProxy) Reload() (err error)

func (*ReverseProxy) Serve

func (rp *ReverseProxy) Serve() (err error)

func (*ReverseProxy) ServeOriginHTTP

func (rp *ReverseProxy) ServeOriginHTTP(app *Application, forwardFor string, w http.ResponseWriter, r *http.Request) (status int, err error)

func (*ReverseProxy) Stop

func (rp *ReverseProxy) Stop() (err error)

type RunAsConfig

type RunAsConfig struct {
	User  string `toml:"user"`
	Group string `toml:"group"`
}

type Slug

type Slug struct {
	App     *Application
	Name    string
	Commit  string
	Archive string

	SettingsFile string

	Settings *SlugSettings
	Workers  map[string]*SlugWorker

	sync.RWMutex
	// contains filtered or unexported fields
}

func NewSlugFromZip

func NewSlugFromZip(app *Application, archive string) (slug *Slug, err error)

func (*Slug) Cleanup

func (s *Slug) Cleanup()

func (*Slug) ConsumeLivePort

func (s *Slug) ConsumeLivePort() (consumedPort int)

func (*Slug) Destroy

func (s *Slug) Destroy() (err error)

func (*Slug) GetInstanceByPid

func (s *Slug) GetInstanceByPid(pid int) (si *SlugWorker)

func (*Slug) GetLivePort

func (s *Slug) GetLivePort() (livePort int)

func (*Slug) GetNumWorkers

func (s *Slug) GetNumWorkers() (num int)

func (*Slug) GetOriginRequestTimeout

func (s *Slug) GetOriginRequestTimeout() (timeout time.Duration)

func (*Slug) GetReadyIntervalTimeout

func (s *Slug) GetReadyIntervalTimeout() (timeout time.Duration)

func (*Slug) GetSlugStartupTimeout

func (s *Slug) GetSlugStartupTimeout() (timeout time.Duration)

func (*Slug) GetSlugWorkerHashes added in v0.1.2

func (s *Slug) GetSlugWorkerHashes() (workers []string)

func (*Slug) HttpClientDo added in v0.1.17

func (s *Slug) HttpClientDo(port int, req *http.Request) (response *http.Response, err error)

func (*Slug) IsReady

func (s *Slug) IsReady(hash string) (ready bool)

func (*Slug) IsRunning

func (s *Slug) IsRunning(hash string) (running bool)

func (*Slug) IsRunningReady

func (s *Slug) IsRunningReady() (running, ready bool)

func (*Slug) RefreshWorkers

func (s *Slug) RefreshWorkers()

func (*Slug) SendSignalToAll

func (s *Slug) SendSignalToAll(sig process.Signal)

func (*Slug) StartCommand added in v0.1.8

func (s *Slug) StartCommand(name string, argv ...string) (err error)

func (*Slug) StartForegroundWorkers

func (s *Slug) StartForegroundWorkers(workersReady chan bool) (err error)

func (*Slug) StartShell added in v0.1.8

func (s *Slug) StartShell() (err error)

func (*Slug) StopAll

func (s *Slug) StopAll() (stopped int)

func (*Slug) StopWorker

func (s *Slug) StopWorker(hash string) (stopped bool)

func (*Slug) String

func (s *Slug) String() string

type SlugSettings

type SlugSettings struct {
	Live []string `toml:"live"`
	Next []string `toml:"next,omitempty"`

	Path         string        `toml:"-"`
	TomlMetaData toml.MetaData `toml:"-"`
	RunAs        RunAsConfig   `toml:"-"`
}

func NewSlugSettings

func NewSlugSettings(path string, config RunAsConfig) (sw *SlugSettings, err error)

func (*SlugSettings) Reload

func (s *SlugSettings) Reload() (err error)

func (*SlugSettings) Save

func (s *SlugSettings) Save() (err error)

type SlugWorker

type SlugWorker struct {
	Slug *Slug  `toml:"-"`
	Hash string `toml:"hash"`
	Name string `toml:"name"`

	Pid  int `toml:"-"`
	Port int `toml:"port"`

	RunPath  string `toml:"run-path"`
	PidFile  string `toml:"pid-file"`
	PortFile string `toml:"port-file"`
	LogFile  string `toml:"log-file"`

	sync.RWMutex
}

func NewSlugWorker

func NewSlugWorker(slug *Slug) (si *SlugWorker, err error)

func NewSlugWorkerWithHash

func NewSlugWorkerWithHash(slug *Slug, hash string) (si *SlugWorker, err error)

func (*SlugWorker) Cleanup

func (s *SlugWorker) Cleanup()

func (*SlugWorker) Destroy

func (s *SlugWorker) Destroy() (err error)

func (*SlugWorker) GetBinProcess

func (s *SlugWorker) GetBinProcess() (proc *process.Process, err error)

func (*SlugWorker) GetPid

func (s *SlugWorker) GetPid() (pid int, err error)

func (*SlugWorker) IsReady

func (s *SlugWorker) IsReady() (ready bool)

func (*SlugWorker) IsRunning

func (s *SlugWorker) IsRunning() (running bool)

func (*SlugWorker) IsRunningReady

func (s *SlugWorker) IsRunningReady() (running, ready bool)

func (*SlugWorker) PrepareStart

func (s *SlugWorker) PrepareStart(port int) (webCmd string, webArgv, environ []string, err error)

func (*SlugWorker) ReadProcfile

func (s *SlugWorker) ReadProcfile() (procTypes map[string]string, err error)

func (*SlugWorker) ReserveUnusedPort

func (s *SlugWorker) ReserveUnusedPort() (port int)

func (*SlugWorker) RunCommand added in v0.1.8

func (s *SlugWorker) RunCommand(name string, argv ...string) (err error)

func (*SlugWorker) SendReloadSignal

func (s *SlugWorker) SendReloadSignal() (sent bool)

func (*SlugWorker) SendSignal

func (s *SlugWorker) SendSignal(sig process.Signal) (sent bool)

func (*SlugWorker) SendStopSignal

func (s *SlugWorker) SendStopSignal() (sent bool)

func (*SlugWorker) Start

func (s *SlugWorker) Start(port int) (err error)

func (*SlugWorker) StartForeground

func (s *SlugWorker) StartForeground(port int) (err error)

func (*SlugWorker) Stop

func (s *SlugWorker) Stop() (stopped bool)

func (*SlugWorker) String

func (s *SlugWorker) String() (text string)

func (*SlugWorker) Unpack

func (s *SlugWorker) Unpack() (err error)

type StatusWatch

type StatusWatch struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewStatusWatch

func NewStatusWatch(cmd *Command, freq time.Duration, ttyPath string) (sw *StatusWatch, err error)

func (*StatusWatch) Run

func (sw *StatusWatch) Run(ctx *cli.Context) (err error)

type TimeoutsConfig

type TimeoutsConfig struct {
	SlugStartup   time.Duration `toml:"slug-startup"`
	ReadyInterval time.Duration `toml:"ready-interval"`
	OriginRequest time.Duration `toml:"origin-request"`
}

type TomlComment

type TomlComment struct {
	Lines     []string
	Inline    string
	Statement string
}

func (*TomlComment) String

func (t *TomlComment) String() (v string)

type TomlComments

type TomlComments []*TomlComment

func MergeApplicationToml

func MergeApplicationToml(current TomlComments, keepCustomComments bool) (modified TomlComments)

func MergeConfigToml

func MergeConfigToml(current TomlComments, keepCustomComments bool) (modified TomlComments)

func ParseComments

func ParseComments(content string) (tomlComments TomlComments, err error)

func (TomlComments) String

func (t TomlComments) String() (v string)

type Tracking

type Tracking struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewTracking

func NewTracking() (t *Tracking)

func (*Tracking) Decrement

func (t *Tracking) Decrement(keys ...string)

func (*Tracking) Get

func (t *Tracking) Get(key string) (value int64)

func (*Tracking) Increment

func (t *Tracking) Increment(keys ...string)

func (*Tracking) String

func (t *Tracking) String() (summary string)

type User

type User struct {
	Name           string   `toml:"name"`
	AuditLog       string   `toml:"audit-log"`
	Applications   []string `toml:"applications"`
	AuthorizedKeys []string `toml:"ssh-keys"`
}

func (*User) HasKey

func (u *User) HasKey(given string) (has bool)

func (*User) Log

func (u *User) Log(format string, argv ...interface{})

func (*User) String

func (u *User) String() (details string)

type Users

type Users []*User

func LoadUsers

func LoadUsers(path string) (users Users, err error)

func (Users) String

func (u Users) String() (details string)

type WatchProc

type WatchProc struct {
	Name    string
	Hash    string
	Pid     int
	Cpu     float32
	Mem     uint64
	Nice    int
	Ports   []int
	Num     int
	Threads int
	Created uint64
}

type WatchSnapshot

type WatchSnapshot struct {
	Stats        cpuinfo.Stats
	Services     []WatchProc
	Applications []WatchProc
}

type Watching

type Watching struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewWatching

func NewWatching(config *Config, refresh time.Duration, fn func()) (w *Watching, err error)

func (*Watching) LogErrorF

func (w *Watching) LogErrorF(format string, argv ...interface{})

func (*Watching) LogInfoF

func (w *Watching) LogInfoF(format string, argv ...interface{})

func (*Watching) Snapshot

func (w *Watching) Snapshot() (s *WatchSnapshot)

func (*Watching) Start

func (w *Watching) Start() (err error)

func (*Watching) Stop

func (w *Watching) Stop()

type WatchingByUsage

type WatchingByUsage []WatchProc

func (WatchingByUsage) Len

func (a WatchingByUsage) Len() int

func (WatchingByUsage) Less

func (a WatchingByUsage) Less(i, j int) bool

func (WatchingByUsage) Swap

func (a WatchingByUsage) Swap(i, j int)

Jump to

Keyboard shortcuts

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