Skip to content

Dockerized version #3

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

Merged
merged 5 commits into from
Jan 8, 2024
Merged

Dockerized version #3

merged 5 commits into from
Jan 8, 2024

Conversation

halitbatur
Copy link
Contributor

Changes

  1. Created an image that has mongodb installed
  2. Updated setup instructions

@halitbatur halitbatur self-assigned this Dec 17, 2023
@wisammechano
Copy link

Suggestion: Consider scripts to package.json that cleans up the container and volumes and provides student the ability to start clean. For example yarn run reset

README.md Outdated
4. **Import Data into MongoDB**: Import the restaurant data into the MongoDB database by executing:

```
docker exec -i your_container_name mongoimport --db practice --collection restaurants --drop --file /home/mongodb/restaurants.json --authenticationDatabase admin --username root --password example
Copy link

@wisammechano wisammechano Dec 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: Since this isn't a docker practice assignment, I suggest leveraging the power of npm by adding a package.json file with scripts that can automate these commands.

A command to clean the database volume, a command to copy the resources, and a quick command to login to mongosh.

Students can then use npm run COMMAND to make things easier for them. They are also used to using npm and yarn more than docker

* add scripts to package.json

* add resest to readme.md

* fix indintation in script.js
@halitbatur
Copy link
Contributor Author

@wisammechano PTAL

version: "3"
services:
mongodb:
image: mongo:5.0

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest hard coding the container name here and then reference it in package.json instead of relying on the auto generated container name

   container_name: recoded-mongodb-queries-practice-assignment

"start": "docker-compose up -d",
"stop": "docker-compose down",
"verify": "docker ps",
"copy-data": "docker cp ./restaurants.json curriculum-backend-mongodb-queries-practice-mongodb-1:/home/mongodb",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replace auto generated container name with the hard coded container name.

PS: Apply to other commands too

Copy link

@wisammechano wisammechano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@halitbatur halitbatur merged commit 10992cb into main Jan 8, 2024
@wisammechano wisammechano deleted the dockerized-version branch January 8, 2024 12:08
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.

3 participants