v5: stable chat server with web UI, SSH tunnel, and nginx proxy

- chat.py: multi-user chat server (stdlib only, single port)
  - Web UI at /chat with SSE real-time messaging
  - Per-user colors (green for self, palette for others)
  - Curses TUI client with scroll support
  - WebSocket SSH tunnel at /tunnel -> 185.208.174.152:22
  - /version endpoint for deployment verification
  - /tunnel.py download endpoint
- tunnel.py: SSH-over-WebSocket client with custom DNS support
- nginx: Kubernetes manifests (Deployment + Service + Ingress)
  - Reverse proxy to chat.py at 188.213.68.133:9997
  - SSE buffering disabled, WebSocket upgrade for /tunnel
- nginx.txt: alternate nginx deployment with different ingress host
- apache: Bitnami Apache Helm values (initial attempt, replaced by nginx)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Siavash Sameni
2026-03-26 14:38:36 +04:00
commit 8d6d50a2e4
5 changed files with 1244 additions and 0 deletions

104
nginx Normal file
View File

@@ -0,0 +1,104 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-conf
data:
default.conf: |
server {
listen 80;
location /tunnel {
proxy_pass http://188.213.68.133:9997;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_buffering off;
proxy_read_timeout 3600s;
proxy_send_timeout 3600s;
}
location / {
proxy_pass http://188.213.68.133:9997;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
# SSE support: disable buffering
proxy_buffering off;
proxy_cache off;
proxy_read_timeout 600s;
add_header X-Accel-Buffering no;
chunked_transfer_encoding off;
}
}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
labels:
app: nginx
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx
ports:
- containerPort: 80
resources:
limits:
cpu: "0.5"
ephemeral-storage: 1G
memory: 1G
requests:
cpu: "0.5"
ephemeral-storage: 1G
memory: 1G
volumeMounts:
- name: nginx-conf
mountPath: /etc/nginx/conf.d
volumes:
- name: nginx-conf
configMap:
name: nginx-conf
---
apiVersion: v1
kind: Service
metadata:
name: nginx-svc
spec:
selector:
app: nginx
ports:
- name: http
protocol: TCP
port: 80
targetPort: 80
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: nginx-ingress
spec:
ingressClassName: nginx
rules:
- host: nginx-0651fe8398-manpache.apps.ir-central1.arvancaas.ir
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: nginx-svc
port:
name: http