gpt4 book ai didi

docker - 使用Marathon json创建新的实现

转载 作者:行者123 更新时间:2023-12-02 19:43:46 24 4
gpt4 key购买 nike

我们一直在探索马拉松部署到docker集群中。在应用程序体系结构中,我们有一个Postgresql数据库,应用程序服务器需要访问该数据库。

在开发阶段,我们依靠fig在docker之间创建链接,然后使用docker施加的环境变量连接到目标(应用服务器到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"
}
}
}
]
}
]
}

有人可以请教吗?

最佳答案

考虑使用类似Consul https://www.consul.io/或etcd https://github.com/coreos/etcd的东西

关于docker - 使用Marathon json创建新的实现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26445830/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com