-
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
[hab] Support FS_ROOT
environment variable.
#530
Conversation
/// The default path where cryptographic keys are stored | ||
pub const CACHE_KEY_PATH: &'static str = "/hab/cache/keys"; | ||
pub const CACHE_KEY_PATH: &'static str = "hab/cache/keys"; | ||
/// The default path where source artifacts are downloaded, extracted, & compiled | ||
pub const CACHE_SRC_PATH: &'static str = "/hab/cache/src"; |
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.
Why is this one and SVC_PATH
still at /
?
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.
Good point, I'll see if I can clarify the docs or make all these paths relative. There are some paths that are used at runtime which will never make sense with an FS_ROOT
set. That's why it was a piecemeal change
084e0d4
to
831d764
Compare
I incorporated feedback from @smith and re-pushed. Now all the path constants in |
This change lays the groundwork for replacing `hab-bpm`, namely in its role setting up Studios. When using the `hab` binary on installation, if an `$FS_ROOT` environment variable is set, this will effectively replace the default `/` path, which allows a user or some automation to install into a mounted filesystem or subdirectory that will become the root of a filesystem for Habitat. For example, here we install `core/redis`, its dependencies, any downloaded public origin keys, and downloaded artifacts under a `/tmp/newfs` filesystem root: ``` > ls -l /tmp/newfs ls: cannot access /tmp/newfs: No such file or directory > env FS_ROOT=/tmp/newfs ./target/debug/hab install core/redis » Installing core/redis ↓ Downloading core/glibc/2.22/20160427193532 16.21 MB / 16.21 MB \ [=================================] 100.00 % 30.25 MB/s ↓ Downloading core-20160423193745 public origin key 75 B / 75 B | [========================================] 100.00 % 358.35 KB/s ☑ Cached core-20160423193745 public origin key ✓ Installed core/glibc/2.22/20160427193532 ↓ Downloading core/linux-headers/4.3/20160427193435 798.63 KB / 798.63 KB / [===============================] 100.00 % 88.11 MB/s ✓ Installed core/linux-headers/4.3/20160427193435 ↓ Downloading core/redis/3.0.7/20160427222845 1.46 MB / 1.46 MB | [===================================] 100.00 % 80.88 MB/s ✓ Installed core/redis/3.0.7/20160427222845 ★ Install of core/redis complete with 3 packages installed. > ls -l /tmp/newfs/ total 4 drwxr-xr-x 4 root root 4096 May 17 05:44 hab > ls -l /tmp/newfs/hab/cache/keys/ total 4 -rw-r--r-- 1 root root 75 May 17 05:44 core-20160423193745.pub > ls -l /tmp/newfs/hab/cache/artifacts/ total 18900 -rw-r--r-- 1 root root 17001749 May 17 05:44 core-glibc-2.22-20160427193532-x86_64-linux.hart -rw-r--r-- 1 root root 817797 May 17 05:44 core-linux-headers-4.3-20160427193435-x86_64-linux.hart -rw-r--r-- 1 root root 1530761 May 17 05:44 core-redis-3.0.7-20160427222845-x86_64-linux.hart > ls -l /tmp/newfs/hab/pkgs/core/ total 12 drwxr-xr-x 3 root root 4096 May 17 05:44 glibc drwxr-xr-x 3 root root 4096 May 17 05:44 linux-headers drwxr-xr-x 3 root root 4096 May 17 05:44 redis ``` Signed-off-by: Fletcher Nichol <[email protected]>
831d764
to
5bcde62
Compare
📌 Commit 5bcde62 has been approved by |
This change lays the groundwork for replacing `hab-bpm`, namely in its role setting up Studios. When using the `hab` binary on installation, if an `$FS_ROOT` environment variable is set, this will effectively replace the default `/` path, which allows a user or some automation to install into a mounted filesystem or subdirectory that will become the root of a filesystem for Habitat. For example, here we install `core/redis`, its dependencies, any downloaded public origin keys, and downloaded artifacts under a `/tmp/newfs` filesystem root: ``` > ls -l /tmp/newfs ls: cannot access /tmp/newfs: No such file or directory > env FS_ROOT=/tmp/newfs ./target/debug/hab install core/redis » Installing core/redis ↓ Downloading core/glibc/2.22/20160427193532 16.21 MB / 16.21 MB \ [=================================] 100.00 % 30.25 MB/s ↓ Downloading core-20160423193745 public origin key 75 B / 75 B | [========================================] 100.00 % 358.35 KB/s ☑ Cached core-20160423193745 public origin key ✓ Installed core/glibc/2.22/20160427193532 ↓ Downloading core/linux-headers/4.3/20160427193435 798.63 KB / 798.63 KB / [===============================] 100.00 % 88.11 MB/s ✓ Installed core/linux-headers/4.3/20160427193435 ↓ Downloading core/redis/3.0.7/20160427222845 1.46 MB / 1.46 MB | [===================================] 100.00 % 80.88 MB/s ✓ Installed core/redis/3.0.7/20160427222845 ★ Install of core/redis complete with 3 packages installed. > ls -l /tmp/newfs/ total 4 drwxr-xr-x 4 root root 4096 May 17 05:44 hab > ls -l /tmp/newfs/hab/cache/keys/ total 4 -rw-r--r-- 1 root root 75 May 17 05:44 core-20160423193745.pub > ls -l /tmp/newfs/hab/cache/artifacts/ total 18900 -rw-r--r-- 1 root root 17001749 May 17 05:44 core-glibc-2.22-20160427193532-x86_64-linux.hart -rw-r--r-- 1 root root 817797 May 17 05:44 core-linux-headers-4.3-20160427193435-x86_64-linux.hart -rw-r--r-- 1 root root 1530761 May 17 05:44 core-redis-3.0.7-20160427222845-x86_64-linux.hart > ls -l /tmp/newfs/hab/pkgs/core/ total 12 drwxr-xr-x 3 root root 4096 May 17 05:44 glibc drwxr-xr-x 3 root root 4096 May 17 05:44 linux-headers drwxr-xr-x 3 root root 4096 May 17 05:44 redis ``` Signed-off-by: Fletcher Nichol <[email protected]> Pull request: #530 Approved by: fnichol
☀️ Test successful - travis |
This change lays the groundwork for replacing `hab-bpm`, namely in its role setting up Studios. When using the `hab` binary on installation, if an `$FS_ROOT` environment variable is set, this will effectively replace the default `/` path, which allows a user or some automation to install into a mounted filesystem or subdirectory that will become the root of a filesystem for Habitat. For example, here we install `core/redis`, its dependencies, any downloaded public origin keys, and downloaded artifacts under a `/tmp/newfs` filesystem root: ``` > ls -l /tmp/newfs ls: cannot access /tmp/newfs: No such file or directory > env FS_ROOT=/tmp/newfs ./target/debug/hab install core/redis » Installing core/redis ↓ Downloading core/glibc/2.22/20160427193532 16.21 MB / 16.21 MB \ [=================================] 100.00 % 30.25 MB/s ↓ Downloading core-20160423193745 public origin key 75 B / 75 B | [========================================] 100.00 % 358.35 KB/s ☑ Cached core-20160423193745 public origin key ✓ Installed core/glibc/2.22/20160427193532 ↓ Downloading core/linux-headers/4.3/20160427193435 798.63 KB / 798.63 KB / [===============================] 100.00 % 88.11 MB/s ✓ Installed core/linux-headers/4.3/20160427193435 ↓ Downloading core/redis/3.0.7/20160427222845 1.46 MB / 1.46 MB | [===================================] 100.00 % 80.88 MB/s ✓ Installed core/redis/3.0.7/20160427222845 ★ Install of core/redis complete with 3 packages installed. > ls -l /tmp/newfs/ total 4 drwxr-xr-x 4 root root 4096 May 17 05:44 hab > ls -l /tmp/newfs/hab/cache/keys/ total 4 -rw-r--r-- 1 root root 75 May 17 05:44 core-20160423193745.pub > ls -l /tmp/newfs/hab/cache/artifacts/ total 18900 -rw-r--r-- 1 root root 17001749 May 17 05:44 core-glibc-2.22-20160427193532-x86_64-linux.hart -rw-r--r-- 1 root root 817797 May 17 05:44 core-linux-headers-4.3-20160427193435-x86_64-linux.hart -rw-r--r-- 1 root root 1530761 May 17 05:44 core-redis-3.0.7-20160427222845-x86_64-linux.hart > ls -l /tmp/newfs/hab/pkgs/core/ total 12 drwxr-xr-x 3 root root 4096 May 17 05:44 glibc drwxr-xr-x 3 root root 4096 May 17 05:44 linux-headers drwxr-xr-x 3 root root 4096 May 17 05:44 redis ``` Signed-off-by: Fletcher Nichol <[email protected]> Pull request: #530 Approved by: fnichol
This change lays the groundwork for replacing `hab-bpm`, namely in its role setting up Studios. When using the `hab` binary on installation, if an `$FS_ROOT` environment variable is set, this will effectively replace the default `/` path, which allows a user or some automation to install into a mounted filesystem or subdirectory that will become the root of a filesystem for Habitat. For example, here we install `core/redis`, its dependencies, any downloaded public origin keys, and downloaded artifacts under a `/tmp/newfs` filesystem root: ``` > ls -l /tmp/newfs ls: cannot access /tmp/newfs: No such file or directory > env FS_ROOT=/tmp/newfs ./target/debug/hab install core/redis » Installing core/redis ↓ Downloading core/glibc/2.22/20160427193532 16.21 MB / 16.21 MB \ [=================================] 100.00 % 30.25 MB/s ↓ Downloading core-20160423193745 public origin key 75 B / 75 B | [========================================] 100.00 % 358.35 KB/s ☑ Cached core-20160423193745 public origin key ✓ Installed core/glibc/2.22/20160427193532 ↓ Downloading core/linux-headers/4.3/20160427193435 798.63 KB / 798.63 KB / [===============================] 100.00 % 88.11 MB/s ✓ Installed core/linux-headers/4.3/20160427193435 ↓ Downloading core/redis/3.0.7/20160427222845 1.46 MB / 1.46 MB | [===================================] 100.00 % 80.88 MB/s ✓ Installed core/redis/3.0.7/20160427222845 ★ Install of core/redis complete with 3 packages installed. > ls -l /tmp/newfs/ total 4 drwxr-xr-x 4 root root 4096 May 17 05:44 hab > ls -l /tmp/newfs/hab/cache/keys/ total 4 -rw-r--r-- 1 root root 75 May 17 05:44 core-20160423193745.pub > ls -l /tmp/newfs/hab/cache/artifacts/ total 18900 -rw-r--r-- 1 root root 17001749 May 17 05:44 core-glibc-2.22-20160427193532-x86_64-linux.hart -rw-r--r-- 1 root root 817797 May 17 05:44 core-linux-headers-4.3-20160427193435-x86_64-linux.hart -rw-r--r-- 1 root root 1530761 May 17 05:44 core-redis-3.0.7-20160427222845-x86_64-linux.hart > ls -l /tmp/newfs/hab/pkgs/core/ total 12 drwxr-xr-x 3 root root 4096 May 17 05:44 glibc drwxr-xr-x 3 root root 4096 May 17 05:44 linux-headers drwxr-xr-x 3 root root 4096 May 17 05:44 redis ``` Signed-off-by: Fletcher Nichol <[email protected]> Pull request: #530 Approved by: fnichol
This change lays the groundwork for replacing
hab-bpm
, namely in itsrole setting up Studios. When using the
hab
binary on installation, ifan
$FS_ROOT
environment variable is set, this will effectively replacethe default
/
path, which allows a user or some automation to installinto a mounted filesystem or subdirectory that will become the root of a
filesystem for Habitat.
For example, here we install
core/redis
, its dependencies, anydownloaded public origin keys, and downloaded artifacts under a
/tmp/newfs
filesystem root:Signed-off-by: Fletcher Nichol [email protected]