- Backend: FastAPI app with all models, services, schemas, routes - Admin Panel: Next.js dashboard with all modules (CRM, POS, repairs, warranties, billing, notifications, etc.) - Ecommerce: storefront (submodule) + product catalog - AI Agents: .agents/ skill library for Antigravity IDE - Docs: architecture, billing, notification gateway markdown - Submodules: Backend/OpenWA, Ecommerce/File 2/storefront
47 lines
1.3 KiB
Python
47 lines
1.3 KiB
Python
import os
|
|
import sys
|
|
import signal
|
|
|
|
def daemonize_cmd(cmd, cwd, log_file):
|
|
pid = os.fork()
|
|
if pid > 0:
|
|
return
|
|
|
|
os.setsid()
|
|
pid2 = os.fork()
|
|
if pid2 > 0:
|
|
sys.exit(0)
|
|
|
|
signal.signal(signal.SIGHUP, signal.SIG_IGN)
|
|
|
|
with open(log_file, "a") as f:
|
|
os.dup2(f.fileno(), 1)
|
|
os.dup2(f.fileno(), 2)
|
|
os.chdir(cwd)
|
|
os.execvp(cmd[0], cmd)
|
|
|
|
log_dir = "/mnt/fam/SERVER/IfixKartEcommerce/docs/12-ai/logs"
|
|
os.makedirs(log_dir, exist_ok=True)
|
|
|
|
# 1. Backend FastAPI
|
|
daemonize_cmd(
|
|
["/mnt/fam/SERVER/IfixKartEcommerce/Backend/venv/bin/uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"],
|
|
"/mnt/fam/SERVER/IfixKartEcommerce/Backend",
|
|
os.path.join(log_dir, "backend.log")
|
|
)
|
|
|
|
# 2. Admin Panel Next.js (Production Start on Port 3022)
|
|
daemonize_cmd(
|
|
["/mnt/fam/SERVER/IfixKartEcommerce/New admin panel/ikixkart-dashboard/node_modules/.bin/next", "start", "-H", "0.0.0.0", "-p", "3022"],
|
|
"/mnt/fam/SERVER/IfixKartEcommerce/New admin panel/ikixkart-dashboard",
|
|
os.path.join(log_dir, "admin.log")
|
|
)
|
|
|
|
# 3. Storefront Next.js
|
|
daemonize_cmd(
|
|
["npx", "next", "dev", "-H", "0.0.0.0", "-p", "3021", "--turbo"],
|
|
"/mnt/fam/SERVER/IfixKartEcommerce/storefrontnewone/storefront",
|
|
os.path.join(log_dir, "storefront.log")
|
|
)
|
|
|
|
print("Started production Admin server on port 3022.")
|