Skip to content

Commit

Permalink
Simplify directores setup
Browse files Browse the repository at this point in the history
  • Loading branch information
xcompass committed Feb 13, 2024
1 parent bff6fa5 commit 372a337
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 9 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ EXPOSE 5000
COPY usr/share/jupyter-canvas-api/api-server.py /usr/share/jupyter-canvas-api/api-server.py
COPY usr/share/jupyter-canvas-api/requirements.txt /usr/share/jupyter-canvas-api/requirements.txt
COPY usr/local/bin/hourly-rsync.sh /etc/cron.hourly/hourly-api-rsync
COPY docker-entrypoint.sh /
RUN mkdir /mnt/efs
RUN chmod +x /etc/cron.hourly/hourly-api-rsync
RUN touch /etc/crontab /etc/cron.*/*
WORKDIR /usr/share/jupyter-canvas-api/
RUN pip3 install -r /usr/share/jupyter-canvas-api/requirements.txt
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD printenv | grep -v "no_proxy" > /etc/environment && /etc/init.d/cron start && python3 -u /usr/share/jupyter-canvas-api/api-server.py
16 changes: 16 additions & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
set -eo pipefail

BASE_DIR="${BASE_DIR:-/mnt/efs}"
DEFAULT_JNOTE_HOME="$BASE_DIR/${JNOTE_COURSE_CODE,,}"
DEFAULT_JNOTE_SNAP="$BASE_DIR/${JNOTE_COURSE_CODE,,}-snap"
DEFAULT_JNOTE_INTSNAP="$BASE_DIR/${JNOTE_COURSE_CODE,,}-internal"

export JNOTE_HOME="${JNOTE_HOME:-$DEFAULT_JNOTE_HOME}"
export JNOTE_SNAP="${JNOTE_SNAP:-$DEFAULT_JNOTE_SNAP}"
export JNOTE_INTSNAP="${JNOTE_INTSNAP:-$DEFAULT_JNOTE_INTSNAP}"

mkdir -p $JNOTE_HOME $JNOTE_SNAP $JNOTE_INTSNAP
chmod 777 $JNOTE_HOME $JNOTE_SNAP $JNOTE_INTSNAP

exec "$@"
19 changes: 10 additions & 9 deletions kube-manifests/jupyterhub-api-pod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ metadata:
spec:
replicas: 1
selector:
matchLabels:
matchLabels:
run: jupyterhub-api-app
app: jhub-api
organization: ubc
Expand All @@ -34,10 +34,10 @@ spec:
memory: 2G
limits:
cpu: "500m"
memory: 2G
memory: 2G
env:
- name: JUPYTER_API_KEY
valueFrom:
valueFrom:
secretKeyRef:
name: jupyterhub-api-key
key: jupyterhub-api-key
Expand All @@ -49,12 +49,13 @@ spec:
value: "5000"
- name: JUPYTER_API_HOST
value: "0.0.0.0"
- name: JNOTE_HOME
value: "/mnt/efs/dsci-100-home/"
- name: JNOTE_SNAP
value: "/mnt/efs/dsci-100-snap/"
- name: JNOTE_INTSNAP
value: "/mnt/efs/dsci-100-internal/"
# optional, to override default values
# - name: JNOTE_HOME
# value: "/mnt/efs/dsci-100-home/"
# - name: JNOTE_SNAP
# value: "/mnt/efs/dsci-100-snap/"
# - name: JNOTE_INTSNAP
# value: "/mnt/efs/dsci-100-internal/"
ports:
- containerPort: 5000
volumeMounts:
Expand Down

0 comments on commit 372a337

Please sign in to comment.