File size: 5,445 Bytes
0122e2f
 
 
b00cd33
0122e2f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
worker_processes auto;
error_log /dev/stderr warn;
pid /tmp/nginx.pid;
worker_rlimit_nofile 8192;

events {
    worker_connections 1024;
}

http {
    access_log /dev/stdout;
    client_max_body_size 100M;

    # ── Status dashboard at / ──────────────────────────────────────────────────
    server {
        listen 7860;

        # ── Root β†’ HTML dashboard ──────────────────────────────────────────────
        location = / {
            default_type text/html;
            return 200 '<!DOCTYPE html>
<html>
<head>
  <title>Redpanda</title>
  <meta charset="utf-8">
  <meta http-equiv="refresh" content="15">
  <style>
    *{box-sizing:border-box;margin:0;padding:0}
    body{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;background:#0a0a0a;color:#e5e5e5;padding:40px 32px}
    h1{font-size:1.9rem;font-weight:700;margin-bottom:6px}
    .sub{color:#666;margin-bottom:28px;font-size:.95rem}
    .grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:14px;margin-bottom:28px}
    .card{background:#141414;border:1px solid #242424;border-radius:10px;padding:18px}
    .card h3{font-size:.7rem;text-transform:uppercase;letter-spacing:.08em;color:#555;margin-bottom:10px}
    .card .val{font-size:1.05rem;font-weight:600;color:#fff;font-family:monospace}
    .card .desc{font-size:.78rem;color:#555;margin-top:4px}
    table{width:100%;border-collapse:collapse;background:#141414;border:1px solid #242424;border-radius:10px;overflow:hidden;margin-bottom:28px}
    th{text-align:left;padding:12px 16px;font-size:.75rem;text-transform:uppercase;letter-spacing:.07em;color:#555;border-bottom:1px solid #242424}
    td{padding:11px 16px;font-size:.88rem;border-bottom:1px solid #1a1a1a}
    tr:last-child td{border-bottom:none}
    code{background:#1e1e1e;padding:2px 8px;border-radius:5px;font-size:.82rem;color:#a78bfa;font-family:monospace}
    .badge{display:inline-block;padding:2px 10px;border-radius:999px;font-size:.75rem;font-weight:600;background:#22c55e18;color:#22c55e;border:1px solid #22c55e44}
  </style>
</head>
<body>
  <h1>πŸ”΄ Redpanda Broker</h1>
  <p class="sub">All services accessible via path-based routing on this port</p>

  <div class="grid">
    <div class="card"><h3>Kafka REST Proxy</h3><div class="val">/kafka/</div><div class="desc">Produce &amp; consume over HTTP</div></div>
    <div class="card"><h3>Admin API</h3><div class="val">/admin/</div><div class="desc">Cluster management &amp; metrics</div></div>
    <div class="card"><h3>Schema Registry</h3><div class="val">/schema/</div><div class="desc">Avro / Protobuf schemas</div></div>
    <div class="card"><h3>Health</h3><div class="val">/health</div><div class="desc">Broker ready check</div></div>
  </div>

  <table>
    <tr><th>Action</th><th>Method</th><th>Path</th></tr>
    <tr><td>List topics</td><td><code>GET</code></td><td><code>/admin/v1/topics</code></td></tr>
    <tr><td>Produce messages</td><td><code>POST</code></td><td><code>/kafka/topics/{topic}</code></td></tr>
    <tr><td>Create consumer</td><td><code>POST</code></td><td><code>/kafka/consumers/{group}</code></td></tr>
    <tr><td>Subscribe consumer</td><td><code>POST</code></td><td><code>/kafka/consumers/{group}/instances/{id}/subscription</code></td></tr>
    <tr><td>Consume records</td><td><code>GET</code></td><td><code>/kafka/consumers/{group}/instances/{id}/records</code></td></tr>
    <tr><td>List schemas</td><td><code>GET</code></td><td><code>/schema/subjects</code></td></tr>
    <tr><td>Cluster health</td><td><code>GET</code></td><td><code>/health</code></td></tr>
  </table>
</body>
</html>';
        }

        # ── /health β†’ Redpanda ready check ────────────────────────────────────
        location = /health {
            proxy_pass         http://127.0.0.1:9644/v1/status/ready;
            proxy_set_header   Host $host;
        }

        # ── /kafka/ β†’ Pandaproxy HTTP REST (port 8082) ────────────────────────
        location /kafka/ {
            rewrite            ^/kafka/(.*) /$1 break;
            proxy_pass         http://127.0.0.1:8082;
            proxy_set_header   Host $host;
            proxy_set_header   X-Real-IP $remote_addr;
            proxy_read_timeout 120s;
            proxy_buffering    off;
        }

        # ── /admin/ β†’ Redpanda Admin API (port 9644) ──────────────────────────
        location /admin/ {
            rewrite            ^/admin/(.*) /$1 break;
            proxy_pass         http://127.0.0.1:9644;
            proxy_set_header   Host $host;
            proxy_set_header   X-Real-IP $remote_addr;
            proxy_read_timeout 120s;
        }

        # ── /schema/ β†’ Schema Registry (port 8081) ────────────────────────────
        location /schema/ {
            rewrite            ^/schema/(.*) /$1 break;
            proxy_pass         http://127.0.0.1:8081;
            proxy_set_header   Host $host;
            proxy_set_header   X-Real-IP $remote_addr;
            proxy_read_timeout 60s;
        }
    }
}