use nginx for ssl & reverse proxy

This commit is contained in:
Will Murphy 2023-01-27 12:44:49 -06:00
parent ba0cc5e911
commit 296651cb67
3 changed files with 22 additions and 12 deletions

View file

@ -1,2 +1,3 @@
DB_NAME=guppe
NODE_ENV=production
PORT_HTTPS=8085

View file

@ -39,8 +39,13 @@ Guppe uses Docker Swarm for easy load balancing Web server replicas
git clone https://github.com/wmurphyrd/guppe.git
cd guppe
cp .env.defaults .env
echo DOMAIN=yourdomain.com >> .env
export DOMAIN=yourdomain.com
echo DOMAIN=$DOMAIN >> .env
echo ALLOWED_DOMAINS=$DOMAIN >> .env
echo SITES='"'$DOMAIN=guppe:8085'"' >> .env
docker swarm init --advertise-addr 127.0.0.1
# all on one node for simple setup or split these onto different nodes for a distributed swarm
docker node update --label-add web=true --label-add database=true --label-add delivery=true $(hostname)
docker stack deploy --compose-file docker-compose.yml guppe
```

View file

@ -1,22 +1,28 @@
version: "3.8"
services:
proxy:
image: valian/docker-nginx-auto-ssl
restart: always
ports:
- 80:80
- 443:443
volumes:
- ssl_data:/etc/resty-auto-ssl
env_file: '.env'
guppe:
image: datatitian/guppe
deploy:
mode: replicated
replicas: 8
replicas: 4
placement:
constraints:
- "node.labels.type==web"
- "node.labels.web==true"
restart: always
ports:
- 443:443
- 80:80
env_file: '.env'
environment:
DB_URL: 'mongodb://mongodb:27017'
PORT_HTTPS: 443
PROXY_MODE: 1
depends_on:
- mongodb
volumes:
@ -34,17 +40,15 @@ services:
retries: 3
start_period: 30s
worker1:
image: datatitian/guppe
command: [ "node", "deliveryWorker.js" ]
deploy:
mode: replicated
replicas: 50
replicas: 25
placement:
constraints:
- "node.labels.type==web"
- "node.labels.delivery==true"
restart: always
env_file: '.env'
environment:
@ -63,7 +67,7 @@ services:
replicas: 1
placement:
constraints:
- "node.labels.type==database"
- "node.labels.database==true"
restart: always
volumes:
- mongo-data:/data/db