1
0
mirror of https://github.com/balkian/jupyterhub-oauth.git synced 2024-12-22 03:58:13 +00:00

Upgrade to 1.7

* Pip install from submodule instead of git
* Updated README
* JPY_COOKIE_SECRET
* DATASET (Read only) and common (Write) folders
This commit is contained in:
J. Fernando Sánchez 2017-01-25 01:53:05 +01:00
parent 0bb2ea7963
commit 85eab8aacc
7 changed files with 58 additions and 18 deletions

6
.gitmodules vendored Normal file
View File

@ -0,0 +1,6 @@
[submodule "oauthenticator"]
path = oauthenticator
url = https://github.com/jupyter/oauthenticator.git
[submodule "dockerspawner"]
path = dockerspawner
url = https://github.com/jupyter/dockerspawner.git

View File

@ -7,8 +7,10 @@ FROM jupyter/jupyterhub
MAINTAINER Project Jupyter <ipython-dev@scipy.org> MAINTAINER Project Jupyter <ipython-dev@scipy.org>
# Install oauthenticator from git # Install oauthenticator from git
RUN pip install git+git://github.com/jupyter/oauthenticator.git ADD oauthenticator /src/oauthenticator
RUN pip install git+git://github.com/jupyter/dockerspawner.git ADD dockerspawner /src/dockerspawner
RUN pip install /src/oauthenticator
RUN pip install /src/dockerspawner
# Create oauthenticator directory and put necessary files in it # Create oauthenticator directory and put necessary files in it
RUN mkdir /srv/oauthenticator RUN mkdir /srv/oauthenticator

View File

@ -3,29 +3,45 @@
Example of running [JupyterHub](https://github.com/jupyter/jupyterhub) Example of running [JupyterHub](https://github.com/jupyter/jupyterhub)
with [GitHub OAuth](https://developer.github.com/v3/oauth/) for authentication. with [GitHub OAuth](https://developer.github.com/v3/oauth/) for authentication.
## setup ## Variables
Edit the file called `userlist` to include one GitHub user name per line.
If that user should be an admin (you!), add `admin` after a space.
For example: ### General variables
``` ```
mal admin ADMINS=balkian,oaraque
zoe admin OAUTH_CALLBACK_URL=http://hub.cluster.gsi.dit.upm.es/hub/oauth_callback
wash HOST_HOMEDIR=/mnt/home/{username} # {username} will be replaced by the actual OAuth user
inara admin ```
kaylee
jayne ## Gitlab variables:
simon
river ```
GITLAB_HOST=https://lab.cluster.gsi.dit.upm.es/
GITLAB_CLIENT_ID=TheMaxiID
GITLAB_CLIENT_SECRET=TheMaxiSecret
OAUTH_CLASS=oauthenticator.gitlab.GitLabOAuthenticator
DATASETS_DIR=/home/datasets # READ ONLY
COMMON_DIR=/home/common # To share files between users
```
## GitHub variables:
```
GITHUB_CLIENT_ID=GHId
GITHUB_CLIENT_SECRET=GHSecret
OAUTH_CLASS=oauthenticator.github.GitHubOAuthenticator
``` ```
## build ## build
Build the container with: Build the container with:
docker build -t jupyter/oauthenticator . make build
Alternatively:
docker build -t gsiupm/jupyter-oauth:testing .
### ssl ### ssl
@ -34,9 +50,13 @@ ssl/ssl.cert.
## run ## run
Add your oauth client id, client secret, and callback URL to the `env file`. Add your oauth client id, client secret, and callback URL to your `env file` (i.e. `.env`).
Once you have built the container, you can run it with: Once you have built the container, you can run it with:
docker run -it -p 8000:8000 --env-file=env jupyter/oauthenticator make run
Alternatively:
docker run -it -p 8000:8000 --env-file=env gsiupm/jupyter-oauth:testing
Which will run the Jupyter server. Which will run the Jupyter server.

View File

@ -1 +1 @@
1.6 1.7

1
dockerspawner Submodule

@ -0,0 +1 @@
Subproject commit f0ea6d065c8a6a2be3e1295e2e30ab17f312a273

View File

@ -29,6 +29,16 @@ c.DockerSpawner.notebook_dir = notebook_dir
# notebook directory in the container # notebook directory in the container
c.DockerSpawner.volumes = { HOME_FORMAT_STRING: notebook_dir } c.DockerSpawner.volumes = { HOME_FORMAT_STRING: notebook_dir }
common = os.environ.get('COMMON_DIR')
if common:
c.DockerSpawner.volumes[common] = join(notebook_dir, 'common')
dsdir = os.environ.get('DATASETS_DIR')
if dsdir:
c.DockerSpawner.read_only_volumes = { dsdir: join(notebook_dir, 'DATASETS')}
import socket import socket
ips = ([ip for ip in socket.gethostbyname_ex(socket.gethostname())[2] if not ip.startswith("127.")][:1]) ips = ([ip for ip in socket.gethostbyname_ex(socket.gethostname())[2] if not ip.startswith("127.")][:1])
c.JupyterHub.hub_ip = ips[0] c.JupyterHub.hub_ip = ips[0]

1
oauthenticator Submodule

@ -0,0 +1 @@
Subproject commit fb38f60a5611056653bedf7416dbc922394b7cf8