我有一个容器,将根据我的应用程序请求多次部署,容器之间的差异依赖于环境变量,它们指向不同的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_VHOST
更改为HAPROXY_1_VHOST
以及requirePorts
,所以也许我可以让每个容器运行在不同的港口。
我已经尝试首先部署一个指向表A的服务,然后另一个指向表B,反之亦然,行为是相同的:首先部署的服务总是有效,其余部分都没有。