Fixed log overloads and docker host proxies for worker and orborus

This commit is contained in:
frikky
2022-03-12 13:18:58 +01:00
parent 345429f89a
commit 80239913d8
2 changed files with 32 additions and 9 deletions
+18 -5
View File
@@ -353,6 +353,12 @@ func deployServiceWorkers(image string) {
Resources: &swarm.ResourceRequirements{
Reservations: &swarm.Resources{},
},
LogDriver: &swarm.Driver{
Name: "json-file",
Options: map[string]string{
"max-size": "10m",
},
},
ContainerSpec: &swarm.ContainerSpec{
Image: image,
Env: []string{
@@ -449,13 +455,16 @@ func deployWorker(image string, identifier string, env []string, executionReques
//CPUShares: 256,
hostConfig := &container.HostConfig{
LogConfig: container.LogConfig{
Type: "json-file",
Config: map[string]string{},
Type: "json-file",
Config: map[string]string{
"max-size": "10m",
},
},
Resources: container.Resources{},
Binds: []string{
"/var/run/docker.sock:/var/run/docker.sock:rw",
},
}
if len(os.Getenv("DOCKER_HOST")) == 0 {
hostConfig.Binds = []string{"/var/run/docker.sock:/var/run/docker.sock:rw"}
}
hostConfig.NetworkMode = container.NetworkMode(fmt.Sprintf("container:%s", containerId))
@@ -1035,6 +1044,10 @@ func main() {
env = append(env, fmt.Sprintf("DOCKER_API_VERSION=%s", dockerApiVersion))
}
if len(os.Getenv("DOCKER_HOST")) > 0 {
env = append(env, fmt.Sprintf("DOCKER_HOST=%s", os.Getenv("DOCKER_HOST")))
}
err = deployWorker(workerImage, containerName, env, execution)
zombiecounter += 1
if err == nil {
+14 -4
View File
@@ -299,8 +299,10 @@ func deployApp(cli *dockerclient.Client, image string, identifier string, env []
//CPUPeriod: 100000,
hostConfig := &container.HostConfig{
LogConfig: container.LogConfig{
Type: "json-file",
Config: map[string]string{},
Type: "json-file",
Config: map[string]string{
"max-size": "10m",
},
},
Resources: container.Resources{},
}
@@ -440,8 +442,10 @@ func DeployContainer(ctx context.Context, cli *dockerclient.Client, config *cont
identifier = fmt.Sprintf("%s-%s-nonetwork", identifier, parsedUuid)
hostConfig = &container.HostConfig{
LogConfig: container.LogConfig{
Type: "json-file",
Config: map[string]string{},
Type: "json-file",
Config: map[string]string{
"max-size": "10m",
},
},
Resources: container.Resources{},
}
@@ -2628,6 +2632,12 @@ func deploySwarmService(dockercli *dockerclient.Client, name, image string, depl
Resources: &swarm.ResourceRequirements{
Reservations: &swarm.Resources{},
},
LogDriver: &swarm.Driver{
Name: "json-file",
Options: map[string]string{
"max-size": "10m",
},
},
ContainerSpec: &swarm.ContainerSpec{
Image: image,
Env: []string{