This commit is contained in:
parent
676ddf2136
commit
69e46f577a
4 changed files with 15 additions and 8 deletions
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
// Config keeps info about configuration of this daemon
|
||||
type Config struct {
|
||||
DockerSocket string `envconfig:"DOCKER_SOCKET" default:"unix://var/run/docker.sock"`
|
||||
DockerSocket string `envconfig:"DOCKER_SOCKET" default:"unix:///var/run/docker.sock"`
|
||||
Token string `envconfig:"TOKEN" required:"true"`
|
||||
AppsPath string `envconfig:"APPS_PATH" default:"/srv"` // Where applications are located
|
||||
AppsBindIPHTTP string `envconfig:"APPS_BIND_IP_HTTP" default:"0.0.0.0"` // On what IP apps' HTTP port gonna be bound
|
||||
|
|
|
@ -67,7 +67,8 @@ func (p *Processor) waitForApp() error {
|
|||
}
|
||||
|
||||
statsProcessor := StatsProcessor{
|
||||
DB: p.DB,
|
||||
DB: p.DB,
|
||||
DockerSock: p.DockerSock,
|
||||
}
|
||||
|
||||
for i := 0; i < loops; i++ {
|
||||
|
@ -101,7 +102,8 @@ func (p *Processor) List() (apps.Apps, error) {
|
|||
appList := apps.Apps{}
|
||||
|
||||
statsProcessor := StatsProcessor{
|
||||
DB: p.DB,
|
||||
DB: p.DB,
|
||||
DockerSock: p.DockerSock,
|
||||
}
|
||||
|
||||
err := statsProcessor.GatherStates()
|
||||
|
@ -124,7 +126,8 @@ func (p *Processor) Get() (apps.App, error) {
|
|||
app := apps.App{}
|
||||
|
||||
statsProcessor := StatsProcessor{
|
||||
DB: p.DB,
|
||||
DB: p.DB,
|
||||
DockerSock: p.DockerSock,
|
||||
}
|
||||
|
||||
err := statsProcessor.UpdateState(p.AppName)
|
||||
|
|
|
@ -11,7 +11,8 @@ import (
|
|||
// StatsProcessor covers all methods that are needed
|
||||
// to gather information about application containers.
|
||||
type StatsProcessor struct {
|
||||
DB *gorm.DB
|
||||
DB *gorm.DB
|
||||
DockerSock string
|
||||
}
|
||||
|
||||
// returns instance of getAppProcessor
|
||||
|
@ -33,7 +34,8 @@ func (s *StatsProcessor) UpdateUsage(name string) error {
|
|||
}
|
||||
|
||||
container := docker.Container{
|
||||
App: &app,
|
||||
App: &app,
|
||||
DockerSock: s.DockerSock,
|
||||
}
|
||||
|
||||
state, err := container.GetState()
|
||||
|
@ -63,7 +65,8 @@ func (s *StatsProcessor) UpdateState(name string) error {
|
|||
}
|
||||
|
||||
container := docker.Container{
|
||||
App: &app,
|
||||
App: &app,
|
||||
DockerSock: s.DockerSock,
|
||||
}
|
||||
state, err := container.Status()
|
||||
if err != nil {
|
||||
|
|
3
main.go
3
main.go
|
@ -74,7 +74,8 @@ func main() {
|
|||
// Stats loop
|
||||
go func() {
|
||||
statsProcessor := glue.StatsProcessor{
|
||||
DB: common.GetDBConnection(),
|
||||
DB: common.GetDBConnection(),
|
||||
DockerSock: config.DockerSocket,
|
||||
}
|
||||
|
||||
for {
|
||||
|
|
Loading…
Reference in a new issue