-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Configurable autosave behaviour from Caddyfile #5209
Comments
Thanks for opening an issue!
What are the log messages you are seeing? Failing to autosave the config will result in errors in the logs but nothing that should stop the server. In general, we advise that users simply ignore unneeded log messages, rather than trying to control everything. |
This one here, if I remember correctly: Lines 367 to 369 in ee7c92e
|
Right, but what's the error? |
The error was:
|
Thanks. So, that error is not fatal, actually. We only log it, we don't stop the server because of it. What are your full logs from process start to end? I'd like to know why the server is stopping. |
Thanks for the quick reply - yep, the server does start despite the error, so it's not of critical importance. The main impact would be for any downstream systems that alert on (in other words: the rest of the logs all look fairly standard - the error stood out as a bit noisy, though) |
Oh, ok, I guess I took this literally:
I disagree with that error being "noisy" though -- 99% of the time it's a legitimate problem, because people have misconfigured their permissions or file systems, which leads to further problems with cert storing, etc. |
Yep, a totally fair perspective - and in many cases it probably does indicate a configuration issue to be addressed. If a significant number of read-only containers run with I feel like the path that would allow the minimal CPU, storage, filtering rules, puzzled developers/admins, and so on could be to allow configuration of that variable. |
To clarify, it is currently configurable, just not via Caddyfile. Shouldn't be too hard to add if someone would like to submit a proposal; I'll leave this open until then, as it's not really a priority for me right now. Thanks! |
This should be very easy to set up as a global option. Thinking Just need to follow the lead of other global options. Take a look at
caddy/caddyconfig/httpcaddyfile/httptype.go Line 286 in 762b027
admin global option.
|
Would |
I don't think it needs to be within |
Hi, I would like to work on this issue. Line 80 in e9d95ab
Lines 103 to 107 in e9d95ab
Thus for example it is suitable something like
It is quite simple to implement because it can only add the case into switch of parseOptAdmin. caddy/caddyconfig/httpcaddyfile/options.go Lines 311 to 320 in e9d95ab
If there's one concerned about this, it is the other attributes of |
The Caddyfile doesn't necessarily need to be a 1 to 1 match to JSON. I don't think there's overlap in configuring an admin endpoint and wanting to disable persisting config. Those are pretty much mutually exclusive configurations. It just happens to be there in the Go struct because it's the admin code which manages the config and writes a copy of the config to file. But that's a technical reason that users don't need to be concerned about.
One thing we try to avoid is "negative" config options, i.e. starting its name with "disable". Instead, I suggest Compare with
That's fine -- those only make sense if you're using JSON config since they're about loading config via the admin API dynamically. It doesn't really make sense to use this as a user of the Caddyfile, since you're probably loading config directly from a file via CLI commands, instead of directly via the API. That should be split into a separate issue to implement later on if we have a good reason to add it. But right now, I don't think it's necessary. |
* Fixes caddyserver#5209 * `persist_config off` disables configuration persist explictly in Caddyfile * if it sets, Admin.Config.Persist becomes false
* Fixes caddyserver#5209 * `persist_config off` disables configuration persist explictly in Caddyfile * if it sets, Admin.Config.Persist becomes false
Thank you, @u5surf @francislavoie! |
What would you like to have changed?
A
Caddyfile
configuration option to enable/disable autosaving the server's configuration state could be useful to reduce some log noise.Why is this feature a useful, necessary, and/or important addition to this project?
This is low priority -- it's not hugely necessary or important -- but I noticed some log messages relating to
caddy
attempting to autosave configuration to disk, and from there noticed that the relevantallowPersist
variable is hardcoded in v2.6.2.For sites where configuration is static and/or configuration writes are not expected/possible, it could make sense to allow that variable to be configurable.
What alternatives are there, or what are you doing in the meantime to work around the lack of this feature?
Failure to write the autosaved configuration is not a fatal error, so the service continues to run.
The text was updated successfully, but these errors were encountered: