commit fc70e26d6ee010f33ae17622f28a8646cced3685
parent 1846143a63a067fdc9d3d3249c797137a34658af
Author: Andreas Gruhler <andreas.gruhler@adfinis.com>
Date: Fri, 11 Oct 2024 01:22:59 +0200
feat(myheats-doc): add nginx proxy
Diffstat:
3 files changed, 37 insertions(+), 2 deletions(-)
diff --git a/docker/docker-myheats-nginx/README.md b/docker/docker-myheats-nginx/README.md
@@ -6,7 +6,7 @@ Build instructions for Digital Ocean.
Estimated Monthly
- App Cost: $17.00 (2x$5 services + $7 PostgreSQL db)
- Managed external db: $15
-- Droplet (incl. db, app services,): $6
+- Droplet (incl. db, app services): $6
https://www.digitalocean.com/pricing
diff --git a/docker/docker-myheats-nginx/docker-compose.yml b/docker/docker-myheats-nginx/docker-compose.yml
@@ -4,13 +4,21 @@
version: '3.9'
services:
+ proxy:
+ container_name: proxy
+ image: docker.io/library/nginx:stable-alpine
+ volumes:
+ - ./proxy.conf:/etc/nginx/conf.d/proxy.conf:ro
+ networks:
+ - myheats
+
myheats-frontend:
container_name: myheats-frontend
image: registry.digitalocean.com/myheats/myheats:latest
networks:
- myheats
- myheats-backend:
+ myheats-api:
container_name: myheats-api
image: registry.digitalocean.com/myheats/myheats:api
networks:
diff --git a/docker/docker-myheats-nginx/proxy.conf b/docker/docker-myheats-nginx/proxy.conf
@@ -0,0 +1,27 @@
+server {
+ listen 443 ssl;
+
+ ssl_certificate /etc/letsencrypt/live/savognin.p0c.ch/fullchain.pem;
+ ssl_certificate_key /etc/letsencrypt/live/savognin.p0c.ch/privkey.pem;
+
+ location / {
+ proxy_pass http://myheats-frontend:80;
+ 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;
+ }
+ location /api {
+ proxy_pass http://myheats-api:8000;
+ 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;
+
+ # WebSocket proxying
+ # https://nginx.org/en/docs/http/websocket.html
+ proxy_http_version 1.1;
+ proxy_set_header Upgrade $http_upgrade;
+ proxy_set_header Connection "upgrade";
+ }
+}