Skip to content

Commit 4258438

Browse files
committed
Update dicumentation and setup
1 parent 9fcfed7 commit 4258438

6 files changed

Lines changed: 109 additions & 67 deletions

File tree

‎.semgrepignore‎

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

‎README.md‎

Lines changed: 97 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,25 @@ First you can git clone this project to your desired location:
2929
```sh
3030
git clone https://github.com/narfasec/isctespot.git
3131
```
32+
33+
### Quick Start with Health Check Script
34+
35+
The easiest way to get started is using our automated health check and setup script:
36+
37+
```bash
38+
cd isctespot/
39+
python install.py
40+
```
41+
42+
This script will:
43+
- ✅ Check system requirements (Python 3.9, Node.js 18+, npm, MariaDB)
44+
- ✅ Verify virtual environment and dependencies
45+
- ✅ Test MariaDB connection on localhost:3306
46+
- ✅ Offer to install missing packages
47+
- ✅ Provide database setup options (clean, create, populate)
48+
- ✅ Start all services in development mode
49+
- ✅ Run health checks on all services
50+
3251
### Docker (Quick start)
3352

3453
[Install Docker](https://docs.docker.com/engine/install/), if not installed in your system.
@@ -47,42 +66,87 @@ First you can git clone this project to your desired location:
4766
docker exec project-server-1 python /app/tests/health_checks/test_flow_1.py
4867
```
4968

50-
## Local Setup (Optional)
69+
## Local Setup (Manual Installation)
5170

5271
_Below are the steps to setup the project on your local environment. This is also the developer setup, with this setup you can easily make changes and debug issues._
5372

54-
### Requirements
55-
* python 3.9 https://www.python.org/downloads/
56-
* node 18 https://nodejs.org/dist/v18.16.0/node-v18.16.0-x64.msi (Windows) | `brew install node 18.16` (Mac OS)
57-
* mariadb community https://mariadb.com/downloads/
58-
### Installation
59-
* Change directory to iscte_spot and start by installing the frontend
60-
```
61-
cd iscte_spot/frontend/admin-one-vue-tailwind-master
62-
npm install
63-
```
64-
* Change directory to server and install the python requirements
65-
```
66-
cd iscte_spot/server
67-
python install -r requirements.txt
68-
```
69-
### Run application
70-
* open one terminal to execute the frontend
71-
```
72-
cd iscte_spot/frontend/admin-one-vue-tailwind-master
73-
npm run dev
74-
```
75-
* open another terminal to execute the server
76-
```
77-
cd iscte_spot/server
78-
python appserver.py
79-
```
80-
* execute setup script according to your system (**setup.ps1** for windows, **setup.sh** for Mac and Linux)
81-
* execute health checks to check if everything is in order
82-
```
83-
cd iscte_spot/server
84-
python .\tests\health_checks\test_flow_1.py
85-
```
73+
### Prerequisites
74+
* **Python 3.9+** - [Download from python.org](https://www.python.org/downloads/)
75+
* **Node.js 18+** - [Download from nodejs.org](https://nodejs.org/)
76+
* **MariaDB** - [Download from mariadb.com](https://mariadb.com/downloads/)
77+
* **npm** - Usually comes with Node.js
78+
79+
### Installation Steps
80+
81+
1. **Clone the repository**
82+
```bash
83+
git clone https://github.com/narfasec/isctespot.git
84+
cd isctespot/
85+
```
86+
87+
2. **Set up MariaDB**
88+
- Install MariaDB on your system
89+
- Start MariaDB service
90+
- Create database: `CREATE DATABASE iscte_spot;`
91+
- Set up user: `CREATE USER 'root'@'localhost' IDENTIFIED BY 'teste123';`
92+
- Grant privileges: `GRANT ALL PRIVILEGES ON iscte_spot.* TO 'root'@'localhost';`
93+
94+
3. **Set up Python environment**
95+
```bash
96+
cd server/
97+
python -m venv venv
98+
99+
# Windows
100+
venv\Scripts\activate
101+
# Linux/macOS
102+
source venv/bin/activate
103+
104+
pip install -r requirements.txt
105+
```
106+
107+
4. **Set up Frontend**
108+
```bash
109+
cd frontend/admin-one-vue-tailwind-master/
110+
npm install
111+
```
112+
113+
### Run Application
114+
115+
1. **Start MariaDB** (if not already running)
116+
117+
2. **Start Backend** (Terminal 1)
118+
```bash
119+
cd server/
120+
source venv/bin/activate # or venv\Scripts\activate on Windows
121+
python appserver.py
122+
```
123+
124+
3. **Start Frontend** (Terminal 2)
125+
```bash
126+
cd frontend/admin-one-vue-tailwind-master/
127+
npm run dev
128+
```
129+
130+
4. **Set up Database** (Terminal 3)
131+
```bash
132+
cd server/db/setup/
133+
python clean_db.py
134+
python create_db.py
135+
python data_population.py
136+
```
137+
138+
5. **Run Health Checks**
139+
```bash
140+
cd server/
141+
python tests/health_checks/test_flow_1.py
142+
```
143+
144+
### Service URLs
145+
- **Frontend**: http://localhost:5173
146+
- **Backend API**: http://localhost:5000
147+
- **Health Check**: http://localhost:5000/health
148+
- **Admin Portal**: http://localhost:5000/ap/login
149+
- **MariaDB**: localhost:3306
86150

87151
### Built With
88152

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
<template>
22
<div class="bg-gray-50 dark:bg-slate-800 dark:text-slate-100">
3-
<nav class="navbar">
4-
<ul class="nav-links">
5-
<li><a href="#about">About</a></li>
6-
<li><a href="#pricing">Pricing</a></li>
7-
<li><a href="#start">Start</a></li>
8-
</ul>
9-
</nav>
103
<slot />
114
</div>
125
</template>

‎server/Dockerfile‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ RUN pip install -r requirements.txt
2222

2323
# Copy the current directory contents into the container
2424
COPY . .
25+
26+
# Replace 'localhost' with 'mariadb' in db_connector.py for Docker environment
27+
RUN sed -i "s/host = 'localhost'/host = 'mariadb'/g" /app/db/db_connector.py
28+
2529
# # RUN python /app/db/setup/test_connection.py
2630
# RUN python /app/db/setup/create_db.py
2731
# RUN python /app/db/setup/data_population.py

‎server/api/__init__.py‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,12 @@ def create_app(config_file='settings.py'):
2121
app.register_blueprint(clients)
2222
app.register_blueprint(admin)
2323

24+
@app.route('/health', methods=['GET'])
25+
def health_check():
26+
"""Simple health check endpoint"""
27+
return {
28+
'status': 'healthy',
29+
'message': 'ISCTE Spot API is running',
30+
}, 200
31+
2432
return app
293 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)