diff --git a/backend/ecosystem.config copy.js b/backend/ecosystem.config copy.js new file mode 100644 index 0000000..9f7cc39 --- /dev/null +++ b/backend/ecosystem.config copy.js @@ -0,0 +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: "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", + }, + ], +}; \ No newline at end of file diff --git a/backend/ecosystem.config.js b/backend/ecosystem.config.js index 9f7cc39..9b0e8f0 100644 --- a/backend/ecosystem.config.js +++ b/backend/ecosystem.config.js @@ -1,94 +1,35 @@ -// // 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: "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" + ` +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=v_GdTdOmIKhJztW1E3lxrXBDmhgCmA0MeoeM4wprqCk= +export RESET_OTP_SECRET=gNr0HlTQu8XhwvRnkoV2oUnmTTLV4c0s9vkG019jVlXQ5IhycTjPZO0xgWkfS4Wx7J8xuee5-rCVQpXYIK5XjQ + +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", }, ], diff --git a/backend/geberate_keys.py b/backend/geberate_keys.py new file mode 100644 index 0000000..dc464b3 --- /dev/null +++ b/backend/geberate_keys.py @@ -0,0 +1,9 @@ +import secrets + +# Generate a secure random key (URL-safe) +def generate_key(length=32): + return secrets.token_urlsafe(length) + +print("BROKER_TOKEN_KEY =", generate_key()) +print("RESET_OTP_SECRET =", generate_key()) +print("GENERIC_SECRET =", generate_key()) \ No newline at end of file