[FEATURE_REQUEST] Move Main conf.yml to Dedicated Directory (Make it Kubernetes-friendly)
Is your feature request related to a problem? If so, please describe.
I run pretty much all of my apps in my Kubernetes cluster, and while K8s is sometimes a royal pain, it's incredibly flexible and powerful. I have a somewhat complex server situation, being partially self-hosted, and partially cloud-based, with multiple domains and cloud providers... and so Dashy is a great solution for me to keep my brain from melting!
However, Kubernetes does still currently have a few limitations. The biggest issue, is that Kubernetes is essentially unable to mount a single writeable file that doesn't break it's "principles" (I guess).
I'm no expert, but having used K8s for a while and gone down this rabbit hole before, there are two options for mounting files:
- You can mount a single file through a
ConfigMapdeclaration, but that is read-only and only updated when the container is created (if changes are made to theConfigMapdeclaration). K8s is pretty rigid with this, as the "file" isn't able to be modified, even temporarily. The write operation will just fail. - The other way is to mount it via a
HostPathkind of volume, which will do the same as what's recommended in the Getting Started documentation for Docker. But... this is highly discouraged for K8s, as the nodes are not supposed to hold your data. For example: a container is started and the configuration file is saved on Host1; the container is deleted and recreated (either through an internal pod failure, health check fail, manifest declaration update, whatever); the K8s scheduler may decide to not recreate the pod/container on Host1, but instead Host2 (for whatever magical reasoning). The configuration file will not be on Host2 (unless you've manually setup some kind of file syncing program outside of K8s). It just seems to turn into a mess.
Unless something has changed with Kubernetes recently that enables this kind of functionality, I don't believe K8s has the ability to easily manage Dashy as it currently is.
I would really appreciate being proven wrong though! :)
I would love to use Dashy as-is in K8s and just have to modify my cluster a bit, but currently it's actually unusable, as it seems to break after a minute or two of being brought up.
Describe the solution you'd like
"Easiest" way I think this could be accomplished would be through moving the configuration file to a dedicated directory where no other required files reside (or at very least would need to be automatically recreated by Dashy itself)
Could be as "simple" as going from /public/conf.yml to /public/config/conf.yml.
This change would of course be a breaking change and probably cause a lot of annoyance with a lot of people though. ...And I wouldn't blame them...
I'm thinking I could probably figure out how to make the changes myself, but would really want to get some kind of confirmation that the changes wouldn't be immediately rejected due to the implications of it.
Or maybe this request can be put towards the next major version release?
Priority
Medium (Would be very useful)
Is this something you would be keen to implement
Maybe
I wholeheartedly agree with this.
Trying to make a workaround at the minute whilst I'm writing this but will let you know if I get anywhere!
@welshname A temporary workaround you might be interested in using: (And also for anyone who may also want to try...)
- Start from a functional configuration (basically don't have it in a crash loop)
- You can also just start the container using
[ "sleep", "infinity" ]in the command field of a K8s manifest, or something very similar if you're using another container management system
- You can also just start the container using
- Mount an empty directory from your host system at a path inside the container (any path that doesn't already have a file or directory at, like
/mytemporarydir), - Get a shell/open a terminal into your container and copy all of the files within
/app/public/into your mounted directory (/mytemporarydir). - Exit the terminal and stop the container
- Change the mount location of the directory you used on your host system into the container at
/app/public - You should now be able to start your container and use it like you probably want to.
Big warning about that
You cannot change versions! As any changes that were made to the container image at /app/public will not automatically apply over your mounted directory, leaving you with a new program trying to use files from an older version (talking more in-general).
As Dashy hasn't been updated in a while, I would think you're probably fine to run it like this.
I am still working on #799 in the background (which will implement this), but it's been hard to find time with other life commitments recently. When it is ready, I'll be sure to update you here before-hand to avoid any breaking changes with your work-around.
I am still working on #799 in the background (which will implement this), but it's been hard to find time with other life commitments recently. When it is ready, I'll be sure to update you here before-hand to avoid any breaking changes with your work-around.
Amazing.
If you want any testing done for it on Kubernetes then let me know. I'll be happy to help.
Ah, didn't see #799. Sounds good, thank you! And of course thank you for making a great app in the first place!
I'd be happy to help out with anything as well.
Closing this issue as a partial duplicate of #799.
This issue has gone 6 weeks without an update. To keep the ticket open, please indicate that it is still relevant in a comment below. Otherwise it will be closed in 5 working days.
....Thought I had closed this.... Let's try again....