Bỏ qua

Nginx Configuration Migration Summary

What Changed

Before (Signoz-Specific)

config/
└── signoz/
    ├── nginx.conf          # Signoz-only nginx config
    ├── dashboards/
    ├── alerts/
    └── otel-collector-config.yaml

After (Scalable Structure)

config/
├── nginx/                  # All nginx reverse proxy configs
│   ├── infrastructure.conf # Unified config for all infrastructure tools
│   └── README.md          # Documentation
└── signoz/                 # Signoz-specific configs only
    ├── dashboards/
    ├── alerts/
    └── otel-collector-config.yaml

Why This Change?

Problems with Old Structure:

  1. Not scalable: Adding new tools (PgAdmin, Grafana) would require modifying Signoz config
  2. Confusing: Nginx config in Signoz folder suggests it's Signoz-only
  3. Hard to maintain: Multiple nginx configs scattered across service folders

Benefits of New Structure:

  1. Scalable: Easy to add new infrastructure tools
  2. Clear separation: Infrastructure proxy vs. service-specific configs
  3. Better organization: All reverse proxy configs in one place
  4. Future-proof: Ready for Grafana, Prometheus, etc.

Changes Made

1. Created config/nginx/ Directory

  • New location for all nginx reverse proxy configurations
  • Separate from service-specific configs

2. Created infrastructure.conf

  • Unified configuration for all infrastructure tools
  • Currently handles Signoz (port 3301)
  • Ready for PgAdmin, Mongo Express, Grafana, etc.

3. Updated Docker Compose

  • Renamed signoz-nginx-proxyinfrastructure-nginx-proxy
  • Updated volume mount: ./config/nginx/infrastructure.conf
  • Updated port mapping: 3301:3301 (was 3301:80)

4. Updated Documentation

  • docs/REVERSE-PROXY-ARCHITECTURE.md - Architecture explanation
  • docs/SIGNOZ-405-FIX.md - Updated with new paths
  • config/nginx/README.md - How to add new tools

Migration Steps

✅ Completed

  1. Created config/nginx/ directory
  2. Created infrastructure.conf with Signoz configuration
  3. Updated docker-compose.dev.yml
  4. Created documentation

🔄 Next Steps (When Ready)

  1. Restart services:

bash docker compose -f docker-compose.dev.yml down infrastructure-nginx-proxy docker compose -f docker-compose.dev.yml up -d infrastructure-nginx-proxy

  1. Verify it works:

bash curl http://localhost:3301/health curl -X POST http://localhost:3301/api/v1/register ...

  1. Optional: Remove old file (after verification): bash # Keep as backup for now, can remove later # rm config/signoz/nginx.conf

Architecture Overview

Two-Tier Proxy System

┌─────────────────────────────────────────┐
│         Client Requests                 │
└──────────────┬──────────────────────────┘
               │
    ┌──────────┴──────────┐
    │                     │
    ▼                     ▼
┌──────────┐      ┌──────────────────┐
│  API     │      │  Infrastructure  │
│  Gateway │      │  Nginx Proxy     │
│ (NestJS) │      │  (config/nginx/) │
│ Port 3000│      │  Port 3301, etc. │
└──────────┘      └──────────────────┘
    │                     │
Business Services    Infrastructure Tools
(user, booking)      (Signoz, PgAdmin)

Adding New Tools

Example: Add PgAdmin

  1. Edit config/nginx/infrastructure.conf:

nginx server { listen 5050; server_name localhost; location / { proxy_pass http://pgadmin:80; # ... proxy headers } }

  1. Update docker-compose.dev.yml:

yaml infrastructure-nginx-proxy: ports: - '${SIGNOZ_FRONTEND_PORT:-3301}:3301' - '${PGADMIN_PORT:-5050}:5050' # Add this

  1. Restart: bash docker compose -f docker-compose.dev.yml restart infrastructure-nginx-proxy

That's it! No need to create new nginx containers or modify Signoz configs.

Benefits for Future Scaling

  1. Single entry point for all infrastructure tools
  2. Consistent configuration across all tools
  3. Easy to add SSL/TLS (one place to configure)
  4. Easy to add authentication (one place to configure)
  5. Better monitoring (one proxy to monitor)

Questions?

See:

  • docs/REVERSE-PROXY-ARCHITECTURE.md - Full architecture explanation
  • config/nginx/README.md - How to add new tools
  • docs/SIGNOZ-405-FIX.md - Original fix documentation