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

Improved initial dev experience for mongodb #56

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 21 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,32 @@ This project is the Backend for the SDPR Business Rules Engine (BRE) and [BRM Ap

### Running MongoDB Locally

A local MongoDB instance is required for the project to run properly. You'll have to set this up first and create a database for it. Make note of the URL.
A local MongoDB instance is required for the project to run properly. You'll have to set this up first and create a database for it.

## Setting up MongoDB

To set up MongoDB and populate it with initial data, follow these steps:

1. Ensure you have Docker and Docker Compose installed on your machine.
2. Run the following command to start the MongoDB container:

```sh
docker-compose up -d
```

### Including Rules from the Rules Repository

To get access to rules locally on your machine simply clone the repo at https://github.com/bcgov/brms-rules into your project. This project is set to grab rules from `brms-rules/rules`, which is the default location of rules if that project is cloned into this one.
Copy link
Collaborator

Choose a reason for hiding this comment

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

it might be pedantic, but would we want to include the clone instructions directly here so they could be easily copy/pasted to copy into the correct directory?


```bash
git clone https://github.com/bcgov/brms-rules.git
```

### Setting Environment Variables

Before running your application locally, you'll need some environment variables. You can create a `.env` file to do so. Set the following variables:

- MONGODB_URL: The URL for connecting to the MongoDB instance you created in the previous step. Set it to something like mongodb://localhost/nest.
- MONGODB_URL: The URL for connecting to the MongoDB instance you created in the previous step. Should be mongodb://localhost:27017/brms-db.
- FRONTEND_URI: The URI for the frontend application. Set it to http://localhost:8080.
- GITHUB_RULES_BRANCH: Specifies which branch Klamm is syncing with
- GITHUB_TOKEN: Optional github token to mitigate issues with rate limiting
Expand All @@ -21,10 +40,6 @@ Before running your application locally, you'll need some environment variables.
- KLAMM_API_URL: The base URL of your Klamm API
- KLAMM_API_AUTH_TOKEN: The Klamm API auth token

### Including Rules from the Rules Repository

To get access to rules locally on your machine simply clone the repo at https://github.com/bcgov/brms-rules into your project. This project is set to grab rules from `brms-rules/rules`, which is the default location of rules if that project is cloned into this one.

### Running the Application

Install dependencies:
Expand Down
13 changes: 13 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: '3.8'

services:
mongodb:
image: mongo:latest
container_name: brm-mongodb
ports:
- '27017:27017'
environment:
MONGO_INITDB_DATABASE: brms-db
volumes:
- ./mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro
restart: on-failure
Loading