changed port to 8010

This commit is contained in:
Deep Koluguri 2025-12-12 21:47:20 -05:00
parent ab33c7314d
commit b86bfad73b
13 changed files with 38 additions and 38 deletions

View File

@ -171,7 +171,7 @@ RATE_LIMIT_WINDOW=15
RATE_LIMIT_MAX=100
# Python Service (if using)
PYTHON_SERVICE_URL=http://localhost:8000
PYTHON_SERVICE_URL=http://localhost:8010
```
### 4.3 Python Service Setup
@ -333,7 +333,7 @@ Type=simple
User=root
WorkingDirectory=/opt/institutional_trader/backend/python_service
Environment="PATH=/opt/institutional_trader/backend/python_service/venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
ExecStart=/opt/institutional_trader/backend/python_service/venv/bin/uvicorn main:app --host 0.0.0.0 --port 8000
ExecStart=/opt/institutional_trader/backend/python_service/venv/bin/uvicorn main:app --host 0.0.0.0 --port 8010
Restart=always
RestartSec=10
StandardOutput=journal
@ -732,7 +732,7 @@ sudo journalctl -u institutional-trader-python -n 50
# Test manually
cd /opt/institutional_trader/backend/python_service
source venv/bin/activate
uvicorn main:app --host 0.0.0.0 --port 8000
uvicorn main:app --host 0.0.0.0 --port 8010
```
### Nginx Errors

View File

@ -61,13 +61,13 @@ cp .env.example .env
```bash
# Development mode (with auto-reload)
cd backend/python_service
uvicorn main:app --reload --port 8000
uvicorn main:app --reload --port 8010
# Or use the Python script
python main.py
```
The service will be available at `http://localhost:8000`
The service will be available at `http://localhost:8010`
### 3. Node.js Backend Setup
@ -78,7 +78,7 @@ npm install
# Configure environment
# Add to your .env file:
PYTHON_SERVICE_URL=http://localhost:8000
PYTHON_SERVICE_URL=http://localhost:8010
USE_PYTHON_SERVICE=true # Set to 'false' to disable Python service
```
@ -110,7 +110,7 @@ LOCAL_DB_NAME=institutional_trader
**Node.js Backend (.env in `backend/`):**
```env
# Python Service Configuration
PYTHON_SERVICE_URL=http://localhost:8000
PYTHON_SERVICE_URL=http://localhost:8010
USE_PYTHON_SERVICE=true # Enable/disable Python service
# Existing database configuration...
@ -154,10 +154,10 @@ If Python service is unavailable or disabled:
```bash
# Health check
curl http://localhost:8000/health
curl http://localhost:8010/health
# Get options flow
curl "http://localhost:8000/api/options-flow?start_date=2024-01-01&end_date=2024-01-02"
curl "http://localhost:8010/api/options-flow?start_date=2024-01-01&end_date=2024-01-02"
```
### Test Node.js Integration
@ -186,12 +186,12 @@ curl "http://localhost:3010/api/options/flow?startDate=2024-01-01&endDate=2024-0
1. Check database credentials in `.env`
2. Verify PostgreSQL is running
3. Check port 8000 is not in use
3. Check port 8010 is not in use
4. Review Python service logs
### Node.js Can't Connect to Python Service
1. Verify Python service is running: `curl http://localhost:8000/health`
1. Verify Python service is running: `curl http://localhost:8010/health`
2. Check `PYTHON_SERVICE_URL` in Node.js `.env`
3. Check firewall/network settings
4. Node.js will automatically fallback to SQL if Python unavailable

View File

@ -18,7 +18,7 @@ The hybrid Node.js + Python architecture is now fully integrated and ready for p
│ HTTP
│ (with fallback)
┌──────▼──────────┐
│ Python Service │ ← FastAPI service (port 8000)
│ Python Service │ ← FastAPI service (port 8010)
│ (FastAPI) │ - Data processing
│ │ - Complex analytics
└──────┬──────────┘
@ -61,7 +61,7 @@ The hybrid Node.js + Python architecture is now fully integrated and ready for p
```bash
cd backend/python_service
pip install -r requirements.txt
uvicorn main:app --reload --port 8000
uvicorn main:app --reload --port 8010
```
### 2. Start Node.js Backend
@ -89,7 +89,7 @@ curl "http://localhost:3010/api/options/flow?startDate=2024-01-01&endDate=2024-0
**Node.js (.env in `backend/`):**
```env
# Python Service Configuration
PYTHON_SERVICE_URL=http://localhost:8000
PYTHON_SERVICE_URL=http://localhost:8010
USE_PYTHON_SERVICE=true # Set to 'false' to disable
# Database (existing)
@ -178,7 +178,7 @@ Periodic health checks log status:
1. **Test with Python service:**
```bash
# Start Python service
cd backend/python_service && uvicorn main:app --port 8000
cd backend/python_service && uvicorn main:app --port 8010
# Test endpoint
curl "http://localhost:3010/api/options/flow"
@ -232,7 +232,7 @@ WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8010"]
```
```dockerfile
@ -249,7 +249,7 @@ CMD ["npm", "start"]
### Python Service Not Starting
1. Check database credentials
2. Verify port 8000 is available
2. Verify port 8010 is available
3. Check Python dependencies
4. Review service logs

View File

@ -47,7 +47,7 @@ LOCAL_DB_NAME=institutional_trader
### Node.js Backend
Add to `backend/.env`:
```env
PYTHON_SERVICE_URL=http://localhost:8000
PYTHON_SERVICE_URL=http://localhost:8010
USE_PYTHON_SERVICE=true
# Your existing database config...
@ -59,12 +59,12 @@ USE_PYTHON_SERVICE=true
```bash
cd backend/python_service
source venv/bin/activate # or venv\Scripts\activate on Windows
uvicorn main:app --reload --port 8000
uvicorn main:app --reload --port 8010
```
You should see:
```
INFO: Uvicorn running on http://0.0.0.0:8000
INFO: Uvicorn running on http://0.0.0.0:8010
INFO: Application startup complete.
```
@ -126,13 +126,13 @@ Check Node.js logs - you should see:
### Python Service Won't Start
- Check database credentials in `.env`
- Verify PostgreSQL is running
- Check port 8000 is available
- Check port 8010 is available
- Review Python service logs
### Node.js Can't Connect
- Verify `PYTHON_SERVICE_URL` in `.env`
- Check Python service is running
- Test: `curl http://localhost:8000/health`
- Test: `curl http://localhost:8010/health`
### No Data Returned
- Check database has data

View File

@ -29,7 +29,7 @@
- Log the fallback for monitoring
**To fix:**
1. Start Python service: `cd backend/python_service && uvicorn main:app --port 8000`
1. Start Python service: `cd backend/python_service && uvicorn main:app --port 8010`
2. Check `PYTHON_SERVICE_URL` in `.env` matches the service URL
3. Verify network connectivity

View File

@ -27,7 +27,7 @@ cp .env.example .env
```bash
python main.py
# Or with uvicorn:
uvicorn main:app --reload --port 8000
uvicorn main:app --reload --port 8010
```
## API Endpoints
@ -46,7 +46,7 @@ Get processed options flow data
**Example:**
```bash
curl http://localhost:8000/api/options-flow?start_date=2024-01-01&end_date=2024-01-02
curl http://localhost:8010/api/options-flow?start_date=2024-01-01&end_date=2024-01-02
```
### GET /api/options-flow/stats
@ -60,7 +60,7 @@ Get flow statistics
The Node.js API layer can call this service via HTTP:
```javascript
const response = await fetch('http://localhost:8000/api/options-flow?start_date=2024-01-01');
const response = await fetch('http://localhost:8010/api/options-flow?start_date=2024-01-01');
const data = await response.json();
```

View File

@ -4,7 +4,7 @@
```bash
cd backend/python_service
uvicorn main:app --reload --port 8000
uvicorn main:app --reload --port 8010
```
## Using Virtual Environment (Recommended)
@ -26,20 +26,20 @@ source venv/bin/activate
pip install -r requirements.txt
# Start service
uvicorn main:app --reload --port 8000
uvicorn main:app --reload --port 8010
```
## Verify Service is Running
Once started, you should see:
```
INFO: Uvicorn running on http://127.0.0.1:8000
INFO: Uvicorn running on http://127.0.0.1:8010
INFO: Application startup complete.
```
Test the health endpoint:
```bash
curl http://localhost:8000/health
curl http://localhost:8010/health
```
Expected response:

View File

@ -28,10 +28,10 @@ Start the service and test the endpoint:
```bash
# Terminal 1: Start Python service
cd backend/python_service
uvicorn main:app --reload --port 8000
uvicorn main:app --reload --port 8010
# Terminal 2: Test endpoint
curl "http://localhost:8000/api/options-flow?start_date=2024-01-01&end_date=2024-01-02"
curl "http://localhost:8010/api/options-flow?start_date=2024-01-01&end_date=2024-01-02"
```
### 3. Integration Test with Node.js
@ -41,7 +41,7 @@ Test the full stack:
```bash
# Terminal 1: Start Python service
cd backend/python_service
uvicorn main:app --reload --port 8000
uvicorn main:app --reload --port 8010
# Terminal 2: Start Node.js backend
cd backend

View File

@ -306,5 +306,5 @@ async def get_flow_stats(
if __name__ == "__main__":
import uvicorn
uvicorn.run(app, host="0.0.0.0", port=8000)
uvicorn.run(app, host="0.0.0.0", port=8010)

View File

@ -7,5 +7,5 @@ if exist venv\Scripts\activate.bat (
)
REM Start the service
uvicorn main:app --host 0.0.0.0 --port 8000 --reload
uvicorn main:app --host 0.0.0.0 --port 8010 --reload

View File

@ -7,5 +7,5 @@ if [ -d "venv" ]; then
fi
# Start the service
uvicorn main:app --host 0.0.0.0 --port 8000 --reload
uvicorn main:app --host 0.0.0.0 --port 8010 --reload

View File

@ -54,7 +54,7 @@ router.get('/', async (req, res) => {
available: isHealthy,
lastCheck: lastCheck?.timestamp || null,
status: lastCheck?.healthy ? 'healthy' : 'unhealthy',
url: process.env.PYTHON_SERVICE_URL || 'http://localhost:8000'
url: process.env.PYTHON_SERVICE_URL || 'http://localhost:8010'
};
if (!isHealthy) {

View File

@ -18,7 +18,7 @@ if (typeof globalThis.fetch !== 'undefined') {
}
}
const PYTHON_SERVICE_URL = process.env.PYTHON_SERVICE_URL || 'http://localhost:8000';
const PYTHON_SERVICE_URL = process.env.PYTHON_SERVICE_URL || 'http://localhost:8010';
/**
* Call Python service for options flow processing