added sample both local docker and system ngins options
This commit is contained in:
35
cfg/sample/soleprint/docker-compose.nginx.yml
Normal file
35
cfg/sample/soleprint/docker-compose.nginx.yml
Normal file
@@ -0,0 +1,35 @@
|
||||
# Nginx Reverse Proxy for Docker-based Local Development
|
||||
#
|
||||
# Usage:
|
||||
# # Start all services including nginx:
|
||||
# docker compose -f docker-compose.yml -f docker-compose.nginx.yml up -d
|
||||
#
|
||||
# # Or start nginx separately after other services:
|
||||
# docker compose -f docker-compose.nginx.yml up -d
|
||||
#
|
||||
# Routes:
|
||||
# - sample.spr.local.ar -> frontend with sidebar injection
|
||||
# - sample.local.ar -> frontend without sidebar
|
||||
#
|
||||
# Note: Requires /etc/hosts entries:
|
||||
# 127.0.0.1 sample.spr.local.ar sample.local.ar
|
||||
|
||||
name: ${DEPLOYMENT_NAME}_nginx
|
||||
|
||||
services:
|
||||
nginx:
|
||||
image: nginx:alpine
|
||||
container_name: ${DEPLOYMENT_NAME}_nginx
|
||||
ports:
|
||||
- "80:80"
|
||||
volumes:
|
||||
- ./nginx/local.conf:/etc/nginx/conf.d/default.conf:ro
|
||||
networks:
|
||||
- default
|
||||
depends_on:
|
||||
- soleprint
|
||||
restart: unless-stopped
|
||||
|
||||
networks:
|
||||
default:
|
||||
name: ${NETWORK_NAME}
|
||||
72
cfg/sample/soleprint/nginx/local.conf
Normal file
72
cfg/sample/soleprint/nginx/local.conf
Normal file
@@ -0,0 +1,72 @@
|
||||
# Sample Room - Nginx Config for Docker
|
||||
#
|
||||
# This config uses docker service names (soleprint, frontend, backend)
|
||||
# which resolve within the docker network.
|
||||
|
||||
# sample.spr.local.ar - frontend with soleprint sidebar
|
||||
server {
|
||||
listen 80;
|
||||
server_name sample.spr.local.ar;
|
||||
|
||||
# Soleprint routes - sidebar API and assets
|
||||
location /spr/ {
|
||||
proxy_pass http://soleprint:8000/;
|
||||
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;
|
||||
}
|
||||
|
||||
# Backend API (uncomment if your app has a backend)
|
||||
# location /api/ {
|
||||
# proxy_pass http://backend:8000/api/;
|
||||
# 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
|
||||
location / {
|
||||
proxy_pass http://frontend:80;
|
||||
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;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_set_header Accept-Encoding "";
|
||||
|
||||
# Inject sidebar CSS and JS into head
|
||||
sub_filter '</head>' '<link rel="stylesheet" href="/spr/sidebar.css"><script src="/spr/sidebar.js" defer></script></head>';
|
||||
sub_filter_once off;
|
||||
sub_filter_types text/html;
|
||||
}
|
||||
}
|
||||
|
||||
# sample.local.ar - frontend without sidebar (direct access)
|
||||
server {
|
||||
listen 80;
|
||||
server_name sample.local.ar;
|
||||
|
||||
# Backend API (uncomment if your app has a backend)
|
||||
# location /api/ {
|
||||
# proxy_pass http://backend:8000/api/;
|
||||
# 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;
|
||||
# }
|
||||
|
||||
location / {
|
||||
proxy_pass http://frontend:80;
|
||||
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;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user