-
Notifications
You must be signed in to change notification settings - Fork 222
/
Copy pathdocker-compose.yml
109 lines (99 loc) · 3.72 KB
/
docker-compose.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
version: "3.5"
# A docker user network is created and referenced by the service. This network
# must also get conveyed to launched kernel containers and that occurs via the env variable: EG_DOCKER_NETWORK
# Notes (FIXMEs):
# 1. We need to address the need to run as UID 0 (root). This appears to be required inorder to create containers/services from within.
# 2. Using endpoint-mode dnsrr (which appears to be required inorder for kernel container to send the connection info response back)
# also required mode=host on any published ports. :-(
# 3. We only use one replica since session affinity is another point of investigation in Swarm
services:
enterprise-gateway:
image: elyra/enterprise-gateway:dev
user: root
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
# It's often helpful to mount the kernelspec files from the host into the container.
# Since this could be a deployed to a swarm cluster, it is recommended in this case that these be mounted on an
# NFS volume available to all nodes of the cluster, or a volume plugin is used instead of a bind mount.
# - /usr/local/share/jupyter/kernels:/usr/local/share/jupyter/kernels
environment:
- "EG_DOCKER_NETWORK=${EG_DOCKER_NETWORK:-enterprise-gateway_enterprise-gateway}"
- "EG_KERNEL_LAUNCH_TIMEOUT=${EG_KERNEL_LAUNCH_TIMEOUT:-60}"
- "EG_CULL_IDLE_TIMEOUT=${EG_CULL_IDLE_TIMEOUT:-3600}"
- "EG_KERNEL_WHITELIST=${EG_KERNEL_WHITELIST:-'r_docker','python_docker','python_tf_docker','python_tf_gpu_docker','scala_docker'}"
- "EG_MIRROR_WORKING_DIRS=${EG_MIRROR_WORKING_DIRS:-False}"
- "EG_RESPONSE_PORT=${EG_RESPONSE_PORT:-8877}"
- "KG_PORT=${KG_PORT:-8888}"
networks:
- "enterprise-gateway"
labels:
app: "enterprise-gateway"
component: "enterprise-gateway"
deploy:
replicas: 1
endpoint_mode: dnsrr
labels:
app: "enterprise-gateway"
component: "enterprise-gateway"
enterprise-gateway-proxy:
image: haproxy:alpine
ports:
- ${KG_PORT:-8888}:8888
- 9088:9088
networks:
- "enterprise-gateway"
entrypoint: ""
command:
- /bin/sh
- -c
- |
cat <<EOF > /usr/local/etc/haproxy/haproxy.cfg
global
maxconn 4096
daemon
log stdout format raw local0
defaults
log global
option httplog
mode http
option http-server-close
option dontlognull
option redispatch
option contstats
retries 3
backlog 10000
timeout client 25s
timeout connect 5s
timeout server 25s
timeout tunnel 3600s
timeout http-keep-alive 1s
timeout http-request 15s
timeout queue 30s
timeout tarpit 60s
default-server inter 3s rise 2 fall 3
option forwardfor
listen stats
bind :9088
mode http
stats enable
stats refresh 10s
stats realm Haproxy\ Statistics
stats show-node
stats uri /
resolvers docker
nameserver dns 127.0.0.11:53
hold valid 1s
frontend proxy
bind 0.0.0.0:8888 maxconn 10000
option forwardfor
default_backend enterprise-gateway
backend enterprise-gateway
dynamic-cookie-key ENTERPRISE_KEY
cookie SRVID insert dynamic
server-template enterprise-gateway 2 enterprise-gateway:8888 check resolvers docker
EOF
exec /docker-entrypoint.sh haproxy -f /usr/local/etc/haproxy/haproxy.cfg
networks:
enterprise-gateway:
name: enterprise-gateway
driver: overlay