Loading…

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

Like this presentation? Why not share!

Opps I deployed it again-ploneconf2010

on

  • 1,347 views

Hostout integrates buildout and fabric into an extensible out of the box deployment system.

Hostout integrates buildout and fabric into an extensible out of the box deployment system.

Statistics

Views

Total Views
1,347
Views on SlideShare
1,347
Embed Views
0

Actions

Likes
2
Downloads
13
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as OpenOffice

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • Isolated environment Combine eggs, sdist, cmmi, .cfg, php, whatever Recipes do the combining Flow is Configure, build (auto install), run Vs Install, configure, run Can share “buildouts”

Opps I deployed it again-ploneconf2010 Opps I deployed it again-ploneconf2010 Presentation Transcript

  • Oops! I deployed it again New ways to get your app in the cloud Dylan Jay
  • You've written a web app And now you need a host
  • We want it to be easy View slide
  • We want flexibility View slide
  • We want it to be cheap
  • Options Type Providers Flexibility (Easy) Scalability Shared Few e.g. Webfaction ($14) Limited Choice (Control Panel) None AppEngine One Google (Free) No Choice (Launcher) Built in VPS Lots e.g. Slicehost ($20) Unlimited choice (DIY) DIY Cloud Few e.g. Rackspace ($11) Unlimited choice (DIY) DIY
  • Can you have your cake and eat it to?
  • Hostout (Fabric, buildout) & Silverlining
  • Code under development
  • Puppet etc Private egg indexes Push vs Pull
  • Fabric << fabfile.py >> from fabric import api def host_type(): api.run('uname -s') $ fab -H localhost,linuxbox host_type
  • Buildout Workflow Get the “buildout” $ python bootstrap.py $ bin/buildout $ bin/myinstalledscript … add recipes to buildout.cfg from pypi … $ bin/buildout
  • Building myapp $ bin/buildout $ bin/paster serve src/myapp/myapp.ini
  • Useful recipes
    • zc.recipe.egg – download eggs and create scripts
    • collective.recipe.command – run shell commands
    • collective.recipe.template – make config files from templates
    • zc.recipe.cmmi – compile, make, install stuff
    • isotoma.recipe.apache – or any other useful shortcuts
    • mr.developer – manage source control
  • Hostout
      Is a buildout recipe to replicate a local buildout to many hosts (using fabric)
  • Why document it when you can code it?
  • Basic Hostout [buildout] parts = host1 [host1] recipe = collective.hostout host = 127.0.0.1:10022 fabfiles = fabfile.py option1 = buildout user = root password = root path = /var/host1
  • Command line
      $> bin/hostout host1 host_type $> bin/hostout host1 host2 host_type echo hello
  • Share your command
      < setup.py > entry_points = {'zc.buildout': ['default =pkg:Recipe',], 'fabric': ['fabfile = pkg.fabfile'] },
    [host1] recipe = collective.hostout extends = pkg
  • Built in commands
    • Run
    • Sudo
    • Deploy
      • Predeploy
        • Bootstrap – platform dependent
          • setupusers
          • setowners
      • Uploadeggs
      • Uploadbuildout
      • Buildout
      • Postdeploy
  • Releasing eggs
    • hostoutversions.cfg during buildout
    • sdist with md5 for all develop eggs
    • fabric.api.put all hashed eggs (if needed)
      • Direct to egg cache
    • deployed.cfg with hashed versions pinned
    • Upload zip of buildout + includes
    • fabric.api.run( bin/buildout -c deployed.cfg )
  • Hostout
    • Get a “production” buildout
    • To your develop.cfg buildout add...
    • [myhost]
    • recipe = collective.hostout
    • extends = hostout.cloud hostout.ubuntu
    • hosttype = rackspace
    • key = myaccount
    • secret = myapikey
    • buildout = production.cfg
    • $ bin/buildout
    • $ bin/hostout myhost deploy
  • Hostout is modular
    • collective.hostout
      • Deploys buildout to any posix host. Needs IP and password
    • hostout.ubuntu
      • bootstraps ubuntu host for buildout
    • hostout.cloud
      • Creates node ready to be bootstrapped
    • fabfiles = myfabfile.py – add your own
  • Suggested layout
    • buildout.cfg (extends = config/deploy.cfg config/devel.cfg)
    • config/
      • base.cfg (extends = base.cfg)
      • devel.cfg (extends = base.cfg)
      • prod.cfg (extends = base.cfg)
      • deploy.cfg (extends = base.cfg)
        • [host1]
        • buildout = production.cfg
        • parts = instance1
  • User model
      [host1] user = {initial sudo user} buildout-user = {owns buildout files + pw-less login} effective-user = {owns var dir} buildout-group = {group owns both}
  • Extra Options
    • include = {files to include in buildout zip}
    • parts = {override parts}
    • sudo-parts = {sudo bin/buildout install …}
    • pre-commands = {shell to sudo before}
    • post-commads = {shell to sudo after}
    • path = {location of buildout}
  • Deployment Hooks
      def predeploy():
        • domystuff
        • api.env.hostout.super.predeploy()
      • Calls that are overridable
        • api.env.hostout.callmycommand()
  • hostout.supervisor
    • Pre and post deployment stop and start
    • bin/hostout host status
    • bin/hostout host supervisorboot
    • bin/hostout host start/stop/restart
  • hostout.cloud
    • bin/hostout host create
    • bin/hostout host destroy
    • Predeploy hook to create if needed
    [host1] extends = hostout.cloud hostout.ubuntu hostout.supervisor hosttype = rackspace hostname = ploneplonk key = ${keys:rackspace_key} secret = ${keys:rackspace_secret}
  • Gotchas
    • Eggs must be releasable. Ie need setuptools-git etc
    • All files must be checked in locally
    • Interactive commands get stuck
  •  
  •  
  • $ bin/hostout host deploy
  • Silverlining
    • By Ian Bicking
    • Create app layout/dir
      • $ silver init myapp
    • Install dependencies into dir
      • $ cd app; bin/easy_install repoze.bfg
    • Install your code into dir
      • $ bin/python src/myapp/setup.py develop
  • Silverlining II
    • Configure it
      • Edit app.ini: runner = src/myapp/myapp.ini
    • Create host
      • $ silver create-node myhost
      • $ silver setup-node myhost
    • Deploy (rsync)
      • $ silver update myapp --node myhost
  • Hostout vs. Silverlining
    • Many deployers
      • Checkin. Checkout. Buildout. deploy
    • Hostout uses fabric
      • Cross platform but more dependencies (pycrypto)
    • Hostout is modular
      • Package your own fabfiles to help others deploy
    • Hostout is flexible – helps professionals
      • Buildout is powerful. No limit to building/installing. NoSQL etc.
    • Buildout shares dl code
  • Silverlining vs. Hostout
    • Silverlining is batteries included
      • You don't need a production buildout
    • Silverlining is “known” target platform
      • means less variables to go wrong
    • Familiar workflow
      • Commandline vs cfg.
  • Thanks
    • Dylan Jay
    • http://www.pretaweb.com
    • twitter: djay75
    • [email_address]
    • Know plone, syd admin or pywebdev? - we're hiring
  • Photo Credits http://www.flickr.com/photos/benheine/4613609067/sizes/l/in/set-72157622547905358/ http://www.flickr.com/photos/stevedave/3444248057/sizes/o/ http://www.flickr.com/photos/rkbcupcakes/3409724942/sizes/o/ http://www.flickr.com/photos/irrational_cat/517564258/