Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: about doing something to the home directory of students #59

Open
consideRatio opened this issue Jul 25, 2020 · 0 comments
Open

Docs: about doing something to the home directory of students #59

consideRatio opened this issue Jul 25, 2020 · 0 comments

Comments

@consideRatio
Copy link
Member

consideRatio commented Jul 25, 2020

This is probably useful to have documented long term, thanks @noahbenson for raising this question!

Question on Slack

I’m trying to find the appropriate place in the environment startup to put a bash command that echos some text into ~/.npythyrc for each student.

Response

Whatever is done in the Docker image we built withint /home/jovyan (which is ~/) will be overridden when we mount the user attached storage. Due to that, we cannot add something from the postStart hook directly to ~/

Due to the override of ~/, I've setup a script that run following startup, which allow us to take some actions after the ~/ folder has been overridden by the users storage. @ariel Rokem pointed out what mechanism is invoking that script.

If we want, we can use that script to write something to the user folder. It's very important that this script never fails though, because that would crash the attempt for a user to start their server.

This is the location of that script: https://github.com/neurohackademy/nh2020-jupyterhub/blob/master/chart/files/etc/singleuser/k8s-lifecycle-hook-post-start.sh, you could open a PR to change that. When a PR changing this file is merged, we should verify pods can still startup without crashing.

I suggest what you do in this file, is to create a symbolic link to a file you add to ~/data somewhere. Then if you want to change the content of the ~/.npythyrc file students have, it will be an quick update that doesn't require their servers to be restarted or you making additional PRs etc.

I think this addition would do the trick. I'll create such file with nothing in it, and update this script. Then you can update it in ~/data/misc/.npythyrc and see it reflected soon afterwards.

# Provide a symbolic link to /nh/data/misc/.npythyrc
[ -f ~/.npythyrc ] || ln -s /nh/data/misc/.npythyrc ~/.npythyrc || true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant