Skip to content

Instantly share code, notes, and snippets.

@papamoose
Last active February 13, 2022 16:19
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save papamoose/1a50a8e21f9a46f1bb8c8b42986dcd83 to your computer and use it in GitHub Desktop.
Save papamoose/1a50a8e21f9a46f1bb8c8b42986dcd83 to your computer and use it in GitHub Desktop.
RobinLinus-snapdrop using docker-compose and traefik

Assumes you run Traefik.

You need to checkout the repository so you can mount the server and client directories into the container.

git clone https://github.com/RobinLinus/snapdrop.git

Then modify docker-compose.yml and create templates/default.conf.template.

---
# https://github.com/RobinLinus/snapdrop
version: "3"
services:
node:
image: "node:lts-alpine"
restart: unless-stopped
user: "node"
working_dir: /home/node/app
volumes:
- ./server/:/home/node/app
command: ash -c "npm i && node index.js"
networks:
- gateway
- internal
labels:
# Watchtower autoupdate
- com.centurylinklabs.watchtower.enable=true
nginx:
image: nginx:latest
restart: unless-stopped
volumes:
- ./templates:/etc/nginx/templates:ro
- ./client:/usr/share/nginx/html
environment:
- NGINX_HOST=snapdrop.example.com
networks:
- gateway
- internal
labels:
- traefik.enable=true
- traefik.http.routers.sdrop.entrypoints=websecure
- traefik.http.routers.sdrop.rule=Host(`snapdrop.example.com`)
- traefik.http.routers.sdrop.tls.certresolver=le
- traefik.http.routers.sdrop.tls.domains[0].main=snapdrop.example.com
- traefik.http.services.sdrop.loadbalancer.server.port=80
# Watchtower autoupdate
- com.centurylinklabs.watchtower.enable=true
networks:
gateway:
external: true
internal:
external: false
server {
listen 80;
server_name ${NGINX_HOST};
expires epoch;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
location /server {
proxy_connect_timeout 300;
proxy_pass http://node:3000;
proxy_set_header Connection "upgrade";
proxy_set_header Upgrade $http_upgrade;
proxy_set_header X-Forwarded-for $remote_addr;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment