Skip to content

Commit c4539a3

Browse files
authored
Merge pull request #55 from CS3219-AY2425S1/development
Service containerisation
2 parents 258bd32 + 641f6bb commit c4539a3

File tree

96 files changed

+5082
-1604
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+5082
-1604
lines changed

.github/workflows/ci.yml

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,17 @@ on:
44
push:
55
branches:
66
- "*"
7-
pull_request:
8-
branches:
9-
- "*"
107

118
env:
129
NODE_VERSION: 20
10+
FIREBASE_PROJECT_ID: ${{ secrets.FIREBASE_PROJECT_ID }}
11+
FIREBASE_PRIVATE_KEY: ${{ secrets.FIREBASE_PRIVATE_KEY }}
12+
FIREBASE_CLIENT_EMAIL: ${{ secrets.FIREBASE_CLIENT_EMAIL }}
13+
FIREBASE_STORAGE_BUCKET: ${{ secrets.FIREBASE_STORAGE_BUCKET }}
14+
JWT_SECRET: ${{ secrets.JWT_SECRET }}
15+
16+
permissions:
17+
contents: read
1318

1419
jobs:
1520
ci:
@@ -30,6 +35,16 @@ jobs:
3035
- name: Linting
3136
working-directory: ${{ matrix.service }}
3237
run: npm run lint
33-
# - name: Tests
34-
# working-directory: ${{ matrix.service }}
35-
# run: npm test
38+
- name: Set .env variables
39+
working-directory: ${{ matrix.service }}
40+
run: |
41+
touch .env
42+
echo "FIREBASE_PROJECT_ID=${{ env.FIREBASE_PROJECT_ID }}" >> .env
43+
echo "FIREBASE_PRIVATE_KEY=${{ env.FIREBASE_PRIVATE_KEY }}" >> .env
44+
echo "FIREBASE_CLIENT_EMAIL=${{ env.FIREBASE_CLIENT_EMAIL }}" >> .env
45+
echo "FIREBASE_CLIENT_EMAIL=${{ env.FIREBASE_CLIENT_EMAIL }}" >> .env
46+
echo "FIREBASE_STORAGE_BUCKET=${{ env.FIREBASE_STORAGE_BUCKET }}" >> .env
47+
echo "JWT_SECRET=${{ env.JWT_SECRET }}" >> .env
48+
- name: Tests
49+
working-directory: ${{ matrix.service }}
50+
run: npm test

.husky/pre-commit

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
cd ./frontend && npm run lint && npm run test
2+
cd ..
3+
4+
cd ./backend/user-service && npm run lint && npm run test
5+
cd ../..
6+
7+
cd ./backend/question-service && npm run lint && npm run test

README.md

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,31 @@
1-
[![Review Assignment Due Date](https://classroom.github.com/assets/deadline-readme-button-22041afd0340ce965d47ae6ef1cefeee28c7c493a6346c4f15d667ab976d596c.svg)](https://classroom.github.com/a/bzPrOe11)
1+
# CS3219 Project (PeerPrep) - AY2425S1 Group 28
22

3-
# CS3219 Project (PeerPrep) - AY2425S1
3+
## Setting up
44

5-
## Group: G28
5+
We will be using Docker to set up PeerPrep. Install Docker [here](https://docs.docker.com/get-started/get-docker).
66

7-
### Note:
7+
Follow the instructions in [here](./backend/README.md) first before proceeding.
88

9-
- You can choose to develop individual microservices within separate folders within this repository **OR** use individual repositories (all public) for each microservice.
10-
- In the latter scenario, you should enable sub-modules on this GitHub classroom repository to manage the development/deployment **AND** add your mentor to the individual repositories as a collaborator.
11-
- The teaching team should be given access to the repositories as we may require viewing the history of the repository in case of any disputes or disagreements.
9+
1. Build all the services (without using cache).
10+
11+
```
12+
docker-compose build --no-cache
13+
```
14+
15+
2. Run all the services (in detached mode).
16+
17+
```
18+
docker-compose up -d
19+
```
20+
21+
To stop all the services, use the following command:
22+
23+
```
24+
docker-compose down
25+
```
26+
27+
## Useful links
28+
29+
- User Service: http://localhost:3001
30+
- Question Service: http://localhost:3000
31+
- Frontend: http://localhost:5173

backend/.env.sample

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Credentials for MongoDB and Mongo Express.
2+
# Create a copy of this file and name it `.env`. Change the values accordingly.
3+
4+
# MongoDB credentials
5+
MONGO_INITDB_ROOT_USERNAME=root
6+
MONGO_INITDB_ROOT_PASSWORD=example
7+
8+
# Mongo Express credentials
9+
ME_CONFIG_BASICAUTH_USERNAME=admin
10+
ME_CONFIG_BASICAUTH_PASSWORD=password
11+
12+
# Do not change anything below this line
13+
ME_CONFIG_MONGODB_ADMINUSERNAME=${MONGO_INITDB_ROOT_USERNAME}
14+
ME_CONFIG_MONGODB_ADMINPASSWORD=${MONGO_INITDB_ROOT_PASSWORD}
15+
16+
ME_CONFIG_MONGODB_URL=mongodb://${MONGO_INITDB_ROOT_USERNAME}:${MONGO_INITDB_ROOT_PASSWORD}@mongo:27017/
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)