我有一个容器,它会根据我的应用程序的请求部署多次,容器之间的差异取决于环境变量,它们指向不同的bd(postgresql)和不同的表(该表表示健康检查的path属性)。当我在我的dc/os1.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_VHOST
至 HAPROXY_1_VHOST
还有 requirePorts
所以也许我可以让每个集装箱在不同的港口运行。
我尝试过先部署一个指向表a的服务,然后再部署另一个指向表b和viceversa的服务,其行为是相同的:首先部署的服务总是工作的,其余的不工作。
暂无答案!
目前还没有任何答案,快来回答吧!