refactor(docker): Enhance Zebra configuration options and entrypoint logic#9344
refactor(docker): Enhance Zebra configuration options and entrypoint logic#9344mergify[bot] merged 10 commits intomainfrom
Conversation
This also removes the logic to set the default port for RPC as this was introducing a buggy logic
Co-authored-by: Marek <mail@marek.onl>
|
@upbqdn I actually didn't realize I left #9388 targeting this branch. I did it just to be able to rebase this one and test the #9388. I'm planning to revert the merge, and reopen the PR, so we can merge them individually. This is because we're going to squash the commits, and then the title and PR content will be confusing, and unrelated to most of the changes. |
|
@upbqdn This PR is clean now, and ready for review/approval |
|
We should update the cookie path here as well: https://github.com/zcashfoundation/zebra/blob/c5610648a150edb74a5b10309df978d69ca23dfb/docker/default-zebra-config.toml#L26. |
This seems correct: All other locations and docs are pointing to this same dir; except for the commented out $ZEBRA_COOKIE_DIR here https://github.com/ZcashFoundation/zebra/pull/9344/files#diff-8f78f3866f02305f1df51579c939174b2c53e8295ad13bd9d2ab763176a792c1R24 which refers to a custom location, as the comment above also implies. There are comments referring to the cookie file itself, and those are pointing to |
|
utACK One simplification I thought of was if we could omit the first config option, and only go with the static location at |
I agree with this, but there are edge-cases we have to consider and we might break those #3432 Unfortunately, this depend on the host and the security policies set on it for docker. |
Motivation
We had some issues with how we were dealing with configuration files:
A possible approach to fix this was using a temporal directory, and using the resulting config from that directory instead from the original mounted dir, but this was also problematic if the temporal directory was mounted as read-only from the host, which also led to the decision of not using
sedand trying to replace the content of the file or creating a new file in a location that could potentially beread-onlyby external host limitations.Fixes #9325
Solution
Key changes:
default-zebra-config.toml), to allow more flexibility: default configuration build, default config file mounting, user-provided config file mounting with a custom$ZEBRA_CONF_PATH$ZEBRA_CONF_PATHto a valid mounted file)ZEBRA_CONF_PATHthen validate if the default${HOME}/.config/zebrad.tomlis mounted (commonly provided with our docker composezebra/docker/docker-compose.yml
Line 23 in ac25192
on-the-flyand must be avoided if a configuration file was provided (this changessedtocatas usingsedis no longer required)Other (required) changes
exec_as_usermust validate if the actual user is root, otherwise runninggosuwill fail when that's not the casezebrad..cookiesdirectory in the same directory as the.cacheas mounting a cached state would override the cookies directory.Tests
All tests should be passing, and building with the docker compose, with our without a mount file, should give the expected configuration results.
Follow-up Work
Validate which other configurations should be added using variables
PR Checklist
C-exclude-from-changeloglabel.