我们一直在探索将 marathon 部署到 docker 集群中。在应用程序架构中,我们有一个应用程序服务器需要访问的 postgresql 数据库。
在开发阶段,我们依靠 fig 来创建 docker 之间的链接,然后使用 docker 强加的环境变量连接到目标(app server to postgresql)
然而,在 Marathon 中我们找不到类似的方法,我们尝试使用依赖项但没有奏效,下面是我们的 Marathon.json 文件
{
"id": "/project",
"groups": [
{
"id": "apps",
"apps": [
{
"id": "app",
"mem": 1024,
"env": {
"APP_HOME": "/var/lib/app",
"GIT_BRANCH": "release/2.0.0",
"SETTING_FILE": "development",
"BROKER_URL": "redis://redis_1:6379/0"
},
"dependencies": ["database", "caching", "messaging"],
"container": {
"type": "DOCKER",
"docker": {
"image": "xxx/aok:app"
}
},
"volumes": [
{
"containerPath": "/var/lib/app",
"hostPath": ".",
"mode": "RW"
}
]
},
{
"id": "celery",
"mem": 1024,
"env": {
"APP_HOME": "/var/lib/app",
"GIT_BRANCH": "release/2.0.0",
"SETTING_FILE": "development",
"BROKER_URL": "redis://redis_1:6379/0"
},
"container": {
"type": "DOCKER",
"docker": {
"image": "xxx/aok:celery"
}
},
"volumes": [
{
"containerPath": "/var/lib/app",
"hostPath": ".",
"mode": "RW"
}
]
},
{
"id": "celeryhb",
"mem": 1024,
"env": {
"APP_HOME": "/var/lib/app",
"GIT_BRANCH": "release/2.0.0",
"SETTING_FILE": "development",
"BROKER_URL": "redis://redis_1:6379/0"
},
"container": {
"type": "DOCKER",
"docker": {
"image": "xxx/aok:celeryhb"
}
},
"volumes": [
{
"containerPath": "/var/lib/app",
"hostPath": ".",
"mode": "RW"
}
]
}
]
},
{
"id": "database",
"apps": [
{
"id": "pg",
"mem": 1024,
"container": {
"type": "DOCKER",
"docker": {
"image": "mughrabi/aok:pg"
},
"volumes": [
{
"containerPath": "/var/lib/postgresql/data",
"hostPath": "/tmp/aok-postgres-data",
"mode": "RW"
}
]
}
}
]
},
{
"id": "caching",
"apps": [
{
"id": "redis",
"mem": 1024,
"container": {
"type": "DOCKER",
"docker": {
"image": "redis"
}
}
}
]
},
{
"id": "messaging",
"apps": [
{
"id": "rabbitmq",
"mem": 1024,
"container": {
"type": "DOCKER",
"docker": {
"image": "rabbitmq"
}
}
}
]
}
]
}
有人可以建议吗?