move feature from meta-sort to meta-core
This commit is contained in:
@@ -0,0 +1,231 @@
|
||||
worker_processes auto;
|
||||
error_log /var/log/nginx/error.log warn;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent"';
|
||||
|
||||
access_log /var/log/nginx/access.log main;
|
||||
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
keepalive_timeout 65;
|
||||
gzip on;
|
||||
gzip_types text/plain text/css application/json application/javascript text/xml application/xml;
|
||||
|
||||
# Upstream: meta-core Go API
|
||||
upstream meta-core-api {
|
||||
server 127.0.0.1:9000;
|
||||
}
|
||||
|
||||
# Upstream: rclone RC API
|
||||
upstream rclone {
|
||||
server 127.0.0.1:5572;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
|
||||
# =========================================================================
|
||||
# Dashboard (React SPA)
|
||||
# =========================================================================
|
||||
root /app/dashboard/dist;
|
||||
index index.html;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
# =========================================================================
|
||||
# Go API routes
|
||||
# All /api/* routes are proxied to meta-core Go server
|
||||
# =========================================================================
|
||||
location /api/ {
|
||||
proxy_pass http://meta-core-api/api/;
|
||||
proxy_http_version 1.1;
|
||||
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;
|
||||
|
||||
# SSE support for /api/events/subscribe
|
||||
proxy_buffering off;
|
||||
proxy_cache off;
|
||||
proxy_read_timeout 86400s;
|
||||
}
|
||||
|
||||
# =========================================================================
|
||||
# Health check (direct to Go API)
|
||||
# =========================================================================
|
||||
location /health {
|
||||
proxy_pass http://meta-core-api/health;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
}
|
||||
|
||||
# =========================================================================
|
||||
# Metadata API (for services to access metadata)
|
||||
# =========================================================================
|
||||
location /meta/ {
|
||||
proxy_pass http://meta-core-api/meta/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
|
||||
location /meta {
|
||||
proxy_pass http://meta-core-api/meta;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
}
|
||||
|
||||
# =========================================================================
|
||||
# File/Data API endpoints
|
||||
# =========================================================================
|
||||
location /file/ {
|
||||
proxy_pass http://meta-core-api/file/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
|
||||
location /data/ {
|
||||
proxy_pass http://meta-core-api/data/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
|
||||
# =========================================================================
|
||||
# Service discovery
|
||||
# =========================================================================
|
||||
location /services {
|
||||
proxy_pass http://meta-core-api/services;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
}
|
||||
|
||||
location /services/ {
|
||||
proxy_pass http://meta-core-api/services/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
}
|
||||
|
||||
# =========================================================================
|
||||
# Leader/role endpoints
|
||||
# =========================================================================
|
||||
location /leader {
|
||||
proxy_pass http://meta-core-api/leader;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
}
|
||||
|
||||
location /role {
|
||||
proxy_pass http://meta-core-api/role;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
}
|
||||
|
||||
# =========================================================================
|
||||
# rclone Web UI (proxied with basic auth)
|
||||
# =========================================================================
|
||||
location /rclone/ {
|
||||
proxy_pass http://rclone/;
|
||||
proxy_http_version 1.1;
|
||||
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 Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
|
||||
# Basic auth for rclone
|
||||
auth_basic "rclone";
|
||||
auth_basic_user_file /etc/nginx/.htpasswd;
|
||||
}
|
||||
|
||||
# =========================================================================
|
||||
# Metadata Editor (standalone React app)
|
||||
# Serves static files for the metadata editor
|
||||
# API routes (/api/metadata/*, /api/kv/*) are handled by the Go API
|
||||
# via the /api/ proxy above
|
||||
# =========================================================================
|
||||
location /editor/ {
|
||||
alias /app/editor/dist/;
|
||||
index index.html;
|
||||
try_files $uri $uri/ /editor/index.html;
|
||||
}
|
||||
|
||||
# =========================================================================
|
||||
# WebDAV HTML browser (for iframe embedding in dashboard)
|
||||
# Returns HTML directory listings instead of JSON
|
||||
# =========================================================================
|
||||
location /webdav-browser/ {
|
||||
alias /files/;
|
||||
autoindex on;
|
||||
# No autoindex_format = defaults to HTML
|
||||
charset utf-8;
|
||||
}
|
||||
|
||||
# =========================================================================
|
||||
# WebDAV endpoint for file access
|
||||
# Exposes /files directory for read/write operations
|
||||
# Supports: GET (read), PUT (write), DELETE, MKCOL (mkdir), PROPFIND
|
||||
# =========================================================================
|
||||
location /webdav/ {
|
||||
alias /files/;
|
||||
|
||||
# WebDAV methods
|
||||
dav_methods PUT DELETE MKCOL COPY MOVE;
|
||||
dav_access user:rw group:rw all:r;
|
||||
|
||||
# Enable autoindex for directory listings (alternative to PROPFIND)
|
||||
autoindex on;
|
||||
autoindex_format json;
|
||||
|
||||
# Allow creating directories automatically
|
||||
create_full_put_path on;
|
||||
|
||||
# No size limit for uploads (large media files)
|
||||
client_max_body_size 0;
|
||||
|
||||
# Optimize for large file transfers
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on;
|
||||
|
||||
# Output buffering for large files
|
||||
output_buffers 1 512k;
|
||||
aio threads;
|
||||
|
||||
# CORS headers for cross-container access
|
||||
add_header 'Access-Control-Allow-Origin' '*' always;
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, HEAD, PUT, DELETE, MKCOL, COPY, MOVE, PROPFIND, OPTIONS' always;
|
||||
add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type, Depth, Range, If-Range' always;
|
||||
add_header 'Access-Control-Expose-Headers' 'Content-Length, Content-Range, Accept-Ranges' always;
|
||||
|
||||
# Handle OPTIONS preflight
|
||||
if ($request_method = 'OPTIONS') {
|
||||
add_header 'Access-Control-Allow-Origin' '*';
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, HEAD, PUT, DELETE, MKCOL, COPY, MOVE, PROPFIND, OPTIONS';
|
||||
add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type, Depth, Range, If-Range';
|
||||
add_header 'Access-Control-Max-Age' 1728000;
|
||||
add_header 'Content-Type' 'text/plain; charset=utf-8';
|
||||
add_header 'Content-Length' 0;
|
||||
return 204;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user