scrapinghub / docker-devpi

pypi caching service using devpi and docker
28 stars 42 forks source link

Support devpi-ldap #3

Closed tmeneau closed 2 years ago

tmeneau commented 9 years ago

This is a pull request to implement devpi-ldap support, including exposing optional configurability through environment variables or a configuration file. I would have waited until the pull request for nginx support was merged in, but since it looks like that's been on pause for about week I figured I'd move forward on this.

While this is a pretty straightforward implementation, there are a few changes in this pull request I wanted to bring to your attention. Please let me know if you have any conflicts with them:

Dependencies

I futzed around with the dependencies since (1) the plugin mechanism used by devpi-ldap is only supported in devpi-server>=2.1.0, and (2) without upgrading the version of Python or enforcing pyOpenSSL support the log could get inundated with InsecurePlatform errors.

DEVPI_SERVERDIR Mount Point

While implementing support for loading the LDAP configuration through a mounted YAML configuration file I ran into a weird issue: if the DEVPI_SERVERDIR directory is not empty but does not yet contain the devpi-server data (.serverversion, etc...), on start the devpi-server believes the DEVPI_SERVERDIR points to the data directory for an incompatible version of the devpi-server and refuses to start until the directory has been emptied. This was reproducible if I added a YAML config file to /mnt/ldap-config.yml and then started the server.

To avoid confusion and having to expose a separate volume to allow users to mount a non-empty directory for I changed the DEVPI_SERVERDIR to: /mnt/devpi-server. I've only been able to think of one implication for backwards compatibility so far:

  1. Assume user already has a devpi container running from a previous image with the host data directory mounted at /docker-data/devpi/ (or something)
  2. User downloads new image, stops their devpi container, and runs the new image with the host data directory mounted at /docker-data/devpi/ (to retain the state of their previous container)
  3. The devpi-server starts up and spins up an entirely new data directory, which is equivalent to /docker-data/devpi/devpi-server on the host.

Since this wouldn't remove any of the previous state, the user would resolve this by running something along the lines of:

rm -rf /docker-data/devpi/devpi-server
mv /docker-data/devpi/* /docker-data/devpi/devpi-server/

Since the implications for backwards-compatibility depends on the use-case and doesn't endanger any pre-existing data I figured I'd leave that in and see if you have a preference for one way or another.

Thanks in advance!

tmeneau commented 2 years ago

Closing this 7+ year old PR.