Skip to content

Instantly share code, notes, and snippets.

@beardicus
Created December 22, 2016 03:20
Show Gist options
  • Save beardicus/2ad7e60da3e1d30814fb8c072261097f to your computer and use it in GitHub Desktop.
Save beardicus/2ad7e60da3e1d30814fb8c072261097f to your computer and use it in GitHub Desktop.
Compose file for launching octoprint, mjpg-streamer, and proxying them through nginx
version: '2.1'
services:
octoprint:
image: beardicus/octoprint
volumes:
- ./data:/data
mjpg-streamer:
image: beardicus/mjpg-streamer
devices:
- '/dev/video0'
nginx:
image: nginx
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
ports:
- 80:80
links:
- octoprint
- mjpg-streamer
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 80;
server_name localhost;
client_max_body_size 25M;
location / {
proxy_pass http://octoprint:5000/;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /sockjs {
proxy_pass http://octoprint:5000; # NO trailing slash here!
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location /webcam/ {
proxy_pass http://mjpg-streamer:8080/;
}
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment