Published: Oct 29, 2020 by Isaac Johnson
Recently, a colleague asked me about Hashi Waypoint and how it related to Chef Habitat. While familiar with Chef’s other products, I wasn’t with “Habitat”. What exactly is Chef Habitat and how does it fit in the DevOps ecosystem? Let’s dig in to find out.
What Chef Habitat is not
I started down the path assuming this was a CI/CD tool like Jenkins or DevOps or Waypoint.. However, digging in more, this is more in the realm of Helm (though not k8s specific) and Nomad married to a build tool.
You should note the big difference from this slide - the “.Hart” file contains the artifact to _ build _ not just launch. This means more of the compile is sent to your destination environment.
Clearly the positive is that the “artifact” does not need to rebuilt for every destination platform, but then the consequence is that your “artifact” is not an immutable binary - it’s more of a pack of code and how to build.
A “Hab Artifact” contains:
- Application Codebase
- Build Instructions
- Configuration Instructions
- Relationships
- Dependencies
- Run-Time Instructions
You can supposedly export as a CNCI container image from Hab Studio (something I plan to explore)
Setup
We will setup Chef Habitat on Windows and WSL but know that the first part of this tutorial is mostly around their hello-world example (save for some fixes). We will get to deploying an app to the cloud using this in the end.
First install CLI
$ curl https://raw.githubusercontent.com/habitat-sh/habitat/master/components/hab/install.sh | sudo bash
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 9420 100 9420 0 0 23550 0 --:--:-- --:--:-- --:--:-- 23550[sudo] password for builder:
--> hab-install: Installing Habitat 'hab' program
--> hab-install: Downloading via wget: https://packages.chef.io/files/stable/habitat/latest/hab-x86_64-linux.tar.gz
--> hab-install: Downloading via wget: https://packages.chef.io/files/stable/habitat/latest/hab-x86_64-linux.tar.gz.sha256sum
renamed '/var/tmp/tmp.bYaS3wusHD/hab-latest.tar.gz' -> 'hab-x86_64-linux.tar.gz'
renamed '/var/tmp/tmp.bYaS3wusHD/hab-latest.tar.gz.sha256sum' -> 'hab-x86_64-linux.tar.gz.sha256sum'
--> hab-install: GnuPG tooling found, downloading signatures
--> hab-install: Downloading via wget: https://packages.chef.io/files/stable/habitat/latest/hab-x86_64-linux.tar.gz.sha256sum.asc
--> hab-install: Downloading via wget: https://packages.chef.io/chef.asc
--> hab-install: GnuPG tooling found, verifying the shasum digest is properly signed
gpg: directory '/home/builder/.gnupg' created
gpg: keybox '/home/builder/.gnupg/pubring.kbx' created
gpg: assuming signed data in 'hab-x86_64-linux.tar.gz.sha256sum'
gpg: Signature made Mon Oct 26 12:15:52 2020 CDT
gpg: using DSA key 11685DB92F03640A2FFE7CA82940ABA983EF826A
gpg: /home/builder/.gnupg/trustdb.gpg: trustdb created
gpg: Good signature from "CHEF Packages <packages@chef.io>" [unknown]
gpg: aka "Opscode Packages <packages@opscode.com>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg: There is no indication that the signature belongs to the owner.
Primary key fingerprint: 1168 5DB9 2F03 640A 2FFE 7CA8 2940 ABA9 83EF 826A
--> hab-install: Verifying the shasum digest matches the downloaded archive
hab-x86_64-linux.tar.gz: OK
--> hab-install: Extracting hab-x86_64-linux.tar.gz
--> hab-install: Installing Habitat package using temporarily downloaded hab
» Installing core/hab
☁ Determining latest version of core/hab in the 'stable' channel
↓ Downloading core/hab/1.6.175/20201026161911 for x86_64-linux
5.26 MB / 5.26 MB / [============================================================] 100.00 % 184.23 MB/s
☛ Verifying core/hab/1.6.175/20201026161911
↓ Downloading core-20180119235000 public origin key
75 B / 75 B | [====================================================================] 100.00 % 3.03 MB/s
☑ Cached core-20180119235000 public origin key
✓ Installed core/hab/1.6.175/20201026161911
★ Install of core/hab/1.6.175/20201026161911 complete with 1 new packages installed.
» Binlinking hab from core/hab/1.6.175/20201026161911 into /bin
★ Binlinked hab from core/hab/1.6.175/20201026161911 to /bin/hab
--> hab-install: Checking installed hab version
hab 1.6.175/20201026161911
--> hab-install: Installation of Habitat 'hab' program complete.
Generate an origin key
This will be used to identify “you” and “your” packages. Think of it as a signing key.
$ export HAB_ORIGIN='freshbrewed'
builder@DESKTOP-JBA79RT:~/Workspaces/chefhab$ hab origin key generate
+---------------------------------------------+
Chef License Acceptance
Before you can continue, 1 product license must be accepted.
View the license at https://www.chef.io/end-user-license-agreement
License that needs accepting:
* Habitat
Do you accept the 1 product license? [yes/No/quit] yes
Accepting 1 product license...
✓ 1 product license accepted.
+---------------------------------------------+
» Generating origin key for freshbrewed
★ Generated origin key pair freshbrewed-20201029104827.
Build a Sample App (Java)
Clone the repo and then init hab
$ git clone https://github.com/chef-training/java-sample
Cloning into 'java-sample'...
remote: Enumerating objects: 10, done.
remote: Counting objects: 100% (10/10), done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 10 (delta 1), reused 7 (delta 0), pack-reused 0
Unpacking objects: 100% (10/10), done.
$ cd java-sample/
$ hab plan init
» Attempting autodiscovery
No scaffolding type was provided. Let's see if we can figure out what
kind of application you're planning to package.
Ø Unable to determine the type of app in your current directory
For now, we'll generate a plan with all of the available plan variables
and build phase callbacks. For more documentation on plan options visit
https://www.habitat.sh/docs/reference/plan-syntax/
» Constructing a cozy habitat for your app...
Ω Creating file: habitat/plan.sh
`plan.sh` is the foundation of your new habitat. It contains metadata,
dependencies, and tasks.
Ω Creating file: habitat/default.toml
`default.toml` contains default values for `cfg` prefixed variables.
Ω Creating file: habitat/README.md
`README.md` contains a basic README document which you should update.
Ω Creating directory: habitat/config/
`/config/` contains configuration files for your app.
Ω Creating directory: habitat/hooks/
`/hooks/` contains automation hooks into your habitat.
For more information on any of the files:
https://www.habitat.sh/docs/reference/plan-syntax/
Ω Creating file: habitat/../.gitignore
★ An abode for your code is initialized!
That created a whole habitat directory structure from the root level. It seems pretty straightforward, however I did note the inclusion of an Apache 2.0 license in the plan.
[master 2994640] hab files
3 files changed, 374 insertions(+)
create mode 100644 habitat/README.md
create mode 100644 habitat/default.toml
create mode 100644 habitat/plan.sh
Next we enter the “hab studio” (a clean environment for builds)
$ hab studio enter
∵ Missing package for core/hab-studio/1.6.175
» Installing core/hab-studio/1.6.175
☁ Determining latest version of core/hab-studio/1.6.175 in the 'stable' channel
↓ Downloading core/hab-studio/1.6.175/20201026165228 for x86_64-linux
5.24 MB / 5.24 MB \ [=====================================================================================================] 100.00 % 216.21 MB/s
☛ Verifying core/hab-studio/1.6.175/20201026165228
↓ Downloading core/hab-backline/1.6.175/20201026165108 for x86_64-linux
2.29 KB / 2.29 KB | [=====================================================================================================] 100.00 % 111.26 MB/s
☛ Verifying core/hab-backline/1.6.175/20201026165108
↓ Downloading core/hab-plan-build/1.6.175/20201026164925 for x86_64-linux
35.50 KB / 35.50 KB | [===================================================================================================] 100.00 % 218.32 MB/s
☛ Verifying core/hab-plan-build/1.6.175/20201026164925
↓ Downloading core/diffutils/3.7/20200306000423 for x86_64-linux
290.74 KB / 290.74 KB | [=================================================================================================] 100.00 % 219.02 MB/s
☛ Verifying core/diffutils/3.7/20200306000423
↓ Downloading core-20200219002627 public origin key
75 B / 75 B | [=============================================================================================================] 100.00 % 2.99 MB/s
☑ Cached core-20200219002627 public origin key
↓ Downloading core/make/4.2.1/20200306002515 for x86_64-linux
360.85 KB / 360.85 KB / [=================================================================================================] 100.00 % 203.56 MB/s
☛ Verifying core/make/4.2.1/20200306002515
↓ Downloading core/mg/20180408/20200306015846 for x86_64-linux
75.81 KB / 75.81 KB / [===================================================================================================] 100.00 % 151.89 MB/s
☛ Verifying core/mg/20180408/20200306015846
↓ Downloading core/util-linux/2.34/20200306003119 for x86_64-linux
2.31 MB / 2.31 MB \ [=====================================================================================================] 100.00 % 186.45 MB/s
☛ Verifying core/util-linux/2.34/20200306003119
↓ Downloading core/vim/8.1.1694/20200306015156 for x86_64-linux
5.84 MB / 5.84 MB \ [=====================================================================================================] 100.00 % 201.30 MB/s
☛ Verifying core/vim/8.1.1694/20200306015156
↓ Downloading core/bash/5.0.16/20200305233030 for x86_64-linux
1.32 MB / 1.32 MB | [======================================================================================================] 100.00 % 52.42 MB/s
☛ Verifying core/bash/5.0.16/20200305233030
↓ Downloading core/binutils/2.32/20200305174809 for x86_64-linux
5.86 MB / 5.86 MB - [=====================================================================================================] 100.00 % 163.99 MB/s
☛ Verifying core/binutils/2.32/20200305174809
↓ Downloading core/coreutils/8.30/20200305231640 for x86_64-linux
2.07 MB / 2.07 MB / [=====================================================================================================] 100.00 % 168.27 MB/s
☛ Verifying core/coreutils/8.30/20200305231640
↓ Downloading core/file/5.37/20200305174635 for x86_64-linux
281.28 KB / 281.28 KB \ [=================================================================================================] 100.00 % 248.45 MB/s
☛ Verifying core/file/5.37/20200305174635
↓ Downloading core/findutils/4.6.0/20200306000932 for x86_64-linux
404.02 KB / 404.02 KB - [=================================================================================================] 100.00 % 240.70 MB/s
☛ Verifying core/findutils/4.6.0/20200306000932
↓ Downloading core/gawk/5.0.1/20200305233704 for x86_64-linux
860.36 KB / 860.36 KB \ [=================================================================================================] 100.00 % 174.03 MB/s
☛ Verifying core/gawk/5.0.1/20200305233704
↓ Downloading core/gzip/1.10/20200306002325 for x86_64-linux
61.89 KB / 61.89 KB \ [===================================================================================================] 100.00 % 160.14 MB/s
☛ Verifying core/gzip/1.10/20200306002325
→ Using core/hab/1.6.175/20201026161911
↓ Downloading core/rq/0.10.4/20200306011144 for x86_64-linux
4.09 MB / 4.09 MB \ [=====================================================================================================] 100.00 % 186.75 MB/s
☛ Verifying core/rq/0.10.4/20200306011144
↓ Downloading core/sed/4.5/20200305230928 for x86_64-linux
167.25 KB / 167.25 KB | [=================================================================================================] 100.00 % 175.89 MB/s
☛ Verifying core/sed/4.5/20200305230928
↓ Downloading core/tar/1.32/20200305233447 for x86_64-linux
663.20 KB / 663.20 KB - [=================================================================================================] 100.00 % 188.10 MB/s
☛ Verifying core/tar/1.32/20200305233447
↓ Downloading core/unzip/6.0/20200306011037 for x86_64-linux
100.05 KB / 100.05 KB | [=================================================================================================] 100.00 % 205.79 MB/s
☛ Verifying core/unzip/6.0/20200306011037
↓ Downloading core/wget/1.19.5/20200306010801 for x86_64-linux
533.21 KB / 533.21 KB - [=================================================================================================] 100.00 % 210.82 MB/s
☛ Verifying core/wget/1.19.5/20200306010801
↓ Downloading core/xz/5.2.4/20200306001321 for x86_64-linux
238.88 KB / 238.88 KB / [=================================================================================================] 100.00 % 176.81 MB/s
☛ Verifying core/xz/5.2.4/20200306001321
↓ Downloading core/readline/8.0/20200305232850 for x86_64-linux
294.89 KB / 294.89 KB | [=================================================================================================] 100.00 % 198.03 MB/s
☛ Verifying core/readline/8.0/20200305232850
↓ Downloading core/libcap/2.27/20200305230759 for x86_64-linux
33.18 KB / 33.18 KB | [===================================================================================================] 100.00 % 172.72 MB/s
☛ Verifying core/libcap/2.27/20200305230759
↓ Downloading core/gmp/6.1.2/20200305175803 for x86_64-linux
412.45 KB / 412.45 KB \ [=================================================================================================] 100.00 % 229.88 MB/s
☛ Verifying core/gmp/6.1.2/20200305175803
↓ Downloading core/mpfr/4.0.1/20200305180218 for x86_64-linux
384.98 KB / 384.98 KB | [=================================================================================================] 100.00 % 235.84 MB/s
☛ Verifying core/mpfr/4.0.1/20200305180218
↓ Downloading core/grep/3.3/20200305232635 for x86_64-linux
193.65 KB / 193.65 KB | [=================================================================================================] 100.00 % 175.26 MB/s
☛ Verifying core/grep/3.3/20200305232635
↓ Downloading core/less/530/20200305235121 for x86_64-linux
82.81 KB / 82.81 KB - [====================================================================================================] 100.00 % 26.11 MB/s
☛ Verifying core/less/530/20200305235121
↓ Downloading core/bzip2/1.0.8/20200305225842 for x86_64-linux
59.09 KB / 59.09 KB \ [===================================================================================================] 100.00 % 174.34 MB/s
☛ Verifying core/bzip2/1.0.8/20200305225842
↓ Downloading core/cacerts/2020.01.01/20200306005234 for x86_64-linux
119.54 KB / 119.54 KB - [=================================================================================================] 100.00 % 202.08 MB/s
☛ Verifying core/cacerts/2020.01.01/20200306005234
↓ Downloading core/libiconv/1.14/20200306010416 for x86_64-linux
527.56 KB / 527.56 KB / [=================================================================================================] 100.00 % 211.04 MB/s
☛ Verifying core/libiconv/1.14/20200306010416
↓ Downloading core/libidn2/2.0.4/20200306010601 for x86_64-linux
84.00 KB / 84.00 KB - [===================================================================================================] 100.00 % 158.46 MB/s
☛ Verifying core/libidn2/2.0.4/20200306010601
↓ Downloading core/libunistring/0.9.10/20200306010001 for x86_64-linux
507.61 KB / 507.61 KB \ [=================================================================================================] 100.00 % 186.09 MB/s
☛ Verifying core/libunistring/0.9.10/20200306010001
↓ Downloading core/openssl-fips/2.0.16/20200306005307 for x86_64-linux
247.25 KB / 247.25 KB - [=================================================================================================] 100.00 % 228.26 MB/s
☛ Verifying core/openssl-fips/2.0.16/20200306005307
↓ Downloading core/openssl/1.0.2t/20200306005450 for x86_64-linux
2.31 MB / 2.31 MB \ [=====================================================================================================] 100.00 % 175.96 MB/s
☛ Verifying core/openssl/1.0.2t/20200306005450
↓ Downloading core/gcc-libs/9.1.0/20200305225533 for x86_64-linux
3.79 MB / 3.79 MB / [=====================================================================================================] 100.00 % 159.12 MB/s
☛ Verifying core/gcc-libs/9.1.0/20200305225533
↓ Downloading core/pcre/8.42/20200305232429 for x86_64-linux
733.65 KB / 733.65 KB \ [=================================================================================================] 100.00 % 234.54 MB/s
☛ Verifying core/pcre/8.42/20200305232429
↓ Downloading core/libbsd/0.9.1/20200306015546 for x86_64-linux
112.18 KB / 112.18 KB - [=================================================================================================] 100.00 % 156.03 MB/s
☛ Verifying core/libbsd/0.9.1/20200306015546
↓ Downloading core/zlib/1.2.11/20200305174519 for x86_64-linux
75.02 KB / 75.02 KB / [===================================================================================================] 100.00 % 125.84 MB/s
☛ Verifying core/zlib/1.2.11/20200305174519
↓ Downloading core/acl/2.2.53/20200305230628 for x86_64-linux
87.04 KB / 87.04 KB - [===================================================================================================] 100.00 % 193.85 MB/s
☛ Verifying core/acl/2.2.53/20200305230628
↓ Downloading core/attr/2.4.48/20200305230504 for x86_64-linux
55.99 KB / 55.99 KB - [===================================================================================================] 100.00 % 253.82 MB/s
☛ Verifying core/attr/2.4.48/20200305230504
↓ Downloading core/ncurses/6.1/20200305230210 for x86_64-linux
844.47 KB / 844.47 KB / [=================================================================================================] 100.00 % 178.62 MB/s
☛ Verifying core/ncurses/6.1/20200305230210
↓ Downloading core/glibc/2.29/20200305172459 for x86_64-linux
12.04 MB / 12.04 MB | [===================================================================================================] 100.00 % 177.31 MB/s
☛ Verifying core/glibc/2.29/20200305172459
↓ Downloading core/linux-headers/4.19.62/20200305172241 for x86_64-linux
1001.13 KB / 1001.13 KB / [===============================================================================================] 100.00 % 221.72 MB/s
☛ Verifying core/linux-headers/4.19.62/20200305172241
✓ Installed core/hab-backline/1.6.175/20201026165108
✓ Installed core/hab-plan-build/1.6.175/20201026164925
✓ Installed core/diffutils/3.7/20200306000423
✓ Installed core/make/4.2.1/20200306002515
✓ Installed core/mg/20180408/20200306015846
✓ Installed core/util-linux/2.34/20200306003119
✓ Installed core/vim/8.1.1694/20200306015156
✓ Installed core/bash/5.0.16/20200305233030
✓ Installed core/binutils/2.32/20200305174809
✓ Installed core/coreutils/8.30/20200305231640
✓ Installed core/file/5.37/20200305174635
✓ Installed core/findutils/4.6.0/20200306000932
✓ Installed core/gawk/5.0.1/20200305233704
✓ Installed core/gzip/1.10/20200306002325
✓ Installed core/rq/0.10.4/20200306011144
✓ Installed core/sed/4.5/20200305230928
✓ Installed core/tar/1.32/20200305233447
✓ Installed core/unzip/6.0/20200306011037
✓ Installed core/wget/1.19.5/20200306010801
✓ Installed core/xz/5.2.4/20200306001321
✓ Installed core/readline/8.0/20200305232850
✓ Installed core/libcap/2.27/20200305230759
✓ Installed core/gmp/6.1.2/20200305175803
✓ Installed core/mpfr/4.0.1/20200305180218
✓ Installed core/grep/3.3/20200305232635
✓ Installed core/less/530/20200305235121
✓ Installed core/bzip2/1.0.8/20200305225842
✓ Installed core/cacerts/2020.01.01/20200306005234
✓ Installed core/libiconv/1.14/20200306010416
✓ Installed core/libidn2/2.0.4/20200306010601
✓ Installed core/libunistring/0.9.10/20200306010001
✓ Installed core/openssl-fips/2.0.16/20200306005307
✓ Installed core/openssl/1.0.2t/20200306005450
✓ Installed core/gcc-libs/9.1.0/20200305225533
✓ Installed core/pcre/8.42/20200305232429
✓ Installed core/libbsd/0.9.1/20200306015546
✓ Installed core/zlib/1.2.11/20200305174519
✓ Installed core/acl/2.2.53/20200305230628
✓ Installed core/attr/2.4.48/20200305230504
✓ Installed core/ncurses/6.1/20200305230210
✓ Installed core/glibc/2.29/20200305172459
✓ Installed core/linux-headers/4.19.62/20200305172241
✓ Installed core/hab-studio/1.6.175/20201026165228
★ Install of core/hab-studio/1.6.175/20201026165228 complete with 43 new packages installed.
hab-studio: Creating Studio at /hab/studios/home--builder--Workspaces--chefhab--java-sample (default)
hab-studio: Importing 'freshbrewed' secret origin key
» Importing origin key from standard input
★ Imported secret origin key freshbrewed-20201029104827
hab-studio: Importing 'freshbrewed' public origin key
» Importing origin key from standard input
★ Imported public origin key freshbrewed-20201029104827
» Installing core/hab-backline/1.6.175/20201026165108
↓ Downloading core/hab-backline/1.6.175/20201026165108 for x86_64-linux
2.29 KB / 2.29 KB | [=====================================================================================================] 100.00 % 133.12 MB/s
☛ Verifying core/hab-backline/1.6.175/20201026165108
↓ Downloading core-20180119235000 public origin key
75 B / 75 B | [=============================================================================================================] 100.00 % 3.74 MB/s
☑ Cached core-20180119235000 public origin key
↓ Downloading core/hab-plan-build/1.6.175/20201026164925 for x86_64-linux
35.50 KB / 35.50 KB | [====================================================================================================] 100.00 % 76.31 MB/s
☛ Verifying core/hab-plan-build/1.6.175/20201026164925
↓ Downloading core/diffutils/3.7/20200306000423 for x86_64-linux
290.74 KB / 290.74 KB | [=================================================================================================] 100.00 % 162.45 MB/s
☛ Verifying core/diffutils/3.7/20200306000423
↓ Downloading core-20200219002627 public origin key
75 B / 75 B | [=============================================================================================================] 100.00 % 3.67 MB/s
☑ Cached core-20200219002627 public origin key
↓ Downloading core/make/4.2.1/20200306002515 for x86_64-linux
360.85 KB / 360.85 KB / [=================================================================================================] 100.00 % 170.83 MB/s
☛ Verifying core/make/4.2.1/20200306002515
↓ Downloading core/mg/20180408/20200306015846 for x86_64-linux
75.81 KB / 75.81 KB / [===================================================================================================] 100.00 % 180.13 MB/s
☛ Verifying core/mg/20180408/20200306015846
↓ Downloading core/util-linux/2.34/20200306003119 for x86_64-linux
2.31 MB / 2.31 MB \ [=====================================================================================================] 100.00 % 158.87 MB/s
☛ Verifying core/util-linux/2.34/20200306003119
↓ Downloading core/vim/8.1.1694/20200306015156 for x86_64-linux
5.84 MB / 5.84 MB \ [=====================================================================================================] 100.00 % 168.37 MB/s
☛ Verifying core/vim/8.1.1694/20200306015156
↓ Downloading core/bash/5.0.16/20200305233030 for x86_64-linux
1.32 MB / 1.32 MB | [=====================================================================================================] 100.00 % 202.46 MB/s
☛ Verifying core/bash/5.0.16/20200305233030
↓ Downloading core/binutils/2.32/20200305174809 for x86_64-linux
5.86 MB / 5.86 MB - [=====================================================================================================] 100.00 % 205.19 MB/s
☛ Verifying core/binutils/2.32/20200305174809
↓ Downloading core/coreutils/8.30/20200305231640 for x86_64-linux
2.07 MB / 2.07 MB / [=====================================================================================================] 100.00 % 195.34 MB/s
☛ Verifying core/coreutils/8.30/20200305231640
↓ Downloading core/file/5.37/20200305174635 for x86_64-linux
281.28 KB / 281.28 KB \ [=================================================================================================] 100.00 % 185.65 MB/s
☛ Verifying core/file/5.37/20200305174635
↓ Downloading core/findutils/4.6.0/20200306000932 for x86_64-linux
404.02 KB / 404.02 KB - [=================================================================================================] 100.00 % 163.14 MB/s
☛ Verifying core/findutils/4.6.0/20200306000932
↓ Downloading core/gawk/5.0.1/20200305233704 for x86_64-linux
860.36 KB / 860.36 KB \ [=================================================================================================] 100.00 % 225.28 MB/s
☛ Verifying core/gawk/5.0.1/20200305233704
↓ Downloading core/gzip/1.10/20200306002325 for x86_64-linux
61.89 KB / 61.89 KB \ [====================================================================================================] 100.00 % 26.60 MB/s
☛ Verifying core/gzip/1.10/20200306002325
↓ Downloading core/hab/1.6.175/20201026161911 for x86_64-linux
5.26 MB / 5.26 MB / [=====================================================================================================] 100.00 % 190.50 MB/s
☛ Verifying core/hab/1.6.175/20201026161911
↓ Downloading core/rq/0.10.4/20200306011144 for x86_64-linux
4.09 MB / 4.09 MB \ [=====================================================================================================] 100.00 % 184.04 MB/s
☛ Verifying core/rq/0.10.4/20200306011144
↓ Downloading core/sed/4.5/20200305230928 for x86_64-linux
167.25 KB / 167.25 KB | [==================================================================================================] 100.00 % 20.09 MB/s
☛ Verifying core/sed/4.5/20200305230928
↓ Downloading core/tar/1.32/20200305233447 for x86_64-linux
663.20 KB / 663.20 KB - [=================================================================================================] 100.00 % 181.55 MB/s
☛ Verifying core/tar/1.32/20200305233447
↓ Downloading core/unzip/6.0/20200306011037 for x86_64-linux
100.05 KB / 100.05 KB | [=================================================================================================] 100.00 % 210.67 MB/s
☛ Verifying core/unzip/6.0/20200306011037
↓ Downloading core/wget/1.19.5/20200306010801 for x86_64-linux
533.21 KB / 533.21 KB - [=================================================================================================] 100.00 % 205.25 MB/s
☛ Verifying core/wget/1.19.5/20200306010801
↓ Downloading core/xz/5.2.4/20200306001321 for x86_64-linux
238.88 KB / 238.88 KB / [=================================================================================================] 100.00 % 196.02 MB/s
☛ Verifying core/xz/5.2.4/20200306001321
↓ Downloading core/readline/8.0/20200305232850 for x86_64-linux
294.89 KB / 294.89 KB | [=================================================================================================] 100.00 % 204.36 MB/s
☛ Verifying core/readline/8.0/20200305232850
↓ Downloading core/libcap/2.27/20200305230759 for x86_64-linux
33.18 KB / 33.18 KB | [===================================================================================================] 100.00 % 130.60 MB/s
☛ Verifying core/libcap/2.27/20200305230759
↓ Downloading core/gmp/6.1.2/20200305175803 for x86_64-linux
412.45 KB / 412.45 KB \ [=================================================================================================] 100.00 % 210.27 MB/s
☛ Verifying core/gmp/6.1.2/20200305175803
↓ Downloading core/mpfr/4.0.1/20200305180218 for x86_64-linux
384.98 KB / 384.98 KB | [=================================================================================================] 100.00 % 168.88 MB/s
☛ Verifying core/mpfr/4.0.1/20200305180218
↓ Downloading core/grep/3.3/20200305232635 for x86_64-linux
193.65 KB / 193.65 KB | [=================================================================================================] 100.00 % 192.71 MB/s
☛ Verifying core/grep/3.3/20200305232635
↓ Downloading core/less/530/20200305235121 for x86_64-linux
82.81 KB / 82.81 KB - [===================================================================================================] 100.00 % 155.34 MB/s
☛ Verifying core/less/530/20200305235121
↓ Downloading core/bzip2/1.0.8/20200305225842 for x86_64-linux
59.09 KB / 59.09 KB \ [===================================================================================================] 100.00 % 161.28 MB/s
☛ Verifying core/bzip2/1.0.8/20200305225842
↓ Downloading core/cacerts/2020.01.01/20200306005234 for x86_64-linux
119.54 KB / 119.54 KB - [=================================================================================================] 100.00 % 213.42 MB/s
☛ Verifying core/cacerts/2020.01.01/20200306005234
↓ Downloading core/libiconv/1.14/20200306010416 for x86_64-linux
527.56 KB / 527.56 KB / [=================================================================================================] 100.00 % 189.12 MB/s
☛ Verifying core/libiconv/1.14/20200306010416
↓ Downloading core/libidn2/2.0.4/20200306010601 for x86_64-linux
84.00 KB / 84.00 KB - [===================================================================================================] 100.00 % 110.72 MB/s
☛ Verifying core/libidn2/2.0.4/20200306010601
↓ Downloading core/libunistring/0.9.10/20200306010001 for x86_64-linux
507.61 KB / 507.61 KB \ [=================================================================================================] 100.00 % 102.26 MB/s
☛ Verifying core/libunistring/0.9.10/20200306010001
↓ Downloading core/openssl-fips/2.0.16/20200306005307 for x86_64-linux
247.25 KB / 247.25 KB - [=================================================================================================] 100.00 % 142.84 MB/s
☛ Verifying core/openssl-fips/2.0.16/20200306005307
↓ Downloading core/openssl/1.0.2t/20200306005450 for x86_64-linux
2.31 MB / 2.31 MB \ [=====================================================================================================] 100.00 % 196.13 MB/s
☛ Verifying core/openssl/1.0.2t/20200306005450
↓ Downloading core/gcc-libs/9.1.0/20200305225533 for x86_64-linux
3.79 MB / 3.79 MB / [=====================================================================================================] 100.00 % 215.72 MB/s
☛ Verifying core/gcc-libs/9.1.0/20200305225533
↓ Downloading core/pcre/8.42/20200305232429 for x86_64-linux
733.65 KB / 733.65 KB \ [=================================================================================================] 100.00 % 227.18 MB/s
☛ Verifying core/pcre/8.42/20200305232429
↓ Downloading core/libbsd/0.9.1/20200306015546 for x86_64-linux
112.18 KB / 112.18 KB - [=================================================================================================] 100.00 % 150.02 MB/s
☛ Verifying core/libbsd/0.9.1/20200306015546
↓ Downloading core/zlib/1.2.11/20200305174519 for x86_64-linux
75.02 KB / 75.02 KB / [===================================================================================================] 100.00 % 146.85 MB/s
☛ Verifying core/zlib/1.2.11/20200305174519
↓ Downloading core/acl/2.2.53/20200305230628 for x86_64-linux
87.04 KB / 87.04 KB - [===================================================================================================] 100.00 % 252.76 MB/s
☛ Verifying core/acl/2.2.53/20200305230628
↓ Downloading core/attr/2.4.48/20200305230504 for x86_64-linux
55.99 KB / 55.99 KB - [===================================================================================================] 100.00 % 246.05 MB/s
☛ Verifying core/attr/2.4.48/20200305230504
↓ Downloading core/ncurses/6.1/20200305230210 for x86_64-linux
844.47 KB / 844.47 KB / [=================================================================================================] 100.00 % 155.27 MB/s
☛ Verifying core/ncurses/6.1/20200305230210
↓ Downloading core/glibc/2.29/20200305172459 for x86_64-linux
12.04 MB / 12.04 MB | [===================================================================================================] 100.00 % 183.57 MB/s
☛ Verifying core/glibc/2.29/20200305172459
↓ Downloading core/linux-headers/4.19.62/20200305172241 for x86_64-linux
1001.13 KB / 1001.13 KB / [===============================================================================================] 100.00 % 208.56 MB/s
☛ Verifying core/linux-headers/4.19.62/20200305172241
✓ Installed core/hab-plan-build/1.6.175/20201026164925
✓ Installed core/diffutils/3.7/20200306000423
✓ Installed core/make/4.2.1/20200306002515
✓ Installed core/mg/20180408/20200306015846
✓ Installed core/util-linux/2.34/20200306003119
✓ Installed core/vim/8.1.1694/20200306015156
✓ Installed core/bash/5.0.16/20200305233030
✓ Installed core/binutils/2.32/20200305174809
✓ Installed core/coreutils/8.30/20200305231640
✓ Installed core/file/5.37/20200305174635
✓ Installed core/findutils/4.6.0/20200306000932
✓ Installed core/gawk/5.0.1/20200305233704
✓ Installed core/gzip/1.10/20200306002325
✓ Installed core/hab/1.6.175/20201026161911
✓ Installed core/rq/0.10.4/20200306011144
✓ Installed core/sed/4.5/20200305230928
✓ Installed core/tar/1.32/20200305233447
✓ Installed core/unzip/6.0/20200306011037
✓ Installed core/wget/1.19.5/20200306010801
✓ Installed core/xz/5.2.4/20200306001321
✓ Installed core/readline/8.0/20200305232850
✓ Installed core/libcap/2.27/20200305230759
✓ Installed core/gmp/6.1.2/20200305175803
✓ Installed core/mpfr/4.0.1/20200305180218
✓ Installed core/grep/3.3/20200305232635
✓ Installed core/less/530/20200305235121
✓ Installed core/bzip2/1.0.8/20200305225842
✓ Installed core/cacerts/2020.01.01/20200306005234
✓ Installed core/libiconv/1.14/20200306010416
✓ Installed core/libidn2/2.0.4/20200306010601
✓ Installed core/libunistring/0.9.10/20200306010001
✓ Installed core/openssl-fips/2.0.16/20200306005307
✓ Installed core/openssl/1.0.2t/20200306005450
✓ Installed core/gcc-libs/9.1.0/20200305225533
✓ Installed core/pcre/8.42/20200305232429
✓ Installed core/libbsd/0.9.1/20200306015546
✓ Installed core/zlib/1.2.11/20200305174519
✓ Installed core/acl/2.2.53/20200305230628
✓ Installed core/attr/2.4.48/20200305230504
✓ Installed core/ncurses/6.1/20200305230210
✓ Installed core/glibc/2.29/20200305172459
✓ Installed core/linux-headers/4.19.62/20200305172241
✓ Installed core/hab-backline/1.6.175/20201026165108
★ Install of core/hab-backline/1.6.175/20201026165108 complete with 43 new packages installed.
» Binlinking hab from core/hab into /hab/studios/home--builder--Workspaces--chefhab--java-sample/hab/bin
★ Binlinked hab from core/hab/1.6.175/20201026161911 to /hab/studios/home--builder--Workspaces--chefhab--java-sample/hab/bin/hab
» Binlinking bash from core/bash into /hab/studios/home--builder--Workspaces--chefhab--java-sample/bin
★ Binlinked bash from core/bash/5.0.16/20200305233030 to /hab/studios/home--builder--Workspaces--chefhab--java-sample/bin/bash
» Binlinking sh from core/bash into /hab/studios/home--builder--Workspaces--chefhab--java-sample/bin
★ Binlinked sh from core/bash/5.0.16/20200305233030 to /hab/studios/home--builder--Workspaces--chefhab--java-sample/bin/sh
hab-studio: Entering Studio at /hab/studios/home--builder--Workspaces--chefhab--java-sample (default)
hab-studio: Exported: HAB_ORIGIN=freshbrewed
--> Launching the Habitat Supervisor in the background...
Running: hab sup run
* Use 'hab svc start' & 'hab svc stop' to start and stop services
* Use 'sup-log' to tail the Supervisor's output (Ctrl+c to stop)
* Use 'sup-term' to terminate the Supervisor
* To pass custom arguments to run the Supervisor, export
'HAB_STUDIO_SUP' with the arguments before running
'hab studio enter'.
--> To prevent a Supervisor from running automatically in your
Studio, export 'HAB_STUDIO_SUP=false' before running
'hab studio enter'.
[1][default:/src:0]#
Now that it’s launched, we can build our project…
[1][default:/src:0]# build
: Loading /src/habitat/plan.sh
java-sample: Plan loaded
java-sample: Validating plan metadata
java-sample: Using HAB_BIN=/hab/pkgs/core/hab/1.6.175/20201026161911/bin/hab for installs, signing, and hashing
java-sample: hab-plan-build setup
java-sample: Writing pre_build file
mkdir: created directory '/src/results'
java-sample: Resolving build dependencies
» Installing core/make
☁ Determining latest version of core/make in the 'stable' channel
→ Using core/make/4.2.1/20200306002515
★ Install of core/make/4.2.1/20200306002515 complete with 0 new packages installed.
java-sample: Resolved build dependency 'core/make' to /hab/pkgs/core/make/4.2.1/20200306002515
» Installing core/gcc
☁ Determining latest version of core/gcc in the 'stable' channel
↓ Downloading core/gcc/9.1.0/20200305180723 for x86_64-linux
46.10 MB / 46.10 MB | [============================================================================================================================] 100.00 % 163.33 MB/s
☛ Verifying core/gcc/9.1.0/20200305180723
→ Using core/binutils/2.32/20200305174809
→ Using core/glibc/2.29/20200305172459
→ Using core/gmp/6.1.2/20200305175803
↓ Downloading core/libmpc/1.1.0/20200305180541 for x86_64-linux
71.73 KB / 71.73 KB | [============================================================================================================================] 100.00 % 157.66 MB/s
☛ Verifying core/libmpc/1.1.0/20200305180541
→ Using core/linux-headers/4.19.62/20200305172241
→ Using core/mpfr/4.0.1/20200305180218
→ Using core/zlib/1.2.11/20200305174519
✓ Installed core/libmpc/1.1.0/20200305180541
✓ Installed core/gcc/9.1.0/20200305180723
★ Install of core/gcc/9.1.0/20200305180723 complete with 2 new packages installed.
java-sample: Resolved build dependency 'core/gcc' to /hab/pkgs/core/gcc/9.1.0/20200305180723
java-sample: Resolving run dependencies
» Installing core/glibc
☁ Determining latest version of core/glibc in the 'stable' channel
→ Using core/glibc/2.29/20200305172459
★ Install of core/glibc/2.29/20200305172459 complete with 0 new packages installed.
java-sample: Resolved dependency 'core/glibc' to /hab/pkgs/core/glibc/2.29/20200305172459
java-sample: Setting up environment
java-sample: Populating runtime environment from dependencies
java-sample: Populating buildtime environment from dependencies
java-sample: Layering runtime environment on top of system environment
java-sample: Layering buildtime environment on top of system environment
java-sample: Setting PATH=/hab/pkgs/core/make/4.2.1/20200306002515/bin:/hab/pkgs/core/gcc/9.1.0/20200305180723/bin:/hab/pkgs/core/glibc/2.29/20200305172459/bin:/hab/pkgs/core/binutils/2.32/20200305174809/bin:/hab/pkgs/core/hab-plan-build/1.6.175/20201026164925/bin:/hab/pkgs/core/bash/5.0.16/20200305233030/bin:/hab/pkgs/core/binutils/2.32/20200305174809/bin:/hab/pkgs/core/coreutils/8.30/20200305231640/bin:/hab/pkgs/core/file/5.37/20200305174635/bin:/hab/pkgs/core/findutils/4.6.0/20200306000932/bin:/hab/pkgs/core/gawk/5.0.1/20200305233704/bin:/hab/pkgs/core/grep/3.3/20200305232635/bin:/hab/pkgs/core/gzip/1.10/20200306002325/bin:/hab/pkgs/core/hab/1.6.175/20201026161911/bin:/hab/pkgs/core/rq/0.10.4/20200306011144/bin:/hab/pkgs/core/sed/4.5/20200305230928/bin:/hab/pkgs/core/tar/1.32/20200305233447/bin:/hab/pkgs/core/unzip/6.0/20200306011037/bin:/hab/pkgs/core/wget/1.19.5/20200306010801/bin:/hab/pkgs/core/xz/5.2.4/20200306001321/bin:/hab/pkgs/core/libcap/2.27/20200305230759/bin:/hab/pkgs/core/less/530/20200305235121/bin:/hab/pkgs/core/ncurses/6.1/20200305230210/bin:/hab/pkgs/core/acl/2.2.53/20200305230628/bin:/hab/pkgs/core/attr/2.4.48/20200305230504/bin:/hab/pkgs/core/bzip2/1.0.8/20200305225842/bin:/hab/pkgs/core/libidn2/2.0.4/20200306010601/bin:/hab/pkgs/core/openssl-fips/2.0.16/20200306005307/bin:/hab/pkgs/core/openssl/1.0.2t/20200306005450/bin:/hab/pkgs/core/pcre/8.42/20200305232429/bin:/hab/pkgs/core/glibc/2.29/20200305172459/bin:/hab/bin:/hab/pkgs/core/hab-plan-build/1.6.175/20201026164925/bin:/hab/pkgs/core/diffutils/3.7/20200306000423/bin:/hab/pkgs/core/less/530/20200305235121/bin:/hab/pkgs/core/make/4.2.1/20200306002515/bin:/hab/pkgs/core/mg/20180408/20200306015846/bin:/hab/pkgs/core/util-linux/2.34/20200306003119/bin:/hab/pkgs/core/vim/8.1.1694/20200306015156/bin:/hab/pkgs/core/ncurses/6.1/20200305230210/bin:/hab/pkgs/core/bash/5.0.16/20200305233030/bin:/hab/pkgs/core/binutils/2.32/20200305174809/bin:/hab/pkgs/core/coreutils/8.30/20200305231640/bin:/hab/pkgs/core/file/5.37/20200305174635/bin:/hab/pkgs/core/findutils/4.6.0/20200306000932/bin:/hab/pkgs/core/gawk/5.0.1/20200305233704/bin:/hab/pkgs/core/gzip/1.10/20200306002325/bin:/hab/pkgs/core/hab/1.6.175/20201026161911/bin:/hab/pkgs/core/rq/0.10.4/20200306011144/bin:/hab/pkgs/core/sed/4.5/20200305230928/bin:/hab/pkgs/core/tar/1.32/20200305233447/bin:/hab/pkgs/core/unzip/6.0/20200306011037/bin:/hab/pkgs/core/wget/1.19.5/20200306010801/bin:/hab/pkgs/core/xz/5.2.4/20200306001321/bin:/hab/pkgs/core/libcap/2.27/20200305230759/bin:/hab/pkgs/core/grep/3.3/20200305232635/bin:/hab/pkgs/core/bzip2/1.0.8/20200305225842/bin:/hab/pkgs/core/libidn2/2.0.4/20200306010601/bin:/hab/pkgs/core/openssl-fips/2.0.16/20200306005307/bin:/hab/pkgs/core/openssl/1.0.2t/20200306005450/bin:/hab/pkgs/core/pcre/8.42/20200305232429/bin:/hab/pkgs/core/acl/2.2.53/20200305230628/bin:/hab/pkgs/core/attr/2.4.48/20200305230504/bin:/hab/pkgs/core/glibc/2.29/20200305172459/bin:/hab/bin
mkdir: created directory '/hab/cache/src'
java-sample: Clean the cache
java-sample: Setting build environment
mkdir: created directory '/hab/cache/src/java-sample-0.1.0'
java-sample: Setting PREFIX=/hab/pkgs/freshbrewed/java-sample/0.1.0/20201029105743
java-sample: Setting LD_RUN_PATH=/hab/pkgs/core/glibc/2.29/20200305172459/lib
java-sample: Setting CFLAGS=-I/hab/pkgs/core/make/4.2.1/20200306002515/include -I/hab/pkgs/core/gcc/9.1.0/20200305180723/include -I/hab/pkgs/core/glibc/2.29/20200305172459/include
java-sample: Setting CXXFLAGS=-I/hab/pkgs/core/make/4.2.1/20200306002515/include -I/hab/pkgs/core/gcc/9.1.0/20200305180723/include -I/hab/pkgs/core/glibc/2.29/20200305172459/include
java-sample: Setting CPPFLAGS=-I/hab/pkgs/core/make/4.2.1/20200306002515/include -I/hab/pkgs/core/gcc/9.1.0/20200305180723/include -I/hab/pkgs/core/glibc/2.29/20200305172459/include
java-sample: Setting LDFLAGS=-L/hab/pkgs/core/gcc/9.1.0/20200305180723/lib -L/hab/pkgs/core/glibc/2.29/20200305172459/lib
java-sample: Setting PKG_CONFIG_PATH=
java-sample: Preparing to build
java-sample: Building
/hab/pkgs/core/hab-plan-build/1.6.175/20201026164925/bin/hab-plan-build: line 1887: ./configure: No such file or directory
java-sample: Build time: 0m14s
java-sample: Exiting on error
And I got this error several times. I then realized that the default plan assumes a make and configure (must have been C/C++ fans).. so you need to disable that and set a “return 0” instead in the plan (i commented out the do_default…)
# The default implementation is to update the prefix path for the configure
# script to use $pkg_prefix and then run make to compile the downloaded source.
# This means the script in the default implementation does
# ./configure --prefix=$pkg_prefix && make. You should override this behavior
# if you have additional configuration changes to make or other software to
# build and install as part of building your package.
do_build() {
#do_default_build
return 0
}
# The default implementation runs nothing during post-compile. An example of a
# command you might use in this callback is make test. To use this callback, two
# conditions must be true. A) do_check() function has been declared, B) DO_CHECK
# environment variable exists and set to true, env DO_CHECK=true.
do_check() {
return 0
}
# The default implementation is to run make install on the source files and
# place the compiled binaries or libraries in HAB_CACHE_SRC_PATH/$pkg_dirname,
# which resolves to a path like /hab/cache/src/packagename-version/. It uses
# this location because of do_build() using the --prefix option when calling the
# configure script. You should override this behavior if you need to perform
# custom installation steps, such as copying files from HAB_CACHE_SRC_PATH to
# specific directories in your package, or installing pre-built binaries into
# your package.
do_install() {
#do_default_install
return 0
}
Now we can build
[12][default:/src:2]# build
: Loading /src/habitat/plan.sh
java-sample: Plan loaded
java-sample: Validating plan metadata
java-sample: Using HAB_BIN=/hab/pkgs/core/hab/1.6.175/20201026161911/bin/hab for installs, signing, and hashing
java-sample: hab-plan-build setup
java-sample: Writing pre_build file
java-sample: Resolving build dependencies
» Installing core/make
☁ Determining latest version of core/make in the 'stable' channel
→ Using core/make/4.2.1/20200306002515
★ Install of core/make/4.2.1/20200306002515 complete with 0 new packages installed.
java-sample: Resolved build dependency 'core/make' to /hab/pkgs/core/make/4.2.1/20200306002515
» Installing core/gcc
☁ Determining latest version of core/gcc in the 'stable' channel
→ Using core/gcc/9.1.0/20200305180723
★ Install of core/gcc/9.1.0/20200305180723 complete with 0 new packages installed.
java-sample: Resolved build dependency 'core/gcc' to /hab/pkgs/core/gcc/9.1.0/20200305180723
java-sample: Resolving run dependencies
» Installing core/glibc
☁ Determining latest version of core/glibc in the 'stable' channel
→ Using core/glibc/2.29/20200305172459
★ Install of core/glibc/2.29/20200305172459 complete with 0 new packages installed.
java-sample: Resolved dependency 'core/glibc' to /hab/pkgs/core/glibc/2.29/20200305172459
java-sample: Setting up environment
java-sample: Populating runtime environment from dependencies
java-sample: Populating buildtime environment from dependencies
java-sample: Layering runtime environment on top of system environment
java-sample: Layering buildtime environment on top of system environment
java-sample: Setting PATH=/hab/pkgs/core/make/4.2.1/20200306002515/bin:/hab/pkgs/core/gcc/9.1.0/20200305180723/bin:/hab/pkgs/core/glibc/2.29/20200305172459/bin:/hab/pkgs/core/binutils/2.32/20200305174809/bin:/hab/pkgs/core/hab-plan-build/1.6.175/20201026164925/bin:/hab/pkgs/core/bash/5.0.16/20200305233030/bin:/hab/pkgs/core/binutils/2.32/20200305174809/bin:/hab/pkgs/core/coreutils/8.30/20200305231640/bin:/hab/pkgs/core/file/5.37/20200305174635/bin:/hab/pkgs/core/findutils/4.6.0/20200306000932/bin:/hab/pkgs/core/gawk/5.0.1/20200305233704/bin:/hab/pkgs/core/grep/3.3/20200305232635/bin:/hab/pkgs/core/gzip/1.10/20200306002325/bin:/hab/pkgs/core/hab/1.6.175/20201026161911/bin:/hab/pkgs/core/rq/0.10.4/20200306011144/bin:/hab/pkgs/core/sed/4.5/20200305230928/bin:/hab/pkgs/core/tar/1.32/20200305233447/bin:/hab/pkgs/core/unzip/6.0/20200306011037/bin:/hab/pkgs/core/wget/1.19.5/20200306010801/bin:/hab/pkgs/core/xz/5.2.4/20200306001321/bin:/hab/pkgs/core/libcap/2.27/20200305230759/bin:/hab/pkgs/core/less/530/20200305235121/bin:/hab/pkgs/core/ncurses/6.1/20200305230210/bin:/hab/pkgs/core/acl/2.2.53/20200305230628/bin:/hab/pkgs/core/attr/2.4.48/20200305230504/bin:/hab/pkgs/core/bzip2/1.0.8/20200305225842/bin:/hab/pkgs/core/libidn2/2.0.4/20200306010601/bin:/hab/pkgs/core/openssl-fips/2.0.16/20200306005307/bin:/hab/pkgs/core/openssl/1.0.2t/20200306005450/bin:/hab/pkgs/core/pcre/8.42/20200305232429/bin:/hab/pkgs/core/glibc/2.29/20200305172459/bin:/hab/bin:/hab/pkgs/core/hab-plan-build/1.6.175/20201026164925/bin:/hab/pkgs/core/diffutils/3.7/20200306000423/bin:/hab/pkgs/core/less/530/20200305235121/bin:/hab/pkgs/core/make/4.2.1/20200306002515/bin:/hab/pkgs/core/mg/20180408/20200306015846/bin:/hab/pkgs/core/util-linux/2.34/20200306003119/bin:/hab/pkgs/core/vim/8.1.1694/20200306015156/bin:/hab/pkgs/core/ncurses/6.1/20200305230210/bin:/hab/pkgs/core/bash/5.0.16/20200305233030/bin:/hab/pkgs/core/binutils/2.32/20200305174809/bin:/hab/pkgs/core/coreutils/8.30/20200305231640/bin:/hab/pkgs/core/file/5.37/20200305174635/bin:/hab/pkgs/core/findutils/4.6.0/20200306000932/bin:/hab/pkgs/core/gawk/5.0.1/20200305233704/bin:/hab/pkgs/core/gzip/1.10/20200306002325/bin:/hab/pkgs/core/hab/1.6.175/20201026161911/bin:/hab/pkgs/core/rq/0.10.4/20200306011144/bin:/hab/pkgs/core/sed/4.5/20200305230928/bin:/hab/pkgs/core/tar/1.32/20200305233447/bin:/hab/pkgs/core/unzip/6.0/20200306011037/bin:/hab/pkgs/core/wget/1.19.5/20200306010801/bin:/hab/pkgs/core/xz/5.2.4/20200306001321/bin:/hab/pkgs/core/libcap/2.27/20200305230759/bin:/hab/pkgs/core/grep/3.3/20200305232635/bin:/hab/pkgs/core/bzip2/1.0.8/20200305225842/bin:/hab/pkgs/core/libidn2/2.0.4/20200306010601/bin:/hab/pkgs/core/openssl-fips/2.0.16/20200306005307/bin:/hab/pkgs/core/openssl/1.0.2t/20200306005450/bin:/hab/pkgs/core/pcre/8.42/20200305232429/bin:/hab/pkgs/core/acl/2.2.53/20200305230628/bin:/hab/pkgs/core/attr/2.4.48/20200305230504/bin:/hab/pkgs/core/glibc/2.29/20200305172459/bin:/hab/bin
java-sample: Clean the cache
java-sample: Setting build environment
mkdir: created directory '/hab/cache/src/java-sample-0.1.0'
java-sample: Setting PREFIX=/hab/pkgs/freshbrewed/java-sample/0.1.0/20201029112300
java-sample: Setting LD_RUN_PATH=/hab/pkgs/core/glibc/2.29/20200305172459/lib
java-sample: Setting CFLAGS=-I/hab/pkgs/core/make/4.2.1/20200306002515/include -I/hab/pkgs/core/gcc/9.1.0/20200305180723/include -I/hab/pkgs/core/glibc/2.29/20200305172459/include
java-sample: Setting CXXFLAGS=-I/hab/pkgs/core/make/4.2.1/20200306002515/include -I/hab/pkgs/core/gcc/9.1.0/20200305180723/include -I/hab/pkgs/core/glibc/2.29/20200305172459/include
java-sample: Setting CPPFLAGS=-I/hab/pkgs/core/make/4.2.1/20200306002515/include -I/hab/pkgs/core/gcc/9.1.0/20200305180723/include -I/hab/pkgs/core/glibc/2.29/20200305172459/include
java-sample: Setting LDFLAGS=-L/hab/pkgs/core/gcc/9.1.0/20200305180723/lib -L/hab/pkgs/core/glibc/2.29/20200305172459/lib
java-sample: Setting PKG_CONFIG_PATH=
java-sample: Preparing to build
java-sample: Building
java-sample: Installing
mkdir: created directory '/hab/pkgs/freshbrewed/java-sample/0.1.0/20201029112300'
java-sample: Writing configuration
java-sample: Writing service management scripts
java-sample: Stripping unneeded symbols from binaries and libraries
java-sample: Building package metadata
/hab/cache/src/java-sample-0.1.0 /src/habitat
java-sample: Generating blake2b hashes of all files in the package
java-sample: Generating signed metadata FILES
» Signing java-sample_blake2bsums
☛ Signing java-sample_blake2bsums with freshbrewed-20201029104827 to create /hab/pkgs/freshbrewed/java-sample/0.1.0/20201029112300/FILES
★ Signed artifact /hab/pkgs/freshbrewed/java-sample/0.1.0/20201029112300/FILES.
/src/habitat
java-sample: Creating manifest
java-sample: Generating package artifact
/hab/pkgs/core/tar/1.32/20200305233447/bin/tar: Removing leading `/' from member names
/hab/cache/artifacts/.freshbrewed-java-sample-0.1.0-20201029112300-x86_64-linux.tar (1/1)
100 % 5440 B / 30.0 KiB = 0.177
» Signing /hab/cache/artifacts/.freshbrewed-java-sample-0.1.0-20201029112300-x86_64-linux.tar.xz
☛ Signing /hab/cache/artifacts/.freshbrewed-java-sample-0.1.0-20201029112300-x86_64-linux.tar.xz with freshbrewed-20201029104827 to create /hab/cache/artifacts/freshbrewed-java-sample-0.1.0-20201029112300-x86_64-linux.hart
★ Signed artifact /hab/cache/artifacts/freshbrewed-java-sample-0.1.0-20201029112300-x86_64-linux.hart.
'/hab/cache/artifacts/freshbrewed-java-sample-0.1.0-20201029112300-x86_64-linux.hart' -> '/src/results/freshbrewed-java-sample-0.1.0-20201029112300-x86_64-linux.hart'
java-sample: hab-plan-build cleanup
java-sample:
java-sample: Source Path: /src
java-sample: Installed Path: /hab/pkgs/freshbrewed/java-sample/0.1.0/20201029112300
java-sample: Artifact: /src/results/freshbrewed-java-sample-0.1.0-20201029112300-x86_64-linux.hart
java-sample: Build Report: /src/results/last_build.env
java-sample: SHA256 Checksum: 8670124f62478ed747418be5bd7671504f3485a0c9f284cdf9db808626207970
java-sample: Blake2b Checksum: b7a073b4622a24b1d9b8e1a2ec1e0b2b58a72ba2cb2c82a06247c592fbc364d8
java-sample:
java-sample: I love it when a plan.sh comes together.
java-sample:
java-sample: Build time: 0m1s
We now have a build.env file:
pkg_origin=freshbrewed
pkg_name=java-sample
pkg_version=0.1.0
pkg_release=20201029112300
pkg_target=x86_64-linux
pkg_ident=freshbrewed/java-sample/0.1.0/20201029112300
pkg_artifact=freshbrewed-java-sample-0.1.0-20201029112300-x86_64-linux.hart
pkg_sha256sum=8670124f62478ed747418be5bd7671504f3485a0c9f284cdf9db808626207970
pkg_blake2bsum=b7a073b4622a24b1d9b8e1a2ec1e0b2b58a72ba2cb2c82a06247c592fbc364d8
And “hart” file: results/freshbrewed-java-sample-0.1.0-20201029112300-x86_64-linux.hart
Which is some small binary file.
$ cat results/freshbrewed-java-sample-0.1.0-20201029112300-x86_64-linux.hart
HART-1
freshbrewed-20201029104827
BLAKE2b
IuiBQ3fpX6ihXws/9mDfc5gD79zhzTWGVnd/dLqQgQzE/2h7A/4ilakGsJ9fUMRmSnt3979yms27RwtwU7H0DzkzNTQ4Nzg5NTQ2OThkMDFkNjIxYWNmMjY5ZjYwYTM0ZGY3YzBkYzU2ODA2ZjM1ZGNlMTg0MDE4NjdhMDFlZmU=
�7zXZ�ִF��)��!�rq�w�
...snip...
Theoretically we could go back in and see the results
$ hab studio enter
[sudo hab-studio] password for builder:
hab-studio: Creating Studio at /hab/studios/home--builder--Workspaces--chefhab--java-sample (default)
hab-studio: Importing 'freshbrewed' secret origin key
» Importing origin key from standard input
★ Imported secret origin key freshbrewed-20201029104827
hab-studio: Importing 'freshbrewed' public origin key
» Importing origin key from standard input
★ Imported public origin key freshbrewed-20201029104827
hab-studio: Entering Studio at /hab/studios/home--builder--Workspaces--chefhab--java-sample (default)
hab-studio: Exported: HAB_ORIGIN=freshbrewed
--> Launching the Habitat Supervisor in the background...
Running: hab sup run
* Use 'hab svc start' & 'hab svc stop' to start and stop services
* Use 'sup-log' to tail the Supervisor's output (Ctrl+c to stop)
* Use 'sup-term' to terminate the Supervisor
* To pass custom arguments to run the Supervisor, export
'HAB_STUDIO_SUP' with the arguments before running
'hab studio enter'.
--> To prevent a Supervisor from running automatically in your
Studio, export 'HAB_STUDIO_SUP=false' before running
'hab studio enter'.
[1][default:/src:0]# source results/last_build.env
[2][default:/src:0]# hab svc load results/$pkg_artifact
» Installing results/freshbrewed-java-sample-0.1.0-20201029112300-x86_64-linux.hart
☁ Determining latest version of results/freshbrewed-java-sample-0.1.0-20201029112300-x86_64-linux.hart in the 'stable' channel
✗✗✗
✗✗✗ [Err: 0] Package not found.
✗✗✗
Lets try on ubuntu in k8s
fire a k8s ubuntu then run the setup steps
kubectl run my-shell --rm -i --tty --image ubuntu -- bash
# apt update && apt install -y curl
# curl https://raw.githubusercontent.com/habitat-sh/habitat/master/components/hab/install.sh | bash
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- 0:00:03 --:--:-- 0
hab 1.6.175/20201026161911
--> hab-install: Installation of Habitat 'hab' program complete.
# hab origin key generate
+---------------------------------------------+
Chef License Acceptance
Before you can continue, 1 product license must be accepted.
View the license at https://www.chef.io/end-user-license-agreement
License that needs accepting:
* Habitat
Do you accept the 1 product license? [yes/No/quit] yes
Accepting 1 product license...
✓ 1 product license accepted.
+---------------------------------------------+
» Generating origin key for freshbrewed
★ Generated origin key pair freshbrewed-20201029130357.
# apt install git
# git clone https://github.com/chef-training/java-sample
Cloning into 'java-sample'...
remote: Enumerating objects: 10, done.
remote: Counting objects: 100% (10/10), done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 10 (delta 1), reused 7 (delta 0), pack-reused 0
Unpacking objects: 100% (10/10), 7.83 KiB | 3.92 MiB/s, done.
root@my-shell-7d5c87b77c-vr97w:/# cd java-sample
root@my-shell-7d5c87b77c-vr97w:/java-sample# hab plan init
» Attempting autodiscovery
No scaffolding type was provided. Let's see if we can figure out what
kind of application you're planning to package.
Ø Unable to determine the type of app in your current directory
For now, we'll generate a plan with all of the available plan variables
and build phase callbacks. For more documentation on plan options visit
https://www.habitat.sh/docs/reference/plan-syntax/
» Constructing a cozy habitat for your app...
Ω Creating file: habitat/plan.sh
`plan.sh` is the foundation of your new habitat. It contains metadata,
dependencies, and tasks.
Ω Creating file: habitat/default.toml
`default.toml` contains default values for `cfg` prefixed variables.
Ω Creating file: habitat/README.md
`README.md` contains a basic README document which you should update.
Ω Creating directory: habitat/config/
`/config/` contains configuration files for your app.
Ω Creating directory: habitat/hooks/
`/hooks/` contains automation hooks into your habitat.
For more information on any of the files:
https://www.habitat.sh/docs/reference/plan-syntax/
Ω Creating file: habitat/../.gitignore
★ An abode for your code is initialized!
Now we enter the studio…
root@my-shell-7d5c87b77c-vr97w:/java-sample# hab studio enter
∵ Missing package for core/hab-studio/1.6.175
» Installing core/hab-studio/1.6.175
☁ Determining latest version of core/hab-studio/1.6.175 in the 'stable' channel
↓ Downloading core/hab-studio/1.6.175/20201026165228 for x86_64-linux
… snip…
…
✓ Installed core/hab-studio/1.6.175/20201026165228
★ Install of core/hab-studio/1.6.175/20201026165228 complete with 43 new packages installed.
hab-studio: Creating Studio at /hab/studios/java-sample (default)
mount: mounting /dev on /hab/studios/java-sample/dev failed: Permission denied
root@my-shell-7d5c87b77c-vr97w:/java-sample# hab studio enter
hab-studio: Creating Studio at /hab/studios/java-sample (default)
mount: mounting /dev on /hab/studios/java-sample/dev failed: Permission denied
It has to be a container issue since I can see the files and I’m root on the container
root@my-shell-7d5c87b77c-vr97w:/java-sample# ls -tlra /hab/studios/java-sample/
total 28
drwxr-xr-x 3 root root 4096 Oct 29 13:06 var
drwxr-xr-x 2 root root 4096 Oct 29 13:06 sys
drwxr-xr-x 2 root root 4096 Oct 29 13:06 run
drwxr-xr-x 2 root root 4096 Oct 29 13:06 proc
drwxr-xr-x 2 root root 4096 Oct 29 13:06 dev
drwxr-xr-x 3 root root 4096 Oct 29 13:06 ..
drwxr-xr-x 7 root root 4096 Oct 29 13:06 .
root@my-shell-7d5c87b77c-vr97w:/java-sample# hab studio enter
hab-studio: Creating Studio at /hab/studios/java-sample (default)
mount: mounting /dev on /hab/studios/java-sample/dev failed: Permission denied
root@my-shell-7d5c87b77c-vr97w:/java-sample# ls /dev
console core fd full mqueue null ptmx pts random shm stderr stdin stdout termination-log tty urandom zero
root@my-shell-7d5c87b77c-vr97w:/java-sample#
Let’s try on Windows
Note: you need to do all this in an admin command prompt
C:\Users\isaac\Documents\Workspaces\chefhab>choco install habitat
Chocolatey v0.10.13
Installing the following packages:
habitat
By installing you accept licenses for the packages.
habitat v1.6.175 [Approved]
habitat package files install completed. Performing other installation steps.
The package habitat wants to run 'chocolateyinstall.ps1'.
Note: If you don't run this script, the installation will fail.
Note: To confirm automatically next time, use '-y' or consider:
choco feature enable -n allowGlobalConfirmation
Do you want to run the script?([Y]es/[N]o/[P]rint): yes
C:\Users\isaac\Documents\Workspaces\chefhab>set HAB_ORIGIN=freshbrewed
C:\Users\isaac\Documents\Workspaces\chefhab>hab origin key generate
» Generating origin key for freshbrewed
≡ Generated origin key pair freshbrewed-20201029131113.
Let’s now clone the repo and hab init
C:\Users\isaac\Documents\Workspaces\chefhab>git clone https://github.com/chef-training/java-sample
Cloning into 'java-sample'...
remote: Enumerating objects: 10, done.
remote: Counting objects: 100% (10/10), done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 10 (delta 1), reused 7 (delta 0), pack-reused 0
Unpacking objects: 100% (10/10), done.
C:\Users\isaac\Documents\Workspaces\chefhab>cd java-sample
C:\Users\isaac\Documents\Workspaces\chefhab\java-sample>hab plan init
» Constructing a cozy habitat for your app...
Ω Creating file: habitat/plan.ps1
`plan.sh` is the foundation of your new habitat. It contains metadata,
dependencies, and tasks.
Ω Creating file: habitat/default.toml
`default.toml` contains default values for `cfg` prefixed variables.
Ω Creating file: habitat/README.md
`README.md` contains a basic README document which you should update.
Ω Creating directory: habitat/config/
`/config/` contains configuration files for your app.
Ω Creating directory: habitat/hooks/
`/hooks/` contains automation hooks into your habitat.
For more information on any of the files:
https://www.habitat.sh/docs/reference/plan-syntax/
Ω Creating file: habitat/../.gitignore
≡ An abode for your code is initialized!
Enter the studio
C:\Users\isaac\Documents\Workspaces\chefhab\java-sample>hab studio enter
‼ Missing package for core/hab-studio/1.6.175
» Installing core/hab-studio/1.6.175
⌂ Determining latest version of core/hab-studio/1.6.175 in the 'stable' channel
↓ Downloading core/hab-studio/1.6.175/20201026165327 for x86_64-windows
67.80 MB / 67.80 MB - [=======================================] 100.00 % 83.96 MB/s
… snip…
** To pass custom arguments to run the Supervisor, set
'$env:HAB_STUDIO_SUP' with the arguments before running
'hab studio enter'.
hab-studio: Entering Studio at C:\hab\studios\Users--isaac--Documents--Workspaces--chefhab--java-sample
[HAB-STUDIO] Habitat:\src>build
java-sample: SHA256 Checksum:
java-sample: Blake2b Checksum:
java-sample:
java-sample: I love it when a plan.ps1 comes together.
java-sample:
this time it built just fine
[HAB-STUDIO] Habitat:\src> cat .\results\last_build.ps1
$pkg_origin="freshbrewed"
$pkg_name="java-sample"
$pkg_version="0.1.0"
$pkg_release="20201029081346"
$pkg_target="x86_64-windows"
$pkg_ident="freshbrewed/java-sample/0.1.0/20201029081346"
$pkg_artifact="freshbrewed-java-sample-0.1.0-20201029081346-x86_64-windows.hart"
$pkg_sha256sum="fced42730386f3eb476000cf37e2f9fa5cb832382a0661110c0867b5ebd925b3"
$pkg_blake2bsum="fbb182523a098df4b070524880d928e9e04fd4e45e6b92f9e5f64587ade22f6f C:\hab\studios\Users--isaac--Documents--Workspaces--chefhab--java-sample\hab\cache\artifacts\freshbrewed-java-sample-0.1.0-20201029081346-x86_64-windows.hart"
And loading the svc
[HAB-STUDIO] Habitat:\src> hab svc load results/freshbrewed-java-sample-0.1.0-20201029081346-x86_64-windows.hart
» Installing results/freshbrewed-java-sample-0.1.0-20201029081346-x86_64-windows.hart
⌂ Determining latest version of results/freshbrewed-java-sample-0.1.0-20201029081346-x86_64-windows.hart in the 'stable' channel
XXX
XXX [Err: 0] Package not found.
XXX
[HAB-STUDIO] Habitat:\src> hab svc load results/freshbrewed-java-sample-0.1.0-20201029081346-x86_64-windows.hart
» Installing results/freshbrewed-java-sample-0.1.0-20201029081346-x86_64-windows.hart
⌂ Determining latest version of results/freshbrewed-java-sample-0.1.0-20201029081346-x86_64-windows.hart in the 'stable' channel
XXX
XXX [Err: 0] Package not found.
XXX
[HAB-STUDIO] Habitat:\src> exit
Waiting for Supervisor to finish...
A non Java Example
builder@DESKTOP-JBA79RT:~/Workspaces/chefhab$ git clone https://github.com/learn-chef/hab-two-tier.git
Cloning into 'hab-two-tier'...
remote: Enumerating objects: 8, done.
remote: Counting objects: 100% (8/8), done.
remote: Compressing objects: 100% (8/8), done.
remote: Total 148 (delta 0), reused 2 (delta 0), pack-reused 140
Receiving objects: 100% (148/148), 11.26 MiB | 17.06 MiB/s, done.
Resolving deltas: 100% (59/59), done.
builder@DESKTOP-JBA79RT:~/Workspaces/chefhab$ cd hab-two-tier/
builder@DESKTOP-JBA79RT:~/Workspaces/chefhab/hab-two-tier$ tree
.
├── README.md
├── docker-compose.yml
├── haproxy
│ ├── config
│ │ └── haproxy.conf
│ ├── default.toml
│ └── plan.sh
└── webapp
├── config
│ └── httpd.conf
├── default.toml
├── hello-world
├── hooks
│ └── init
└── plan.sh
5 directories, 10 files
Now let’s build
[1][default:/src:0]# ls
README.md docker-compose.yml haproxy webapp
[2][default:/src:0]# build haproxy
: Loading /src/haproxy/plan.sh
haproxy: Plan loaded
haproxy: Validating plan metadata
haproxy: Using HAB_BIN=/hab/pkgs/core/hab/1.6.175/20201026161911/bin/hab for installs, signing, and hashing
haproxy: hab-plan-build setup
haproxy: Writing pre_build file
mkdir: created directory '/src/results'
haproxy: Resolving build dependencies
haproxy: Resolving run dependencies
» Installing core/haproxy
☁ Determining latest version of core/haproxy in the 'stable' channel
↓ Downloading core/haproxy/2.2.2/20200903011659 for x86_64-linux
791.88 KB / 791.88 KB - [==========================================================================================================================] 100.00 % 143.29 MB/s
☛ Verifying core/haproxy/2.2.2/20200903011659
→ Using core/pcre/8.42/20200305232429
→ Using core/openssl/1.0.2t/20200306005450
→ Using core/gcc-libs/9.1.0/20200305225533
→ Using core/zlib/1.2.11/20200305174519
→ Using core/cacerts/2020.01.01/20200306005234
→ Using core/glibc/2.29/20200305172459
→ Using core/linux-headers/4.19.62/20200305172241
→ Using core/openssl-fips/2.0.16/20200306005307
✓ Installed core/haproxy/2.2.2/20200903011659
★ Install of core/haproxy/2.2.2/20200903011659 complete with 1 new packages installed.
haproxy: Resolved dependency 'core/haproxy' to /hab/pkgs/core/haproxy/2.2.2/20200903011659
haproxy: Setting up environment
haproxy: Populating runtime environment from dependencies
haproxy: Populating buildtime environment from dependencies
haproxy: Layering runtime environment on top of system environment
haproxy: Layering buildtime environment on top of system environment
haproxy: Setting PATH=/hab/pkgs/core/haproxy/2.2.2/20200903011659/bin:/hab/pkgs/core/pcre/8.42/20200305232429/bin:/hab/pkgs/core/openssl/1.0.2t/20200306005450/bin:/hab/pkgs/core/glibc/2.29/20200305172459/bin:/hab/pkgs/core/openssl-fips/2.0.16/20200306005307/bin:/hab/pkgs/core/hab-plan-build/1.6.175/20201026164925/bin:/hab/pkgs/core/bash/5.0.16/20200305233030/bin:/hab/pkgs/core/binutils/2.32/20200305174809/bin:/hab/pkgs/core/coreutils/8.30/20200305231640/bin:/hab/pkgs/core/file/5.37/20200305174635/bin:/hab/pkgs/core/findutils/4.6.0/20200306000932/bin:/hab/pkgs/core/gawk/5.0.1/20200305233704/bin:/hab/pkgs/core/grep/3.3/20200305232635/bin:/hab/pkgs/core/gzip/1.10/20200306002325/bin:/hab/pkgs/core/hab/1.6.175/20201026161911/bin:/hab/pkgs/core/rq/0.10.4/20200306011144/bin:/hab/pkgs/core/sed/4.5/20200305230928/bin:/hab/pkgs/core/tar/1.32/20200305233447/bin:/hab/pkgs/core/unzip/6.0/20200306011037/bin:/hab/pkgs/core/wget/1.19.5/20200306010801/bin:/hab/pkgs/core/xz/5.2.4/20200306001321/bin:/hab/pkgs/core/libcap/2.27/20200305230759/bin:/hab/pkgs/core/less/530/20200305235121/bin:/hab/pkgs/core/ncurses/6.1/20200305230210/bin:/hab/pkgs/core/acl/2.2.53/20200305230628/bin:/hab/pkgs/core/attr/2.4.48/20200305230504/bin:/hab/pkgs/core/bzip2/1.0.8/20200305225842/bin:/hab/pkgs/core/libidn2/2.0.4/20200306010601/bin:/hab/pkgs/core/openssl-fips/2.0.16/20200306005307/bin:/hab/pkgs/core/openssl/1.0.2t/20200306005450/bin:/hab/pkgs/core/pcre/8.42/20200305232429/bin:/hab/pkgs/core/glibc/2.29/20200305172459/bin:/hab/bin:/hab/pkgs/core/hab-plan-build/1.6.175/20201026164925/bin:/hab/pkgs/core/diffutils/3.7/20200306000423/bin:/hab/pkgs/core/less/530/20200305235121/bin:/hab/pkgs/core/make/4.2.1/20200306002515/bin:/hab/pkgs/core/mg/20180408/20200306015846/bin:/hab/pkgs/core/util-linux/2.34/20200306003119/bin:/hab/pkgs/core/vim/8.1.1694/20200306015156/bin:/hab/pkgs/core/ncurses/6.1/20200305230210/bin:/hab/pkgs/core/bash/5.0.16/20200305233030/bin:/hab/pkgs/core/binutils/2.32/20200305174809/bin:/hab/pkgs/core/coreutils/8.30/20200305231640/bin:/hab/pkgs/core/file/5.37/20200305174635/bin:/hab/pkgs/core/findutils/4.6.0/20200306000932/bin:/hab/pkgs/core/gawk/5.0.1/20200305233704/bin:/hab/pkgs/core/gzip/1.10/20200306002325/bin:/hab/pkgs/core/hab/1.6.175/20201026161911/bin:/hab/pkgs/core/rq/0.10.4/20200306011144/bin:/hab/pkgs/core/sed/4.5/20200305230928/bin:/hab/pkgs/core/tar/1.32/20200305233447/bin:/hab/pkgs/core/unzip/6.0/20200306011037/bin:/hab/pkgs/core/wget/1.19.5/20200306010801/bin:/hab/pkgs/core/xz/5.2.4/20200306001321/bin:/hab/pkgs/core/libcap/2.27/20200305230759/bin:/hab/pkgs/core/grep/3.3/20200305232635/bin:/hab/pkgs/core/bzip2/1.0.8/20200305225842/bin:/hab/pkgs/core/libidn2/2.0.4/20200306010601/bin:/hab/pkgs/core/openssl-fips/2.0.16/20200306005307/bin:/hab/pkgs/core/openssl/1.0.2t/20200306005450/bin:/hab/pkgs/core/pcre/8.42/20200305232429/bin:/hab/pkgs/core/acl/2.2.53/20200305230628/bin:/hab/pkgs/core/attr/2.4.48/20200305230504/bin:/hab/pkgs/core/glibc/2.29/20200305172459/bin:/hab/bin
mkdir: created directory '/hab/cache/src'
haproxy: Clean the cache
haproxy: Setting build environment
mkdir: created directory '/hab/cache/src/haproxy-1.6.11'
haproxy: Setting PREFIX=/hab/pkgs/freshbrewed/haproxy/1.6.11/20201029152918
haproxy: Setting LD_RUN_PATH=
haproxy: Setting CFLAGS=
haproxy: Setting CXXFLAGS=
haproxy: Setting CPPFLAGS=
haproxy: Setting LDFLAGS=
haproxy: Setting PKG_CONFIG_PATH=
haproxy: Preparing to build
haproxy: Building
haproxy: Installing
mkdir: created directory '/hab/pkgs/freshbrewed'
mkdir: created directory '/hab/pkgs/freshbrewed/haproxy'
mkdir: created directory '/hab/pkgs/freshbrewed/haproxy/1.6.11'
mkdir: created directory '/hab/pkgs/freshbrewed/haproxy/1.6.11/20201029152918'
haproxy: Writing configuration
haproxy: Writing service management scripts
haproxy: Writing /hab/pkgs/freshbrewed/haproxy/1.6.11/20201029152918/run script to run haproxy -f /hab/svc/haproxy/config/haproxy.conf -db as root:root
haproxy: Stripping unneeded symbols from binaries and libraries
haproxy: Building package metadata
/hab/cache/src/haproxy-1.6.11 /src/haproxy
haproxy: Generating blake2b hashes of all files in the package
haproxy: Generating signed metadata FILES
» Signing haproxy_blake2bsums
☛ Signing haproxy_blake2bsums with freshbrewed-20201029104827 to create /hab/pkgs/freshbrewed/haproxy/1.6.11/20201029152918/FILES
★ Signed artifact /hab/pkgs/freshbrewed/haproxy/1.6.11/20201029152918/FILES.
/src/haproxy
haproxy: Creating manifest
haproxy: Generating package artifact
/hab/pkgs/core/tar/1.32/20200305233447/bin/tar: Removing leading `/' from member names
/hab/cache/artifacts/.freshbrewed-haproxy-1.6.11-20201029152918-x86_64-linux.tar (1/1)
100 % 2876 B / 30.0 KiB = 0.094
» Signing /hab/cache/artifacts/.freshbrewed-haproxy-1.6.11-20201029152918-x86_64-linux.tar.xz
☛ Signing /hab/cache/artifacts/.freshbrewed-haproxy-1.6.11-20201029152918-x86_64-linux.tar.xz with freshbrewed-20201029104827 to create /hab/cache/artifacts/freshbrewed-haproxy-1.6.11-20201029152918-x86_64-linux.hart
★ Signed artifact /hab/cache/artifacts/freshbrewed-haproxy-1.6.11-20201029152918-x86_64-linux.hart.
'/hab/cache/artifacts/freshbrewed-haproxy-1.6.11-20201029152918-x86_64-linux.hart' -> '/src/results/freshbrewed-haproxy-1.6.11-20201029152918-x86_64-linux.hart'
haproxy: hab-plan-build cleanup
haproxy:
haproxy: Source Path: /src/haproxy
haproxy: Installed Path: /hab/pkgs/freshbrewed/haproxy/1.6.11/20201029152918
haproxy: Artifact: /src/results/freshbrewed-haproxy-1.6.11-20201029152918-x86_64-linux.hart
haproxy: Build Report: /src/results/last_build.env
haproxy: SHA256 Checksum: 75cd807c09ec0f36a4ab44980cba768f6353b32f0c28cd9ab8711c889a75d5f0
haproxy: Blake2b Checksum: 13c38cce8e2bc7af6c184e04b4bca048954dfe1e7b4ee9564d5c6816e272179b
haproxy:
haproxy: I love it when a plan.sh comes together.
haproxy:
haproxy: Build time: 0m1s
[3][default:/src:0]# ls ./results/
freshbrewed-haproxy-1.6.11-20201029152918-x86_64-linux.hart last_build.env
[4][default:/src:0]#
[4][default:/src:0]# build webapp
: Loading /src/webapp/plan.sh
webapp: Plan loaded
webapp: Validating plan metadata
webapp: Using HAB_BIN=/hab/pkgs/core/hab/1.6.175/20201026161911/bin/hab for installs, signing, and hashing
webapp: hab-plan-build setup
webapp: Writing pre_build file
webapp: Resolving build dependencies
webapp: Resolving run dependencies
» Installing core/httpd
☁ Determining latest version of core/httpd in the 'stable' channel
↓ Downloading core/httpd/2.4.39/20200404140323 for x86_64-linux
4.88 MB / 4.88 MB | [==============================================================================================================================] 100.00 % 149.21 MB/s
☛ Verifying core/httpd/2.4.39/20200404140323
↓ Downloading core-20200331193006 public origin key
75 B / 75 B | [======================================================================================================================================] 100.00 % 3.34 MB/s
☑ Cached core-20200331193006 public origin key
→ Using core/acl/2.2.53/20200305230628
↓ Downloading core/apr-util/1.6.1/20200404133336 for x86_64-linux
139.10 KB / 139.10 KB / [==========================================================================================================================] 100.00 % 128.96 MB/s
☛ Verifying core/apr-util/1.6.1/20200404133336
↓ Downloading core/apr/1.7.0/20200404040137 for x86_64-linux
274.38 KB / 274.38 KB - [==========================================================================================================================] 100.00 % 127.49 MB/s
☛ Verifying core/apr/1.7.0/20200404040137
→ Using core/attr/2.4.48/20200305230504
→ Using core/bash/5.0.16/20200305233030
→ Using core/binutils/2.32/20200305174809
→ Using core/bzip2/1.0.8/20200305225842
→ Using core/cacerts/2020.01.01/20200306005234
→ Using core/coreutils/8.30/20200305231640
↓ Downloading core/db/5.3.28/20200305234355 for x86_64-linux
1.57 MB / 1.57 MB | [==============================================================================================================================] 100.00 % 161.90 MB/s
☛ Verifying core/db/5.3.28/20200305234355
↓ Downloading core/expat/2.2.7/20200305234221 for x86_64-linux
98.97 KB / 98.97 KB | [============================================================================================================================] 100.00 % 166.57 MB/s
☛ Verifying core/expat/2.2.7/20200305234221
→ Using core/gcc-libs/9.1.0/20200305225533
↓ Downloading core/gdbm/1.18.1/20200305234038 for x86_64-linux
152.36 KB / 152.36 KB \ [==========================================================================================================================] 100.00 % 125.23 MB/s
☛ Verifying core/gdbm/1.18.1/20200305234038
→ Using core/glibc/2.29/20200305172459
→ Using core/gmp/6.1.2/20200305175803
→ Using core/grep/3.3/20200305232635
→ Using core/less/530/20200305235121
→ Using core/libcap/2.27/20200305230759
→ Using core/libiconv/1.14/20200306010416
→ Using core/linux-headers/4.19.62/20200305172241
→ Using core/ncurses/6.1/20200305230210
→ Using core/openssl-fips/2.0.16/20200306005307
→ Using core/openssl/1.0.2t/20200306005450
→ Using core/pcre/8.42/20200305232429
↓ Downloading core/perl/5.30.0/20200305235250 for x86_64-linux
11.22 MB / 11.22 MB \ [============================================================================================================================] 100.00 % 135.40 MB/s
☛ Verifying core/perl/5.30.0/20200305235250
→ Using core/readline/8.0/20200305232850
→ Using core/sed/4.5/20200305230928
→ Using core/zlib/1.2.11/20200305174519
✓ Installed core/apr-util/1.6.1/20200404133336
✓ Installed core/apr/1.7.0/20200404040137
✓ Installed core/db/5.3.28/20200305234355
✓ Installed core/expat/2.2.7/20200305234221
✓ Installed core/gdbm/1.18.1/20200305234038
✓ Installed core/perl/5.30.0/20200305235250
✓ Installed core/httpd/2.4.39/20200404140323
★ Install of core/httpd/2.4.39/20200404140323 complete with 7 new packages installed.
webapp: Resolved dependency 'core/httpd' to /hab/pkgs/core/httpd/2.4.39/20200404140323
webapp: Setting up environment
webapp: Populating runtime environment from dependencies
webapp: Populating buildtime environment from dependencies
webapp: Layering runtime environment on top of system environment
webapp: Layering buildtime environment on top of system environment
webapp: Setting PATH=/hab/pkgs/core/httpd/2.4.39/20200404140323/bin:/hab/pkgs/core/acl/2.2.53/20200305230628/bin:/hab/pkgs/core/apr-util/1.6.1/20200404133336/bin:/hab/pkgs/core/apr/1.7.0/20200404040137/bin:/hab/pkgs/core/attr/2.4.48/20200305230504/bin:/hab/pkgs/core/bash/5.0.16/20200305233030/bin:/hab/pkgs/core/binutils/2.32/20200305174809/bin:/hab/pkgs/core/bzip2/1.0.8/20200305225842/bin:/hab/pkgs/core/coreutils/8.30/20200305231640/bin:/hab/pkgs/core/db/5.3.28/20200305234355/bin:/hab/pkgs/core/expat/2.2.7/20200305234221/bin:/hab/pkgs/core/gdbm/1.18.1/20200305234038/bin:/hab/pkgs/core/glibc/2.29/20200305172459/bin:/hab/pkgs/core/grep/3.3/20200305232635/bin:/hab/pkgs/core/less/530/20200305235121/bin:/hab/pkgs/core/libcap/2.27/20200305230759/bin:/hab/pkgs/core/ncurses/6.1/20200305230210/bin:/hab/pkgs/core/openssl-fips/2.0.16/20200306005307/bin:/hab/pkgs/core/openssl/1.0.2t/20200306005450/bin:/hab/pkgs/core/pcre/8.42/20200305232429/bin:/hab/pkgs/core/perl/5.30.0/20200305235250/bin:/hab/pkgs/core/sed/4.5/20200305230928/bin:/hab/pkgs/core/hab-plan-build/1.6.175/20201026164925/bin:/hab/pkgs/core/bash/5.0.16/20200305233030/bin:/hab/pkgs/core/binutils/2.32/20200305174809/bin:/hab/pkgs/core/coreutils/8.30/20200305231640/bin:/hab/pkgs/core/file/5.37/20200305174635/bin:/hab/pkgs/core/findutils/4.6.0/20200306000932/bin:/hab/pkgs/core/gawk/5.0.1/20200305233704/bin:/hab/pkgs/core/grep/3.3/20200305232635/bin:/hab/pkgs/core/gzip/1.10/20200306002325/bin:/hab/pkgs/core/hab/1.6.175/20201026161911/bin:/hab/pkgs/core/rq/0.10.4/20200306011144/bin:/hab/pkgs/core/sed/4.5/20200305230928/bin:/hab/pkgs/core/tar/1.32/20200305233447/bin:/hab/pkgs/core/unzip/6.0/20200306011037/bin:/hab/pkgs/core/wget/1.19.5/20200306010801/bin:/hab/pkgs/core/xz/5.2.4/20200306001321/bin:/hab/pkgs/core/libcap/2.27/20200305230759/bin:/hab/pkgs/core/less/530/20200305235121/bin:/hab/pkgs/core/ncurses/6.1/20200305230210/bin:/hab/pkgs/core/acl/2.2.53/20200305230628/bin:/hab/pkgs/core/attr/2.4.48/20200305230504/bin:/hab/pkgs/core/bzip2/1.0.8/20200305225842/bin:/hab/pkgs/core/libidn2/2.0.4/20200306010601/bin:/hab/pkgs/core/openssl-fips/2.0.16/20200306005307/bin:/hab/pkgs/core/openssl/1.0.2t/20200306005450/bin:/hab/pkgs/core/pcre/8.42/20200305232429/bin:/hab/pkgs/core/glibc/2.29/20200305172459/bin:/hab/bin:/hab/pkgs/core/hab-plan-build/1.6.175/20201026164925/bin:/hab/pkgs/core/diffutils/3.7/20200306000423/bin:/hab/pkgs/core/less/530/20200305235121/bin:/hab/pkgs/core/make/4.2.1/20200306002515/bin:/hab/pkgs/core/mg/20180408/20200306015846/bin:/hab/pkgs/core/util-linux/2.34/20200306003119/bin:/hab/pkgs/core/vim/8.1.1694/20200306015156/bin:/hab/pkgs/core/ncurses/6.1/20200305230210/bin:/hab/pkgs/core/bash/5.0.16/20200305233030/bin:/hab/pkgs/core/binutils/2.32/20200305174809/bin:/hab/pkgs/core/coreutils/8.30/20200305231640/bin:/hab/pkgs/core/file/5.37/20200305174635/bin:/hab/pkgs/core/findutils/4.6.0/20200306000932/bin:/hab/pkgs/core/gawk/5.0.1/20200305233704/bin:/hab/pkgs/core/gzip/1.10/20200306002325/bin:/hab/pkgs/core/hab/1.6.175/20201026161911/bin:/hab/pkgs/core/rq/0.10.4/20200306011144/bin:/hab/pkgs/core/sed/4.5/20200305230928/bin:/hab/pkgs/core/tar/1.32/20200305233447/bin:/hab/pkgs/core/unzip/6.0/20200306011037/bin:/hab/pkgs/core/wget/1.19.5/20200306010801/bin:/hab/pkgs/core/xz/5.2.4/20200306001321/bin:/hab/pkgs/core/libcap/2.27/20200305230759/bin:/hab/pkgs/core/grep/3.3/20200305232635/bin:/hab/pkgs/core/bzip2/1.0.8/20200305225842/bin:/hab/pkgs/core/libidn2/2.0.4/20200306010601/bin:/hab/pkgs/core/openssl-fips/2.0.16/20200306005307/bin:/hab/pkgs/core/openssl/1.0.2t/20200306005450/bin:/hab/pkgs/core/pcre/8.42/20200305232429/bin:/hab/pkgs/core/acl/2.2.53/20200305230628/bin:/hab/pkgs/core/attr/2.4.48/20200305230504/bin:/hab/pkgs/core/glibc/2.29/20200305172459/bin:/hab/bin
webapp: Clean the cache
webapp: Setting build environment
mkdir: created directory '/hab/cache/src/webapp-0.2.0'
webapp: Setting PREFIX=/hab/pkgs/freshbrewed/webapp/0.2.0/20201029152949
webapp: Setting LD_RUN_PATH=
webapp: Setting CFLAGS=-I/hab/pkgs/core/httpd/2.4.39/20200404140323/include
webapp: Setting CXXFLAGS=-I/hab/pkgs/core/httpd/2.4.39/20200404140323/include
webapp: Setting CPPFLAGS=-I/hab/pkgs/core/httpd/2.4.39/20200404140323/include
webapp: Setting LDFLAGS=
webapp: Setting PKG_CONFIG_PATH=
webapp: Preparing to build
webapp: Building
webapp: Installing
mkdir: created directory '/hab/pkgs/freshbrewed/webapp'
mkdir: created directory '/hab/pkgs/freshbrewed/webapp/0.2.0'
mkdir: created directory '/hab/pkgs/freshbrewed/webapp/0.2.0/20201029152949'
webapp: Writing configuration
webapp: Writing service management scripts
webapp: Writing /hab/pkgs/freshbrewed/webapp/0.2.0/20201029152949/run script to run httpd -DFOREGROUND -f /hab/svc/webapp/config/httpd.conf as root:root
webapp: Stripping unneeded symbols from binaries and libraries
webapp: Building package metadata
/hab/cache/src/webapp-0.2.0 /src/webapp
webapp: Generating blake2b hashes of all files in the package
webapp: Generating signed metadata FILES
» Signing webapp_blake2bsums
☛ Signing webapp_blake2bsums with freshbrewed-20201029104827 to create /hab/pkgs/freshbrewed/webapp/0.2.0/20201029152949/FILES
★ Signed artifact /hab/pkgs/freshbrewed/webapp/0.2.0/20201029152949/FILES.
/src/webapp
webapp: Creating manifest
webapp: Generating package artifact
/hab/pkgs/core/tar/1.32/20200305233447/bin/tar: Removing leading `/' from member names
/hab/cache/artifacts/.freshbrewed-webapp-0.2.0-20201029152949-x86_64-linux.tar (1/1)
100 % 25.8 KiB / 70.0 KiB = 0.369
» Signing /hab/cache/artifacts/.freshbrewed-webapp-0.2.0-20201029152949-x86_64-linux.tar.xz
☛ Signing /hab/cache/artifacts/.freshbrewed-webapp-0.2.0-20201029152949-x86_64-linux.tar.xz with freshbrewed-20201029104827 to create /hab/cache/artifacts/freshbrewed-webapp-0.2.0-20201029152949-x86_64-linux.hart
★ Signed artifact /hab/cache/artifacts/freshbrewed-webapp-0.2.0-20201029152949-x86_64-linux.hart.
'/hab/cache/artifacts/freshbrewed-webapp-0.2.0-20201029152949-x86_64-linux.hart' -> '/src/results/freshbrewed-webapp-0.2.0-20201029152949-x86_64-linux.hart'
webapp: hab-plan-build cleanup
webapp:
webapp: Source Path: /src/webapp
webapp: Installed Path: /hab/pkgs/freshbrewed/webapp/0.2.0/20201029152949
webapp: Artifact: /src/results/freshbrewed-webapp-0.2.0-20201029152949-x86_64-linux.hart
webapp: Build Report: /src/results/last_build.env
webapp: SHA256 Checksum: 5169851dc9cc42dd141b316ff771ce5ab07720b1e254a137f02515df5bf29a1f
webapp: Blake2b Checksum: 40c87208c84d1605d4d836b63d26223de0a004a47f95a96a8dd0016b52218ae1
webapp:
webapp: I love it when a plan.sh comes together.
webapp:
webapp: Build time: 0m10s
[5][default:/src:0]# ls ./results/
freshbrewed-haproxy-1.6.11-20201029152918-x86_64-linux.hart freshbrewed-webapp-0.2.0-20201029152949-x86_64-linux.hart last_build.env
[6][default:/src:0]#
The results are quite small:
[7][default:/src:0]# ls -ltrah results/
total 44K
drwxr-xr-x 6 1000 1000 4.0K Oct 29 15:29 ..
-rw-r--r-- 1 1000 1000 3.1K Oct 29 15:29 freshbrewed-haproxy-1.6.11-20201029152918-x86_64-linux.hart
-rw-r--r-- 1 1000 1000 388 Oct 29 15:29 last_build.env
-rw-r--r-- 1 1000 1000 27K Oct 29 15:29 freshbrewed-webapp-0.2.0-20201029152949-x86_64-linux.hart
drwxr-xr-x 2 1000 1000 4.0K Oct 29 15:29 .
Let’s load and test:
[8][default:/src:0]# hab svc load $HAB_ORIGIN/webapp
The freshbrewed/webapp service was successfully loaded
[10][default:/src:0]# hab svc status
package type desired state elapsed (s) pid group
freshbrewed/webapp/0.2.0/20201029152949 standalone up up 24 28422 webapp.default
We can also see the log (ctrl-c to exit)
[13][default:/src:127]# sup-log
--> Tailing the Habitat Supervisor's output (use 'Ctrl+c' to stop)
webapp.default(HK): Modified hook content in /hab/svc/webapp/hooks/init
webapp.default(SR): Hooks recompiled
webapp.default(CF): Created configuration file /hab/svc/webapp/config/httpd.conf
webapp.default(SR): Initializing
webapp.default hook[init]:(HK): addgroup: group 'hab' in use
webapp.default hook[init]:(HK): adduser: user 'hab' in use
webapp.default(SV): Starting service as user=root, group=root
webapp.default(O): [Thu Oct 29 15:32:28.994104 2020] [ssl:warn] [pid 28422] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache]
webapp.default(O): [Thu Oct 29 15:32:28.996715 2020] [mpm_prefork:notice] [pid 28422] AH00163: Apache/2.4.39 (Unix) OpenSSL/1.0.2t-fips configured -- resuming normal operations
webapp.default(O): [Thu Oct 29 15:32:28.996759 2020] [core:notice] [pid 28422] AH00094: Command line: 'httpd -D FOREGROUND -f /hab/svc/webapp/config/httpd.conf'
Now if we want to test, we’ll need to install curl
[16][default:/src:0]# hab pkg install core/curl -b
» Installing core/curl
☁ Determining latest version of core/curl in the 'stable' channel
↓ Downloading core/curl/7.68.0/20200601114640 for x86_64-linux
589.60 KB / 589.60 KB / [==========================================================================================================================] 100.00 % 143.77 MB/s
☛ Verifying core/curl/7.68.0/20200601114640
→ Using core/cacerts/2020.01.01/20200306005234
→ Using core/glibc/2.29/20200305172459
→ Using core/linux-headers/4.19.62/20200305172241
↓ Downloading core/nghttp2/1.40.0/20200506083229 for x86_64-linux
149.12 KB / 149.12 KB - [==========================================================================================================================] 100.00 % 148.19 MB/s
☛ Verifying core/nghttp2/1.40.0/20200506083229
→ Using core/openssl-fips/2.0.16/20200306005307
→ Using core/openssl/1.0.2t/20200306005450
→ Using core/zlib/1.2.11/20200305174519
✓ Installed core/nghttp2/1.40.0/20200506083229
✓ Installed core/curl/7.68.0/20200601114640
★ Install of core/curl/7.68.0/20200601114640 complete with 2 new packages installed.
» Binlinking curl-config from core/curl/7.68.0/20200601114640 into /hab/bin
★ Binlinked curl-config from core/curl/7.68.0/20200601114640 to /hab/bin/curl-config
» Binlinking curl from core/curl/7.68.0/20200601114640 into /hab/bin
★ Binlinked curl from core/curl/7.68.0/20200601114640 to /hab/bin/curl
now we can just see the last few lines of the running service to see that indeed it is running
[18][default:/src:0]# curl -s 127.0.0.1 | tail -n 5
The time is <strong>15:35:21</strong> and I live at <strong>172.26.12.24</strong>.
</div>
</div>
</body>
</html>
Now let’s create a CNCI Container Image:
[19][default:/src:0]# ls results/
freshbrewed-haproxy-1.6.11-20201029152918-x86_64-linux.hart freshbrewed-webapp-0.2.0-20201029152949-x86_64-linux.hart last_build.env
[20][default:/src:0]# hab pkg export docker results/freshbrewed-haproxy-1.6.11-20201029152918-x86_64-linux.hart
Ø 'hab pkg export docker' is now a deprecated alias for 'hab pkg export container'. Please update your automation and processes accordingly.
∵ Missing package for core/hab-pkg-export-container/1.6.175
» Installing core/hab-pkg-export-container/1.6.175
☁ Determining latest version of core/hab-pkg-export-container/1.6.175 in the 'stable' channel
↓ Downloading core/hab-pkg-export-container/1.6.175/20201026165629 for x86_64-linux
3.73 MB / 3.73 MB / [==============================================================================================================================] 100.00 % 174.29 MB/s
☛ Verifying core/hab-pkg-export-container/1.6.175/20201026165629
↓ Downloading core/buildah/1.14.8/20200513154053 for x86_64-linux
6.77 MB / 6.77 MB - [==============================================================================================================================] 100.00 % 137.80 MB/s
☛ Verifying core/buildah/1.14.8/20200513154053
↓ Downloading core/docker/19.03.8/20200505084334 for x86_64-linux
42.87 MB / 42.87 MB \
.... LONG SNIP ....
★ Binlinked cut from core/busybox-static/1.31.0/20200306011713 to /tmp/.tmpPF4u3i/rootfs/bin/cut
» Binlinking makemime from core/busybox-static/1.31.0/20200306011713 into /tmp/.tmpPF4u3i/rootfs/bin
★ Binlinked makemime from core/busybox-static/1.31.0/20200306011713 to /tmp/.tmpPF4u3i/rootfs/bin/makemime
» Binlinking hab from core/hab/1.6.175/20201026161911 into /tmp/.tmpPF4u3i/rootfs/bin
★ Binlinked hab from core/hab/1.6.175/20201026161911 to /tmp/.tmpPF4u3i/rootfs/bin/hab
Ω Creating cacerts symlink into /etc
☒ Deleting artifact key symlink
☒ Deleting artifact cache symlink
Ω Creating user 'hab' in /etc/passwd
Ω Creating group 'hab' in /etc/group
Ω Creating entrypoint script
Ω Creating image Dockerfile
Ω Creating image
[+] Building 11.1s (10/10) FINISHED
=> [internal] load .dockerignore 0.1s
=> => transferring context: 2B 0.0s
=> [internal] load build definition from Dockerfile 0.1s
=> => transferring dockerfile: 1.86kB 0.0s
=> [internal] load build context 2.2s
=> => transferring context: 207.56MB 2.1s
=> [1/6] ADD rootfs/hab /hab 0.5s
=> [2/6] COPY rootfs/bin /bin 4.9s
=> [3/6] RUN find /hab -type d -exec chmod g=u {} ; && mkdir /root && chmod 750 root && mkdir /tmp && chmod 1777 /tmp && mkdir -p /var/tmp && chmod 17 0.7s
=> [4/6] COPY rootfs/etc /etc 0.1s
=> [5/6] COPY rootfs/init.sh /init.sh 0.1s
=> [6/6] RUN HAB_FEAT_OFFLINE_INSTALL=ON HAB_LICENSE=accept-no-persist /hab/pkgs/core/hab/1.6.175/20201026161911/bin/hab pkg install freshbrewed/haproxy/1 0.6s
=> exporting to image 1.8s
=> => exporting layers 1.8s
=> => writing image sha256:66ce07f6e5f65331bcf29e9aad73e348c0146a150774d82794ec586fb0135b4d 0.0s
=> => naming to docker.io/freshbrewed/haproxy:latest 0.0s
=> => naming to docker.io/freshbrewed/haproxy:1.6.11 0.0s
=> => naming to docker.io/freshbrewed/haproxy:1.6.11-20201029152918 0.0s
☒ Deleting temporary files
★ Container image 'freshbrewed/haproxy' created with tags: latest, 1.6.11, 1.6.11-20201029152918
Ω Creating build report /src/results/last_container_export.env
Ω Creating old build report '/src/results/last_docker_export.env' for backwards compatibility; please favor '/src/results/last_container_export.env' going forward
We will use the results to generate the container for the webapp as well
[21][default:/src:0]# source results/last_build.env
[22][default:/src:0]# hab pkg export docker results/$pkg_artifact
Ø 'hab pkg export docker' is now a deprecated alias for 'hab pkg export container'. Please update your automation and processes accordingly.
» Building a container image with: results/freshbrewed-webapp-0.2.0-20201029152949-x86_64-linux.hart
Ω Creating build root in /tmp/.tmpndhU7o
Ω Creating root filesystem
Ω Creating artifact cache symlink
... SNIP ...
★ Binlinked seq from core/busybox-static/1.31.0/20200306011713 to /tmp/.tmpndhU7o/rootfs/bin/seq
» Binlinking ln from core/busybox-static/1.31.0/20200306011713 into /tmp/.tmpndhU7o/rootfs/bin
★ Binlinked ln from core/busybox-static/1.31.0/20200306011713 to /tmp/.tmpndhU7o/rootfs/bin/ln
» Binlinking cut from core/busybox-static/1.31.0/20200306011713 into /tmp/.tmpndhU7o/rootfs/bin
★ Binlinked cut from core/busybox-static/1.31.0/20200306011713 to /tmp/.tmpndhU7o/rootfs/bin/cut
» Binlinking makemime from core/busybox-static/1.31.0/20200306011713 into /tmp/.tmpndhU7o/rootfs/bin
★ Binlinked makemime from core/busybox-static/1.31.0/20200306011713 to /tmp/.tmpndhU7o/rootfs/bin/makemime
» Binlinking hab from core/hab/1.6.175/20201026161911 into /tmp/.tmpndhU7o/rootfs/bin
★ Binlinked hab from core/hab/1.6.175/20201026161911 to /tmp/.tmpndhU7o/rootfs/bin/hab
Ω Creating cacerts symlink into /etc
☒ Deleting artifact key symlink
☒ Deleting artifact cache symlink
Ω Creating user 'hab' in /etc/passwd
Ω Creating group 'hab' in /etc/group
Ω Creating entrypoint script
Ω Creating image Dockerfile
Ω Creating image
[+] Building 35.0s (10/10) FINISHED
=> [internal] load build definition from Dockerfile 0.1s
=> => transferring dockerfile: 1.85kB 0.0s
=> [internal] load .dockerignore 0.1s
=> => transferring context: 2B 0.0s
=> [internal] load build context 2.9s
=> => transferring context: 226.84MB 2.8s
=> [1/6] ADD rootfs/hab /hab 1.2s
=> [2/6] COPY rootfs/bin /bin 25.1s
=> [3/6] RUN find /hab -type d -exec chmod g=u {} ; && mkdir /root && chmod 750 root && mkdir /tmp && chmod 1777 /tmp && mkdir -p /var/tmp && chmod 17 1.2s
=> [4/6] COPY rootfs/etc /etc 0.1s
=> [5/6] COPY rootfs/init.sh /init.sh 0.1s
=> [6/6] RUN HAB_FEAT_OFFLINE_INSTALL=ON HAB_LICENSE=accept-no-persist /hab/pkgs/core/hab/1.6.175/20201026161911/bin/hab pkg install freshbrewed/webapp/0. 0.6s
=> exporting to image 3.5s
=> => exporting layers 3.5s
=> => writing image sha256:05bd0d1575abc22aea9b5e668168f0ec7cb3843cf99dc3c69d561cb937b07713 0.0s
=> => naming to docker.io/freshbrewed/webapp:latest 0.0s
=> => naming to docker.io/freshbrewed/webapp:0.2.0 0.0s
=> => naming to docker.io/freshbrewed/webapp:0.2.0-20201029152949 0.0s
☒ Deleting temporary files
★ Container image 'freshbrewed/webapp' created with tags: latest, 0.2.0, 0.2.0-20201029152949
Ω Creating build report /src/results/last_container_export.env
Ω Creating old build report '/src/results/last_docker_export.env' for backwards compatibility; please favor '/src/results/last_container_export.env' going forward
[23][default:/src:0]#
We can now exit and see the images were created:
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
freshbrewed/webapp 0.2.0 05bd0d1575ab 14 minutes ago 429MB
freshbrewed/webapp 0.2.0-20201029152949 05bd0d1575ab 14 minutes ago 429MB
freshbrewed/webapp latest 05bd0d1575ab 14 minutes ago 429MB
freshbrewed/haproxy 1.6.11 66ce07f6e5f6 16 minutes ago 207MB
freshbrewed/haproxy 1.6.11-20201029152918 66ce07f6e5f6 16 minutes ago 207MB
freshbrewed/haproxy latest 66ce07f6e5f6 16 minutes ago 207MB
<none> <none> 2fbb4b4d7f8d 6 days ago 106MB
Their guide uses docker compose, but let’s just test this webapp by pushing to ACR and AKS
$ az acr login --name ijk8senv5cr
Login Succeeded
$ docker tag freshbrewed/webapp:latest ijk8senv5cr.azurecr.io/freshbrewed/webapp:latest
$ docker push ijk8senv5cr.azurecr.io/freshbrewed/webapp:latest
The push refers to repository [ijk8senv5cr.azurecr.io/freshbrewed/webapp]
0af7f52c0169: Pushed
aa5813773bed: Pushed
8589174711b5: Pushed
d7d5f52dbffa: Pushed
9e4a14a0b798: Pushed
e387b618b9e4: Pushed
latest: digest: sha256:4711e2692e2ccd41c273315651e86435eb4186ddaadc840713f3ecc361df9859 size: 1568
Here is a simple deployment.yaml:
apiVersion: v1
kind: Service
metadata:
name: freshbrewed-webapp
spec:
type: LoadBalancer
ports:
- port: 80
targetPort: 8080
selector:
app: freshbrewed-webapp
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: freshbrewed-webapp
spec:
replicas: 3
selector:
matchLabels:
app: freshbrewed-webapp
template:
metadata:
labels:
app: freshbrewed-webapp
spec:
containers:
- name: freshbrewed-webapp
image: ijk8senv5cr.azurecr.io/freshbrewed/webapp:latest
ports:
- containerPort: 8080
I deployed
$ kubectl apply -f deployment.yaml
service/freshbrewed-webapp created
deployment.apps/freshbrewed-webapp created
However, I had an image pull issue due to AAD token rotation…
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled <unknown> default-scheduler Successfully assigned bikeapp/freshbrewed-webapp-848699945-6d8t9 to aks-nodepool1-91930899-vmss000001
Normal BackOff 14s (x2 over 42s) kubelet, aks-nodepool1-91930899-vmss000001 Back-off pulling image "ijk8senv5cr.azurecr.io/freshbrewed/webapp:latest"
Warning Failed 14s (x2 over 42s) kubelet, aks-nodepool1-91930899-vmss000001 Error: ImagePullBackOff
Normal Pulling 2s (x3 over 43s) kubelet, aks-nodepool1-91930899-vmss000001 Pulling image "ijk8senv5cr.azurecr.io/freshbrewed/webapp:latest"
Warning Failed 2s (x3 over 42s) kubelet, aks-nodepool1-91930899-vmss000001 Failed to pull image "ijk8senv5cr.azurecr.io/freshbrewed/webapp:latest": [rpc error: code = Unknown desc = Error response from daemon: Get https://ijk8senv5cr.azurecr.io/v2/freshbrewed/webapp/manifests/latest: unauthorized: Application not registered with AAD., rpc error: code = Unknown desc = Error response from daemon: Get https://ijk8senv5cr.azurecr.io/v2/freshbrewed/webapp/manifests/latest: unauthorized: authentication required, visit https://aka.ms/acr/authorization for more information.]
Warning Failed 2s (x3 over 42s) kubelet, aks-nodepool1-91930899-vmss000001 Error: ErrImagePull
Usually i can just attach to fix, but despite rolling creds, this didnt seem to sort me out…
$ az aks update -n ijk8s -g ijk8senv --attach-acr ijk8senv5cr
So ultimately i ensured my SP had acr pull powers:
$ az role assignment create --assignee 420e6839-1c96-499d-9926-2b384b2dbffd --scope `az acr show --name ijk8senv5cr --query id --output tsv` --role acrpull
Then i set a secret
$ kubectl create secret docker-registry ijacr5 --docker-server=ijk8senv5cr.azurecr.io --docker-username=420e6839-1c96-499d-9926-2b384b2dbffd --docker-password= **************************
Lastly, update the deployment to use the secret (and take care of an env var) then apply
$ cat deployment.yaml
apiVersion: v1
kind: Service
metadata:
name: freshbrewed-webapp
spec:
type: LoadBalancer
ports:
- port: 80
targetPort: 80
selector:
app: freshbrewed-webapp
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: freshbrewed-webapp
spec:
replicas: 1
selector:
matchLabels:
app: freshbrewed-webapp
template:
metadata:
labels:
app: freshbrewed-webapp
spec:
containers:
- name: freshbrewed-webapp
image: ijk8senv5cr.azurecr.io/freshbrewed/webapp:latest
env:
- name: HAB_LICENSE
value: "accept-no-persist"
ports:
- containerPort: 80
imagePullSecrets:
- name: ijacr5
$ kubectl apply -f ./deployment.yaml
service/freshbrewed-webapp configured
deployment.apps/freshbrewed-webapp configured
Let’s check out our service
$ kubectl get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
bikes ClusterIP 10.0.53.23 <none> 80/TCP 7d1h
bikesharing-traefik LoadBalancer 10.0.219.101 20.37.130.17 80:32233/TCP,443:31750/TCP 7d1h
bikesharingweb ClusterIP 10.0.23.68 <none> 80/TCP 7d1h
billing ClusterIP 10.0.183.53 <none> 80/TCP 7d1h
databases-mongo ClusterIP 10.0.141.209 <none> 27017/TCP 7d1h
databases-sql ClusterIP 10.0.184.100 <none> 1433/TCP 7d1h
freshbrewed-webapp LoadBalancer 10.0.182.20 52.141.217.171 80:32338/TCP 131m
gateway ClusterIP 10.0.149.236 <none> 80/TCP 7d1h
populatedatabase ClusterIP 10.0.169.162 <none> 80/TCP 7d1h
reservation ClusterIP 10.0.192.219 <none> 80/TCP 7d1h
reservationengine ClusterIP 10.0.180.157 <none> 80/TCP 7d1h
users ClusterIP 10.0.118.112 <none> 80/TCP 7d1h
we can see the app running:
Remote Hab servers
It appears that while you can point to a remote habitat server: hab svc load core/redis --remote-sup=hab1.mycompany.com:9632
The idea is that you push to https://bldr.habitat.sh/#/pkgs/core
However, to create packages, it demands I use a Github account and I’m not comfortable with the ‘act on my behalf’ privilege:
There are plenty of builds shown on the current Chef habitat site
Summary
I think Chef Habitat is an interesting offering. I certainly have a positive impression of Chef from a software perspective. Many things in this suite, however, felt dated; from the odd use of goofy terminal decorations to the defaults of makefiles. I was frustrated by a non-functioning hello-world (or perhaps there were assumptions, like a version of Java or something, not stated).
I was simply not able to figure out how they intended to take this “.HART” file and do something with it. I get the bundling and storing, but is this to ?archive source? or ?DR my git repo? . I think at this stage I step away a bit more clear on the build side but even more confused on the deploy (If ultimately I use to build CNCI images, why not just docker compose? If its to deploy CNCI containers, why not just use YAML?).
For now, I’ll just say “interesting” on Chef Habitat.