netdisco-docker icon indicating copy to clipboard operation
netdisco-docker copied to clipboard

use volumes instead of bind mounts

Open ollyg opened this issue 2 years ago • 1 comments

mkdir -p netdisco/{logs,config,nd-site-local} should probably be mkdir -p netdisco/{logs,config,nd-site-local,pgdata}

ollyg avatar Jan 02 '23 20:01 ollyg

Actually this doesn't change much, since the container will "help" on startup:

netdisco-postgresql_1  | fixing permissions on existing directory /var/lib/postgresql/data ... ok

So the only difference is that with the mkdir, I now have a 70:<my primary group> instead of a 70:root directory, but both aren't group readable anyways :)

ram@cicd:/tmp/issue52 $ ls -ld /tmp/no_mkdir/netdisco/pgdata /tmp/si_mkdir/netdisco/pgdata
drwx------ 19 70 root     4096 Feb  3 01:27 /tmp/no_mkdir/netdisco/pgdata
drwx------ 19 70 ram      4096 Feb  3 01:40 /tmp/si_mkdir/netdisco/pgdata

I suspect that a better solution to all this permission/mkdir micromanagement would be to use volumes instead of bind mounts. But I'm a bit of a troglodyte when it comes to this corner of docker, we'd probably need to look at some other projects with a similar hodgepodge of users, storage areas, config files and containers to learn how to do this properly.

I'd also expect a lot of documentation and support friction from that, so it's probably something we should only do with severe breaking changes anyways, like next time we update the Postgres major version.

rc9000 avatar Feb 03 '23 01:02 rc9000