Skip to content

Commit e9e2b33

Browse files
authored
End of 4th sprint - ex4
End of 4th sprint - ex4
2 parents f1c46ef + 4caa3c3 commit e9e2b33

127 files changed

Lines changed: 24904 additions & 525 deletions

File tree

Some content is hidden

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

.dockerignore

Lines changed: 0 additions & 32 deletions
This file was deleted.

.github/workflows/main.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ on:
1111
- main-Ex3
1212
- main-Ex4
1313
- main-Ex5
14-
# TODO: Add more main-ExN branches as we need for assignments
1514

1615
jobs:
1716
# ----- Build & tests the CPP server -----

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
# CLion config
3737
.idea/
3838
# build, cmake folders
39-
server_cpp/build/
39+
**/build/
4040
server_cpp/cmake-build-debug/
4141
cmake-build-debug/
42-
/web_server/node_modules/
42+
**/node_modules/

README.md

Lines changed: 31 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
# Gmail-AdvancedSystemProgramming
22
Daily meeting summaries are uploaded to `Issues` tab
3-
## Dear TA please check main-Ex1 for the final version of Ex1
4-
## Dear TA please check main-Ex2 for the final version of Ex2
5-
## Dear TA please check main-Ex3 for the final version of Ex3
3+
Roee's miluim service documents are uploaded to `Issues` tab if needed, Tzvika was informed about it.
4+
5+
## Dear TA please check main-Ex4 for the final version of Ex4
66

77
---
88

99
## Table of Contents
1010
- [Running server and client](#testing-and-running)
1111
- [Getting started](#getting-started)
1212
- [Testing bloom filter server and python client](#to-test-the-python-client-and-bloom-filter-server)
13-
- [Running the web server](#running-the-servers)
14-
15-
- [Screenshots & routes examples](#screenshots)
16-
- [Ex3](#ex3-screenshots)
13+
- [Running as web application project](#running-the-entire-web-app)
14+
- [env variables](#env-variables)
15+
- [Screenshots](#screenshots)
1716
- [Useful links](#useful-links)
1817
- [CPP server README](https://github.com/YuvalAnteby/Gmail-AdvancedSystemProgramming/tree/main-Exe/server_cpp)
1918
- [Python client README](https://github.com/YuvalAnteby/Gmail-AdvancedSystemProgramming/blob/main-Ex3/python_client/README.md)
@@ -28,32 +27,30 @@ First clone the project
2827
git clone https://github.com/YuvalAnteby/Gmail-AdvancedSystemProgramming.git
2928
cd Gmail-AdvancedSystemProgramming/python_client
3029
```
31-
And build it
32-
```bash
33-
docker-compose build
34-
```
30+
**If you want to change the configuration (ports, names, bloom filter integers etc.) you can do it in dockerfiles
31+
and docker compose.**
3532

3633
### To test the python client and bloom filter server
37-
**Make sure you already cloned the project and built it using docker compose**
34+
This will build and run only the test related containers (CPP server, gtest, python test)
3835
```bash
39-
docker-compose run --build --rm gtest
40-
docker-compose run --build --rm test_client
36+
docker-compose --profile tests up --build
4137
```
4238

43-
#### Running the servers
44-
**Make sure you already cloned the project and built it using docker compose** </br>
45-
In case you want to change any configuration value (port, bloom filter integers etc.) change the relevant dockerfile or docker compose file. </br>
46-
Changing the port and the name of the cpp server also requires changing models/blacklist.js global vars (since we shouldn't include .env files)
47-
48-
- To run the web server and bloom filter server
39+
### Running the entire web app
40+
This will build and run only the web application related containers (React, Node.js, CPP server)
4941
```bash
50-
docker-compose up web_server
42+
docker-compose --profile web_app up --build
5143
```
52-
- To run the python client
44+
45+
### env variables
46+
In Node.js and React root folders you can find .env files with default values to help you check the project.</br>
47+
In a real world application these wouldn't be uploaded, we did it for easier set up for the checkers :)
48+
49+
### Running the python client
50+
**NOTE: The instructions didn't ask to run the python client and express server together using the same command**
5351
```bash
54-
docker-compose run python_client
52+
docker-compose run client --build
5553
```
56-
**NOTE: The Ex3 instructions didn't ask to run the python client and express server together using the same command**
5754

5855
- Remainder, to exit the container gracefully use
5956
```bash
@@ -63,26 +60,25 @@ control+c
6360
---
6461

6562
### Screenshots
66-
#### Ex3 screenshots
6763
<details>
68-
<summary>Click to expand Ex3 screenshots</summary>
64+
<summary>Click to expand Ex4 screenshots</summary>
6965

70-
<img src="screenshots/ex3/curl runexample1.png" height="50%" alt="">
71-
<img src="screenshots/ex3/curl runexample2.png" height="50%" alt="">
72-
<img src="screenshots/ex3/curl runexample3.png" height="50%" alt="">
73-
<img src="screenshots/ex3/curl runexample4.png" height="50%" alt="">
74-
<img src="screenshots/ex3/curl runexample5.png" height="50%" alt="">
66+
<img src="screenshots/ex4/light_login.png" width="50%" alt="light_login">
67+
<img src="screenshots/ex4/dark_inbox.png" width="50%" alt="dark_inbox">
68+
<img src="screenshots/ex4/light_compose.png" width="50%" alt="light_compose">
69+
<img src="screenshots/ex4/dark_reading.png" width="50%" alt="dark_reading">
70+
<img src="screenshots/ex4/dark_signup.png" width="50%" alt="dark_signup">
7571

7672
</details>
7773

78-
For more screenshots [click here](https://github.com/YuvalAnteby/Gmail-AdvancedSystemProgramming/main-Ex3/screenshots/ex3)
74+
For more screenshots [click here](https://github.com/YuvalAnteby/Gmail-AdvancedSystemProgramming/main-Ex4/screenshots/ex4)
7975

8076
---
8177

8278
## Useful links
83-
- [CPP server README](https://github.com/YuvalAnteby/Gmail-AdvancedSystemProgramming/tree/main-Exe/server_cpp)
84-
- [Python client README](https://github.com/YuvalAnteby/Gmail-AdvancedSystemProgramming/blob/main-Ex3/python_client/README.md)
85-
- [JavaScript server README](https://github.com/YuvalAnteby/Gmail-AdvancedSystemProgramming/blob/main-Ex3/web_server/README.md)
79+
- [CPP server README](https://github.com/YuvalAnteby/Gmail-AdvancedSystemProgramming/blob/main-Ex4/server_cpp)
80+
- [JavaScript server README](https://github.com/YuvalAnteby/Gmail-AdvancedSystemProgramming/blob/main-Ex4/web_server/README.md)
81+
- [React frontend README](https://github.com/YuvalAnteby/Gmail-AdvancedSystemProgramming/blob/main-Ex4/frontend/README.md)
8682

8783
---
8884

-810 Bytes
Binary file not shown.
-1.68 KB
Binary file not shown.
Binary file not shown.

docker-compose.yml

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,39 @@
11
services:
2+
# React frontend
3+
web_front:
4+
profiles: ["web_app"]
5+
build:
6+
context: frontend
7+
dockerfile: Dockerfile
8+
container_name: react_frontend
9+
depends_on:
10+
- web_server
11+
env_file:
12+
- ./frontend/.env
13+
ports:
14+
- "${REACT_APP_PORT:-3000}:3000"
15+
networks:
16+
- gmail-net
17+
218
# Web server using JS express
319
web_server:
20+
profiles: ["web_app"]
421
build:
522
context: ./web_server
623
dockerfile: Dockerfile
724
container_name: web_server
8-
ports:
9-
- "3000:3000"
25+
env_file:
26+
- ./web_server/.env
1027
depends_on:
1128
- run_server
29+
ports:
30+
- "${NODE_PORT:-3001}:3001"
1231
networks:
1332
- gmail-net
33+
1434
# Server itself (CPP)
1535
run_server:
36+
profiles: ["web_app", "tests"]
1637
build:
1738
context: ./server_cpp
1839
dockerfile: Dockerfile
@@ -25,19 +46,23 @@ services:
2546
- "12347:12347"
2647
networks:
2748
- gmail-net
49+
2850
# Server gtest
2951
gtest:
52+
profiles: [ "tests" ]
3053
build:
3154
context: ./server_cpp
3255
dockerfile: Dockerfile_test
3356
container_name: gmail_tests
3457
# Prevent the use of terminal input during test runs
3558
stdin_open: false
3659
tty: false
60+
3761
# Client (Python)
3862
python_client:
63+
profiles: [ "client" ]
3964
build:
40-
context: python_client
65+
context: ./python_client
4166
dockerfile: Dockerfile
4267
# container_name: python_client
4368
depends_on:
@@ -51,19 +76,21 @@ services:
5176
command: [ "python", "main.py", "run_server", "12347" ]
5277
networks:
5378
- gmail-net
79+
5480
# Client test runner (Python).
5581
test_client:
82+
profiles: [ "tests" ]
5683
build:
57-
context: .
58-
dockerfile: python_client/Dockerfile.tests
84+
context: ./python_client
85+
dockerfile: Dockerfile.tests
5986
container_name: client_tests
6087
depends_on:
6188
- run_server
62-
command: ["python","python_client/tests/test_client_unittest.py"]
89+
command: ["python","tests/test_client_unittest.py"]
6390

6491

6592
volumes:
66-
app_data: # <-- define the named volume
93+
app_data:
6794

6895
networks:
6996
gmail-net:

frontend/.dockerignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Node modules and build output should be created inside the container
2+
node_modules/
3+
build/
4+
dist/
5+
6+
# Log files
7+
npm-debug.log*
8+
yarn-error.log*
9+
yarn-debug.log*
10+
*.log
11+
12+
# Environment files
13+
.env
14+
15+
# macOS/IDE files
16+
.DS_Store
17+
.vscode/
18+
.idea/
19+
20+
# READMEs
21+
*.md

frontend/.env

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
REACT_APP_API_URL=http://localhost:3001/api
2+
REACT_APP_PORT=3000
3+
REACT_APP_MAILS_PER_PAGE=10
4+
REACT_APP_NAME='Mail ASP'
5+
REACT_APP_DEFAULT_AVATAR=/profile_default.png

0 commit comments

Comments
 (0)