Skip to content

Instantly share code, notes, and snippets.

@paparaka
Last active February 24, 2024 12:03
Show Gist options
  • Star 12 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save paparaka/294450b727c2aa5455e7125f695e54ed to your computer and use it in GitHub Desktop.
Save paparaka/294450b727c2aa5455e7125f695e54ed to your computer and use it in GitHub Desktop.
---
version: '2'
services:
jupyter:
image: jupyter/scipy-notebook
container_name: jupyter
command: start.sh jupyter lab --LabApp.token='*******************' --LabApp.allow_remote_access='True' --LabApp.allow_origin='*'
restart: always
environment:
JUPYTER_ENABLE_LAB: "yes"
networks:
- skynet
hostname: jupyter
nginx:
image: nginx
container_name: nginx
restart: always
networks:
- skynet
ports:
- 80:80
- 443:443
volumes:
- ./self.crt:/etc/nginx/self.crt
- ./self.key:/etc/nginx/self.key
- /etc/nginx/nginx.conf:/etc/nginx/nginx.conf
networks:
skynet:
driver: bridge
ipam:
driver: default
config:
- subnet: 192.168.69.0/24
user root;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
server {
listen 80 default;
server_name _;
return 301 https://$host$request_uri;
}
upstream jupyter {
server jupyter:8888;
}
############## Jupyter ####################
server {
listen 0.0.0.0:443 ssl;
server_name jupyter.remote.lan
www.jupyter.remote.lan;
ssl_certificate /etc/nginx/self.crt;
ssl_certificate_key /etc/nginx/self.key;
ssl_protocols TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA512:EECDH+ECDSA+SHA384:EECDH+ECDSA+SHA256:ECDH+AESGCM:ECDH+AES256:DH+AESGCM:DH+AES256:RSA+AESGCM:!aNULL:!eNULL:!LOW:!RC4:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS;
ssl_session_cache builtin:1000 shared:SSL:10m;
access_log /var/log/nginx/jupyter.log ;
error_log /var/log/nginx/jupyter.error.log debug;
location / {
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;
proxy_pass http://jupyter;
proxy_read_timeout 90;
}
location ~* /(api/kernels/[^/]+/(channels|iopub|shell|stdin)|terminals/websocket)/? {
proxy_pass http://jupyter;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# WebSocket support
proxy_http_version 1.1;
proxy_set_header Upgrade "websocket";
proxy_set_header Connection "Upgrade";
proxy_read_timeout 86400;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment