From 6ffd4901043fa21ca583c1ceab740b4cba2ef9a2 Mon Sep 17 00:00:00 2001 From: talksik Date: Mon, 14 Aug 2023 14:43:49 -0700 Subject: [PATCH] consolidating based on subdomains --- docker-compose.yaml | 11 ++----- nginx.conf | 70 +++++++++++++++++++++++++++++---------------- 2 files changed, 48 insertions(+), 33 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 85b4b83..cda114f 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -7,15 +7,10 @@ services: restart: unless-stopped container_name: nginx-reverse-proxy ports: - - 8080:8080 # hello world nginx docker container itself - - 5000:5000 # container registry with tls within docker + - 80:80 + - 443:443 - # rancher - - 2000:2000 - - 2001:2001 - - - 80:80 # hello world in kubernetes cluster - - 3080:3080 # api within kubernetes cluster + # kubernetes - 6000:6000 # audio route - 6001:6001 # video route - 6002:6002 # presence route diff --git a/nginx.conf b/nginx.conf index cf19d77..b04a670 100644 --- a/nginx.conf +++ b/nginx.conf @@ -1,10 +1,25 @@ -# nginx.conf for a basic web server -events {} +user nginx; +worker_processes auto; +error_log /var/log/nginx/error.log; + +events { + worker_connections 1024; +} http { + # TODO: route to proper location based on subdomain server { - listen 8080; - server_name localhost; + listen 80; + server_name flowy.live; + + location / { + root /usr/share/nginx/html; + index index.html; + } + } + server { + listen 443; + server_name flowy.live; location / { root /usr/share/nginx/html; @@ -12,9 +27,23 @@ http { } } - # container registry server { - listen 5000; + listen 80; + server_name registry.flowy.live; + + location / { + proxy_pass http://registry: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; + } + } + server { + listen 443; + server_name registry.flowy.live; + + # TODO: add tls termination at nginx level location / { proxy_pass http://registry:5000; @@ -25,9 +54,9 @@ http { } } - # rancher http server { - listen 2000; + listen 80; + server_name rancher.flowy.live; location / { proxy_pass http://rancher:80; @@ -37,32 +66,23 @@ http { proxy_set_header X-Forwarded-Proto $scheme; } } - - # kubernetes cluster hello world - server { - listen 80; - - location / { - proxy_pass http://localhost:33360; # TODO: change to NodePort of helloworld within kubernetes - 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; - } - } } stream { # rancher https: passthrough ssl server { - listen 2001; + listen 443; + server_name rancher.flowy.live; + proxy_pass rancher:443; } - # kubernetes cluster api + # k8s api: passthrough grpc/tcp server { - listen 3080; - proxy_pass localhost:33360; # TODO: change to NodePort of api within kubernetes + listen 80; + server_name api.flowy.live; + + proxy_pass localhost:33606; } # k8s audio relay