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

Setting MONKEY_MONGO_URL env variable to non-default value results in island exiting with error #4170

Open
cakekoa opened this issue May 8, 2024 · 1 comment
Labels
Bug An error, flaw, misbehavior or failure in the Monkey or Monkey Island.

Comments

@cakekoa
Copy link
Contributor

cakekoa commented May 8, 2024

Describe the bug

The mongo URL is configurable via the MONKEY_MONGO_URL environment variable. However, Flask-Security also has a connection to mongodb, and it uses hard-coded values instead of the connection details from MONKEY_MONGO_URL. Thus, if MONKEY_MONGO_URL differs from the defaults, the server will error out because one of the connections to mongo will fail.

Introduced in 564c15d #2157

To Reproduce

Steps to reproduce the behavior:

  1. Setup and run mongodb on a different port (e.g. 27019)
  2. Set MONKEY_MONGO_URL environment variable with the port (e.g. mongodb://localhost:27019/monkey_island)
  3. Run the island
  4. Observe that the island exits because it failed to connect to mongodb

Expected behavior

I expect both connections to mongodb to use the same connection details.

Machine version (please complete the following information):

  • OS: Windows or Linux
@cakekoa cakekoa added the Bug An error, flaw, misbehavior or failure in the Monkey or Monkey Island. label May 8, 2024
ilija-lazoroski added a commit that referenced this issue May 13, 2024
ilija-lazoroski added a commit that referenced this issue May 13, 2024
mssalvatore pushed a commit that referenced this issue May 13, 2024
@aleex1848
Copy link

aleex1848 commented Oct 29, 2024

I'm also trying to run it using docker compose but facing the same problem. Here's my workaround:

  • copy file /monkey/monkey_island/cc/mongo_consts.py from inside the container to your docker-host (using docker cp)
  • edit the file on your docker-host and replace HOST,PORT with your valid values. ( i only changed DEFAULT_MONGO_DB_HOST from "localhost" to "db" which is the service name of the mongodb container in my compose)
  • mount the file into your container e.g.
volumes:
      - ${DOCKER_DIR}mongo_consts.py:/monkey/monkey_island/cc/mongo_consts.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug An error, flaw, misbehavior or failure in the Monkey or Monkey Island.
Projects
None yet
Development

No branches or pull requests

2 participants