-
Notifications
You must be signed in to change notification settings - Fork 315
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
Re-organize Habitat filesystem paths, environment variables, Plan variables, and runtime templating data #374
Conversation
This change seeks to remove as many hard-coded references to the `$BLDR_ROOT` of the Habitat file system tree. Several programs and utilities require this knowledge but all should now compute all other paths from this foundational one. Several occurences of the above path have been preserved as some parts of the codebase will be going away and others are too old to have been sufficiently refactored (note: these are mostly Plans that may not be supported going forward).
`HAB_ROOT_PATH` is the The root of the Habitat tree. It currently defaults to a value of `/opt/bldr` -- which will be subject to future change.
`HAB_SRC_PATH` is the default path where source artifacts are downloaded, extracted, & compiled. It defaults to `$HAB_ROOT_PATH/cache/src`.
`HAB_CACHE_ARTIFACT_PATH` is the default download root path for package artifacts, used on package installation. It defaults to `$HAB_ROOT_PATH/cache/artifacts`.
… packages. `HAB_PKG_PATH` is the root path containing all locally installed packages. If defaults to `$HAB_ROOT_PATH/pkgs`.
`HAB_CACHE_KEY_PATH` is the default path where cryptographic keys are stored. It defaults to `$HAB_ROOT_PATH/cache/keys`.
`HAB_CACHE_GPG_PATH` is the default path where gpg keys are stored. It defaults to `$HAB_ROOT_PATH/cache/gpg`.
`SVC_PATH` and `pkg_svc_path` are both representations of the root path containing all runtime service directories and files. It defaults to `$HAB_ROOT_PATH/svc`.
Also, several outstanding service config paths were found and updated.
Note that this path is internal to the Supervisor and should not be directly accessed under normal circumstances.
This change removes another source of either hardcoded paths or magic (i.e. underdocumented) directories under the service path. Instances of `PackageInstall` know their own `svc_path` as well as other flavors and this change keeps that path-building responsibility there.
This PR has passed 'Verify' and is ready for review and approval! |
@fnichol if there are any errors I willingly accept them. Thanks for doing this chore for the team, it's a big change but also a big improvement! |
might be a good time to get rid of HAB_CACHE_GPG_PATH
|
@metadave I was wondering if it was too early or not for that. I could add a commit, or have one ready to purge that var from the codebase |
@@ -150,10 +150,10 @@ FLAGS: | |||
-h Prints this message | |||
|
|||
OPTIONS: | |||
-u <BLDR_REPO> Sets a Bldr repository URL | |||
-u <BLDR_REPO> Sets a Habitat repository URL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lots of BLDR_REPO
, perhaps we should s/BLDR_REPO/HAB_REPO/
while we're in here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll deal with this one in another PR. I wanted to make sure that "repo" is no longer the correct word.
@fnichol don't let the GPG thing hold this PR up, it's easy enough to deal with when I get the other stuff merged. Cheers! |
Change: 21c0986f-7ce2-49a2-ba88-2501fc72a7f9 approved by: @reset |
Background
This change set purges many more references to
bldr
and the current filesystem paths, namely/opt/bldr/*
. The changes here aim to make a path-renaming an easy task, in as few places as possible while simultaneously creating consistent variable naming for Plan authors when they writeplan.sh
files and consume service config data in configuration file templates.I have attempted to hit all all locations where these paths and variable names are impacted but I can't guarantee that it's 100% error-free. As the new template data (such as
{{pkg.svc_config_path}}
) is being used in the Plans, a correspondingly current Supervisor needs to be used (it produces the service config).Here is a brief example of the
pkg
section of runtime config toml:Variables
HAB_ROOT_PATH
HAB_ROOT_PATH
is the The root of the Habitat tree. It currentlydefaults to a value of
/opt/bldr
-- which will be subject to futurechange. (Formerly
BLDR_ROOT
)$HAB_ROOT_PATH
hcore::fs::ROOT_PATH: 'static String
HAB_CACHE_ARTIFACT_PATH
HAB_CACHE_ARTIFACT_PATH
is the default download root path for package artifacts, used on package installation. It defaults to$HAB_ROOT_PATH/cache/artifacts
. (FormerlyBLDR_PKG_CACHE
)$HAB_CACHE_ARTIFACT_PATH
hcore::fs::CACHE_ARTIFACT_PATH: 'static String
HAB_CACHE_GPG_PATH
HAB_CACHE_GPG_PATH
is the default path where gpg keys are stored. Itdefaults to
$HAB_ROOT_PATH/cache/gpg
. (FormerlyBLDR_GPG_CACHE
)$HAB_CACHE_GPG_PATH
hcore::fs::CACHE_GPG_PATH: 'static String
HAB_CACHE_KEY_PATH
HAB_CACHE_KEY_PATH
is the default path where cryptographic keys arestored. It defaults to
$HAB_ROOT_PATH/cache/keys
. (FormerlyHABITAT_KEY_CACHE
)$HAB_CACHE_KEY_PATH
hcore::fs::CACHE_KEY_PATH: 'static String
HAB_CACHE_SRC_PATH
HAB_CACHE_SRC_PATH
is the default path where source artifacts are downloaded, extracted, & compiled. It defaults to$HAB_ROOT_PATH/cache/src
. (FormerlyBLDR_SRC_CACHE
)$HAB_CACHE_SRC_PATH
hcore::fs::CACHE_SRC_PATH: 'static String
HAB_PKG_PATH
HAB_PKG_PATH
is the root path containing all locally installed packages. If defaults to$HAB_ROOT_PATH/pkgs
. (FormerlyBLDR_PKG_ROOT
)$HAB_PKG_PATH
hcore::fs::PKG_PATH: 'static String
Service Paths
Service paths are "dynamically" generated, as they depend on the name of the package identifer.
svc_path
pkg_svc_path
,{{pkg.svc_path}}
, andfn svc_path()
are all representations of the root path for a given service's configuration, files, and data. It is$HAB_ROOT_PATH/svc/$NAME
where$NAME
is the name component of a service identifier. For example, thesvc_path
for thechef/redis
package would be$HAB_ROOT_PATH/svc/redis
.$pkg_svc_path
{{pkg.svc_path}}
PackageInstall#svc_path() -> PathBuf
orhcore::fs::svc_path(&str) -> PathBuf
svc_config_path
pkg_svc_config_path
,{{pkg.svc_config_path}}
, andfn svc_config_path()
are all representations of the path to to a given service's config. It is$pkg_svc_path/config
.$pkg_svc_config_path
{{pkg.svc_config_path}}
PackageInstall#svc_config_path() -> PathBuf
orhcore::fs::svc_config_path(&str) -> PathBuf
svc_data_path
pkg_svc_data_path
,{{pkg.svc_data_path}}
, andfn svc_data_path()
are all representations of the path to to a given service's data. It is$pkg_svc_path/data
.$pkg_svc_data_path
{{pkg.svc_data_path}}
PackageInstall#svc_data_path() -> PathBuf
orhcore::fs::svc_data_path(&str) -> PathBuf
svc_files_path
pkg_svc_files_path
,{{pkg.svc_files_path}}
, andfn svc_files_path()
are all representations of the path to to a given service's gossiped config files. It is$pkg_svc_path/files
.$pkg_svc_files_path
{{pkg.svc_files_path}}
PackageInstall#svc_files_path() -> PathBuf
orhcore::fs::svc_files_path(&str) -> PathBuf
svc_hooks_path
pkg_svc_hooks_path
,{{pkg.svc_hooks_path}}
, andfn svc_hooks_path()
are all representations of the path to to a given service's hooks. It is$pkg_svc_path/hooks
.PackageInstall#svc_hooks_path() -> PathBuf
orhcore::fs::svc_hooks_path(&str) -> PathBuf
svc_static_path
pkg_svc_static_path
,{{pkg.svc_static_path}}
, andfn svc_static_path()
are all representations of the path to to a given service's static content. It is$pkg_svc_path/static
.$pkg_svc_static_path
{{pkg.svc_static_path}}
PackageInstall#svc_static_path() -> PathBuf
orhcore::fs::svc_static_path(&str) -> PathBuf
svc_var_path
pkg_svc_var_path
,{{pkg.svc_var_path}}
, andfn svc_var_path()
are all representations of the path to to a given service's variable state. It is$pkg_svc_path/var
.$pkg_svc_var_path
{{pkg.svc_var_path}}
PackageInstall#svc_var_path() -> PathBuf
orhcore::fs::svc_var_path(&str) -> PathBuf
svc_toml_path
Note I don't think this is used at the moment and so is not fully implemented.