2

我有一个容器,将根据我的应用程序的请求部署多次,容器之间的差异取决于环境变量,它们指向不同的 bd(PostgreSQL)和不同的表(表代表健康检查的路径属性)。当我在我的 DC/OS 1.8 上部署第一个服务时,它就像一个魅力,但是,其余的部署不起作用。

我的app.json样子如下:

{
  "volumes": null,
  "id": "/data-microservices/ms1",
  "cmd": null,
  "args": null,
  "user": null,
  "env": {
    "DATABASE_URL": "postgres://<username>:<password>@<host>:5432/<dbname>",
    "TABLE": "<thetable>"
  },
  "instances": 1,
  "cpus": 0.1,
  "mem": 65,
  "disk": 0,
  "gpus": 0,
  "backoffSeconds": 1,
  "backoffFactor": 1.15,
  "maxLaunchDelaySeconds": 3600,
  "container": {
    "docker": {
      "image": "imtachu/data-microservice",
      "forcePullImage": true,
      "privileged": false,
      "portMappings": [
        {
          "containerPort": 8080,
          "protocol": "tcp"
        }
      ],
      "network": "BRIDGE"
    }
  },
  "healthChecks": [
    {
      "protocol": "HTTP",
      "path": "/api/<thetable>",
      "gracePeriodSeconds": 10,
      "intervalSeconds": 2,
      "timeoutSeconds": 10,
      "maxConsecutiveFailures": 10,
      "ignoreHttp1xx": false
    }
  ],
  "readinessChecks": null,
  "dependencies": null,
  "upgradeStrategy": {
    "minimumHealthCapacity": 1,
    "maximumOverCapacity": 1
  },
  "labels": {
    "HAPROXY_GROUP": "external",
    "HAPROXY_0_VHOST": "dcos2-PublicSlaveL-KWSCFODW1ME5-878889582.us-east-1.elb.amazonaws.com"
  },
  "acceptedResourceRoles": null,
  "residency": null,
  "secrets": null,
  "taskKillGracePeriodSeconds": null,
  "portDefinitions": [
    {
      "protocol": "tcp",
      "labels": {}
    }
  ],
  "requirePorts": false
}

到目前为止,我已经尝试修改hostPort属性并将其更改为HAPROXY_0_VHOSTHAPROXY_1_VHOST所以requirePorts也许我可以让每个容器在不同的端口上运行。

我尝试先部署一个指向表 A 的服务,然后再部署一个指向表 B 的服务,反之亦然,并且行为是相同的:第一个部署的服务始终有效,其余的则无效。

4

0 回答 0