-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
65 additions
and
45 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,53 @@ | ||
user nginx; | ||
worker_processes auto; | ||
error_log /var/log/nginx/error.log warn; | ||
pid /var/run/nginx.pid; | ||
|
||
events { | ||
worker_connections 1024; | ||
} | ||
|
||
http { | ||
upstream backend_servers { | ||
server 203.0.113.10:80; # Kubernetes backend service | ||
server 203.0.113.20:5000; # Non-Kubernetes backend server | ||
} | ||
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" "$http_x_forwarded_for"'; | ||
access_log /var/log/nginx/access.log main; | ||
sendfile on; | ||
keepalive_timeout 65; | ||
|
||
server { | ||
listen 80; | ||
location /api/ { | ||
proxy_pass http://backend_servers; | ||
server_name localhost; | ||
|
||
location / { | ||
proxy_pass http://client:3000; | ||
proxy_http_version 1.1; | ||
proxy_set_header Upgrade $http_upgrade; | ||
proxy_set_header Connection "upgrade"; | ||
|
||
# Check if we're in production mode | ||
if ($NODE_ENV = "production") { | ||
root /usr/share/nginx/html; | ||
try_files $uri $uri/ /index.html; | ||
} | ||
} | ||
|
||
location /api { | ||
proxy_pass http://backend:5000; | ||
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; | ||
} | ||
|
||
# Development-only location block for WebSocket support | ||
location /sockjs-node { | ||
proxy_pass http://client:3000; | ||
proxy_http_version 1.1; | ||
proxy_set_header Upgrade $http_upgrade; | ||
proxy_set_header Connection "upgrade"; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
|
||
# Build and push Docker images | ||
docker build -t your-registry/backend:latest ./backend | ||
docker build -t your-registry/frontend:latest ./frontend | ||
docker push your-registry/backend:latest | ||
docker push your-registry/frontend:latest | ||
|
||
# Apply Kubernetes configurations | ||
kubectl apply -k ./k8s | ||
|
||
# Set up Nginx reverse proxy on non-Kubernetes server | ||
ssh user@non-kubernetes-server 'sudo apt-get update && sudo apt-get install -y nginx' | ||
scp ./nginx/nginx.conf user@non-kubernetes-server:/etc/nginx/nginx.conf | ||
ssh user@non-kubernetes-server 'sudo systemctl restart nginx' | ||
|
||
# Set up WireGuard VPN | ||
scp ./vpn/wireguard-config.conf user@server:/etc/wireguard/wg0.conf | ||
ssh user@server 'sudo systemctl start wg-quick@wg0' |