Skip to content

Commit 2afaaae

Browse files
committed
Updated docker files and fixed j-hub configs.
1 parent ef8aeea commit 2afaaae

File tree

8 files changed

+54
-27
lines changed

8 files changed

+54
-27
lines changed

Dockerfile_singleuser

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ RUN pip3 install --no-cache-dir dvc flask GitPython elasticsearch opensearch-py
172172
RUN pip3 install --no-cache-dir opencv-python torchvision eland plotly
173173

174174
# XNAT
175-
RUN pip3 install --no-cache-dir xnat
175+
RUN pip3 install --no-cache-dir xnat
176176

177177
# medcat & models
178178
RUN pip3 install --no-cache-dir -U spacy click torch thinc

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ There are two docker compose files:
3939
Check the [env/general.env](./env/general.env), set the `CPU_ARCHITECTURE` variable to whatever you need, the default for most Laptops/PCs is `amd64`, if you have an ARM laptop/device then set to `arm64`, that should suffice.
4040

4141
Execute the following in the main repo directory:
42+
4243
```
43-
source envs/*
44+
bash export_env_vars.sh
4445
docker compose up -d
4546
```
4647

config/jupyterhub_config.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def pre_spawn_hook(spawner):
6666
#c.DockerSpawner.notebook_dir = notebook_dir
6767
# Mount the real user"s Docker volume on the host to the notebook user"s
6868
# notebook directory in the container
69-
c.DockerSpawner.volumes = { "jupyterhub-user-{username}": notebook_dir, "jupyter-hub-shared-scratch": shared_content_dir}
69+
c.DockerSpawner.volumes = {"jupyterhub-user-{username}": notebook_dir, "jupyter-hub-shared-scratch": shared_content_dir}
7070
# volume_driver is no longer a keyword argument to create_container()
7171

7272

@@ -134,13 +134,15 @@ def post_spawn_hook(spawner):
134134
# need an admin approval so they can actually log in the system.
135135
c.Authenticator.open_signup = False
136136

137-
c.NotebookApp.allow_root=False
137+
c.NotebookApp.allow_root = False
138138

139139
c.LocalAuthenticator.create_system_users = True
140140
c.SystemdSpawner.dynamic_users = True
141141
c.PAMAuthenticator.admin_groups = {"wheel"}
142142
c.Authenticator.whitelist = whitelist = set()
143143

144+
#c.Authenticator.allow_all = True
145+
144146
curr_dir = os.path.dirname(__file__)
145147

146148
# Get active users
@@ -270,12 +272,12 @@ def start(self):
270272
c.ConfigurableHTTPProxy.api_url = jupyter_hub_proxy_url + str(jupyter_hub_proxy_api_port)
271273
# ideally a private network address
272274
# c.JupyterHub.proxy_api_ip = "10.0.1.4"
273-
c.JupyterHub.proxy_api_port = jupyter_hub_proxy_api_port
275+
# c.JupyterHub.proxy_api_port = jupyter_hub_proxy_api_port
274276

275277
# TLS config
276278
c.JupyterHub.port = jupyter_hub_ssl_port
277-
c.JupyterHub.ssl_key = os.environ.get("SSL_KEY", "/etc/jupyterhub/root-ca.key")
278-
c.JupyterHub.ssl_cert = os.environ.get("SSL_CERT", "/etc/jupyterhub/root-ca.pem")
279+
c.JupyterHub.ssl_key = os.environ.get("SSL_KEY", "/srv/jupyterhub/root-ca.key")
280+
c.JupyterHub.ssl_cert = os.environ.get("SSL_CERT", "/srv/jupyterhub/root-ca.pem")
279281

280282
# Persist hub data on volume mounted inside container
281283
data_dir = os.environ.get("DATA_VOLUME_CONTAINER", "./")

docker-compose-dev.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
services:
22
cogstack-jupyter-hub:
33
build: ./Dockerfile_hub
4-
container_name: cogstack-jupyter-hub
4+
container_name: cogstack-jupyter-hub-dev
55
restart: always
66
environment:
77
- http_proxy=$HTTP_PROXY
@@ -11,19 +11,19 @@ services:
1111
- JUPYTERHUB_INTERNAL_PROXY_API_PORT=${JUPYTERHUB_INTERNAL_PROXY_API_PORT:-8887}
1212
- JUPYTERHUB_SSL_PORT=${JUPYTERHUB_SSL_PORT:-443}
1313
env_file:
14-
- ./env/jupyter.env
1514
- ./env/general.env
15+
- ./env/jupyter.env
1616
volumes:
1717
- jupyter-hub-shared-scratch:/home/jovyan/scratch
18-
- jupyter-hub-vol:/etc/jupyterhub
18+
- jupyter-hub-vol:/srv/jupyterhub
1919
# Security configs
20-
- ./${DEFAULT_SECURITY_DIR:-./security/}root-ca.key:/etc/jupyterhub/root-ca.key:ro
21-
- ./${DEFAULT_SECURITY_DIR:-./security/}root-ca.pem:/etc/jupyterhub/root-ca.pem:ro
22-
- ./config/jupyterhub_cookie_secret:/etc/jupyterhub/jupyterhub_cookie_secret:ro
20+
- ./${DEFAULT_SECURITY_DIR:-./security/}root-ca.key:/srv/jupyterhub/root-ca.key:ro
21+
- ./${DEFAULT_SECURITY_DIR:-./security/}root-ca.pem:/srv/jupyterhub/root-ca.pem:ro
22+
- ./config/jupyterhub_cookie_secret:/srv/jupyterhub/jupyterhub_cookie_secret:ro
2323
# User list and jupyter config
24-
- ./config/jupyterhub_config.py:/etc/jupyterhub/jupyterhub_config.py:ro
25-
- ./config/userlist:/etc/jupyterhub/userlist:ro
26-
- ./config/teamlist:/etc/jupyterhub/teamlist:ro
24+
- ./config/jupyterhub_config.py:/srv/jupyterhub/jupyterhub_config.py:ro
25+
- ./config/userlist:/srv/jupyterhub/userlist:ro
26+
- ./config/teamlist:/srv/jupyterhub/teamlist:ro
2727
# Give access to Docker socket
2828
- /var/run/docker.sock:/var/run/docker.sock
2929
ulimits:

docker-compose.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@ services:
1111
- JUPYTERHUB_INTERNAL_PROXY_API_PORT=${JUPYTERHUB_INTERNAL_PROXY_API_PORT:-8887}
1212
- JUPYTERHUB_SSL_PORT=${JUPYTERHUB_SSL_PORT:-443}
1313
env_file:
14-
- ./env/jupyter.env
1514
- ./env/general.env
15+
- ./env/jupyter.env
1616
volumes:
1717
- jupyter-hub-shared-scratch:/home/jovyan/scratch
18-
- jupyter-hub-vol:/etc/jupyterhub
18+
- jupyter-hub-vol:/srv/jupyterhub
1919
# Security configs
20-
- ./${DEFAULT_SECURITY_DIR:-./security/}root-ca.key:/etc/jupyterhub/root-ca.key:ro
21-
- ./${DEFAULT_SECURITY_DIR:-./security/}root-ca.pem:/etc/jupyterhub/root-ca.pem:ro
22-
- ./config/jupyterhub_cookie_secret:/etc/jupyterhub/jupyterhub_cookie_secret:ro
20+
- ./${DEFAULT_SECURITY_DIR:-./security/}root-ca.key:/srv/jupyterhub/root-ca.key:ro
21+
- ./${DEFAULT_SECURITY_DIR:-./security/}root-ca.pem:/srv/jupyterhub/root-ca.pem:ro
22+
- ./config/jupyterhub_cookie_secret:/srv/jupyterhub/jupyterhub_cookie_secret:ro
2323
# User list and jupyter config
24-
- ./config/jupyterhub_config.py:/etc/jupyterhub/jupyterhub_config.py:ro
25-
- ./config/userlist:/etc/jupyterhub/userlist:ro
26-
- ./config/teamlist:/etc/jupyterhub/teamlist:ro
24+
- ./config/jupyterhub_config.py:/srv/jupyterhub/jupyterhub_config.py:ro
25+
- ./config/userlist:/srv/jupyterhub/userlist:ro
26+
- ./config/teamlist:/srv/jupyterhub/teamlist:ro
2727
# Give access to Docker socket
2828
- /var/run/docker.sock:/var/run/docker.sock
2929
ulimits:

env/general.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
# set only CPU_ARCHITECTURE to amd/arm64
55
# remove if this causes issues on any other platform
66
# possible values: amd64, arm64
7-
CPU_ARCHITECTURE=amd64
7+
CPU_ARCHITECTURE=arm64
88
DOCKER_DEFAULT_PLATFORM=linux/${CPU_ARCHITECTURE:-amd64}

env/jupyter.env

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ DOCKER_NOTEBOOK_IDLE_TIMEOUT=7200
3131
DATA_VOLUME_CONTAINER="./"
3232

3333
# These don't really need to be changed.
34-
SSL_KEY="/etc/jupyterhub/root-ca.key"
35-
SSL_CERT="/etc/jupyterhub/root-ca.pem"
34+
SSL_KEY="/srv/jupyterhub/root-ca.key"
35+
SSL_CERT="/srv/jupyterhub/root-ca.pem"
3636

3737
DOCKER_NETWORK_NAME="cogstack-net"
3838
DOCKER_JUPYTER_HUB_CONTAINER_NAME="cogstack-jupyter-hub"

export_env_vars.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
3+
set -o allexport
4+
5+
current_dir=$(pwd)
6+
env_dir="./env/"
7+
8+
env_files=(
9+
$env_dir"general.env"
10+
$env_dir"jupyter.env"
11+
)
12+
13+
set -a
14+
15+
for env_file in ${env_files[@]}; do
16+
source $env_file
17+
done
18+
19+
# for nginx vars
20+
export DOLLAR="$"
21+
22+
set +a
23+
24+
set +o allexport

0 commit comments

Comments
 (0)