summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYurenHao0426 <blackhao0426@gmail.com>2026-02-12 20:06:25 +0000
committerYurenHao0426 <blackhao0426@gmail.com>2026-02-12 20:06:25 +0000
commit6e8f245a6fc5bed08cfa96e4f669dc6af134afca (patch)
tree388bf2a3d6fc4ab70d0238466231b7640cb65304
parent924a82ac26dc9938b692f15db7aa06dd66b021bd (diff)
Add deployment config: nginx proxy, HTTPS, systemd servicesHEADmaster
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
-rw-r--r--README.md21
-rw-r--r--backend/main.py2
-rw-r--r--frontend/src/api.js2
-rw-r--r--frontend/vite.config.js3
4 files changed, 26 insertions, 2 deletions
diff --git a/README.md b/README.md
index 23599b3..122a1a8 100644
--- a/README.md
+++ b/README.md
@@ -79,6 +79,27 @@ npm run dev
Then open http://localhost:5173 in your browser.
+## Deployment (systemd + HTTPS)
+
+The app can be deployed with nginx reverse proxy, Let's Encrypt HTTPS, and systemd services for persistent background running.
+
+### Service Management
+
+```bash
+# Restart services
+sudo systemctl restart llm-council-backend
+sudo systemctl restart llm-council-frontend
+
+# View logs
+sudo journalctl -u llm-council-backend -f
+sudo journalctl -u llm-council-frontend -f
+
+# Check status
+sudo systemctl status llm-council-backend llm-council-frontend
+```
+
+Service files are at `/etc/systemd/system/llm-council-{backend,frontend}.service`. Nginx config is at `/etc/nginx/sites-available/llm-council.blackhao.com`. Both services auto-start on boot and auto-restart on crash.
+
## Tech Stack
- **Backend:** FastAPI (Python 3.10+), async httpx, OpenRouter API
diff --git a/backend/main.py b/backend/main.py
index 40353dd..721e7ea 100644
--- a/backend/main.py
+++ b/backend/main.py
@@ -31,7 +31,7 @@ def _extract_conversation_history(conversation: Dict[str, Any]) -> List[Dict[str
# Enable CORS for local development
app.add_middleware(
CORSMiddleware,
- allow_origins=["http://localhost:5173", "http://localhost:3000"],
+ allow_origins=["http://localhost:5173", "http://localhost:3000", "https://llm-council.blackhao.com"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
diff --git a/frontend/src/api.js b/frontend/src/api.js
index a53ed90..dfe9dff 100644
--- a/frontend/src/api.js
+++ b/frontend/src/api.js
@@ -2,7 +2,7 @@
* API client for the LLM Council backend.
*/
-const API_BASE = 'http://localhost:8001';
+const API_BASE = window.location.hostname === 'localhost' ? 'http://localhost:8001' : '';
export const api = {
/**
diff --git a/frontend/vite.config.js b/frontend/vite.config.js
index 8b0f57b..5c08825 100644
--- a/frontend/vite.config.js
+++ b/frontend/vite.config.js
@@ -4,4 +4,7 @@ import react from '@vitejs/plugin-react'
// https://vite.dev/config/
export default defineConfig({
plugins: [react()],
+ server: {
+ allowedHosts: ['llm-council.blackhao.com'],
+ },
})