Skip to content

Use mongo#51

Merged
smalho01 merged 6 commits intodevfrom
use-mongo
Feb 9, 2023
Merged

Use mongo#51
smalho01 merged 6 commits intodevfrom
use-mongo

Conversation

@KeeyanGhoreshi
Copy link
Copy Markdown
Contributor

Describe your changes

The server will now default to using mongo. If you launch using docker you will have to change the mongo hostname in the config to use the url of the deployed database. You can also test with a local database by starting mongo on your machine and changing the hostname to match the url of the database (likely localhost: 27017).

To launch the database with docker, use:

docker run --name rems_local_pims_remsadmin_mongo --expose 27017 -p 27017:27017 -e MONGO_INITDB_ROOT_USERNAME='username' -e MONGO_INITDB_ROOT_PASSWORD='password' -v rems_local_pims_remsadmin_mongo:/data/db -v "$(pwd)"/mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js mongo

Then put your chosen username and password in the env file like so:

{
  "MONGO_HOSTNAME": {
    "type": "string",
    "default":"username:password@localhost:27017",
    "required": true
  }

note that if you have already launched through docker, a user will already be created and you will either have to delete the database to create a new one with a new user, or just use the user that was originally made.

After setting up the database, you can use the app and it should update the database with the data on launch. You can use a tool like mongo Compass to see the data being populated.

Issue ticket number and Jira link

REMS-304

Checklist before requesting a review

  • I have performed a self-review of my code
  • Ensure the target / base branch for any feature PR is set to dev not main (the only exception to this is releases from dev and hotfix branches)

Checklist for conducting a review

  • Review the code changes and make sure they all make sense and are necessary.
  • Pull the PR branch locally and test by running through workflow and making sure everything works as it is supposed to.

Workflow

Owner of the Pull Request will be responsible for merge after all requirements are met, including approval from at least one reviewer. Additional changes made after a review will dismiss any approvals and require re-review of the additional updates. Auto merging can be enabled below if additional changes are likely not to be needed. The bot will auto assign reviewers to your Pull Request for you.

@smalho01
Copy link
Copy Markdown
Collaborator

smalho01 commented Feb 7, 2023

wait to merge until rems-303 is merged

@KeeyanGhoreshi
Copy link
Copy Markdown
Contributor Author

this PR builds off 303, so it can either be merged into that PR or the base branch can change to dev after 303 is pulled in

Base automatically changed from rems-303-reinstantiate-mongo to dev February 9, 2023 21:03
@smalho01 smalho01 merged commit 46ca1a2 into dev Feb 9, 2023
@smalho01 smalho01 deleted the use-mongo branch February 9, 2023 21:09
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