Skip to content

Commit 897ecb6

Browse files
Update README and env files
1 parent c428049 commit 897ecb6

File tree

5 files changed

+63
-60
lines changed

5 files changed

+63
-60
lines changed

.env

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
POSTGRES_USER=peerprep
2+
POSTGRES_PASSWORD=somepassword
3+
GOOGLE_APPLICATION_CREDENTIALS=/firebase-auth/service-account.json
4+
MONGODB_URL=mongodb://peerprep-mongo:27017/questions
5+
BUCKET_NAME=peerprep-test.appspot.com
6+
USERS_SERVICE_URL=http://peerprep-users-service:6969
7+
POSTGRES_URL=postgres://peerprep:somepassword@peerprep-postgres/peerprep
8+
INITIALIZATION_VECTOR=vector
9+
ENCRYPTION_KEY=key

README.md

Lines changed: 25 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# PeerPrep Group 21
2+
13
# Testing
24

35
We recommend using our production environment for testing. You can find the production environment at [https://peerprep.sivarn.com](https://peerprep.sivarn.com).
@@ -6,71 +8,45 @@ A set of email/password with admin privileges will be uploaded to Canvas through
68

79
# Testing Locally
810

9-
- Install Docker for your operating system. You can find the installation instructions [here](https://docs.docker.com/get-docker/).
10-
- Clone the repository.
11-
- Run `git submodule update --init` to clone the submodules.
12-
- In the frontend folder, add .env file with the following content:
11+
Clone the repository to your local machine: `git clone [email protected]:CS3219-AY2324S1/ay2324s1-course-assessment-g21.git`
12+
Update the submodules: `git submodule update --init`
1313

14-
```
15-
NEXT_PUBLIC_FIREBASE_API_KEY=AIzaSyAMiTV5yv2D-gvCy2TNEFREZIMUJ3SnYD8
16-
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=peerprep-test.firebaseapp.com
17-
NEXT_PUBLIC_FIREBASE_PROJECT_ID=peerprep-test
18-
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=peerprep-test.appspot.com
19-
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=655590321803
20-
NEXT_PUBLIC_FIREBASE_APP_ID=1:655590321803:web:293756d86132bdafddae8e
21-
NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID=G-XXSP3K70CN
22-
NEXT_PUBLIC_PEERPREP_INNKEEPER_SOCKET_URL=localhost
23-
```
14+
## Third-party installations
2415

25-
Note that usually these values are kept secret, but since this is a test environment, we are not concerned about security.
16+
- [Docker](https://docs.docker.com/get-docker/)
2617

27-
- In the root folder, add .env file with the following content:
18+
## Environment Variables
2819

29-
```
30-
POSTGRES_USER=peerprep
31-
POSTGRES_PASSWORD=somepassword
32-
GOOGLE_APPLICATION_CREDENTIALS=/firebase-auth/service-account.json
33-
MONGODB_URL=mongodb://peerprep-mongo:27017/questions
34-
BUCKET_NAME=peerprep-test.appspot.com
35-
USERS_SERVICE_URL=http://peerprep-users-service:6969
36-
POSTGRES_URL=postgres://peerprep:somepassword@peerprep-postgres/peerprep
37-
INITIALIZATION_VECTOR=vector
38-
ENCRYPTION_KEY=key
39-
```
40-
41-
- In the firebase-auth folder, add service-account.json (file name has to be exact match) file with the following content:
20+
Note that usually these values are kept secret, but since all of these keys have been made for test environments, we are not concerned about security. We have committed the following test-env files in assignment submissions for your convenience.
4221

43-
```
44-
{
45-
"type": "service_account",
46-
"project_id": "peerprep-test",
47-
"private_key_id": "3a7f69677fabe63fb16358b58a9bab77a79b6e22",
48-
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEuwIBADANBgkqhkiG9w0BAQEFAASCBKUwggShAgEAAoIBAQDI/7aXOEK+k/iZ\nGfo4K2WKeV2u8QSuE9RfN9oVff5fgTUHdYNK9KXF+JRAfxqf2ZJkh3hdS4ipvSxp\n1HGZQ+l9Qu4XTpQRABv+9zhhI0NQr/xk/zZzR92lVlDP/UeXqkthnhd4dKo+MId1\nl2JAeOWQaCEyDtGi0pIFnwW9k4K8Myo/hjWwE+wV4SdgY2kjBUprYsv9iAllUELn\nsr8hxXmko6YMtnF0H4GI1cD/z8GLwRsD6Y/ZUBRK8oDQFVdKHe2U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2R3cNiAGb+B\nIcErbw5Smzx91Go8IVrTsqac71nJaeGP6NN32D9gKYCJy+GgVbkiEQ9Kb6JZefaz\neV3ZNe4uxZOWz5oq65yiwK0KOL7QCH2sxPR/AoGBAN+QhUp2XEZjLwlx8pSjwRGn\nUJfhU3eeqhGMF+DOf7BaYUYTEvQVA45gGQQJdiN+ncnrtO35/vLZ43jvOKeu+ens\nc+Tq3i1Sga73ifMazmJShml/NQGch8J0SFA88VnmYXsj8y27gmOJuLT9h+DIlK9L\nTk7APwYR9tLFOY1wVT71\n-----END PRIVATE KEY-----\n",
49-
"client_email": "[email protected]",
50-
"client_id": "113117889579042558853",
51-
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
52-
"token_uri": "https://oauth2.googleapis.com/token",
53-
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
54-
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-737ke%40peerprep-test.iam.gserviceaccount.com",
55-
"universe_domain": "googleapis.com"
56-
}
57-
```
22+
- `./.env`
23+
- `./frontend/.env`
24+
- `./firebase-auth/service-account.json`
5825

59-
Note that usually these values are kept secret, but since this is a test environment, we are not concerned about security.
26+
If you face any issues / if you have non-standard installations or config for any service, please modify these files appropriately.
6027

6128
- In the root folder, run `docker compose -f docker-compose.yml up -d`.
6229

6330
- Application should be running at [http://localhost](http://localhost).
6431

65-
# Giving yourself admin privileges
32+
### Giving yourself admin privileges
6633

67-
- Login to the application in your browser using Google/Github.
68-
- Run the following commands in your terminal:
34+
Note that the admin portal is not accessible until you grant yourself admin privileges. You may carry out the steps here to grant yourself admin access.
6935

70-
```
36+
:warning: Note that this step must be done only after all the services are up and you have successfully logged into the frontend using Google or Github.
37+
38+
Run the following commands in the terminal one after another:
39+
40+
```sql
7141
docker exec -it peerprep-postgres bash
7242
psql -U peerprep
7343
UPDATE profiles SET role='admin';
7444
```
7545

7646
This will give every user admin privileges. Note that this is only for testing purposes.
47+
48+
### Before you start testing matching
49+
50+
The questions repository will be empty when you first start the application. You will need to populate it with questions before you can start matching.
51+
52+
To do so, you can grant yourself admin priveleges as described above, and then go to the admin portal at [http://localhost/admin/question](http://localhost/admin/question). You can then add questions to the database.

firebase-auth/service-account.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"type": "service_account",
3+
"project_id": "peerprep-test",
4+
"private_key_id": "3a7f69677fabe63fb16358b58a9bab77a79b6e22",
5+
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEuwIBADANBgkqhkiG9w0BAQEFAASCBKUwggShAgEAAoIBAQDI/7aXOEK+k/iZ\nGfo4K2WKeV2u8QSuE9RfN9oVff5fgTUHdYNK9KXF+JRAfxqf2ZJkh3hdS4ipvSxp\n1HGZQ+l9Qu4XTpQRABv+9zhhI0NQr/xk/zZzR92lVlDP/UeXqkthnhd4dKo+MId1\nl2JAeOWQaCEyDtGi0pIFnwW9k4K8Myo/hjWwE+wV4SdgY2kjBUprYsv9iAllUELn\nsr8hxXmko6YMtnF0H4GI1cD/z8GLwRsD6Y/ZUBRK8oDQFVdKHe2U5DvPqCfZ1bxb\nDfX+Jx/7+pKeWbAqFJB9s6YSJ1imQzQYuYLip2fLE2BSpUXMvlI8CxTuoxAuXHSM\nEMbMbVMnAgMBAAECggEAPuR4oy+Y/t35IxrURyAZGS+ppzRGNRwCTzsAM8plPkgF\nKkzUZK9RcbU62kWLNKpVGryi5npcjFQjoge19fGgjS/UpRlSzlD88ZY0n3xzszsl\n3ApZZM//ZB0ykyoa7TN9e9GGYYwLuwLfV+Wi+i56EmnqvSmS4gJGa5jbKHsQJMfF\nGArs6w/M0AJKDBvT0+KWHUypPYGQao1/1tBWZmXGGfOIeWJ4V+FsWHzISV6bDQ5d\njcPDJwwWD8HVLd8Y8UuJvU2WP4ydpQ6iAVW+3Cy/kEHcaaMUN3IrhisSzd/DURR0\nppVgOJUmrfXTFHHI6OlRlDJ0D7h2GNGD2SSN96JHdQKBgQD57A9o1o5XZRIkEufa\nsY1+dihZpA8L1I3eqhkEH/FDhViO6iQEOIMK8MvSvzIsmKCLc7Wyy5Ai5WAHAAIj\nkKI2/ErKjv7GA5k+B+AhFL+O6acpFwiDIvGIhq4CKFZ/70AMWMXt37nqMSCsiRw4\nNXCXXeSiujNBQvL5a/jc+LbY1QKBgQDN4xJePjOIRYifPVrmQ7Ju75ttTDYCZsiQ\n8P29/nzDF+BRJGuXxGZMnKGZiP3zrm379xP5e1etL940IbQT1GR2MAsIQwEKlC/i\nTV1a8g+NdrQA/Sb4Ru5DI/AMwNr/8OvmtvgSjK0SGgBFkGLRH4F7WyNXNNLOtclJ\nQbUXAor6CwJ/Q1xcyuUJeITFXvO5ijhQ6sTuGzsc0xN3KYyvMW1qmchXFi4Fhx20\nND6ysRrXay24F94YGxjCwKUSPNDDwtI45pkZj377LGPL6ew1fLUa7GoNpAWRRccl\nUqb6P5qftdvGZ42Fy5eBhJ25MMfD02KT9jhYZ4PITM6+rntrmCNxJQKBgEsnr4XN\naNw+nZ+bMvpJDfJm7rKYFkMMJ/yYq9dV9U72AUE9bTUKUVl395lnI2R3cNiAGb+B\nIcErbw5Smzx91Go8IVrTsqac71nJaeGP6NN32D9gKYCJy+GgVbkiEQ9Kb6JZefaz\neV3ZNe4uxZOWz5oq65yiwK0KOL7QCH2sxPR/AoGBAN+QhUp2XEZjLwlx8pSjwRGn\nUJfhU3eeqhGMF+DOf7BaYUYTEvQVA45gGQQJdiN+ncnrtO35/vLZ43jvOKeu+ens\nc+Tq3i1Sga73ifMazmJShml/NQGch8J0SFA88VnmYXsj8y27gmOJuLT9h+DIlK9L\nTk7APwYR9tLFOY1wVT71\n-----END PRIVATE KEY-----\n",
6+
"client_email": "[email protected]",
7+
"client_id": "113117889579042558853",
8+
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
9+
"token_uri": "https://oauth2.googleapis.com/token",
10+
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
11+
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-737ke%40peerprep-test.iam.gserviceaccount.com",
12+
"universe_domain": "googleapis.com"
13+
}

frontend/.env

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
NEXT_PUBLIC_FIREBASE_API_KEY=AIzaSyAMiTV5yv2D-gvCy2TNEFREZIMUJ3SnYD8
2+
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=peerprep-test.firebaseapp.com
3+
NEXT_PUBLIC_FIREBASE_PROJECT_ID=peerprep-test
4+
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=peerprep-test.appspot.com
5+
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=655590321803
6+
NEXT_PUBLIC_FIREBASE_APP_ID=1:655590321803:web:293756d86132bdafddae8e
7+
NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID=G-XXSP3K70CN
8+
NEXT_PUBLIC_PEERPREP_INNKEEPER_SOCKET_URL=localhost

frontend/.env.local.example

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
# TODO: this exposes the firebase api key to the client, which is very dangerous
2-
# We need to expose this on the backend only
3-
NEXT_PUBLIC_FIREBASE_API_KEY=
4-
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=
5-
NEXT_PUBLIC_FIREBASE_PROJECT_ID=
6-
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=
7-
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=
8-
NEXT_PUBLIC_FIREBASE_APP_ID=
9-
NEXT_PUBLIC_GOOGLE_CLIENT_ID=
10-
NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID=
11-
NEXT_PUBLIC_PEERPREP_INNKEEPER_SOCKET_URL=
1+
NEXT_PUBLIC_FIREBASE_API_KEY=AIzaSyAMiTV5yv2D-gvCy2TNEFREZIMUJ3SnYD8
2+
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=peerprep-test.firebaseapp.com
3+
NEXT_PUBLIC_FIREBASE_PROJECT_ID=peerprep-test
4+
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=peerprep-test.appspot.com
5+
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=655590321803
6+
NEXT_PUBLIC_FIREBASE_APP_ID=1:655590321803:web:293756d86132bdafddae8e
7+
NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID=G-XXSP3K70CN
8+
NEXT_PUBLIC_PEERPREP_INNKEEPER_SOCKET_URL=localhost

0 commit comments

Comments
 (0)