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

[FIX] Add retries to docker-compose.yml, to wait for MongoDB to be ready #13199

Merged
merged 3 commits into from
Mar 4, 2019
Merged

[FIX] Add retries to docker-compose.yml, to wait for MongoDB to be ready #13199

merged 3 commits into from
Mar 4, 2019

Conversation

tiangolo
Copy link
Contributor

@tiangolo tiangolo commented Jan 20, 2019

The current docker-compose.yml file requires manual steps to deploy a Rocket Chat stack, it cannot be done in a single deterministic command or integration with CI systems.

The current instructions require to wait for MongoDB to be ready, and then starting the mongodb-init-replica service manually, and then the rocketchat service manually too.

That means that, if starting from scratch, with a fresh MongoDB container, at the firsts docker-compose up -d, those two services will fail to start and stay down.

The proposed change makes those two services wait for MongoDB to be ready, by retrying 30 times, waiting 5 seconds before each retry. That way, when the service mongo is ready, mongo-init-replica will run, initialize the replica set and exit normally (with exit code 0). And then rocketchat will be able to start with the initialized MongoDB.


This would make the instructions for Docker Compose here: https://rocket.chat/docs/installation/docker-containers/docker-compose/

Be almost only docker-compose up -d.

And after a bit, everything will be ready.

The docs PR is here: https://github.com/RocketChat/docs/pull/1050

@CLAassistant
Copy link

CLAassistant commented Jan 20, 2019

CLA assistant check
All committers have signed the CLA.

@tiangolo
Copy link
Contributor Author

I'm not sure what to do about the test errors as I didn't modify anything related to them.

@geekgonecrazy
Copy link
Contributor

Thanks for the contribution! That's a nice 1 line check. Can you sign the CLA?

@tiangolo
Copy link
Contributor Author

I did sign it! With the interactive CLAassistant

geekgonecrazy
geekgonecrazy previously approved these changes Jan 24, 2019
@tiangolo
Copy link
Contributor Author

The companion docs PR is here: https://github.com/RocketChat/docs/pull/1050

@tiangolo
Copy link
Contributor Author

tiangolo commented Feb 1, 2019

I'm not sure about the process, I have signed the CLA about 3 times, and then the CLA Bot comments saying that I signed it.

And a couple days later it edits the comment and I appear again as if I hadn't signed it. Am I doing something wrong?

@geekgonecrazy
Copy link
Contributor

Looks like all is good from CLA standpoint. 👍

@geekgonecrazy geekgonecrazy added this to the 0.75.0 milestone Feb 2, 2019
@tiangolo
Copy link
Contributor Author

tiangolo commented Feb 2, 2019

Cool! Thanks

@tiangolo
Copy link
Contributor Author

tiangolo commented Mar 3, 2019

I see that the Circle CI build is always "Pending — Your job is on hold on CircleCI!", is there anything that I have to do on my side to "un-pause" it?

@rodrigok
Copy link
Member

rodrigok commented Mar 4, 2019

@tiangolo that's expected, it's a job we added to be able to trigger the docker image build manually when we need to test the PR, you can see it's not marked as required here.

@rodrigok rodrigok merged commit e7227de into RocketChat:develop Mar 4, 2019
@tiangolo
Copy link
Contributor Author

tiangolo commented Mar 4, 2019

Get it. Thanks!

@Sing-Li
Copy link
Member

Sing-Li commented Mar 4, 2019

@tiangolo have you tested this with any particular version of mongo? On some mongo version, issuing the rs.initiate() EARLY will make the DB totally irresponsive to all subsequent requests 😞

@tiangolo
Copy link
Contributor Author

tiangolo commented Mar 4, 2019

I'm using it on a CI/CD environment/application with mongo:3.2, which is what was used when I created the PR. But I haven't updated it to Mongo 4.0.

@rodrigok rodrigok mentioned this pull request Apr 28, 2019
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

Successfully merging this pull request may close these issues.

5 participants