Separate configuration, data, state and runtime directories#484
Merged
Separate configuration, data, state and runtime directories#484
Conversation
This refactors func-e to use config_home, data_home, state_home and runtime_dir conventions defined in [XDG](https://specifications.freedesktop.org/basedir-spec/latest/). Instead of the now deprecated `api.HomeDir()`/`$FUNC_E_HOME`, we have four tiers: - `api.ConfigHome()`/`$FUNC_E_CONFIG_HOME`: Configuration files like version preferences (default: ~/.config/func-e) - `api.DataHome()`/`$FUNC_E_DATA_HOME`: Envoy binaries and downloaded data (default: ~/.local/share/func-e) - `api.StateHome()`/`$FUNC_E_STATE_HOME`: Run logs and persistent state (default: ~/.local/state/func-e) - `api.RuntimeDir()`/`$FUNC_E_RUNTIME_DIR`: Ephemeral temporary files (default: /tmp/func-e-${UID}) This separation aligns with XDG Base Directory Specification principles: - **Configuration** (envoy-version) is distinct from **data** (binaries) - **State** (logs) is separate from ephemeral **temporary** files (admin addresses) - Each directory can be independently configured for different storage tiers - Docker deployments can easily map volumes to appropriate directories **Run ID** This also adds `api.RunID()`/`$FUNC_E_RUN_ID` to override the formerly epoch timestamp with something else for predictable paths in Docker which only support one run typically. For example, we can set it to zero and always know where the logs are. Here are details on the implementation: - --run-id: Sets custom run identifier for current execution (or $FUNC_E_RUN_ID) - Default: YYYYMMDD_HHMMSS_UUU (human-readable timestamp) - Previous: epoch nanoseconds (less readable) - Enables predictable paths for docker (e.g. setting to zero) **Migration** func-e begins immediately to use these conventions except in cases where the deprecated $FUNC_E_HOME was overridden, such as envoyproxy/gateway. This allows tools to migrate on their own schedule. Unless you set the now deprecated `api.HomeDir()`/`$FUNC_E_HOME`, files end up in the new layout described above: - Version preference: $FUNC_E_CONFIG_HOME/envoy-version (was: $FUNC_E_HOME/version) - Binaries: $FUNC_E_DATA_HOME/envoy-versions/{version}/bin/envoy (was: $FUNC_E_HOME/versions/{version}/bin/envoy) - Run logs: $FUNC_E_STATE_HOME/envoy-runs/{runID}/stdout.log (was: $FUNC_E_HOME/runs/{epoch}/stdout.log) - Admin address: $FUNC_E_RUNTIME_DIR/{runID}/admin-address.txt (was: $FUNC_E_HOME/runs/{epoch}/admin-address.txt) Signed-off-by: Adrian Cole <adrian@tetrate.io>
8513185 to
debfac5
Compare
mathetake
approved these changes
Oct 13, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This refactors func-e to use config_home, data_home, state_home and runtime_dir conventions defined in XDG.
Instead of the now deprecated
api.HomeDir()/$FUNC_E_HOME, we have four tiers:api.ConfigHome()/$FUNC_E_CONFIG_HOME: Configuration files like version preferences (default: ~/.config/func-e)api.DataHome()/$FUNC_E_DATA_HOME: Envoy binaries and downloaded data (default: ~/.local/share/func-e)api.StateHome()/$FUNC_E_STATE_HOME: Run logs and persistent state (default: ~/.local/state/func-e)api.RuntimeDir()/$FUNC_E_RUNTIME_DIR: Ephemeral temporary files (default: /tmp/func-e-${UID})This separation aligns with XDG Base Directory Specification principles:
Run ID
This also adds
api.RunID()/$FUNC_E_RUN_IDto override the formerly epoch timestamp with something else for predictable paths in Docker which only support one run typically. For example, we can set it to zero and always know where the logs are.Here are details on the implementation:
Migration
func-e begins immediately to use these conventions except in cases where the deprecated $FUNC_E_HOME was overridden, such as envoyproxy/gateway. This allows tools to migrate on their own schedule.
Unless you set the now deprecated
api.HomeDir()/$FUNC_E_HOME, files end up in the new layout described above: