Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

本地已有mongo Container占用27017,只修改AUTOTEST_PLATFORM_MONGO_PORT 无法部署成功 #2

Closed
apert4160 opened this issue Aug 27, 2019 · 4 comments

Comments

@apert4160
Copy link

我在本地已经有一个mongo Container跑在27017端口上

部署Taisite-Platrome 时:

  • 修改/etc/profile->AUTOTEST_PLATFORM_MONGO_PORT=27016
  • 启动docker参数-p 27016:27016
  • 部署sh deploy 27016

在执行到createAdminUser.py时报错

数据库连接拒绝

其他地方有需要修改mongo的端口的吗?

@amazingTest
Copy link
Owner

amazingTest commented Aug 27, 2019

第一个 issue 来了~

我来描述一下根据你的问题我的一些观点与想法~

  1. docker容器化部署中数据库连接是可以(建议)通过 docker内网IP 连接的,所以与 是否已经有一个mongo Container跑在27017端口上 无关,因为每一个 container 有不同的内网 IP。

  2. 可以测试一下环境变量是否设置正确,通过 python ./backend/config.py 命令*。

  3. 然后通过 docker inspect 命令查询你想连接的数据库容器的 docker内网 IP 地址

  4. 检查 数据库IP 地址是否与 环境变量设置的一致

  5. 不需要修改/etc/profile->AUTOTEST_PLATFORM_MONGO_PORT=27016 , 如果你连接的是 docker 容器内部的数据库。

  6. 启动docker参数-p 27016:27016 如果是指启动数据库的话,这样是没有任何意义的,因为你将容器内的 27016 端口(暂时没有意义的端口),映射到了宿主机的 27016 上(也没什么意义)

  7. sh deploy 27016 只是表示最后访问项目的地址为 XXX.xxx.xxx: 27016 ,与数据库无关

综上所述,可以用以下步骤进行尝试:

  1. 修改/etc/profile->AUTOTEST_PLATFORM_MONGO_PORT=27017

  2. 通过 docker 内网 IP 设置数据库相关的环境变量

  3. 再次运行 sh deploy ${PORT}

期待你的回复~

@apert4160
Copy link
Author

感谢回复,晚些时候试过来反馈

@apert4160
Copy link
Author

原来我们可能误会了,我原意是想另外启动一个mongo container,单独运行Taisite项目。

把环境变量配置到已经在运行的Mongo上,可以成功部署项目了。

建议把README的部署部分回滚回去,搬到另一个地方不是很友好,太功利了。(虽然不太适合在这说)

@amazingTest
Copy link
Owner

成功部署了就好~

没关系,这里没有什么不适合说的,我尊重你的建议,但我也有我自己的考虑哈

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants