Skip to content

Commit c366eb0

Browse files
committed
Update readme
1 parent 44c8016 commit c366eb0

File tree

2 files changed

+55
-31
lines changed

2 files changed

+55
-31
lines changed

backend/question-service/README.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,59 @@
11
# Question Service
22

3+
## Setting-up MongoDB
4+
5+
> :notebook: If you are familiar to MongoDB and wish to use a local instance, please feel free to do so. This guide utilizes MongoDB Cloud Services.
6+
7+
1. Set up a MongoDB Shared Cluster by following the steps in this [Guide](../user-service/MongoDBSetup.md).
8+
9+
2. After setting up, go to the Database Deployment Page. You would see a list of the Databases you have set up. Select `Connect` on the cluster you just created earlier.
10+
11+
![alt text](../user-service/GuideAssets/ConnectCluster.png)
12+
13+
3. Select the `Drivers` option, as we have to link to a Node.js App (Question Service).
14+
15+
![alt text](../user-service/GuideAssets/DriverSelection.png)
16+
17+
4. Select `Node.js` in the `Driver` pull-down menu, and copy the connection string.
18+
19+
Notice, you may see `<password>` in this connection string. We will be replacing this with the admin account password that we created earlier on when setting up the Shared Cluster.
20+
21+
![alt text](../user-service/GuideAssets/ConnectionString.png)
22+
23+
5. In the `question-service` directory, create a copy of the `.env.sample` file and name it `.env`.
24+
25+
6. Update the `MONGO_URI` of the `.env` file, and paste the string we copied earlier in step 4.
26+
27+
## Setting-up Firebase
28+
29+
1. Go to https://console.firebase.google.com/u/0/.
30+
31+
2. Create a project and choose a project name. Navigate to `Storage` and click on it to activate it.
32+
33+
3. Select `Start in production mode` and your preferred cloud storage region.
34+
35+
4. After Storage is created, go to `Rules` section and set rule to:
36+
```
37+
rules_version = '2';
38+
service firebase.storage {
39+
match /b/{bucket}/o {
40+
match /{allPaths=**} {
41+
allow read: if true;
42+
allow write: if request.auth != null;
43+
}
44+
}
45+
}
46+
```
47+
This rule ensures that only verified users can upload images while ensuring that URLs of images are public. Remember to click `Publish` to save changes.
48+
49+
5. Go to `Settings`, `Project settings`, `Service accounts` and click `Generate new private key`. This will download a `.json` file, which will contain your credentials.
50+
51+
6. In `.env` of question service, replace:
52+
- `FIREBASE_PROJECT_ID` with `project_id` found in the downloaded json file.
53+
- `FIREBASE_PRIVATE_KEY` with `private_key` found in the downloaded json file.
54+
- `FIREBASE_CLIENT_EMAIL` with `client_email` found in the downloaded json file.
55+
- `FIREBASE_STORAGE_BUCKET` with the folder path of the Storage. It should look something like `gs://<appname>.appspot.com`.
56+
357
458
## Running Question Service
559

backend/user-service/README.md

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
77
1. Set up a MongoDB Shared Cluster by following the steps in this [Guide](MongoDBSetup.md).
88

9-
2. After setting up, go to the Database Deployment Page. You would see a list of the Databases you have set up. Select `Connect` on the cluster you just created earlier on for User Service.
9+
2. After setting up, go to the Database Deployment Page. You would see a list of the Databases you have set up. Select `Connect` on the cluster you just created earlier.
1010

1111
![alt text](GuideAssets/ConnectCluster.png)
1212

@@ -24,36 +24,6 @@
2424

2525
6. Update the `DB_CLOUD_URI` of the `.env` file, and paste the string we copied earlier in step 4.
2626

27-
## Setting-up Firebase
28-
29-
1. Go to https://console.firebase.google.com/u/0/.
30-
31-
2. Create a project and choose a project name. Navigate to `Storage` and click on it to activate it.
32-
33-
3. Select `Start in production mode` and your preferred cloud storage region.
34-
35-
4. After Storage is created, go to `Rules` section and set rule to:
36-
```
37-
rules_version = '2';
38-
service firebase.storage {
39-
match /b/{bucket}/o {
40-
match /{allPaths=**} {
41-
allow read: if true;
42-
allow write: if request.auth != null;
43-
}
44-
}
45-
}
46-
```
47-
This rule ensures that only verified users can upload images while ensuring that URLs of images are public. Remember to click `Publish` to save changes.
48-
49-
5. Go to `Settings`, `Project settings`, `Service accounts` and click `Generate new private key`. This will download a `.json` file, which will contain your credentials.
50-
51-
6. In `.env` of question service, replace:
52-
- `FIREBASE_PROJECT_ID` with `project_id` found in the downloaded json file.
53-
- `FIREBASE_PRIVATE_KEY` with `private_key` found in the downloaded json file.
54-
- `FIREBASE_CLIENT_EMAIL` with `client_email` found in the downloaded json file.
55-
- `FIREBASE_STORAGE_BUCKET` with the folder path of the Storage. It should look something like `gs://<appname>.appspot.com`.
56-
5727
## Running User Service
5828

5929
1. Open Command Line/Terminal and navigate into the `user-service` directory.

0 commit comments

Comments
 (0)