added sample both local docker and system ngins options

This commit is contained in:
buenosairesam
2026-01-27 02:31:55 -03:00
parent 8c5deb74e8
commit 027f73794d
3 changed files with 160 additions and 17 deletions

View File

@@ -57,9 +57,52 @@ Next.js and other streaming SSR frameworks may not include `</body>` in the init
## Nginx Configuration
### For Local Development (system nginx)
There are two options for local development:
Each room needs entries in `/etc/nginx/sites-enabled/`:
### Option 1: Docker Nginx (Recommended for portability)
Each room includes a docker-compose.nginx.yml that runs nginx in a container.
```bash
# Add to /etc/hosts
127.0.0.1 sample.spr.local.ar sample.local.ar
# Start room with nginx
cd gen/<room>/soleprint
docker compose -f docker-compose.yml -f docker-compose.nginx.yml up -d
```
The nginx config in `cfg/<room>/soleprint/nginx/local.conf` uses docker service names:
```nginx
location /spr/ {
proxy_pass http://soleprint:8000/;
}
location / {
proxy_pass http://frontend:80;
# ... sub_filter for sidebar injection
}
```
**Pros**: Portable, no system dependencies, isolated per room
**Cons**: Only one room can use port 80 at a time
### Option 2: System Nginx (For running multiple rooms)
If you need multiple rooms running simultaneously, use your system's nginx.
1. Install nginx: `sudo apt install nginx`
2. Add hosts entries for all rooms:
```
# /etc/hosts
127.0.0.1 amar.spr.local.ar amar.local.ar
127.0.0.1 dlt.spr.local.ar dlt.local.ar
127.0.0.1 sample.spr.local.ar sample.local.ar
```
3. Create config in `/etc/nginx/sites-enabled/spr_local.conf`:
```nginx
# room.spr.local.ar - app with sidebar
@@ -79,7 +122,10 @@ server {
# Backend API (if applicable)
location /api/ {
proxy_pass http://127.0.0.1:BACKEND_PORT/api/;
# ... headers
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
# Frontend with sidebar injection
@@ -102,24 +148,14 @@ server {
server {
listen 80;
server_name room.local.ar;
# ... same as above but without sub_filter
# ... same locations but without sub_filter in / block
}
```
### For Docker/AWS (nginx container)
4. Reload nginx: `sudo nginx -t && sudo systemctl reload nginx`
The nginx config lives in `cfg/<room>/soleprint/nginx/local.conf` and uses docker service names instead of localhost ports:
```nginx
location /spr/ {
proxy_pass http://soleprint:8000/spr/;
}
location / {
proxy_pass http://frontend:3000;
# ... sub_filter same as above
}
```
**Pros**: Multiple rooms on port 80 via different hostnames
**Cons**: Requires system nginx, manual config updates
## Port Allocation