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 docker mongo setup #27

Open
carlan opened this issue Jun 27, 2020 · 3 comments · May be fixed by #28
Open

Fix docker mongo setup #27

carlan opened this issue Jun 27, 2020 · 3 comments · May be fixed by #28

Comments

@carlan
Copy link

carlan commented Jun 27, 2020

On first or second stream you were having issues with docker and mongodb. The impression from the stream was the db service was delaying the start up somehow. The issue is also referenced on the docker-compose.yml as a comment.

I'm creating this issue to start a discussion (if required), have a quick look on the setup and also reference it on future PR.

carlan added a commit to carlan/entropychat.app that referenced this issue Jun 27, 2020
- Updated server docker-compose.yml to add container name and new volume
- Updated main README.md to add a note on MONGO_HOST configuration
- Added mongo-init.sh to initialize mongodb container

Fixes CodingGarden#27 💚
@carlan carlan linked a pull request Jun 27, 2020 that will close this issue
6 tasks
@carlan
Copy link
Author

carlan commented Jun 27, 2020

I found some missing bits and pieces here and there.

The main one was the initialization script, when we config the MONGO_INITDB_ROOT_USERNAME and MONGO_INITDB_ROOT_PASSWORD the user is created on the admin database as we are able to see on the logs. However, when we try to create the database configured on the .env file, nothing happens.

To solve this issue I created a simple script to add the users collection as we need to add "something" on the database to create it.

@carlan
Copy link
Author

carlan commented Jun 27, 2020

I forgot to mention that If the database has already been created remember to remove the server/docker-data/db directory as everything I've said on previous comment happens only once when the database is being created.

brilvio added a commit to brilvio/entropychat.app that referenced this issue Jul 15, 2020
carlan added a commit to carlan/entropychat.app that referenced this issue Jul 18, 2020
- Rolled back previous changes after feedback
- Updated docker-compose.yml
- Updated gitignore
- Added initialization scripts for db and api
- Added placeholder file

Fixes CodingGarden#27 💚
@carlan
Copy link
Author

carlan commented Jul 18, 2020

PR updated with the changes requested.

EDIT: I saw you had a bit of hard time understanding/remembering (no offence intended) what's going on. I should have added a comment explaining what I've done. Sorry about that.
The solution I've applied for this is rudimentar simple, I believe as you wanted/mentioned on previous stream. On db container I'm exporting the mongo logs in a volume, without it the server api wouldn't have a way to check if the database is ready or not based on the string. On server api container, I'm reading the log from the same volume and waiting for the string before continue.

carlan added a commit to carlan/entropychat.app that referenced this issue Jul 18, 2020
- Rolled back previous changes on gitignore
- Updated docker-compose.yml
- Updated db and api initialization scripts
- Deleted placeholder file

Fixes CodingGarden#27 💚
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 a pull request may close this issue.

1 participant