Skip to content

Commit 81bc9ce

Browse files
committed
Update README.md, verify correct deployment
1 parent 90ab8bc commit 81bc9ce

File tree

4 files changed

+89
-24
lines changed

4 files changed

+89
-24
lines changed

Project/README.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Pattern recognition WEB and API
2+
3+
This is a full-stack project for the subject of pattern recognition. The project is split into 3 parts:
4+
- **backend** - API and DB for feature set creation/deletion and execution of exploratory data analysis using PCA and hierarchical clustering
5+
- **frontend** - Interface for hosting a SPA and a wrapper for various web requests done from the frontend
6+
- **nginx** - Reverse proxy and load balancer for the backend and frontend and serving static files (CSS/JS)
7+
8+
For each part, there is a separate README file with more detailed information in the respective folder.
9+
10+
11+
## Running the code
12+
13+
You can run the project by running the following command in the root of the project:
14+
```
15+
docker compose build
16+
docker compose up -d
17+
```
18+
To stop the project, run the following command in the root of the project:
19+
```
20+
docker compose down
21+
```
22+
23+
The dashboard can be accessed on the following URL: [http://localhost:5000/recognition-web/v1/dashboard](http://localhost:5000/recognition-web/v1/dashboard)
24+
25+
26+
## Basic project architecture
27+
28+
The project uses a microservices architecture with docker compose to run the services. It creates **4 containers** that are interconnected with **2 networks**. The containers are:
29+
- **db** - Postgres database for storing the feature sets (Network: __db-api__)
30+
- **recognition-api** - API for creating/deleting feature sets and running exploratory data analysis (Network: __db-api__, __api-nginx__)
31+
- **recognition-web** - SPA for the dashboard and a wrapper for the API requests (Network: __web-nginx__)
32+
- **recognition-nginx** - Reverse proxy and load balancer for the backend and frontend and serving static files (CSS/JS) (Network: __web-nginx__, __api-nginx__)
33+
34+
## Dependencies used
35+
36+
Bellow is a list of dependencies used in the project by each part of the project:
37+
- **Backend** (API and DB)
38+
- API (Docker image: python:3.11-alpine)
39+
- __Python__ (Version: >=3.9, <3.12)
40+
- __asyncio__ (Version: ^3.4.3)
41+
- __aiohttp__ (Version: ^3.8.1)
42+
- __asyncpg__ (Version: ^0.26.0)
43+
- __aiohttp-sqlalchemy__ (Version: ^0.34.0)
44+
- __SQLAlchemy__ (Version: ^1.4.39)
45+
- __numpy__ (Version: ^1.17.3)
46+
- __scikit-learn__ (Version: ^1.2.0)
47+
- __pytest__ (Version: ^6.2.5)
48+
- __pytest-asyncio__ (Version: ^0.16.0)
49+
- __testcontainers__ (Version: ^3.0.0)
50+
- DB (Docker image: postgres:15.1)
51+
- __Postgres__ (Version: 15.1)
52+
53+
- **Frontend** (Docker image: python:3.11-alpine)
54+
- __Python__ (Version: >=3.9, <3.12)
55+
- __asyncio__ (Version: ^3.4.3)
56+
- __aiohttp__ (Version: ^3.8.1)
57+
58+
- **Nginx**
59+
- __Nginx__ (Version: 1.23)
60+
61+
## References
62+
63+
[1] Markelle Kelly, Rachel Longjohn, Kolby Nottingham, The UCI Machine Learning Repository, https://archive.ics.uci.edu

Project/backend/api/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,6 @@ USER apprunner
6868
RUN ./.venv/bin/pip install *.whl
6969
#This will initialize the python's virtual env (so we don't need to call source .venv/bin/activate)
7070
ENV PATH="/app/.venv/bin:${PATH}"
71-
ENV VIRTUAL_ENV="/app/.venv"
71+
ENV VIRTUAL_ENV="/app/.venv"
72+
# Invoke the application
73+
CMD ["python", "/app/.venv/lib/python3.11/site-packages/recognition_api/main.py"]

Project/docker-compose.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ services:
3939
- POSTGRES_USER=${APP_DB_USERNAME}
4040
- POSTGRES_DB=${APP_DB_DBNAME}
4141
# Comment out ports here if you do not want outside DB access
42-
ports:
43-
- ${APP_DB_OUT_PORT}:5432
42+
#ports:
43+
# - ${APP_DB_OUT_PORT}:5432
4444
volumes:
4545
- ./backend/postgres-docker/data:/var/lib/postgresql/data/
4646
healthcheck:
@@ -63,7 +63,7 @@ services:
6363
api:
6464
condition: service_healthy
6565
networks:
66-
- frontend-nginx
66+
- web-nginx
6767
environment:
6868
- API_WEB_CONNECTION_STRING=http://nginx:8000/recognition-api/v1
6969
- APP_CONFIG
@@ -77,13 +77,13 @@ services:
7777
retries: 5
7878

7979
nginx:
80-
image: "recognition-api:nginx"
80+
image: "recognition-nginx:v1"
8181
restart: unless-stopped
8282
build:
8383
context: ./nginx
8484
networks:
8585
- api-nginx
86-
- frontend-nginx
86+
- web-nginx
8787
ports:
8888
- ${NGINX_OUT_PORT}:8000
8989
depends_on:
@@ -104,4 +104,4 @@ services:
104104
networks:
105105
db-api:
106106
api-nginx:
107-
frontend-nginx:
107+
web-nginx:

README.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,20 @@ python3 exercise2.py
4949

5050
## Project
5151

52-
The final project is a pattern recognition API. It uses aiohttp server in combination with Postgres DB and NGINX reverse proxy. Deployment is done via docker compose.
53-
54-
Curently implemented features are as follows:
55-
- Basic API and DB for feature upload and chunked upload webpage
56-
- All possible web requests are available in "test_requests.txt" file in Backend folder
57-
- Uploaded dataset should be in the following format:
58-
59-
```
60-
numeric, numeric, numeric, ... , numeric, label
61-
```
62-
63-
Still work in progress.
64-
65-
66-
### References
67-
68-
[1] Markelle Kelly, Rachel Longjohn, Kolby Nottingham, The UCI Machine Learning Repository, https://archive.ics.uci.edu
52+
The final project is a pattern recognition API for exploratory data analysis. More information can be found in the respective README file in the Project folder.
53+
54+
The project is still in development and is not yet finished...
55+
56+
Curent roadmap:
57+
- [x] Create a basic API for feature set creation/deletion
58+
- [x] Create a basic API for exploratory data analysis using PCA and hierarchical clustering
59+
- [x] Create a basic nginx reverse proxy for the frontend and backend
60+
- [x] Create a basic wrapper for various web requests done from the frontend
61+
- [x] Deploy the project using docker compose
62+
- [ ] Create a basic frontend for the API
63+
- [ ] Add more features to the API
64+
- [ ] Add more features to the frontend
65+
- [ ] Deploy the project using Kubernetes
66+
- [ ] Add a DB k8s deployment
67+
- [ ] Add a API k8s deployment
68+
- [ ] Add a frontend k8s deployment

0 commit comments

Comments
 (0)