Skip to content

Commit

Permalink
Update for Habitat 0.57.0 and new node app
Browse files Browse the repository at this point in the history
* Update AMI IDs for 0.57.0
* The sample-node-app no longer uses scaffolding
* `new-plan.sh` always tracks updates to `plan.sh`.
* Use the new default config toml file
* TEMPORARY- use a fork of the app repo

Signed-off-by: Nathen Harvey <[email protected]>
  • Loading branch information
Nathen Harvey committed Jul 6, 2018
1 parent 056a9ce commit b97fc60
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 25 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ aws_access_key_id = MYKEYID
aws_secret_access_key = MYACCESSKEY
```

Platform | Hab 0.56.0 | none
Platform | Hab 0.57.0 | none
---- | ------ | ----
CentOS 7 | ami-0f36a4015d35d109c | ami-06cb1643574bae9c8
Ubuntu 16.04 | ami-0216854b2a2ad08e6 | ami-074c27cb2c39554bb
CentOS 7 | ami-0445e31e5afdf93a3 | ami-033ae197aa303d85f
Ubuntu 16.04 | ami-00d15a59d4cd20401 | ami-020eb04dc676c777b

## Pre-requisites

Expand Down
6 changes: 2 additions & 4 deletions cookbooks/habitat_workstation/files/default/new-config.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
message = "Hello, World!"
node_env = "production"

[app]
port = 9000
title = 'Habitat - The fastest path from code to cloud native.'

9 changes: 0 additions & 9 deletions cookbooks/habitat_workstation/files/default/new-plan.sh

This file was deleted.

1 change: 1 addition & 0 deletions cookbooks/habitat_workstation/metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@
depends 'ufw'
depends 'habitat'
depends 'yum-epel'
depends 'line'
29 changes: 20 additions & 9 deletions cookbooks/habitat_workstation/recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,21 +102,32 @@
mode '0664'
end

cookbook_file '/home/chef/new-plan.sh' do
source 'new-plan.sh'
owner 'chef'
group 'chef'
mode '0664'
end

# TODO: switch back to habitat-sh/sample-node-app/ once
# PR-14 is merged
# https://github.com/habitat-sh/sample-node-app/pull/14
git '/home/chef/sample-node-app' do
repository 'https://github.com/habitat-sh/sample-node-app.git'
revision 'master'
repository 'https://github.com/nathenharvey/sample-node-app.git'
revision 'nathen/configurable-port'
action :sync
user 'chef'
group 'chef'
end

execute 'copy the plan.sh' do
command <<EOF
cp /home/chef/sample-node-app/habitat/plan.sh /home/chef/new-plan.sh
EOF
not_if { ::File.exist?('/home/chef/new-plan.sh') }
end

# the line cookbook provides this resource
replace_or_add 'update the origin to chef' do
path '/home/chef/new-plan.sh'
pattern 'pkg_origin=your_origin'
line "pkg_origin=chef"
replace_only true
end

cookbook_file '/home/chef/sample-node-app/new-config.toml' do
source 'new-config.toml'
owner 'chef'
Expand Down
4 changes: 4 additions & 0 deletions cookbooks/habitat_workstation/test/integration/install_hab.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@
describe command('hab') do
it { should exist }
end

describe command('diff /home/chef/new-plan.sh /home/chef/sample-node-app/habitat/plan.sh') do
its(:stdout) { should match /< pkg_origin=chef/ }
end

0 comments on commit b97fc60

Please sign in to comment.