Skip to content

Instantly share code, notes, and snippets.

View mattray's full-sized avatar
🇦🇺
in Sydney

Matt Ray mattray

🇦🇺
in Sydney
View GitHub Profile
railsapp_1 | myrailsapp.default(SR): Initializing
railsapp_1 | myrailsapp.default(HK): Hook failed to run, init, hab-sup(ER)[src/error.rs:467:8]: No such file or directory (os error 2)
db_1 | postgresql.default(SR): Initializing
db_1 | postgresql.default hook[init]:(HK): Executing init hook
db_1 | postgresql.default hook[init]:(HK): Making sure hab user owns var, config and data paths
db_1 | postgresql.default hook[init]:(HK): Database does not exist, creating with 'initdb'
db_1 | postgresql.default hook[init]:(HK): no data was returned by command ""/hab/pkgs/core/postgresql/9.6.3/20170727171300/bin/postgres" -V"
db_1 | postgresql.default hook[init]:(HK): The program "postgres" is needed by initdb but was not found in the
db_1 | postgresql.default hook[init]:(HK): same directory as "/hab/pkgs/core/postgresql/9.6.3/20170727171300/bin/initdb".
db_1 | postgresql.default hook[init]:(HK): Check your installation.
./bin/build_demo.sh 1.4.5 'Westpac' mattray-apac 3 'mray' 'Sales'
./bin/build_demo.sh 1.4.6 'Westpac-2' mattray-apac 12 'mray' 'Sales'
./bin/build_demo.sh 1.4.6 'Westpac-2' mattray-apac 24 'mray' 'Sales'
./bin/build_demo.sh 1.4.6 'Westpac-3' mattray-apac 24 'mray' 'Sales'
./bin/build_demo.sh 1.4.6 'Westpac-4' mattray-apac 24 'mray' 'Sales'
./bin/build_demo.sh 1.4.11 'DD-1' mattray-apac 12 'mray' 'Sales'
./bin/build_demo.sh 1.4.12 'DD-2' mattray-apac 3 'mray' 'Sales'
./bin/build_demo.sh 1.4.11 'Edukasyon-1' mattray-apac 3 'mray' 'Sales'
./bin/build_demo.sh 1.5.1 'Edukasyon-2' mattray-apac 3 'mray' 'Sales'
./bin/build_demo.sh 1.5.1 'Edukasyon-3' mattray-apac 3 'mray' 'Sales'

Bulk Node Bootstapping

Spiceweasel generates Chef knife commands from a JSON or YAML file. It provides a condensed format to make it easier batch load Chef infrastructure. From the Mass Node Bootstrapping doc "workstation-to-node-to-server bootstrap won’t work", Spiceweasel doesn't solve this it simply scripts knife calls and uses the "parallel" command to batch them up. It does break down the steps to bootstrapping that infrastructure and provides some internal validation that nodes are not trying to use unlisted cookbooks, roles and other Chef primitives. It also provides for deletion of the listed content.

Spiceweasel development has been dormant for over 2 years, but it has an extensive test suite. It needs to be updated for Chef 12/13, updated for Ruby 2.3 and made compatible with the latest ChefDK.

Bootstrapping Clients

Spiceweasel does not currently support "knife client" commands but this would be straightforward to add. Syntax like:

# This file is the heart of your application's habitat.
# See full docs at https://www.habitat.sh/docs/reference/plan-syntax/
# Required.
# Sets the name of the package. This will be used in along with `pkg_origin`,
# and `pkg_version` to define the fully-qualified package name, which determines
# where the package is installed to on disk, how it is referred to in package
# metadata, and so on.
pkg_name=R

cd ~/ws/national-parks-plan hab studio enter

build

look at plan

look at config

open ~/ws/national-parks/src/main/java/io/chef/nationalparks/mongo/DBConnection.java

$ docker run -it -p 8080:8080 mattray/national-parks --peer 172.17.0.3 --bind database:mongodb.default
hab-sup(MN): Starting mattray/national-parks
hab-sup(MR): Butterfly Member ID 568156dd398b43f78762b6d9c7f9b90e
national-parks.default(SR): Process will run as user=root, group=hab
hab-sup(MR): Starting butterfly on 0.0.0.0:9638
hab-sup(MR): Starting http-gateway on 0.0.0.0:9631
hab-sup(SC): Updated mongoimport-opts.conf 5b4b01a4a3892ea3751793da57f072ae08eec694ddcda872239fc8239e4bcd1b
hab-sup(SC): Updated catalina-opts.conf 5b4b01a4a3892ea3751793da57f072ae08eec694ddcda872239fc8239e4bcd1b
national-parks.default hook[init]:(PH): Seeding Mongo Collection
national-parks.default hook[init]:(PH): $MONGOIMPORT_OPTS=
$ docker run -it -p 27017:27017 core/mongodb
hab-sup(MN): Starting core/mongodb
hab-sup(MR): Butterfly Member ID ac2dcb51e8af44e2acdbb44f15660074
mongodb.default(SR): Process will run as user=hab, group=hab
hab-sup(MR): Starting butterfly on 0.0.0.0:9638
hab-sup(MR): Starting http-gateway on 0.0.0.0:9631
hab-sup(SC): Updated mongod.conf f9886a510442a32e91d38a79b0baad2a4bb589ba36fed74e2ea3493d517d8bd5
hab-sup(SC): Updated mongos.conf 8c3e4cd2f3cdd7cd922ce3b529f93672f3af8274e5f6d462a5f8824c25bbbe18
mongodb.default(SR): Initializing
mongodb.default(SV): Starting
mray@farnsworth[18:00]2.3.1(master*)~/ws/azure-syd-demo/cookbooks/azure-syd-demo
$ curl -vL https://atlas.hashicorp.com/bento/boxes/centos-7.1/versions/2.2.2/providers/virtualbox.box -o file
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Trying 52.206.86.0...
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Connected to atlas.hashicorp.com (52.206.86.0) port 443 (#0)
* TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
* Server certificate: *.hashicorp.com
* Server certificate: RapidSSL SHA256 CA
* Server certificate: GeoTrust Global CA
★ Install of mattray/redis complete with 3 packages installed.
hab-sup(GS): Supervisor 172.17.0.3: 4ba11133-4423-4efc-b2ea-56ec1f4900cd
hab-sup(GS): Census redis.default: e9dd72ad-2bea-436f-b2bd-a32a3ac77bfd
hab-sup(GS): Starting inbound gossip listener
hab-sup(GS): Starting outbound gossip distributor
hab-sup(GS): Starting gossip failure detector
hab-sup(CN): Starting census health adjuster
hab-sup(SC): Updated redis.config
hab-sup(TP): Restarting because the service config was updated via the census
hab-sup(TL): 1 of 3 census entries; waiting for minimum quorum
$ hab studio enter
hab-studio: Creating Studio at /hab/studios/src (default)
hab-studio: Entering Studio at /hab/studios/src (default)
hab-studio: Exported: http_proxy=http://192.168.142.180:8123
hab-studio: Exported: https_proxy=http://192.168.142.180:8123