Skip to content

Commit 016db3e

Browse files
committed
Resolve conflicts
2 parents e4603cd + 2ff44fd commit 016db3e

File tree

200 files changed

+16655
-550
lines changed

Some content is hidden

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

200 files changed

+16655
-550
lines changed

.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ DB_PORT=27017
1515
PEERPREP_QUESTION_INITDB_NAME=peerprepQuestionServiceDB # must match question service .env file and init-mongo.js
1616
PEERPREP_USER_INITDB_NAME=peerprepUserServiceDB # must match user service .env file and init-mongo.js
1717
PEERPREP_MATCHING_INITDB_NAME=peerprepMatchingServiceDB # must match user service .env file and init-mongo.js
18+
PEERPREP_COLLABORATION_INITDB_NAME=peerprepCollaborationServiceDB # must match collab service .env file and init-mongo.js

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,9 @@ ehthumbs.db
4444
/user-service/user-service/.env
4545
/backend/user-service/.env
4646
/frontend/.env
47+
/addon/chat/Chatio/obj
48+
/addon/chat/Chatio/Properties/PublishProfiles
49+
/addon/chat/Chatio/Properties/ServiceDependencies/Chatiox - Web Deploy
50+
/addon/chat/Chatio/.vs/Chatio
51+
/addon/chat/Chatio/bin
52+
/backend/collaboration-service/coverage

README.md

Lines changed: 47 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,45 @@
55
This project follows a microservices architecture with the following services:
66
1. **Frontend** - Port `3000`
77
2. **User Service** - Port `3001`
8-
3. **Question Service** - Port `3002`
8+
3. **Question Service** - Port `3002`
99
4. **Matching Service** - Port `3003`
10-
5. **MongoDB** - Port `27017` (Database)
11-
6. **Nginx API Gateway** - Port `80`
12-
7. **Redis** - Port `6379`
10+
5. **Collaboration Service** - Port `3004`
11+
6. **MongoDB** - Port `27017` (Database)
12+
7. **Nginx API Gateway** - Port `80`
13+
8. **Redis** - Port `6379`
14+
9. **Zookeeper** - Port `2181`
15+
10. **Kafka** - Port `9092`, Port `29092`
16+
11. **Chat Service** (Located in addon/chat)
1317

1418
### Setting up the Project
19+
20+
### Running the Project with `start.sh`
21+
22+
A `start.sh` script is provided in the root directory to simplify setup. This script will start all services, check for any `.env.example` files, and create the required `.env` files if they don’t already exist.
23+
24+
To run the project, open a terminal in the `cs3219-ay2425s1-project-g25` directory and execute:
25+
26+
./start.sh
27+
28+
This script can be run on **Linux**, **macOS**, and **Windows** (with Git Bash or WSL). It will initialize all services and ensure the environment files are set up as needed.
29+
30+
Ensure the script has execute permissions. If needed, set them by running:
31+
32+
chmod +x start.sh
33+
34+
35+
This will initialize all services and ensure the environment files are set up as needed. Note that running `start.sh` requires Git Bash, WSL, or a similar terminal environment capable of executing Bash scripts.
36+
37+
### Manual Setup
1538
Copy and paste the .env.example files in each service. Rename them as .env files.
1639
Files to do this in:
1740
1. ./
1841
2. /frontend
1942
3. /backend/user-service
2043
4. /backend/question-service
2144
5. /backend/matching-service
45+
6. /backend/collaboration-service
46+
2247
Then, run `node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"` twice to generate
2348
your 2 JWT token secrets. For the first one, paste it into the JWT_ACCESS_TOKEN_SECRET variable of
2449
the .env files in question-service and user-service. Then, copy the second into the
@@ -27,10 +52,15 @@ JWT_REFRESH_TOKEN_SECRET of the .env file in user-service.
2752
Further note: The DB_CLOUD_URI .env variable in user-service doesn't need to be filled in. A local
2853
database will be created in the mongoDB service.
2954

30-
Consult the readme files in the service if there are further configurations needed.
55+
Consult the readme files in each service if there are further configurations needed.
56+
3157
### Running the Project
3258

33-
To run all services, execute the following command in the root directory:
59+
To run the main services, execute the following command in the root directory:
60+
61+
`docker-compose up --build`
62+
63+
To run the chat service, navigate to the addon/chat directory and run:
3464

3565
`docker-compose up --build`
3666

@@ -39,11 +69,15 @@ Once the containers are up:
3969
- User Service: [http://localhost:3001](http://localhost:3001)
4070
- Question Service: [http://localhost:3002](http://localhost:3002)
4171
- Matching Service: [http://localhost:3003](http://localhost:3003)
72+
- Collaboration Service: [http://localhost:3004](http://localhost:3004)
4273
- MongoDB: [http://localhost:27017](http://localhost:27017)
4374
- Nginx API Gateway: [http://localhost:80](http://localhost:80)
4475
- Redis: [http://localhost:6379](http://localhost:6379)
76+
- Zookeeper: [http://localhost:2181](http://localhost:2181)
77+
- Kafka: [http://localhost:9092](http://localhost:9092)
78+
- Chat Service: Available through the main application
4579

46-
Note that even after docker says that everything is up and running, there is a risk that they aren't when you load the frontend.
80+
Note that even after docker says that everything is up and running, there is a risk that they aren't when you load the frontend. Wait for the frontend logs to show up in the docker logs.
4781
In this event, wait for about a minute before trying again. If that still doesn't work and there are network errors, try
4882
rebuilding the services by running `docker-compose up --build` again.
4983

@@ -58,3 +92,9 @@ rebuilding the services by running `docker-compose up --build` again.
5892
### Nginx API Gateway
5993

6094
- Nginx runs on port `80` and acts as the API gateway for routing requests to the respective services.
95+
96+
### Kubernetes Auto Pod Scaling
97+
98+
All files for Kubernetes deployment and auto scaling of services can be found in the `/kubernetes/` folder.
99+
100+
Refer to the [README](/kubernetes/README.md) in the kubernetes folder for more information.
262 KB
Binary file not shown.
533 KB
Binary file not shown.

addon/chat/Chatio/Chatio.csproj

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net8.0</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<UserSecretsId>ebee6fc2-2cd0-4bfd-8580-ad97b28e9c5c</UserSecretsId>
8+
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.10" />
13+
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.10" />
14+
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.6" />
15+
<PackageReference Include="MongoDB.Driver" Version="3.0.0" />
16+
<PackageReference Include="OpenAI" Version="2.0.0" />
17+
<PackageReference Include="StackExchange.Redis" Version="2.8.16" />
18+
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2" />
19+
</ItemGroup>
20+
21+
</Project>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<ActiveDebugProfile>http</ActiveDebugProfile>
5+
<Controller_SelectedScaffolderID>MvcControllerEmptyScaffolder</Controller_SelectedScaffolderID>
6+
<Controller_SelectedScaffolderCategoryPath>root/Common/MVC/Controller</Controller_SelectedScaffolderCategoryPath>
7+
<NameOfLastUsedPublishProfile>C:\Users\Wwj\source\repos\project_ai\Chatio\Properties\PublishProfiles\Chatiox - Web Deploy.pubxml</NameOfLastUsedPublishProfile>
8+
</PropertyGroup>
9+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
10+
<DebuggerFlavor>ProjectDebugger</DebuggerFlavor>
11+
</PropertyGroup>
12+
</Project>

addon/chat/Chatio/Chatio.sln

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.9.34723.18
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Chatio", "Chatio.csproj", "{03BC4C39-81A2-4440-A442-2B93B0C68BFA}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{03BC4C39-81A2-4440-A442-2B93B0C68BFA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{03BC4C39-81A2-4440-A442-2B93B0C68BFA}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{03BC4C39-81A2-4440-A442-2B93B0C68BFA}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{03BC4C39-81A2-4440-A442-2B93B0C68BFA}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {73C44709-CDEF-4DF9-8E10-62DE730AA6DE}
24+
EndGlobalSection
25+
EndGlobal
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
namespace Chatio.Configurations;
2+
3+
public class MongoDbSettings
4+
{
5+
public string ConnectionString { get; set; } = null!;
6+
public string DatabaseName { get; set; } = null!;
7+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
namespace Chatio.Configurations;
2+
3+
public class OpenAiSettings
4+
{
5+
public required string ApiKey { get; set; }
6+
public required string DefaultChatModel { get; set; }
7+
public required string DefaultEmbeddingModel { get; set; }
8+
public double DefaultTemperature { get; set; }
9+
public double DefaultTopP { get; set; }
10+
public double DefaultFrequencyPenalty { get; set; }
11+
public double DefaultPresencePenalty { get; set; }
12+
public int DefaultMaxTokens { get; set; }
13+
}

0 commit comments

Comments
 (0)