Thanks Min. I've gone ahead and added Ryan Lovett's imagespawner to the
JupyterHub wiki (https://github.com/jupyterhub/jupyterhub/wiki/Spawners).

  

If members of the community have developed spawners that would be helpful to
others, please contribute them to the wiki.

  

Thanks!

  

**Carol Willing**

  

Research Software Engineer, Project Jupyter

Cal Poly San Luis Obispo

  

Director, Python Software Foundation

  

Strengths: Empathy, Relator, Ideation, Strategic, Learner

  

Sent from [Nylas N1](https://link.nylas.com/link/68p140bimyedpd78wkdi7pwew
/local-027c75cc-cc2f/0?redirect=https%3A%2F%2Fnylas.com%2Fn1%3Fref%3Dn1&r=anVw
eXRlckBnb29nbGVncm91cHMuY29t), the extensible, open source mail client.

![](https://link.nylas.com/open/68p140bimyedpd78wkdi7pwew/local-027c75cc-
cc2f?r=anVweXRlckBnb29nbGVncm91cHMuY29t)

  
On Nov 18 2016, at 2:47 am, MinRK <[email protected]> wrote:  

> On Wed, Nov 16, 2016 at 9:32 PM, Joshua Dunham
<[[email protected]](mailto:[email protected])> wrote:

>

>> Hi Jupyters,  
  
     I'm working through setting up JupyterHub and am trying to think through
how to provide a few group of people access to a single hub. Some questions:  
  
\- I've noticed that {username} is a variable I can use in some capacity (like
directing the user to a specific path), Can I do the same with a group
variable? My plan is to keep the config file sparse in terms of allowed users
and instead start the server and populate the database. The API shows that
users can be a part of groups but I can't find how I can use this (if at all).
I can populate the database with a Jupyter service if this variable is useable
in the config.  

>

> Group’s tricky, because a user can be in multiple groups. But if you assume
that you only put users in one group, then you can accomplish this. An
powerful but oft-overlooked tool is that you can have fully custom logic for
paths and things by implementing tiny subclasses in your config file:

>  
>  
>     # jupyterhub_config.py

>  
>     from jupyterhub.spawner import LocalProcessSpawner

>  
>     class MySpawner(LocalProcessSpawner):

>         def template_namespace(self):

>             # add the user's first group as 'group' in the template
namespace

>             ns = super().template_namespace()

>             ns['group'] = self.user.groups[0]

>  
>     c.MySpawner.notebook_dir = '/shared/{group}/{username}'

>  
>

>>  
\- The API on swagger shows that there is a way to get a username based on API
key, is there a way to set a user's api key using the API? I'd like to inject
a JWT 'key' that allows access to external systems. If possible, how could a
user call this key in their notebook? Another option is to get a token using
the authenticator but I'm not sure how I could store this for the duration of
the token lifetime.  

>

> The API key is a key for accessing JupyterHub itself, not for accessing
external systems. Do you want to inject environment variables into the user’s
server? You can do this with [Authenticator.pre_spawn_start](http://jupyterhub
.readthedocs.io/en/latest/api/auth.html?highlight=pre_spawn_start#jupyterhub.a
uth.Authenticator.pre_spawn_start&r=anVweXRlckBnb29nbGVncm91cHMuY29t), or
augmenting `Spawner.environment`, depending on where the token comes from.

>

>>  
\- The HTML form in the config seems like it could be useful to spawn a
specific docker container for a user. Is this possible?  

>

> Yes! [imagespawner](https://github.com/ryanlovett/imagespawner&r=anVweXRlckB
nb29nbGVncm91cHMuY29t) is an example of using this form to allow users to pick
from a list of supported docker images.

>

> -Min

>

>>  
  
Thanks for your help and patience!  
  
 -Joshua  

>>

>> \--  
You received this message because you are subscribed to the Google Groups
"Project Jupyter" group.  
To unsubscribe from this group and stop receiving emails from it, send an
email to [[email protected]](mailto:jupyter+unsubscribe@goo
glegroups.com).  
To post to this group, send email to
[[email protected]](mailto:[email protected]).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/ju
pyter/2884f464-ae46-4996-bb84-312cddc69743%40googlegroups.com](https://groups.
google.com/d/msgid/jupyter/2884f464-ae46-4996-bb84-312cddc69743%40googlegroups
.com?utm_medium=email&utm_source=footer&r=anVweXRlckBnb29nbGVncm91cHMuY29t).  
For more options, visit [https://groups.google.com/d/optout](https://groups.go
ogle.com/d/optout&r=anVweXRlckBnb29nbGVncm91cHMuY29t).  

>

> ​

>

> \--  
You received this message because you are subscribed to the Google Groups
"Project Jupyter" group.  
To unsubscribe from this group and stop receiving emails from it, send an
email to [[email protected]](mailto:jupyter+unsubscribe@goo
glegroups.com).  
To post to this group, send email to
[[email protected]](mailto:[email protected]).  
To view this discussion on the web visit
[https://groups.google.com/d/msgid/jupyter/CAHNn8BW9dJb-WhF69ccaj0zM0amYCF7OzY
EZzjOZvSNRrtqcog%40mail.gmail.com](https://groups.google.com/d/msgid/jupyter
/CAHNn8BW9dJb-WhF69ccaj0zM0amYCF7OzYEZzjOZvSNRrtqcog%40mail.gmail.com?utm_medi
um=email&utm_source=footer&r=anVweXRlckBnb29nbGVncm91cHMuY29t).  
For more options, visit [https://groups.google.com/d/optout](https://groups.go
ogle.com/d/optout&r=anVweXRlckBnb29nbGVncm91cHMuY29t).  

-- 
You received this message because you are subscribed to the Google Groups 
"Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jupyter/gmbqoj2zu79x75abj898gu9x-2147483647%40mailer.nylas.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to