Skip to content

Commit

Permalink
Climate hub (#297)
Browse files Browse the repository at this point in the history
* testing adding nccasc workshop github usernames to hub

* deploy climate hub

* missed a value

* add secrets for login

* add the setup auth to main doc

Co-authored-by: lherwehe <lauren.herwehe@colorado.edu>
Co-authored-by: leah wasser <leahwasser@leahs-MacBook-Pro.local>
  • Loading branch information
3 people committed Oct 28, 2020
1 parent 12f60b9 commit bad16ad
Show file tree
Hide file tree
Showing 11 changed files with 163 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ script:
- |
# Build earth-analytics-hub image
python ./deploy.py --no-setup --build ea-hub
- |
# Build climate workshop image
python ./deploy.py --no-setup --build climate-hub
- |
# Build documentation
pushd docs && make html && popd
Expand Down Expand Up @@ -73,6 +76,10 @@ before_deploy:
# Stage 3, Step 2: Build & push image, then deploy earth-analytics-hub
python ./deploy.py --build --push ea-hub
python ./deploy.py --deploy ea-hub
- |
# Stage 3, Step 3: Build & push image, then deploy climate-hub
python ./deploy.py --build --push climate-hub
python ./deploy.py --deploy climate-hub
- |
# Stage 3, Step 4: Deploy monitoring of the hubs
python ./deploy.py --deploy monitoring
Expand Down
2 changes: 1 addition & 1 deletion deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ def main():
argparser.add_argument(
'chartname',
help="Select which chart to deploy",
choices=['ea-hub', 'nbgrader-hub', 'monitoring']
choices=['ea-hub', 'nbgrader-hub', 'climate-hub', 'monitoring']
)

args = argparser.parse_args()
Expand Down
39 changes: 39 additions & 0 deletions docs/source/daily-operations/new-hub.rst
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,42 @@ check that travis looked at your new hub configuration, then merge the PR.

Once your hub is up and running you will be able to reach it
at :code:`https://hub.earthdatascience.org/<hubname>`.


Step Five: If you use GItHub Authentication: Create new GitHub Oath App
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If you are using GitHub authentication then you will need to add a new
hubname.yaml file in the secrets/ directory. This directory can be unlocked
using git crypt (see setup instructions in these docs for more.)

To setup authentication:

1. In Github.com go to settings --> Developer and create a new github oauth application

Homepage Url: https://hub.earthdatascience.org/hubname-hub/hub/login
Authorization Callback Url: https://hub.earthdatascience.org/edsc-hub/hub/oauth_callback

For earth lab we prefer to keep authentication in a single account (the earth
lab account) rather than have this hosted on different individual user accounts.

Click "Register Application"

2. Once you register the application, you will have a new Client ID and Client secret that you can add to the secrets/hubmame.yaml file.

Your secret file will look something like this:

.. code-block:: yaml
jupyterhub:
proxy:
secretToken: "longstring-of-characters here"
auth:
type: github
github:
clientId: client-id-string-from-github-oath-app
clientSecret: secret-id-string-from-github-oath-app
See the authentication section of these docs for more on setting up authentication
The JupyterHub secret token comes from a secret place. Leah needs to figure out
where that is generated in the near future. :)
4 changes: 4 additions & 0 deletions hub-charts/climate-hub/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
description: A Helm chart for the climate 101 workshop hub
name: climate-hub
version: 0.1.0
4 changes: 4 additions & 0 deletions hub-charts/climate-hub/requirements.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
dependencies:
- name: jupyterhub
version: "v0.9.0"
repository: "https://jupyterhub.github.io/helm-chart"
76 changes: 76 additions & 0 deletions hub-charts/climate-hub/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
jupyterhub:
hub:
nodeSelector:
cloud.google.com/gke-nodepool: core-pool
baseUrl: /climate-hub/
annotations:
prometheus.io/scrape: "true"
# this needs to start with the value of `hub.baseUrl`
prometheus.io/path: /climate-hub/hub/metrics
resources:
requests:
cpu: 200m
memory: 256Mi
limits:
cpu: 200m
memory: 256Mi
singleuser:
image:
# tag will be set by travis on deployment
name: earthlabhubops/ea-k8s-user-climate-hub
tag: set-on-deployment
startTimeout: 600
cpu:
guarantee: 1.
limit: 2.
memory:
guarantee: 1G
limit: 2G
lifecycleHooks:
postStart:
exec:
command:
- "sh"
- "-c"
- >
gitpuller https://github.com/earthlab/climate-data-101;
proxy:
nodeSelector:
cloud.google.com/gke-nodepool: core-pool
service:
type: ClusterIP
chp:
resources:
requests:
cpu: 200m
memory: 128Mi
limits:
cpu: 200m
memory: 128Mi
ingress:
enabled: true
hosts:
- hub.earthdatascience.org
annotations:
ingress.kubernetes.io/proxy-body-size: 64m
kubernetes.io/ingress.class: nginx
kubernetes.io/tls-acme: "true"
tls:
- secretName: kubelego-tls-jupyterhub
hosts:
- hub.earthdatascience.org
auth:
admin:
access: true
users:
- lherwehe
- nkorinek
- lwasser
- kcranston
whitelist:
users:
- earth-lab
- lwasser
type: github
github:
callbackUrl: "https://hub.earthdatascience.org/climate-hub/hub/oauth_callback"
Binary file added hub-charts/ea-hub/charts/jupyterhub-0.9.0.tgz
Binary file not shown.
Binary file added secrets/climate-hub.yaml
Binary file not shown.
Binary file modified secrets/ea-hub.yaml
Binary file not shown.
Binary file modified secrets/edsc-hub.yaml
Binary file not shown.
32 changes: 32 additions & 0 deletions user-images/climate-hub/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
FROM earthlab/earth-analytics-python-env:214f803

# Install nbgrader server extensions - we only want the students to see the
# validate extension, but you can't just install one. You need to install
# them all and then disable the ones you don't want. Hmmm, ok.

# Setup nbgitpuller to sync files from course repo to hub
RUN conda install -c conda-forge nbgitpuller \
&& jupyter serverextension enable --py nbgitpuller --sys-prefix

# Setup nbzip - this allows students to download files from the hub
RUN pip install git+https://github.com/ryanlovett/jupyter-tree-download.git

# Setup nbgrader + extensions
RUN jupyter nbextension install --sys-prefix --py nbgrader --overwrite \
&& jupyter nbextension enable --sys-prefix --py nbgrader \
&& jupyter serverextension enable --sys-prefix --py nbgrader

# Disable create_assignment & formgrader
RUN jupyter nbextension disable --sys-prefix create_assignment/main \
# disable formgrader
&& jupyter nbextension disable --sys-prefix formgrader/main --section=tree \
&& jupyter serverextension disable --sys-prefix \
nbgrader.server_extensions.formgrader \
# Disable assignment_list
&& jupyter nbextension disable --sys-prefix assignment_list/main --section=tree \
&& jupyter serverextension disable --sys-prefix \
nbgrader.server_extensions.assignment_list

# Install zip to support the download tool
USER root
RUN apt-get update && apt-get -y install zip

0 comments on commit bad16ad

Please sign in to comment.