Skip to content

Commit e399952

Browse files
committed
docs: add nginx and SSL setup completion summary
- Configured nginx reverse proxy for dev.codeframeapp.com → localhost:14100 - Configured nginx reverse proxy for api.dev.codeframeapp.com → localhost:14200 - Set up SSL certificates via Let's Encrypt (valid until 2026-01-23) - Enabled auto-renewal via certbot - Configured WebSocket support for /ws endpoint - Documented port assignments (no conflicts with existing apps) - Added troubleshooting and testing instructions
1 parent 0456c81 commit e399952

1 file changed

Lines changed: 184 additions & 0 deletions

File tree

docs/nginx-setup-complete.md

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
# Nginx & SSL Configuration Complete
2+
3+
**Date**: 2025-10-25
4+
**Server**: 47.88.89.175
5+
6+
## ✅ What Was Configured
7+
8+
### 1. Frontend (dev.codeframeapp.com)
9+
- **URL**: https://dev.codeframeapp.com
10+
- **Proxies to**: localhost:14100 (Next.js)
11+
- **SSL Certificate**: ✅ Valid until 2026-01-23
12+
- **Auto-renewal**: ✅ Configured via certbot
13+
- **HTTP → HTTPS redirect**: ✅ Enabled
14+
15+
### 2. Backend API (api.dev.codeframeapp.com)
16+
- **URL**: https://api.dev.codeframeapp.com
17+
- **Proxies to**: localhost:14200 (FastAPI)
18+
- **WebSocket support**: ✅ /ws endpoint configured
19+
- **SSL Certificate**: ✅ Valid until 2026-01-23
20+
- **Auto-renewal**: ✅ Configured via certbot
21+
- **HTTP → HTTPS redirect**: ✅ Enabled
22+
23+
## Configuration Files
24+
25+
### Frontend Config
26+
**Location**: `/etc/nginx/sites-available/dev.codeframeapp.com`
27+
```nginx
28+
server {
29+
server_name dev.codeframeapp.com;
30+
31+
location / {
32+
proxy_pass http://127.0.0.1:14100;
33+
# Standard proxy headers configured
34+
}
35+
36+
listen 443 ssl; # managed by Certbot
37+
listen 80; # redirects to HTTPS
38+
}
39+
```
40+
41+
### Backend Config
42+
**Location**: `/etc/nginx/sites-available/api.dev.codeframeapp.com`
43+
```nginx
44+
server {
45+
server_name api.dev.codeframeapp.com;
46+
47+
location / {
48+
proxy_pass http://127.0.0.1:14200;
49+
# Standard proxy headers configured
50+
}
51+
52+
location /ws {
53+
proxy_pass http://127.0.0.1:14200;
54+
# WebSocket headers configured
55+
# 7-day timeout for persistent connections
56+
}
57+
58+
listen 443 ssl; # managed by Certbot
59+
listen 80; # redirects to HTTPS
60+
}
61+
```
62+
63+
## Ports in Use
64+
65+
- **14100**: Next.js frontend (proxied from dev.codeframeapp.com)
66+
- **14200**: FastAPI backend (proxied from api.dev.codeframeapp.com)
67+
68+
**Note**: These ports are NOT in conflict with existing applications on the server:
69+
- Port 3000: next-server (different app)
70+
- Port 8000: python3 (different app)
71+
- Port 8080: docker-proxy (different app)
72+
73+
## SSL Certificates
74+
75+
### Frontend Certificate
76+
```
77+
Certificate: /etc/letsencrypt/live/dev.codeframeapp.com/fullchain.pem
78+
Private Key: /etc/letsencrypt/live/dev.codeframeapp.com/privkey.pem
79+
Expires: 2026-01-23
80+
```
81+
82+
### Backend Certificate
83+
```
84+
Certificate: /etc/letsencrypt/live/api.dev.codeframeapp.com/fullchain.pem
85+
Private Key: /etc/letsencrypt/live/api.dev.codeframeapp.com/privkey.pem
86+
Expires: 2026-01-23
87+
```
88+
89+
**Auto-renewal**: Certbot has set up a cron job to automatically renew certificates before expiry.
90+
91+
## Next Steps
92+
93+
### 1. Configure Environment Files
94+
95+
On the server at `/opt/codeframe`:
96+
97+
**Backend** (`.env.staging`):
98+
```bash
99+
ANTHROPIC_API_KEY=your-key-here
100+
API_HOST=127.0.0.1
101+
API_PORT=14200
102+
CORS_ALLOWED_ORIGINS=https://dev.codeframeapp.com
103+
DATABASE_PATH=/opt/codeframe/.codeframe/state.db
104+
LOG_LEVEL=INFO
105+
ENVIRONMENT=staging
106+
```
107+
108+
**Frontend** (`web-ui/.env.production.local`):
109+
```bash
110+
NEXT_PUBLIC_API_URL=https://api.dev.codeframeapp.com
111+
NEXT_PUBLIC_WS_URL=wss://api.dev.codeframeapp.com/ws
112+
```
113+
114+
### 2. Start the Applications
115+
116+
The deployment workflow will handle starting via PM2, but for manual testing:
117+
118+
```bash
119+
# On the server
120+
cd /opt/codeframe
121+
122+
# Start backend
123+
pm2 start ecosystem.staging.config.js --only codeframe-backend-staging
124+
125+
# Start frontend
126+
pm2 start ecosystem.staging.config.js --only codeframe-frontend-staging
127+
128+
# Check status
129+
pm2 list
130+
```
131+
132+
### 3. Test the Endpoints
133+
134+
**Frontend health check**:
135+
```bash
136+
curl https://dev.codeframeapp.com/api/health
137+
```
138+
139+
**Backend health check**:
140+
```bash
141+
curl https://api.dev.codeframeapp.com/health
142+
```
143+
144+
## Troubleshooting
145+
146+
### Check Nginx Status
147+
```bash
148+
ssh root@47.88.89.175 'systemctl status nginx'
149+
```
150+
151+
### View Nginx Logs
152+
```bash
153+
# Frontend logs
154+
ssh root@47.88.89.175 'tail -f /var/log/nginx/dev.codeframeapp.com.access.log'
155+
ssh root@47.88.89.175 'tail -f /var/log/nginx/dev.codeframeapp.com.error.log'
156+
157+
# Backend logs
158+
ssh root@47.88.89.175 'tail -f /var/log/nginx/api.dev.codeframeapp.com.access.log'
159+
ssh root@47.88.89.175 'tail -f /var/log/nginx/api.dev.codeframeapp.com.error.log'
160+
```
161+
162+
### Test SSL Certificates
163+
```bash
164+
# Check frontend cert
165+
openssl s_client -connect dev.codeframeapp.com:443 -servername dev.codeframeapp.com < /dev/null
166+
167+
# Check backend cert
168+
openssl s_client -connect api.dev.codeframeapp.com:443 -servername api.dev.codeframeapp.com < /dev/null
169+
```
170+
171+
### Reload Nginx After Changes
172+
```bash
173+
ssh root@47.88.89.175 'nginx -t && systemctl reload nginx'
174+
```
175+
176+
## DNS Verification
177+
178+
Ensure DNS records are pointing to the server:
179+
```bash
180+
dig dev.codeframeapp.com +short
181+
dig api.dev.codeframeapp.com +short
182+
```
183+
184+
Both should return: **47.88.89.175**

0 commit comments

Comments
 (0)