Skip to content
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

Merged
merged 1 commit into from
May 17, 2016

Conversation

fnichol
Copy link
Collaborator

@fnichol fnichol commented May 17, 2016

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]

@thesentinels
Copy link
Contributor

By analyzing the blame information on this pull request, we identified @metadave, @adamhjk and @reset to be potential reviewers

/// 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";
Copy link
Contributor

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 /?

Copy link
Collaborator Author

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

@bookshelfdave
Copy link
Contributor

👏 I wonder if we could use this for integration testing as well?

gif-keyboard-2578626351067295967

@fnichol fnichol force-pushed the fnichol/fs-root-installation branch 2 times, most recently from 084e0d4 to 831d764 Compare May 17, 2016 15:00
@fnichol
Copy link
Collaborator Author

fnichol commented May 17, 2016

I incorporated feedback from @smith and re-pushed. Now all the path constants in core::fs are relative paths, represented as Strings.

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]>
@fnichol fnichol force-pushed the fnichol/fs-root-installation branch from 831d764 to 5bcde62 Compare May 17, 2016 16:07
@fnichol
Copy link
Collaborator Author

fnichol commented May 17, 2016

Compile all the crates, silly me.

gif-keyboard-9994866415490830399

Repushed

@fnichol
Copy link
Collaborator Author

fnichol commented May 17, 2016

@thesentinels r+

@thesentinels
Copy link
Contributor

📌 Commit 5bcde62 has been approved by fnichol

@thesentinels
Copy link
Contributor

⌛ Testing commit 5bcde62 with merge 8137822...

thesentinels pushed a commit that referenced this pull request May 17, 2016
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
@thesentinels
Copy link
Contributor

☀️ Test successful - travis

@thesentinels thesentinels merged commit 5bcde62 into master May 17, 2016
@fnichol fnichol deleted the fnichol/fs-root-installation branch May 17, 2016 17:26
jtimberman pushed a commit that referenced this pull request Jun 12, 2016
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
raskchanky pushed a commit that referenced this pull request Apr 16, 2019
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants