# Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. # JupyterHub docker-compose configuration file version: "2" services: hub-db: image: postgres:9.5 container_name: jupyterhub-db restart: always environment: POSTGRES_DB: ${POSTGRES_DB} PGDATA: ${DB_VOLUME_CONTAINER} env_file: - secrets/postgres.env volumes: - "db:${DB_VOLUME_CONTAINER}" hub: depends_on: - hub-db build: context: . dockerfile: Dockerfile.jupyterhub args: JUPYTERHUB_VERSION: ${JUPYTERHUB_VERSION} restart: always image: jupyterhub container_name: jupyterhub volumes: # Bind Docker socket on the host so we can connect to the daemon from # within the container - "/var/run/docker.sock:/var/run/docker.sock:rw" # Bind Docker volume on host for JupyterHub database and cookie secrets - "data:${DATA_VOLUME_CONTAINER}" links: - hub-db environment: # All containers will join this network DOCKER_NETWORK_NAME: ${DOCKER_NETWORK_NAME} # JupyterHub will spawn this Notebook image for users DOCKER_NOTEBOOK_IMAGE: ${LOCAL_NOTEBOOK_IMAGE} # Notebook directory inside user image DOCKER_NOTEBOOK_DIR: ${DOCKER_NOTEBOOK_DIR} # Using this run command (optional) DOCKER_SPAWN_CMD: ${DOCKER_SPAWN_CMD} # Postgres db info POSTGRES_DB: ${POSTGRES_DB} POSTGRES_HOST: hub-db VIRTUAL_HOST: hub.consistentbayes.com LETSENCRYPT_HOST: hub.consistentbayes.com LETSENCRYPT_EMAIL: consistentbayes@gmail.com env_file: - secrets/postgres.env - secrets/oauth.env command: > jupyterhub -f /srv/jupyterhub/jupyterhub_config.py labels: # Traefik configuration. - "traefik.enable=true" - "traefik.frontend.rule=Host:hub.consistentbayes.com" nginx: image: nginx:latest container_name: nginx volumes: - /etc/nginx/conf.d - /etc/letsencrypt/live:/etc/nginx/certs:ro - /etc/nginx/vhost.d - /usr/share/nginx/html ports: - "80:80" - "443:443" labels: - "com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy" nginx-gen: image: jwilder/docker-gen container_name: nginx-gen volumes_from: [nginx] volumes: - /path/to/nginx.tmpl:/etc/docker-gen/templates/nginx.tmpl:ro - /var/run/docker.sock:/tmp/docker.sock:ro command: -notify-sighup nginx -watch -wait 5s:30s /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf labels: - "com.github.jrcs.letsencrypt_nginx_proxy_companion.docker_gen" nginx-letsencrypt: image: jrcs/letsencrypt-nginx-proxy-companion container_name: nginx-letsencrypt volumes_from: [nginx] volumes: - /etc/letsencrypt/live:/etc/nginx/certs:rw - /var/run/docker.sock:/var/run/docker.sock:ro environment: - NGINX_DOCKER_GEN_CONTAINER=nginx-gen - NGINX_PROXY_CONTAINER=nginx volumes: data: external: name: ${DATA_VOLUME_HOST} db: external: name: ${DB_VOLUME_HOST} networks: default: external: name: ${DOCKER_NETWORK_NAME}