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
 | ||||
|  |  | |||
|  | @ -68,6 +68,7 @@ func (p *Processor) waitForApp() error { | |||
| 
 | ||||
| 	statsProcessor := StatsProcessor{ | ||||
| 		DB:         p.DB, | ||||
| 		DockerSock: p.DockerSock, | ||||
| 	} | ||||
| 
 | ||||
| 	for i := 0; i < loops; i++ { | ||||
|  | @ -102,6 +103,7 @@ func (p *Processor) List() (apps.Apps, error) { | |||
| 
 | ||||
| 	statsProcessor := StatsProcessor{ | ||||
| 		DB:         p.DB, | ||||
| 		DockerSock: p.DockerSock, | ||||
| 	} | ||||
| 
 | ||||
| 	err := statsProcessor.GatherStates() | ||||
|  | @ -125,6 +127,7 @@ func (p *Processor) Get() (apps.App, error) { | |||
| 
 | ||||
| 	statsProcessor := StatsProcessor{ | ||||
| 		DB:         p.DB, | ||||
| 		DockerSock: p.DockerSock, | ||||
| 	} | ||||
| 
 | ||||
| 	err := statsProcessor.UpdateState(p.AppName) | ||||
|  |  | |||
|  | @ -12,6 +12,7 @@ import ( | |||
| // to gather information about application containers.
 | ||||
| type StatsProcessor struct { | ||||
| 	DB         *gorm.DB | ||||
| 	DockerSock string | ||||
| } | ||||
| 
 | ||||
| // returns instance of getAppProcessor
 | ||||
|  | @ -34,6 +35,7 @@ func (s *StatsProcessor) UpdateUsage(name string) error { | |||
| 
 | ||||
| 	container := docker.Container{ | ||||
| 		App:        &app, | ||||
| 		DockerSock: s.DockerSock, | ||||
| 	} | ||||
| 
 | ||||
| 	state, err := container.GetState() | ||||
|  | @ -64,6 +66,7 @@ func (s *StatsProcessor) UpdateState(name string) error { | |||
| 
 | ||||
| 	container := docker.Container{ | ||||
| 		App:        &app, | ||||
| 		DockerSock: s.DockerSock, | ||||
| 	} | ||||
| 	state, err := container.Status() | ||||
| 	if err != nil { | ||||
|  |  | |||
							
								
								
									
										1
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								main.go
									
									
									
									
									
								
							|  | @ -75,6 +75,7 @@ func main() { | |||
| 	go func() { | ||||
| 		statsProcessor := glue.StatsProcessor{ | ||||
| 			DB:         common.GetDBConnection(), | ||||
| 			DockerSock: config.DockerSocket, | ||||
| 		} | ||||
| 
 | ||||
| 		for { | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue