london community summit 2016 - habitat

23
Application Automation with Habitat Simon Fisher / Fletcher Nichol

Upload: chef

Post on 08-Jan-2017

119 views

Category:

Technology


5 download

TRANSCRIPT

Page 1: London Community Summit 2016 -  Habitat

Application Automation with HabitatSimon Fisher / Fletcher Nichol

Page 2: London Community Summit 2016 -  Habitat
Page 3: London Community Summit 2016 -  Habitat
Page 4: London Community Summit 2016 -  Habitat

Errno::EACCES: Permission denied - /home/-----/#####/-----/vendor/bundle/ruby/1.9.1/cache/bundler /home/-----/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/fileutils.rb:247:in `mkdir' /home/-----/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/fileutils.rb:247:in `fu_mkdir' /home/-----/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/fileutils.rb:221:in `block (2 levels) in mkdir_p' /home/-----/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/fileutils.rb:219:in `reverse_each' /home/-----/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/fileutils.rb:219:in `block in mkdir_p' /home/-----/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/fileutils.rb:205:in `each' /home/-----/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/fileutils.rb:205:in `mkdir_p'

Page 5: London Community Summit 2016 -  Habitat
Page 6: London Community Summit 2016 -  Habitat
Page 7: London Community Summit 2016 -  Habitat

include_recipe 'nginx::default’

template "#{node['dafne_online']['deploy_base']}/shared/config/nginx.conf" do

source 'nginx_conf.erb’

owner 'rails’

group 'admin’

mode '0644’

notifies :restart, 'service[nginx]’

end

Page 8: London Community Summit 2016 -  Habitat

deploy node['dafne_online']['deploy_base'] do

repository "https://#{node['dafne_online']['git_user']}:#{git_pw}@dafneonline.git.cloudforge.com/dafneonline.git" rollback_on_error true

environment rails_user_env

restart_command 'sudo -H -u rails bash -c "export PATH=/opt/rubies/2.2.3/bin:$PATH && /etc/init.d/unicorn_dafneonline restart"’

action :deploy symlinks shared_hash

user node['dafne_online']['deploy_user']

group 'admin’

before_symlink do

execute 'bundle install' do

command "bundle install --path #{node['dafne_online']['deploy_base']}/shared/bundle --without development test --deployment --quiet”

user node['dafne_online']['deploy_user']

environment rails_user_env

cwd release_path

action :run

end

end

before_restart do

link '/etc/init.d/unicorn_dafneonline' do

to '/home/rails/apps/dafneonline/current/config/unicorn_init.sh’

end

template "#{node['dafne_online']['deploy_base']}/current/config/unicorn.rb" do

source 'unicorn.rb.erb' owner node['dafne_online']['deploy_user']

group 'admin’

mode 00744

end

execute 'compile assets' do

command "RAILS_ENV=#{node['dafne_online']['rails_env']} bundle exec rake assets:precompile”

user node['dafne_online']['deploy_user']

environment rails_user_env

cwd release_path

action :run

end

end

after_restart do

execute 'notify Airbrake of deployment' do

command "RAILS_ENV=#{node['dafne_online']['rails_env']} bundle exec rake airbrake:deploy TO=#{node['dafne_online']['rails_env']} REVISION=

REPO=https://dafneonline.git.cloudforge.com/dafneonline.git USER=#{node['dafne_online']['deploy_user']}”

environment rails_user_env

user node['dafne_online']['deploy_user']

cwd release_path

action :run

end

end

end

Page 9: London Community Summit 2016 -  Habitat

9

Page 10: London Community Summit 2016 -  Habitat

Habitat Technology

Plan Artifact DepotBuildService

Supervisor

Supervisor

Supervisor

Supervisor

Ring

Bare MetalContainers

AMIVM

Depot

Build Service & Workflow

Package Format

Artifact Distribution

Server

Artifact Distribution

Server

Intelligent Run-Time Supervisor w/REST API

Source Code Repo

Supervisor Supervisor

Page 11: London Community Summit 2016 -  Habitat

Stop!Demo Time

Page 12: London Community Summit 2016 -  Habitat

What’s New?Habitat features and updates post-launch 2016

Page 13: London Community Summit 2016 -  Habitat

Package Search from Command Line$ hab pkg search hab-studio

core/hab-studio/0.10.0/20160929200453

core/hab-studio/0.10.0/20160929200924

core/hab-studio/0.10.1/20160929223112

core/hab-studio/0.10.2/20160930230930

core/hab-studio/0.6.0/20160612082608

core/hab-studio/0.6.0/20160613075329

core/hab-studio/0.7.0/20160614232531

core/hab-studio/0.8.0/20160708162421

core/hab-studio/0.8.0/20160729121901

core/hab-studio/0.8.0/20160729180228

core/hab-studio/0.8.0/20160729195909

core/hab-studio/0.9.0/20160815225526

core/hab-studio/0.9.1/20160901205418

core/hab-studio/0.9.3/20160916192516

core/hab-studio/0.9.3/20160922234920

core/hab-studio/0.9.3/20160926154214

Page 14: London Community Summit 2016 -  Habitat

Improved Proxy Support• Supports $http_proxy, $https_proxy, $no_proxy

environment variables• Basic authentication• Propagate into Studios

Page 15: London Community Summit 2016 -  Habitat

Iterate Service Configurations Quicker using–config-from• Faster iteration of configuration templates during plan

development• $ hab start yourorigin/yourpackage --config-from

/path/to/config• Intended only for development

Page 16: London Community Summit 2016 -  Habitat

Improved Root/Non-Root Behavior via sudo• Drop the need to prefix most hab commands with sudo• Entering a Studio with sudo detects user’s key cache

(not root’s)• $ hab setup; sudo hab studio enter• Future release will “auto-sudo” when using Studio

subcommands

Page 17: London Community Summit 2016 -  Habitat

Better Mac Docker/Studio Upgrading• Mac uses a Docker image for Linux Studio• Runs Docker image with same version as hab CLI• On upgrading hab CLI, new Docker image automatically

pulled

Page 18: London Community Summit 2016 -  Habitat

Process: Release Train Model• Userland tooling: hab CLI, Supervisor, Director• Every second Thursday, cut from master• Typically a minor version revision• Features ship when ready and early features will hide

behind feature flags

Page 19: London Community Summit 2016 -  Habitat

Process: (Upcoming) Continuous Deployment• Platform infrastructure: web site, Depot, Builder• Packages built off master and published to Depot• Platform upgrades when new packages publish• Decoupled release from userland tooling

Page 20: London Community Summit 2016 -  Habitat

Builder: A Distributed Build Service• Micro service architecture, built with Habitat in mind• Habitat runs on Habitat• Upcoming: early access to build a package on the

platform via feature flag/invite• Upcoming: building packages on pushes to GitHub• Upcoming: dependent package rebuilding• More details: “Habitat 301: Building Habitats” ChefConf

2016 Talk by Jamie Winsor

Page 21: London Community Summit 2016 -  Habitat

Expanding Horizons: Windows• Bring Mac Habitat experience to Windows• Building hab CLI• Upcoming: ship first hab packages for Windows• Upcoming: native Windows Habitat packages• Upcoming: Supervisor running on Windows

Page 22: London Community Summit 2016 -  Habitat

Contribute to “Habtoberfest”!• Habitat participating in Digital Ocean’s Hacktoberfest

event• Runs October 1st through 31st• Make 4 pull requests (on any FOSS project), earn a

limited edition Hacktoberfest T-shirt• Habitat repo has “Hacktoberfest” tagged issues• http://hacktoberfest.digitalocean.com

Page 23: London Community Summit 2016 -  Habitat

Help Shape the Direction of Habitat• Try out Habitat https://www.habitat.sh/try/• Build a package• Try out use cases, contact us when: you win, you come

up short, (i.e. anytime)• Join us in HabiChat http://slack.habitat.sh/• We’re at a Community Summit—let’s talk!