znc / znc-docker

https://hub.docker.com/_/znc/
51 stars 29 forks source link

Add optional `/bootstrap` option for read-only Docker volume support #23

Closed jerryaldrichiii closed 5 years ago

jerryaldrichiii commented 5 years ago

This is useful for mounting read-only volumes (e.g. k8s ConfigMap/Secrets).

ZNC expects write access so this allows mounting a volume as read-only then copying the data to /znc-data at runtime.

I tested this locally, but I am by no means an expert so this "feature" may be way off base. It helped me with my k8s project though :smile:.

Feel free to edit anything/everything and thank you for everything you've done so far.

DarthGandalf commented 5 years ago

What kind of things to do you put to /bootstrap, and how it interacts with ZNC writing its configs?

jerryaldrichiii commented 5 years ago

Sure, for me, I render the configs/znc.conf and SSL cert there via a k8s Secret (ConfigMap) which renders and mounts as a read-only volume. Though, you could also mount a volume from the host machine there if you didn't want it to be overwritten/modified at runtime.

DarthGandalf commented 5 years ago

I think this is better done in a custom image with FROM znc. And in Dockerfile you can either add the needed files directly, or modify startup-sequnce like you did here.

Generally, it's expected that ZNC can write its config when you modify it e.g. via webadmin. But here, /znc saveconfig will claim success, but upon restart the settings will be reverted.

jerryaldrichiii commented 5 years ago

Good point! FWIW, that's what I essentially did for my project.

Think there is value in me adding a guard around the copy so it will only copy if /znc-data is empty? Or, better to keep it lean and avoid this method entirely? Won't hurt my feelings either way 😄

DarthGandalf commented 5 years ago

Well, if this feature is not going upstream, use whatever suits your case better :)

jerryaldrichiii commented 5 years ago

Hehe, I meant if there was any value adding it to this PR 😉

I think you're right though. No need to add it here. Regardless, thanks for taking the time to review and give feedback.