This commit is contained in:
parent
676ddf2136
commit
69e46f577a
@ -8,7 +8,7 @@ import (
|
|||||||
|
|
||||||
// Config keeps info about configuration of this daemon
|
// Config keeps info about configuration of this daemon
|
||||||
type Config struct {
|
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"`
|
Token string `envconfig:"TOKEN" required:"true"`
|
||||||
AppsPath string `envconfig:"APPS_PATH" default:"/srv"` // Where applications are located
|
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
|
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{
|
statsProcessor := StatsProcessor{
|
||||||
DB: p.DB,
|
DB: p.DB,
|
||||||
|
DockerSock: p.DockerSock,
|
||||||
}
|
}
|
||||||
|
|
||||||
for i := 0; i < loops; i++ {
|
for i := 0; i < loops; i++ {
|
||||||
@ -101,7 +102,8 @@ func (p *Processor) List() (apps.Apps, error) {
|
|||||||
appList := apps.Apps{}
|
appList := apps.Apps{}
|
||||||
|
|
||||||
statsProcessor := StatsProcessor{
|
statsProcessor := StatsProcessor{
|
||||||
DB: p.DB,
|
DB: p.DB,
|
||||||
|
DockerSock: p.DockerSock,
|
||||||
}
|
}
|
||||||
|
|
||||||
err := statsProcessor.GatherStates()
|
err := statsProcessor.GatherStates()
|
||||||
@ -124,7 +126,8 @@ func (p *Processor) Get() (apps.App, error) {
|
|||||||
app := apps.App{}
|
app := apps.App{}
|
||||||
|
|
||||||
statsProcessor := StatsProcessor{
|
statsProcessor := StatsProcessor{
|
||||||
DB: p.DB,
|
DB: p.DB,
|
||||||
|
DockerSock: p.DockerSock,
|
||||||
}
|
}
|
||||||
|
|
||||||
err := statsProcessor.UpdateState(p.AppName)
|
err := statsProcessor.UpdateState(p.AppName)
|
||||||
|
@ -11,7 +11,8 @@ import (
|
|||||||
// StatsProcessor covers all methods that are needed
|
// StatsProcessor covers all methods that are needed
|
||||||
// to gather information about application containers.
|
// to gather information about application containers.
|
||||||
type StatsProcessor struct {
|
type StatsProcessor struct {
|
||||||
DB *gorm.DB
|
DB *gorm.DB
|
||||||
|
DockerSock string
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns instance of getAppProcessor
|
// returns instance of getAppProcessor
|
||||||
@ -33,7 +34,8 @@ func (s *StatsProcessor) UpdateUsage(name string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
container := docker.Container{
|
container := docker.Container{
|
||||||
App: &app,
|
App: &app,
|
||||||
|
DockerSock: s.DockerSock,
|
||||||
}
|
}
|
||||||
|
|
||||||
state, err := container.GetState()
|
state, err := container.GetState()
|
||||||
@ -63,7 +65,8 @@ func (s *StatsProcessor) UpdateState(name string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
container := docker.Container{
|
container := docker.Container{
|
||||||
App: &app,
|
App: &app,
|
||||||
|
DockerSock: s.DockerSock,
|
||||||
}
|
}
|
||||||
state, err := container.Status()
|
state, err := container.Status()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user