From 78aa2bf201abf90b70e4b532e5d703ab105cfbe0 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 10 Apr 2026 00:06:30 +0000 Subject: [PATCH] Made Changes from server by mohan --- backend/app/main.py | 1 + backend/app/services/db.py | 2 +- backend/ecosystem.config.js | 110 ++++++++++++++++++++++++++++-------- backend/requirements.txt | 21 +++++-- 4 files changed, 104 insertions(+), 30 deletions(-) diff --git a/backend/app/main.py b/backend/app/main.py index 45105bb..79dc348 100644 --- a/backend/app/main.py +++ b/backend/app/main.py @@ -28,6 +28,7 @@ DEFAULT_DEV_ORIGINS = { "http://127.0.0.1:3000", "http://localhost:5173", "http://127.0.0.1:5173", + "https://app.quantfortune.com" } PRODUCTION_ENV_NAMES = {"prod", "production"} diff --git a/backend/app/services/db.py b/backend/app/services/db.py index b793cc7..d3821fe 100644 --- a/backend/app/services/db.py +++ b/backend/app/services/db.py @@ -51,7 +51,7 @@ def _db_config() -> dict[str, str | int]: if url: return {"url": url} - password = os.getenv("DB_PASSWORD") or os.getenv("PGPASSWORD") + password = os.getenv("DB_PASSWORD") or os.getenv("PGPASSWORD") or "traderpass" if not password and not is_non_prod: raise RuntimeError("DB_PASSWORD or PGPASSWORD must be configured in non-development environments") diff --git a/backend/ecosystem.config.js b/backend/ecosystem.config.js index 2c48ca2..9f7cc39 100644 --- a/backend/ecosystem.config.js +++ b/backend/ecosystem.config.js @@ -1,31 +1,95 @@ +// // module.exports = { +// // apps: [ +// // { +// // name: "Quantfortune - Backend", +// // cwd: "/SERVER_CLIENT/PRODUCTION/SIP_GoldBees_Backend/backend", +// // script: "/SERVER_CLIENT/PRODUCTION/SIP_GoldBees_Backend/backend/.venv/bin/uvicorn", +// // args: "app.main:app --host 0.0.0.0 --port 3002", +// // interpreter: "none", +// // env: { +// // PYTHONPATH: +// // process.env.PYTHONPATH || +// // "/SERVER_CLIENT/PRODUCTION/SIP_GoldBees_Backend:/SERVER_CLIENT/PRODUCTION/SIP_GoldBees_Backend/backend", + +// // APP_ENV: process.env.APP_ENV || "production", +// // DB_HOST: process.env.DB_HOST, +// // DB_PORT: process.env.DB_PORT, +// // DB_NAME: process.env.DB_NAME, +// // DB_USER: process.env.DB_USER, +// // DB_PASSWORD: process.env.DB_PASSWORD, +// // DB_SCHEMA: process.env.DB_SCHEMA, +// // CORS_ORIGINS: process.env.CORS_ORIGINS, +// // BROKER_TOKEN_KEY: process.env.BROKER_TOKEN_KEY, +// // SMTP_HOST: process.env.SMTP_HOST, +// // SMTP_PORT: process.env.SMTP_PORT, +// // SMTP_USER: process.env.SMTP_USER, +// // SMTP_PASS: process.env.SMTP_PASS, +// // SMTP_FROM_NAME: process.env.SMTP_FROM_NAME, +// // RESET_OTP_SECRET: process.env.RESET_OTP_SECRET, +// // ENABLE_SUPER_ADMIN_BOOTSTRAP: process.env.ENABLE_SUPER_ADMIN_BOOTSTRAP, +// // SUPER_ADMIN_EMAIL: process.env.SUPER_ADMIN_EMAIL, +// // SUPER_ADMIN_PASSWORD: process.env.SUPER_ADMIN_PASSWORD, +// // }, +// // }, +// // ], +// // }; + + +// module.exports = { +// apps: [ +// { +// name: "Quantfortune - Backend", +// cwd: "/SERVER_CLIENT/PRODUCTION/SIP_GoldBees_Backend/backend", +// script: "/SERVER_CLIENT/PRODUCTION/SIP_GoldBees_Backend/backend/.venv/bin/uvicorn", +// args: "app.main:app --host 0.0.0.0 --port 3002", +// interpreter: "none", +// env: { +// PYTHONPATH: +// "/SERVER_CLIENT/PRODUCTION/SIP_GoldBees_Backend:/SERVER_CLIENT/PRODUCTION/SIP_GoldBees_Backend/backend", + +// APP_ENV: "development", + +// DB_HOST: "localhost", +// DB_PORT: "5432", +// DB_NAME: "trading_db", +// DB_USER: "trader", +// DB_PASSWORD: "traderpass", +// DB_SCHEMA: "quant_app", + +// PGPASSWORD: "traderpass", + +// CORS_ORIGINS: +// "http://localhost:3000,http://127.0.0.1:3000,http://localhost:5173,http://127.0.0.1:5173", + +// BROKER_TOKEN_KEY: "dev-broker-token-key", +// RESET_OTP_SECRET: "dev-reset-otp-secret", + +// SMTP_HOST: "", +// SMTP_PORT: "", +// SMTP_USER: "", +// SMTP_PASS: "", +// SMTP_FROM_NAME: "Quantfortune Support", + +// ENABLE_SUPER_ADMIN_BOOTSTRAP: "false", +// SUPER_ADMIN_EMAIL: "", +// SUPER_ADMIN_PASSWORD: "", +// }, +// }, +// ], +// }; + + module.exports = { apps: [ { name: "Quantfortune - Backend", cwd: "/SERVER_CLIENT/PRODUCTION/SIP_GoldBees_Backend/backend", - script: "/SERVER_CLIENT/PRODUCTION/SIP_GoldBees_Backend/backend/.venv/bin/uvicorn", - args: "app.main:app --host 0.0.0.0 --port 3002", + script: "bash", + args: [ + "-lc", + "export PYTHONPATH=/SERVER_CLIENT/PRODUCTION/SIP_GoldBees_Backend:/SERVER_CLIENT/PRODUCTION/SIP_GoldBees_Backend/backend && export APP_ENV=production && export DB_HOST=localhost && export DB_PORT=5432 && export DB_NAME=trading_db && export DB_USER=trader && export DB_PASSWORD=traderpass && export PGPASSWORD=traderpass && export DB_SCHEMA=quant_app && export BROKER_TOKEN_KEY=dev-broker-token-key && export RESET_OTP_SECRET=dev-reset-otp-secret && export CORS_ORIGINS='https://app.quantfortune.com' && exec /SERVER_CLIENT/PRODUCTION/SIP_GoldBees_Backend/backend/.venv/bin/uvicorn app.main:app --host 0.0.0.0 --port 3002" + ], interpreter: "none", - env: { - APP_ENV: process.env.APP_ENV || "production", - DB_HOST: process.env.DB_HOST, - DB_PORT: process.env.DB_PORT, - DB_NAME: process.env.DB_NAME, - DB_USER: process.env.DB_USER, - DB_PASSWORD: process.env.DB_PASSWORD, - DB_SCHEMA: process.env.DB_SCHEMA, - CORS_ORIGINS: process.env.CORS_ORIGINS, - BROKER_TOKEN_KEY: process.env.BROKER_TOKEN_KEY, - SMTP_HOST: process.env.SMTP_HOST, - SMTP_PORT: process.env.SMTP_PORT, - SMTP_USER: process.env.SMTP_USER, - SMTP_PASS: process.env.SMTP_PASS, - SMTP_FROM_NAME: process.env.SMTP_FROM_NAME, - RESET_OTP_SECRET: process.env.RESET_OTP_SECRET, - ENABLE_SUPER_ADMIN_BOOTSTRAP: process.env.ENABLE_SUPER_ADMIN_BOOTSTRAP, - SUPER_ADMIN_EMAIL: process.env.SUPER_ADMIN_EMAIL, - SUPER_ADMIN_PASSWORD: process.env.SUPER_ADMIN_PASSWORD, - }, }, ], -}; +}; \ No newline at end of file diff --git a/backend/requirements.txt b/backend/requirements.txt index 9f1303b..b303852 100644 --- a/backend/requirements.txt +++ b/backend/requirements.txt @@ -1,6 +1,9 @@ +alembic==1.13.3 annotated-doc==0.0.4 annotated-types==0.7.0 anyio==4.12.1 +argon2-cffi==25.1.0 +argon2-cffi-bindings==25.1.0 beautifulsoup4==4.14.3 certifi==2026.1.4 cffi==2.0.0 @@ -11,25 +14,34 @@ cryptography==46.0.3 curl_cffi==0.13.0 fastapi==0.128.0 frozendict==2.4.7 +greenlet==3.3.1 h11==0.16.0 -idna==3.11 +httpcore==1.0.9 httpx==0.27.2 +idna==3.11 +iniconfig==2.3.0 +Mako==1.3.10 +MarkupSafe==3.0.3 multitasking==0.0.12 -numpy==2.2.6 +numpy==2.4.1 +packaging==26.0 pandas==2.3.3 peewee==3.19.0 platformdirs==4.5.1 +pluggy==1.6.0 protobuf==6.33.4 psycopg2-binary==2.9.11 -SQLAlchemy==2.0.36 pycparser==2.23 pydantic==2.12.5 pydantic_core==2.41.5 +pytest==8.3.5 python-dateutil==2.9.0.post0 pytz==2025.2 requests==2.32.5 six==1.17.0 +sniffio==1.3.1 soupsieve==2.8.1 +SQLAlchemy==2.0.36 starlette==0.50.0 ta==0.11.0 typing-inspection==0.4.2 @@ -39,6 +51,3 @@ urllib3==2.6.3 uvicorn==0.40.0 websockets==16.0 yfinance==1.0 -alembic==1.13.3 -pytest==8.3.5 -argon2-cffi==25.1.0