Proposal(lang-python): Use fuse-overlayfs instead of pyenv-hooks for persistence. #1071
Description
Using pyenv-hook for setting up python/pip persistence over pyenv bought in unwanted issues and increased a maintenance burden, something that I had not anticipated (#868).
Before going ahead with pyenv-hooks I had tried native kernel overlayfs but that didn't work1. Recently, I looked for alternative methods in an effort to simplify the pyenv setup, it seems that a fuse implementation of overlayfs works.
By using fuse-overlayfs, we can get rid of all the custom logic that was implemented via pyenv-hook bash scripts.
with pyenv-hooks | with fuse-overlayfs |
---|---|
Implications:
- Requires the host workspace to have privileged access to
/dev/fuse
, if not found it will simply skip mounting on$HOME/.pyenv
and things will keep working normally except they will lack persistence between prebuilds/reboots. - Unsure if it got any drawbacks.
Questions
- Does it work inside
gp validate
environment?- Yes.
- When is it mounted?
- It is mounted when
$GITPOD_REPO_ROOT
exists. Means it will be mounted beforesupervisor
tasks are executed in a prebuild-workspace or user-workspace. Uses an atomic lock to avoid race conditions and makes all the terminals await for the completion.
- It is mounted when
Proposed implementation
- Remove pyenv-hooks.
- Remove run-time variables and define them statically from the Dockerfile.
- Install fuse-overlayfs in the base image.
- Use a helper script (similar to install-packages) that wraps around
fuse-overlayfs
for easy use.
You can check the following commit for an example implementation: axonasif@d9ec66a
A docker image with the above change is available as: axonasif/workspace-python:debug2
- Testing from here: https://github.com/axonasif/test/tree/python_fix_test
fuse-overlayfs for solving Ruby issues
It could help with Ruby and nix as well with one simple command.