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 RATE_LIMIT_MAX=100
# Python Service (if using) # Python Service (if using)
PYTHON_SERVICE_URL=http://localhost:8000 PYTHON_SERVICE_URL=http://localhost:8010
``` ```
### 4.3 Python Service Setup ### 4.3 Python Service Setup
@ -333,7 +333,7 @@ Type=simple
User=root User=root
WorkingDirectory=/opt/institutional_trader/backend/python_service 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" 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 Restart=always
RestartSec=10 RestartSec=10
StandardOutput=journal StandardOutput=journal
@ -732,7 +732,7 @@ sudo journalctl -u institutional-trader-python -n 50
# Test manually # Test manually
cd /opt/institutional_trader/backend/python_service cd /opt/institutional_trader/backend/python_service
source venv/bin/activate 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 ### Nginx Errors

View File

@ -61,13 +61,13 @@ cp .env.example .env
```bash ```bash
# Development mode (with auto-reload) # Development mode (with auto-reload)
cd backend/python_service cd backend/python_service
uvicorn main:app --reload --port 8000 uvicorn main:app --reload --port 8010
# Or use the Python script # Or use the Python script
python main.py 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 ### 3. Node.js Backend Setup
@ -78,7 +78,7 @@ npm install
# Configure environment # Configure environment
# Add to your .env file: # 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 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/`):** **Node.js Backend (.env in `backend/`):**
```env ```env
# Python Service Configuration # Python Service Configuration
PYTHON_SERVICE_URL=http://localhost:8000 PYTHON_SERVICE_URL=http://localhost:8010
USE_PYTHON_SERVICE=true # Enable/disable Python service USE_PYTHON_SERVICE=true # Enable/disable Python service
# Existing database configuration... # Existing database configuration...
@ -154,10 +154,10 @@ If Python service is unavailable or disabled:
```bash ```bash
# Health check # Health check
curl http://localhost:8000/health curl http://localhost:8010/health
# Get options flow # 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 ### 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` 1. Check database credentials in `.env`
2. Verify PostgreSQL is running 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 4. Review Python service logs
### Node.js Can't Connect to Python Service ### 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` 2. Check `PYTHON_SERVICE_URL` in Node.js `.env`
3. Check firewall/network settings 3. Check firewall/network settings
4. Node.js will automatically fallback to SQL if Python unavailable 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 │ HTTP
│ (with fallback) │ (with fallback)
┌──────▼──────────┐ ┌──────▼──────────┐
│ Python Service │ ← FastAPI service (port 8000) │ Python Service │ ← FastAPI service (port 8010)
│ (FastAPI) │ - Data processing │ (FastAPI) │ - Data processing
│ │ - Complex analytics │ │ - Complex analytics
└──────┬──────────┘ └──────┬──────────┘
@ -61,7 +61,7 @@ The hybrid Node.js + Python architecture is now fully integrated and ready for p
```bash ```bash
cd backend/python_service cd backend/python_service
pip install -r requirements.txt pip install -r requirements.txt
uvicorn main:app --reload --port 8000 uvicorn main:app --reload --port 8010
``` ```
### 2. Start Node.js Backend ### 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/`):** **Node.js (.env in `backend/`):**
```env ```env
# Python Service Configuration # Python Service Configuration
PYTHON_SERVICE_URL=http://localhost:8000 PYTHON_SERVICE_URL=http://localhost:8010
USE_PYTHON_SERVICE=true # Set to 'false' to disable USE_PYTHON_SERVICE=true # Set to 'false' to disable
# Database (existing) # Database (existing)
@ -178,7 +178,7 @@ Periodic health checks log status:
1. **Test with Python service:** 1. **Test with Python service:**
```bash ```bash
# Start Python service # Start Python service
cd backend/python_service && uvicorn main:app --port 8000 cd backend/python_service && uvicorn main:app --port 8010
# Test endpoint # Test endpoint
curl "http://localhost:3010/api/options/flow" curl "http://localhost:3010/api/options/flow"
@ -232,7 +232,7 @@ WORKDIR /app
COPY requirements.txt . COPY requirements.txt .
RUN pip install -r requirements.txt RUN pip install -r requirements.txt
COPY . . COPY . .
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"] CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8010"]
``` ```
```dockerfile ```dockerfile
@ -249,7 +249,7 @@ CMD ["npm", "start"]
### Python Service Not Starting ### Python Service Not Starting
1. Check database credentials 1. Check database credentials
2. Verify port 8000 is available 2. Verify port 8010 is available
3. Check Python dependencies 3. Check Python dependencies
4. Review service logs 4. Review service logs

View File

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

View File

@ -29,7 +29,7 @@
- Log the fallback for monitoring - Log the fallback for monitoring
**To fix:** **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 2. Check `PYTHON_SERVICE_URL` in `.env` matches the service URL
3. Verify network connectivity 3. Verify network connectivity

View File

@ -27,7 +27,7 @@ cp .env.example .env
```bash ```bash
python main.py python main.py
# Or with uvicorn: # Or with uvicorn:
uvicorn main:app --reload --port 8000 uvicorn main:app --reload --port 8010
``` ```
## API Endpoints ## API Endpoints
@ -46,7 +46,7 @@ Get processed options flow data
**Example:** **Example:**
```bash ```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 ### GET /api/options-flow/stats
@ -60,7 +60,7 @@ Get flow statistics
The Node.js API layer can call this service via HTTP: The Node.js API layer can call this service via HTTP:
```javascript ```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(); const data = await response.json();
``` ```

View File

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

View File

@ -28,10 +28,10 @@ Start the service and test the endpoint:
```bash ```bash
# Terminal 1: Start Python service # Terminal 1: Start Python service
cd backend/python_service cd backend/python_service
uvicorn main:app --reload --port 8000 uvicorn main:app --reload --port 8010
# Terminal 2: Test endpoint # 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 ### 3. Integration Test with Node.js
@ -41,7 +41,7 @@ Test the full stack:
```bash ```bash
# Terminal 1: Start Python service # Terminal 1: Start Python service
cd backend/python_service cd backend/python_service
uvicorn main:app --reload --port 8000 uvicorn main:app --reload --port 8010
# Terminal 2: Start Node.js backend # Terminal 2: Start Node.js backend
cd backend cd backend

View File

@ -306,5 +306,5 @@ async def get_flow_stats(
if __name__ == "__main__": if __name__ == "__main__":
import uvicorn 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 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 fi
# Start the service # 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, available: isHealthy,
lastCheck: lastCheck?.timestamp || null, lastCheck: lastCheck?.timestamp || null,
status: lastCheck?.healthy ? 'healthy' : 'unhealthy', 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) { 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 * Call Python service for options flow processing