-
Notifications
You must be signed in to change notification settings - Fork 12
/
docker-compose-letsencrypt.yml
157 lines (149 loc) · 4.33 KB
/
docker-compose-letsencrypt.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
# JupyterHub docker-compose configuration file
version: "3"
services:
#hub-db:
# build:
# context: .
# dockerfile: server_apps/postgres-hub/Dockerfile.postgres
# args:
# JPY_PSQL_PASSWORD: ${JPY_PSQL_PASSWORD}
# POSTGRES_VERSION: ${POSTGRES_VERSION}
# image: postgres-hub
# container_name: jupyterhub-db
# restart: always
# environment:
# POSTGRES_DB: ${POSTGRES_DB}
# PGDATA: ${DB_VOLUME_CONTAINER}
# JPY_PSQL_PASSWORD: ${JPY_PSQL_PASSWORD}
# POSTGRES_PASSWORD: ${JPY_PSQL_PASSWORD}
# env_file:
# - .env
# volumes:
# - "db:${DB_VOLUME_CONTAINER}"
# healthcheck:
# test: ["CMD-SHELL", "pg_isready -U postgres"]
# interval: 30s
# timeout: 30s
# retries: 3
# https://github.com/nginx-proxy/nginx-proxy
nginx-proxy:
build:
context: nginx-proxy/
dockerfile: Dockerfile
image: nginx_proxy
ports:
- "80:80"
container_name: nginx_proxy
restart: always
volumes:
- "/var/run/docker.sock:/tmp/docker.sock:ro"
- "./secrets:/etc/nginx/certs:rw"
- "nginx_vhostd:/etc/nginx/vhost.d:rw"
- "nginx_html:/usr/share/nginx/html:rw"
healthcheck:
test: "ping -c 1 localhost || fail"
interval: 3m
timeout: 3s
retries: 3
#logging:
# driver: syslog
# options:
# syslog-address: "udp://0.0.0.0:514"
# syslog-format: rfc3164
# tag: nginxproxy
# https://github.com/nginx-proxy/acme-companion
letsencrypt:
depends_on:
- nginx-proxy
#build:
# context: server_apps/letsencrypt
# dockerfile: Dockerfile
restart: always
#image: letsencrypt
image: jrcs/letsencrypt-nginx-proxy-companion
container_name: letsencrypt
environment:
DEFAULT_EMAIL: herman.tolentino@gmail.com
NGINX_PROXY_CONTAINER: nginx_proxy
CERTS_UPDATE_INTERVAL: 86400
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "./secrets:/etc/nginx/certs:rw"
- "nginx_vhostd:/etc/nginx/vhost.d:rw"
- "nginx_html:/usr/share/nginx/html:rw"
healthcheck:
test: "ping -c 1 localhost || fail"
interval: 3m
timeout: 3s
retries: 3
hub:
#depends_on:
# - hub-db
hostname: jupyterhub
build:
context: .
dockerfile: Dockerfile.jupyterhub
args:
JUPYTERHUB_VERSION: ${JUPYTERHUB_VERSION}
JUPYTER_UI: ${JUPYTER_UI}
LOGO_IMAGE: ${LOGO_IMAGE}
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}"
- "./secrets:/srv/jupyterhub/secrets"
healthcheck:
test: "curl -f -k https://localhost/hub/health || false"
interval: 2m
timeout: 3s
retries: 3
ports:
- "443:443"
- "8000:8000"
env_file:
- .env
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}
JUPYTERHUB_SERVICE_HOST_IP: ${JUPYTERHUB_SERVICE_HOST_IP}
# Server time out
SERVER_TIMEOUT_SECONDS: ${SERVER_TIMEOUT_SECONDS}
# Postgres db info
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_HOST: hub-db
LETSENCRYPT_HOST: ${JH_FQDN}
LETSENCRYPT_EMAIL: ${JH_EMAIL}
VIRTUAL_HOST: ${JH_FQDN}
VIRTUAL_PORT: ${VIRTUAL_PORT}
command: >
jupyterhub --ip=0.0.0.0 -f /srv/jupyterhub/jupyterhub_config.py --log-level=${JUPYTERHUB_LOG_LEVEL} &>> /var/log/jupyter/jupyterhub.log
volumes:
data:
external:
name: ${DATA_VOLUME_HOST}
db:
external:
name: ${DB_VOLUME_HOST}
nginx_vhostd:
external:
name: nginx_vhostd
nginx_html:
external:
name: nginx_html
networks:
default:
external:
name: ${DOCKER_NETWORK_NAME}