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

Bug using docker-compose service linking #807

Open
Korving-F opened this issue Jun 21, 2023 · 1 comment
Open

Bug using docker-compose service linking #807

Korving-F opened this issue Jun 21, 2023 · 1 comment

Comments

@Korving-F
Copy link

In the repository's docker-compose.yml file an aliasing trick is used so that the default rita.yaml config works out-of-the-box. This linking seems to generally work as intended with other aliases, except for the use of localhost and therefore the backend connection still breaks with an Failed to connect to database: no reachable servers-error. Not sure how to properly fix it, or what the underlying root cause exactly is though.

I tested this with Docker Compose version v2.17.3, docker version 24.0.2. Rita version v4.8.0.

# docker-compose.yaml
links:
 # give db an alias of "localhost" so that RITA's default config works unchanged
 - db:localhost
# rita.yaml
MongoDB:
  # See https://docs.mongodb.com/manual/reference/connection-string/
  ConnectionString: mongodb://localhost:27017
@sko9370
Copy link

sko9370 commented Mar 21, 2024

I came across the same issue as you and it seems like the best practice would be to have rita reference the db container directly by its name "db," leaving the docker-compose.yaml the same but changing the ConnectionString to mongodb://db:27017. This is reflected in a separate config specifically for docker compose use that was created it seems after your issue. I created a pull request to specify this explicitly in the documentation.

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