0
Application Deployment is System State                               Joshua Timberman                                  @jt...
% whoamiWednesday, February 22, 12
Wednesday, February 22, 12
Wednesday, February 22, 12
Who are you?                 • Developers?                 • System administrators?                 • DevOps?Wednesday, Fe...
System StateWednesday, February 22, 12
Configuration ManagementWednesday, February 22, 12
System Integration                                   http://www.flickr.com/photos/opalsson/3773629074/Wednesday, February 2...
WAT?Wednesday, February 22, 12
n-Tier Infrastructure                                           Load Balancer                             App Server   { {...
Wednesday, February 22, 12
Were hiring!                             opscode.com/careers/Wednesday, February 22, 12
ResourcesWednesday, February 22, 12
Declarative interface to                               system resourcesWednesday, February 22, 12
user "django_app" do                               shell "/bin/false                               comment "Django App Use...
Describe *what*.                                 Not how.Wednesday, February 22, 12
def install_package(name, version)         package_name = "#{name}=#{version}"         package_name = name if @is_virtual_...
package “python”                                            {   yum install python                                        ...
RecipesWednesday, February 22, 12
Ruby Internal Ruby DSL RubyWednesday, February 22, 12
def method_missing(method_symbol, *args, &block)                    return "lol method_missing"                  endWednes...
user "django_app" do                               shell "/bin/false                               comment "Django App"   ...
CookbooksWednesday, February 22, 12
opscode/cookbooks/python                             ├── README.md                             ├── attributes             ...
RolesWednesday, February 22, 12
Roles describe nodes.Wednesday, February 22, 12
name "django_cms"         description "django app app server"         run_list(           "recipe[mysql::client]",        ...
Roles contain recipesWednesday, February 22, 12
name "base"                        description "All nodes have the base role"                        run_list(            ...
Application DeploymentWednesday, February 22, 12
Wednesday, February 22, 12
Wednesday, February 22, 12
Wednesday, February 22, 12
Wednesday, February 22, 12
Wednesday, February 22, 12
Build your own                 • Lets be realistic.                 • You own your availability.Wednesday, February 22, 12
Application Deployment vs...                 • Configuration management                 • Ad-hoc system administration    ...
Wednesday, February 22, 12
Wednesday, February 22, 12
Package management                 • Rpm                 • Deb                 • Pkgsrc                 • Gems            ...
git "/srv/django_app" do                 repository "git://github.com/me/django_app.git"                 reference "master...
FabricWednesday, February 22, 12
CapistranoWednesday, February 22, 12
chef-deployWednesday, February 22, 12
deploy_revision[/srv/django_app]Wednesday, February 22, 12
deploy_revision "/srv/django_app" do  revision "2.0.17"  repository "git://github.com/me/django_app.git"  user "django_app...
Ad-Hoc Deployment                 • knife ssh                 • capistrano                 • fabric (use pychef!)Wednesday...
require chef/knife   require chef/search/query   Capistrano::Configuration.instance.load do     Chef::Knife.new.configure_...
from fabric.api import env, run, roles                             from chef.fabric import chef_roledefs                  ...
Further Resources                 •      https://us.pycon.org/2012/schedule/                        presentation/286/ (Noa...
Questions?                                Joshua Timberman                             joshua@opscode.com                 ...
Upcoming SlideShare
Loading in...5
×

Socal piggies-app-deploy

1,272

Published on

presentation file for my talk at socal python group Feb 22, 2012

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,272
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
7
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Socal piggies-app-deploy"

  1. 1. Application Deployment is System State Joshua Timberman @jtimberman joshua@opscode.comWednesday, February 22, 12
  2. 2. % whoamiWednesday, February 22, 12
  3. 3. Wednesday, February 22, 12
  4. 4. Wednesday, February 22, 12
  5. 5. Who are you? • Developers? • System administrators? • DevOps?Wednesday, February 22, 12
  6. 6. System StateWednesday, February 22, 12
  7. 7. Configuration ManagementWednesday, February 22, 12
  8. 8. System Integration http://www.flickr.com/photos/opalsson/3773629074/Wednesday, February 22, 12
  9. 9. WAT?Wednesday, February 22, 12
  10. 10. n-Tier Infrastructure Load Balancer App Server { { App Server • • • Provision Configure Integrate Database MasterWednesday, February 22, 12
  11. 11. Wednesday, February 22, 12
  12. 12. Were hiring! opscode.com/careers/Wednesday, February 22, 12
  13. 13. ResourcesWednesday, February 22, 12
  14. 14. Declarative interface to system resourcesWednesday, February 22, 12
  15. 15. user "django_app" do shell "/bin/false comment "Django App User" system true action :create end package "python" do action :install end python_pip "gunicorn" do action :install endWednesday, February 22, 12
  16. 16. Describe *what*. Not how.Wednesday, February 22, 12
  17. 17. def install_package(name, version) package_name = "#{name}=#{version}" package_name = name if @is_virtual_package run_command_with_systems_locale( :command => "apt-get -q -y #{expand_options(@new_resource.options)} install #{package_name}", :environment => { "DEBIAN_FRONTEND" => "noninteractive" } ) endWednesday, February 22, 12
  18. 18. package “python” { yum install python apt-get install python pacman sync python pkg_add -r pythonWednesday, February 22, 12
  19. 19. RecipesWednesday, February 22, 12
  20. 20. Ruby Internal Ruby DSL RubyWednesday, February 22, 12
  21. 21. def method_missing(method_symbol, *args, &block) return "lol method_missing" endWednesday, February 22, 12
  22. 22. user "django_app" do shell "/bin/false comment "Django App" system true end package "python" python_pip "gunicorn" do action :install endWednesday, February 22, 12
  23. 23. CookbooksWednesday, February 22, 12
  24. 24. opscode/cookbooks/python ├── README.md ├── attributes │   └── default.rb ├── metadata.rb ├── providers │   ├── pip.rb │   └── virtualenv.rb ├── recipes │   ├── default.rb │   ├── package.rb │   ├── pip.rb │   ├── source.rb │   └── virtualenv.rb └── resources ├── pip.rb └── virtualenv.rbWednesday, February 22, 12
  25. 25. RolesWednesday, February 22, 12
  26. 26. Roles describe nodes.Wednesday, February 22, 12
  27. 27. name "django_cms" description "django app app server" run_list( "recipe[mysql::client]", "recipe[application]" )Wednesday, February 22, 12
  28. 28. Roles contain recipesWednesday, February 22, 12
  29. 29. name "base" description "All nodes have the base role" run_list( "recipe[zsh]", "recipe[sudo]", "recipe[apt]", "recipe[git]", "recipe[build-essential]" ) override_attributes( :authorization => { :sudo => { :users => ["ubuntu"], :passwordless => true } } )Wednesday, February 22, 12
  30. 30. Application DeploymentWednesday, February 22, 12
  31. 31. Wednesday, February 22, 12
  32. 32. Wednesday, February 22, 12
  33. 33. Wednesday, February 22, 12
  34. 34. Wednesday, February 22, 12
  35. 35. Wednesday, February 22, 12
  36. 36. Build your own • Lets be realistic. • You own your availability.Wednesday, February 22, 12
  37. 37. Application Deployment vs... • Configuration management • Ad-hoc system administration • Going against policyWednesday, February 22, 12
  38. 38. Wednesday, February 22, 12
  39. 39. Wednesday, February 22, 12
  40. 40. Package management • Rpm • Deb • Pkgsrc • Gems • Eggs • Not a solved problem.Wednesday, February 22, 12
  41. 41. git "/srv/django_app" do   repository "git://github.com/me/django_app.git"   reference "master"   action :sync endWednesday, February 22, 12
  42. 42. FabricWednesday, February 22, 12
  43. 43. CapistranoWednesday, February 22, 12
  44. 44. chef-deployWednesday, February 22, 12
  45. 45. deploy_revision[/srv/django_app]Wednesday, February 22, 12
  46. 46. deploy_revision "/srv/django_app" do revision "2.0.17" repository "git://github.com/me/django_app.git" user "django_app" group "www-data" before_migrate do requirements_file = "#{release_path}/requirements.txt" execute "pip install -r #{requirements_file}" do cwd release_path end end action :deployendWednesday, February 22, 12
  47. 47. Ad-Hoc Deployment • knife ssh • capistrano • fabric (use pychef!)Wednesday, February 22, 12
  48. 48. require chef/knife require chef/search/query Capistrano::Configuration.instance.load do   Chef::Knife.new.configure_chef   def chef_role(name, query = "*:*", options = {})     attr = options.delete(:attribute) || :ipaddress     nodes = Chef::Search::Query.new.search(:node, query) [0].map {|n| n[attr] }     role name, *nodes, options     nodes   end end https://github.com/cramerdev/capistrano-chefWednesday, February 22, 12
  49. 49. from fabric.api import env, run, roles from chef.fabric import chef_roledefs env.roledefs = chef_roledefs() @roles(web_app) def mytask(): run(uptime) http://pychef.readthedocs.org/en/latest/fabric.htmlWednesday, February 22, 12
  50. 50. Further Resources • https://us.pycon.org/2012/schedule/ presentation/286/ (Noah Kantrowitz) • http://wiki.opscode.com/display/chef/ Build+a+Django+Stack • http://community.opscode.com/ cookbooks/application • http://pychef.readthedocs.org/en/latest/ index.htmlWednesday, February 22, 12
  51. 51. Questions? Joshua Timberman joshua@opscode.com @jtimberman (twitter, github) lists.opscode.com irc.freenode.net/chef http://www.flickr.com/photos/oberazzi/318947873/Wednesday, February 22, 12
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×