Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultConfig = Config{ Addr: ":8000", AssignmentPath: "assignments", CleanInactiveEvery: time.Hour, CheckExpiredEvery: time.Minute, WebsocketTimeout: time.Hour, InstanceExpire: 4 * time.Hour, AutoPullEvery: time.Hour, AutoPullExpiry: 30 * time.Minute, PruneEvery: time.Hour, }
DefaultConfig is the App's default configuration.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
App is the main application for uAssign.
func NewApp ¶
NewApp creates a new app, with an optional list of options. This function does not open any connections, only setting up the app before Run is called.
type Config ¶
type Config struct { // Addr is the address where the app will run its HTTP/S server. Addr string // LetsEncryptDomain is the domain to obtain LetsEncrypt certs for. LetsEncryptDomain string // CertFile is a path to a certificate file for HTTPS. CertFile string // KeyFile is a path to a key file for HTTPS. KeyFile string // Database is the PostgreSQL database connection string. Database string // MigrateUp enables upward database migration at startup. MigrateUp bool // MigrateReset enables upward database migration via database reset at startup. MigrateReset bool // AssignmentPath is the path assignments are stored in. If relative, // then this will be relative to the current working directory. AssignmentPath string // StaticPath is the path to the static elements served at /static // by the app. StaticPath string // AESKey is a base64-encoded string containing the AES key. AESKey string // CleanInactiveEvery is the period at which the app will clean up // inactive images and containers. CleanInactiveEvery time.Duration // CheckExpiredEvery is the period at which the app will check for // active instances past their expiry time and stop them. CheckExpiredEvery time.Duration // WebsocketTimeout is the maximum duration a websocket can be // inactive before expiring. WebsocketTimeout time.Duration // InstanceExpire is the maximum duration an instance will be kept // on the server until it expires and a new instance must be created. InstanceExpire time.Duration // ForceInactive enables forced instance inactive marking at startup/shutdown. ForceInactive bool // DisableLimits disables Docker container limits. DisableLimits bool // DisableAutoPull disables automatic image pulling (for updates). DisableAutoPull bool // AutoPullEvery is the interval at which the server will attempt // to pull images that have been recently used (to keep them updated). AutoPullEvery time.Duration // AutoPullExpiry defines what the autopuller defines as "recent". AutoPullExpiry time.Duration // PruneEvery is the interval at which the server will prune docker. PruneEvery time.Duration // Debug enables debug routes. Debug bool // PProfToken is the token/password used for HTTP pprof connections. PProfToken string }
Config is a set of human-readable configuration for the app.
type Option ¶
type Option func(*App)
Option is a function that runs on an App to configure it.
func WithDockerClient ¶
func WithDockerClient(cli client.CommonAPIClient) Option
WithDockerClient sets the docker client used in the app.
func WithLogger ¶
WithLogger sets the logger used within the app. If not provided, DefaultLogger is used.
func WithSpewConfig ¶
func WithSpewConfig(c *spew.ConfigState) Option
WithSpewConfig sets the spew config state used for various debugging endpoints in the app. If not provided, DefaultSpew is used.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.