aiidalab / aiidalab-docker-stack

Docker images with the basic software stack for AiiDAlab
https://aiidalab.net
Other
9 stars 14 forks source link

Replace default user info in aiida profile #1

Open ltalirz opened 6 years ago

ltalirz commented 6 years ago

https://github.com/ltalirz/mc-docker-stack/blob/37437fd16de6a433e55cfd51239b6d8fd4d9d242/start-singleuser.sh#L50-L55

One could use the JUPYTERHUB_USER environment variable (holds user email). Perhaps one needs to add more environment variables for user name & affiliation? We just need to forward this information from the auth server.

This is important as soon as any of the data generated in jupyter are to be exported.

ltalirz commented 4 years ago

an update on this old issue:

  1. the relevant variables can now be passed as environment variables to the docker container: https://github.com/aiidateam/aiida-core/blob/develop/Dockerfile#L7-L12
  2. according to @yakutovicha , one can use the jupyterhub_config.py to pass environment variables to the container like so:
    c.DockerSpawner.environment = {"SYSTEM_USER_UID":"1234"}

Re 2.: I think this actually doesn't cover this use case, since on that level the variables are static. However, I already figured out some time ago how to pass specific variables to the environment via a pre-spawn hook: https://github.com/materialscloud-org/openstack-ansible/blob/30443cd8b8335126e0a1aeed89be48786c35b2f6/static/aiidalab/aiidalab_config.py#L51-L60

The remaining problem: I'll need to somehow figure out how to

  1. Request the information of interest from the authentication service. Might be doable through the OAuth scope - otherwise one will have to do a separate request to the OIDC user info endpoint
  2. Pass this information through to the pre-spawn hook. To see whether this is somehow stored on the user object.