SlideShare uma empresa Scribd logo
1 de 31
Buildout and Hostout or “How to host an app  for $20 in 20min” Dylan Jay [email_address] Technical Solutions Manager PretaWeb   (Thanks to Darryl Cousins for slides 1-10 from NZPUG presentation)
A Python Module A block of code imported by some other code
A python module: hello.py We can import the method from the module:  def   helloworld ():  print u"Hello World from hello import  helloworld
A Python Package: hello A package is a module that contains other modules:  hello/  __init__.py  hello.py Now we must import the method from the module within the module.   from hello.hello import helloworld
Disutils Distutils was written so we have a unified way to install python modules.  python setup.py install
Disutils – creating a distribution To distribute the hello module we need have it in a directory with a setup.py file.  workingdir/  setup.py  hello/  __init__.py  hello.py  The setup.py file needs at the least the following. from distutils.core import setup  setup(name="hello",  )
Disutils creating a distribution continued Now we can create a distribution tarball with disutils.  python setup.py sdist  Our directory now looks like this  workingdir/  setup.py  hello/  __init__.py  hello.py  dist/  hello-1.0.tar.gz   If we unpack the source distribution it looks like this:  Hello-1.0/  PKG-INFO  setup.py  hello/  __init__.py  hello.py
setuptools •  Setuptools is built on top of distutils  •  uses the setup.py  •  uses eggs for distribution  •  allows us to save our modules as eggs to pypi  Installing setuptools  wget http://peak.telecommunity.com/dist/ez_setup.py  python ez_setup.py
Eggs To create an egg change the import line in setup.py  from setuptools import setup  setup(name="hello",  version="1.0",  )   We can call that with:  python setup.py bdist_egg   Which creates a binary egg in our dist directory  dist/  hello-1.0-py2.4.egg
pypi If we want that egg available on pypi and we have an account we can do that with a single command.  python setup.py sdist upload  Which all the world can use  easy_install hello
virtualenv If we want to install without affecting whole system $ easy_install virtualenv $ virtualenv myenv $ source myenv/bin/activate (myenv)$ easy_install hello . . .  (myenv)$ deactivate
zc.buildout – what is it? “ Buildout is a system of configuring repeatable steps for assembling complicated systems (applications) from multiple parts.”  ,[object Object],[object Object],[object Object],[object Object],[object Object]
Installing  buildout $ easy_install zc.buildout $ cd myproj $ buildout init This creates the following directory structure myproj/ bin/ buildout parts/ develop-eggs/ buildout.cfg
buildout.cfg Buildout does very little by itself [buildout]  parts =  A buildout is made of parts. Parts are instances of recipes.  Recipes do the work. [buildout]  parts = py [py]  recipe = zc.recipe.egg  interpreter = py  eggs = hello
Recipes – 185+ on pypi
Running buildout $ bin/buildout Installing py. Generated interpreter 'myproj/bin/py'. $ bin/py >>> from hello import helloworld >>> helloworld() Hello World
Buildout - Scripts You can generate scripts [buildout] parts = buildout1 buildout2 [buildout1]  recipe = zc.recipe.egg  eggs = zc.buildout==1.2.1 scripts = buildout=buildout1 [buildout2] recipe = zc.recipe.egg eggs = zc.buildout<=1.2.0 scripts = buildout=buildout2
Buildout - Versions You can pin versions [buildout] parts = buildout1 buildout2 versions = versions [buildout1]  recipe = zc.recipe.egg  eggs = zc.buildout scripts = buildout=buildout1 [versions] zc.buildout = 1.2.1
Buildout - Scripts are wrappers $ cat bin/buildout1 #!/bin/python import sys sys.path[0:0] = [ '/download-cache/eggs/zc.buildout-1.2.1-py2.4.egg', '/download-cache/eggs/setuptools-0.6c9-py2.4.egg', ] import zc.buildout.buildout if __name__ == '__main__': zc.buildout.buildout.main()
Buildout – manages installation $ bin/buildout -v Uninstalling py. Installing buildout1. Installing 'zc.buildout==1.2.1'. We have the distribution that satisfies 'zc.buildout==1.2.1'. Adding required 'setuptools' required by zc.buildout 1.2.1. Picked: setuptools = 0.6c9 Generated script 'myproj/bin/buildout1'. Installing buildout2. Installing 'zc.buildout==1.2.0'. We have the distribution that satisfies 'zc.buildout==1.2.0'. Adding required 'setuptools' required by zc.buildout 1.2.0. Picked: setuptools = 0.6c9 Generated script 'myproj/bin/buildout2'.
Buildout – variables and dependencies and distutils [ buildout ] parts =  py [ py ]  recipe =  zc .recipe.egg  Interpreter =  py extra-paths= ${reportlab:output}  [ reportlab ] recipe = collective.recipe. distutils url  = http://www.reportlab.org/ftp/ReportLab_2_3.tar.gz output = ${buildout:directory}/parts/site-packages/
Helloworld in Plone src/hello/hello/hello.py from  Products.Five.browser  import  BrowserView class   HelloWorld (BrowserView): def   __call__ ( self ): return  &quot;Hello World&quot; src/hello/hello/configure.zcml <configure xmlns:browser=&quot; http://namespaces.zope.org/browser &quot;> <browser:page name=&quot;hello&quot;  class=&quot;.hello.HelloWorld&quot; permission=&quot;zope2.Public&quot; /> </configure>
Helloworld in Plone buildout base.cfg [ buildout ] parts = instance develop =  src /hello [zope2] recipe =  plone .recipe.zope2install url  = http://www.zope.org/Products/Zope/2.10.8/Zope-2.10.8-final.tgz [instance] recipe =  plone .recipe.zope2instance zope2-location = ${zope2:location} user = dylan:jay eggs =  hello  Plone zcml  = hello
Run Helloworld $ bin/buildout -c base.cfg Develop: 'myproj/src/hello' Updating zope2. Updating fake eggs Installing instance. $ bin/instance fg 2009-06-08 20:24:54 INFO ZServer HTTP server started at Mon Jun  8 20:24:54 2009 Hostname: localhost Port: 8080 ... 2009-06-08 20:25:44 INFO Zope Ready to handle requests
Production buildout extends base prod.cfg [ buildout ] extends = base. cfg parts += supervisor [instance] zeo -client = True zeo -address = ${zeo:zeo-address} [ zeo ] recipe =  plone .recipe.zope2zeoserver zope2-location = ${zope2:location} Zeo -address = 127.0.0.1:9000 [varnish] recipe =  plone .recipe.varnish:instance bind = 127.0.0.1:80 mode = foreground backends  = ${instance:http-address} daemon = ${varnish-build:location}/ sbin / varnishd [varnish-build] recipe =  zc .recipe. cmmi url  =  http://waix.dl.sourceforge.net/sourceforge/varnish/varnish-2.0.3.tar.gz [supervisor] recipe = collective.recipe.supervisor programs = 10  zeo  ${zeo:location}/bin/ runzeo 20 instance1 ${instance:location}/bin/ runzope 70 cache ${buildout:bin-directory}/varnish ${varnish:location} true
Hosting a buildout First get a server with root access ~$20USD p/m for 256mb Slicehost, Amazon ec2, etc
collective.hostout ,[object Object],[object Object],[object Object],[object Object]
Put collective.hostout in buildout.cfg [ buildout ] extends = base. cfg parts +=  hostout [ hostout ] recipe = collective. hostout host= myproj . slicehost . com buildout  =  prod . cfg start_cmd = ${buildout:bin-directory}/ supervisord stop_cmd = ${buildout:bin-directory}/ supervisorctl  shutdown
Run hostout $ bin/buildout  Develop: 'myproj/src/hello' Updating zope2. Updating fake eggs Updating instance. Installing hostout. $ bin/hostout  running setup script 'src/hello/setup.py'. … creating deployment file: versions.cfg prod.cfg base.cfg hello1.0dev_12...6-py2.4.egg logging into the following hosts as root: myproj.slicehost.com Password: Installing python Bootstrapping buildout in /var/local/buildout Unpacking deployment file Running buildout Running start command
Hostout – with source control Doesn't need access to svn or git on the server
Hostout TODO ,[object Object],[object Object],[object Object],[object Object],[object Object]

Mais conteúdo relacionado

Mais procurados

PuppetCamp SEA 1 - Version Control with Puppet
PuppetCamp SEA 1 - Version Control with PuppetPuppetCamp SEA 1 - Version Control with Puppet
PuppetCamp SEA 1 - Version Control with PuppetWalter Heck
 
Buildout: How to maintain big app stacks without losing your mind
Buildout: How to maintain big app stacks without losing your mindBuildout: How to maintain big app stacks without losing your mind
Buildout: How to maintain big app stacks without losing your mindDylan Jay
 
Buildout and Plone
Buildout and PloneBuildout and Plone
Buildout and Ploneknappt
 
Augeas
AugeasAugeas
Augeaslutter
 
Guarding Your Code Against Bugs with Continuous Testing
Guarding Your Code Against Bugs with Continuous TestingGuarding Your Code Against Bugs with Continuous Testing
Guarding Your Code Against Bugs with Continuous TestingEric Hogue
 
#SPUG - Legacy applications
#SPUG - Legacy applications#SPUG - Legacy applications
#SPUG - Legacy applicationsPiotr Pasich
 
Perl web app 테스트전략
Perl web app 테스트전략Perl web app 테스트전략
Perl web app 테스트전략Jeen Lee
 
Webinar - Manage user, groups, packages in windows using puppet
Webinar - Manage user, groups, packages in windows using puppetWebinar - Manage user, groups, packages in windows using puppet
Webinar - Manage user, groups, packages in windows using puppetOlinData
 
Automated release management with team city & octopusdeploy - NDC 2013
Automated release management with team city & octopusdeploy - NDC 2013Automated release management with team city & octopusdeploy - NDC 2013
Automated release management with team city & octopusdeploy - NDC 2013Kristoffer Deinoff
 
Denys Serhiienko "ASGI in depth"
Denys Serhiienko "ASGI in depth"Denys Serhiienko "ASGI in depth"
Denys Serhiienko "ASGI in depth"Fwdays
 
Search and play more than 50 clips
Search and play more than 50 clipsSearch and play more than 50 clips
Search and play more than 50 clipsphanhung20
 
HTMLarea to CKEditor - create presets and your own plugin for TYPO3
HTMLarea to CKEditor - create presets and your own plugin for TYPO3HTMLarea to CKEditor - create presets and your own plugin for TYPO3
HTMLarea to CKEditor - create presets and your own plugin for TYPO3Frans Saris
 
GettingStartedWithPHP
GettingStartedWithPHPGettingStartedWithPHP
GettingStartedWithPHPNat Weerawan
 
Drupal Day 2012 - Automating Drupal Development: Make!les, Features and Beyond
Drupal Day 2012 - Automating Drupal Development: Make!les, Features and BeyondDrupal Day 2012 - Automating Drupal Development: Make!les, Features and Beyond
Drupal Day 2012 - Automating Drupal Development: Make!les, Features and BeyondDrupalDay
 
Legacy applications - 4Developes konferencja, Piotr Pasich
Legacy applications  - 4Developes konferencja, Piotr PasichLegacy applications  - 4Developes konferencja, Piotr Pasich
Legacy applications - 4Developes konferencja, Piotr PasichPiotr Pasich
 
Zagreb workshop
Zagreb workshopZagreb workshop
Zagreb workshopLynn Root
 
Elixir & Phoenix - fast, concurrent and explicit
Elixir & Phoenix - fast, concurrent and explicitElixir & Phoenix - fast, concurrent and explicit
Elixir & Phoenix - fast, concurrent and explicitTobias Pfeiffer
 
Alessandro sf 2010
Alessandro sf 2010Alessandro sf 2010
Alessandro sf 2010Puppet
 
The Puppet Debugging Kit: Building Blocks for Exploration and Problem Solving...
The Puppet Debugging Kit: Building Blocks for Exploration and Problem Solving...The Puppet Debugging Kit: Building Blocks for Exploration and Problem Solving...
The Puppet Debugging Kit: Building Blocks for Exploration and Problem Solving...Puppet
 

Mais procurados (20)

PuppetCamp SEA 1 - Version Control with Puppet
PuppetCamp SEA 1 - Version Control with PuppetPuppetCamp SEA 1 - Version Control with Puppet
PuppetCamp SEA 1 - Version Control with Puppet
 
Buildout: How to maintain big app stacks without losing your mind
Buildout: How to maintain big app stacks without losing your mindBuildout: How to maintain big app stacks without losing your mind
Buildout: How to maintain big app stacks without losing your mind
 
Buildout and Plone
Buildout and PloneBuildout and Plone
Buildout and Plone
 
はじめてのSymfony2
はじめてのSymfony2はじめてのSymfony2
はじめてのSymfony2
 
Augeas
AugeasAugeas
Augeas
 
Guarding Your Code Against Bugs with Continuous Testing
Guarding Your Code Against Bugs with Continuous TestingGuarding Your Code Against Bugs with Continuous Testing
Guarding Your Code Against Bugs with Continuous Testing
 
#SPUG - Legacy applications
#SPUG - Legacy applications#SPUG - Legacy applications
#SPUG - Legacy applications
 
Perl web app 테스트전략
Perl web app 테스트전략Perl web app 테스트전략
Perl web app 테스트전략
 
Webinar - Manage user, groups, packages in windows using puppet
Webinar - Manage user, groups, packages in windows using puppetWebinar - Manage user, groups, packages in windows using puppet
Webinar - Manage user, groups, packages in windows using puppet
 
Automated release management with team city & octopusdeploy - NDC 2013
Automated release management with team city & octopusdeploy - NDC 2013Automated release management with team city & octopusdeploy - NDC 2013
Automated release management with team city & octopusdeploy - NDC 2013
 
Denys Serhiienko "ASGI in depth"
Denys Serhiienko "ASGI in depth"Denys Serhiienko "ASGI in depth"
Denys Serhiienko "ASGI in depth"
 
Search and play more than 50 clips
Search and play more than 50 clipsSearch and play more than 50 clips
Search and play more than 50 clips
 
HTMLarea to CKEditor - create presets and your own plugin for TYPO3
HTMLarea to CKEditor - create presets and your own plugin for TYPO3HTMLarea to CKEditor - create presets and your own plugin for TYPO3
HTMLarea to CKEditor - create presets and your own plugin for TYPO3
 
GettingStartedWithPHP
GettingStartedWithPHPGettingStartedWithPHP
GettingStartedWithPHP
 
Drupal Day 2012 - Automating Drupal Development: Make!les, Features and Beyond
Drupal Day 2012 - Automating Drupal Development: Make!les, Features and BeyondDrupal Day 2012 - Automating Drupal Development: Make!les, Features and Beyond
Drupal Day 2012 - Automating Drupal Development: Make!les, Features and Beyond
 
Legacy applications - 4Developes konferencja, Piotr Pasich
Legacy applications  - 4Developes konferencja, Piotr PasichLegacy applications  - 4Developes konferencja, Piotr Pasich
Legacy applications - 4Developes konferencja, Piotr Pasich
 
Zagreb workshop
Zagreb workshopZagreb workshop
Zagreb workshop
 
Elixir & Phoenix - fast, concurrent and explicit
Elixir & Phoenix - fast, concurrent and explicitElixir & Phoenix - fast, concurrent and explicit
Elixir & Phoenix - fast, concurrent and explicit
 
Alessandro sf 2010
Alessandro sf 2010Alessandro sf 2010
Alessandro sf 2010
 
The Puppet Debugging Kit: Building Blocks for Exploration and Problem Solving...
The Puppet Debugging Kit: Building Blocks for Exploration and Problem Solving...The Puppet Debugging Kit: Building Blocks for Exploration and Problem Solving...
The Puppet Debugging Kit: Building Blocks for Exploration and Problem Solving...
 

Semelhante a How to host an app for $20 in 20min using buildout and hostout

ZopeSkel & Buildout packages
ZopeSkel & Buildout packagesZopeSkel & Buildout packages
ZopeSkel & Buildout packagesQuintagroup
 
Martin Aspeli Extending And Customising Plone 3
Martin Aspeli   Extending And Customising Plone 3Martin Aspeli   Extending And Customising Plone 3
Martin Aspeli Extending And Customising Plone 3Vincenzo Barone
 
PyGrunn - Buildout presentation
PyGrunn - Buildout presentationPyGrunn - Buildout presentation
PyGrunn - Buildout presentationKim Chee Leong
 
Fast Paced Drupal 8: Accelerating Development with Composer, Drupal Console a...
Fast Paced Drupal 8: Accelerating Development with Composer, Drupal Console a...Fast Paced Drupal 8: Accelerating Development with Composer, Drupal Console a...
Fast Paced Drupal 8: Accelerating Development with Composer, Drupal Console a...Acquia
 
Oops, where's my site?
Oops, where's my site?Oops, where's my site?
Oops, where's my site?David Glick
 
Dexterity in 15 minutes or less
Dexterity in 15 minutes or lessDexterity in 15 minutes or less
Dexterity in 15 minutes or lessrijk.stofberg
 
Marek Kuziel - Deploying Django with Buildout
Marek Kuziel - Deploying Django with BuildoutMarek Kuziel - Deploying Django with Buildout
Marek Kuziel - Deploying Django with Buildoutmarekkuziel
 
Python from zero to hero (Twitter Explorer)
Python from zero to hero (Twitter Explorer)Python from zero to hero (Twitter Explorer)
Python from zero to hero (Twitter Explorer)Yuriy Senko
 
나도 할 수 있다 오픈소스
나도 할 수 있다 오픈소스나도 할 수 있다 오픈소스
나도 할 수 있다 오픈소스효준 강
 
Opps I deployed it again-ploneconf2010
Opps I deployed it again-ploneconf2010Opps I deployed it again-ploneconf2010
Opps I deployed it again-ploneconf2010Dylan Jay
 
Deploying Symfony | symfony.cat
Deploying Symfony | symfony.catDeploying Symfony | symfony.cat
Deploying Symfony | symfony.catPablo Godel
 
Opps i deployed it again
Opps i deployed it againOpps i deployed it again
Opps i deployed it againDylan Jay
 
Cooking Perl with Chef: Real World Tutorial with Jitterbug
Cooking Perl with Chef: Real World Tutorial with JitterbugCooking Perl with Chef: Real World Tutorial with Jitterbug
Cooking Perl with Chef: Real World Tutorial with JitterbugDavid Golden
 
Mojolicious - A new hope
Mojolicious - A new hopeMojolicious - A new hope
Mojolicious - A new hopeMarcus Ramberg
 
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)Fabrice Bernhard
 
Chocolatey - making the process of installing software on windows easy as pie
Chocolatey - making the process of installing software on windows easy as pieChocolatey - making the process of installing software on windows easy as pie
Chocolatey - making the process of installing software on windows easy as pieJustin James
 
Cooking environments with chef
Cooking environments with chefCooking environments with chef
Cooking environments with chefpythonandchips
 

Semelhante a How to host an app for $20 in 20min using buildout and hostout (20)

ZopeSkel & Buildout packages
ZopeSkel & Buildout packagesZopeSkel & Buildout packages
ZopeSkel & Buildout packages
 
Martin Aspeli Extending And Customising Plone 3
Martin Aspeli   Extending And Customising Plone 3Martin Aspeli   Extending And Customising Plone 3
Martin Aspeli Extending And Customising Plone 3
 
PyGrunn - Buildout presentation
PyGrunn - Buildout presentationPyGrunn - Buildout presentation
PyGrunn - Buildout presentation
 
Fast Paced Drupal 8: Accelerating Development with Composer, Drupal Console a...
Fast Paced Drupal 8: Accelerating Development with Composer, Drupal Console a...Fast Paced Drupal 8: Accelerating Development with Composer, Drupal Console a...
Fast Paced Drupal 8: Accelerating Development with Composer, Drupal Console a...
 
Oops, where's my site?
Oops, where's my site?Oops, where's my site?
Oops, where's my site?
 
Dexterity in 15 minutes or less
Dexterity in 15 minutes or lessDexterity in 15 minutes or less
Dexterity in 15 minutes or less
 
Marek Kuziel - Deploying Django with Buildout
Marek Kuziel - Deploying Django with BuildoutMarek Kuziel - Deploying Django with Buildout
Marek Kuziel - Deploying Django with Buildout
 
Welcome to Jenkins
Welcome to JenkinsWelcome to Jenkins
Welcome to Jenkins
 
Python from zero to hero (Twitter Explorer)
Python from zero to hero (Twitter Explorer)Python from zero to hero (Twitter Explorer)
Python from zero to hero (Twitter Explorer)
 
나도 할 수 있다 오픈소스
나도 할 수 있다 오픈소스나도 할 수 있다 오픈소스
나도 할 수 있다 오픈소스
 
Plone Einführung
Plone EinführungPlone Einführung
Plone Einführung
 
Opps I deployed it again-ploneconf2010
Opps I deployed it again-ploneconf2010Opps I deployed it again-ploneconf2010
Opps I deployed it again-ploneconf2010
 
Deploying Symfony | symfony.cat
Deploying Symfony | symfony.catDeploying Symfony | symfony.cat
Deploying Symfony | symfony.cat
 
Opps i deployed it again
Opps i deployed it againOpps i deployed it again
Opps i deployed it again
 
Cooking Perl with Chef: Real World Tutorial with Jitterbug
Cooking Perl with Chef: Real World Tutorial with JitterbugCooking Perl with Chef: Real World Tutorial with Jitterbug
Cooking Perl with Chef: Real World Tutorial with Jitterbug
 
Mojolicious - A new hope
Mojolicious - A new hopeMojolicious - A new hope
Mojolicious - A new hope
 
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
 
Chocolatey - making the process of installing software on windows easy as pie
Chocolatey - making the process of installing software on windows easy as pieChocolatey - making the process of installing software on windows easy as pie
Chocolatey - making the process of installing software on windows easy as pie
 
Pyramid deployment
Pyramid deploymentPyramid deployment
Pyramid deployment
 
Cooking environments with chef
Cooking environments with chefCooking environments with chef
Cooking environments with chef
 

Mais de Dylan Jay

5 things STILL! TOO! HARD! in Plone 5
5 things STILL! TOO! HARD! in Plone 55 things STILL! TOO! HARD! in Plone 5
5 things STILL! TOO! HARD! in Plone 5Dylan Jay
 
The eggless Plone manifesto (or Plone the open source cms-as-a-service platf...
The eggless Plone manifesto (or Plone  the open source cms-as-a-service platf...The eggless Plone manifesto (or Plone  the open source cms-as-a-service platf...
The eggless Plone manifesto (or Plone the open source cms-as-a-service platf...Dylan Jay
 
The goodies of zope, pyramid, and plone (2)
The goodies of zope, pyramid, and plone (2)The goodies of zope, pyramid, and plone (2)
The goodies of zope, pyramid, and plone (2)Dylan Jay
 
Surviving an earthquake's worth of traffic
Surviving an earthquake's worth of trafficSurviving an earthquake's worth of traffic
Surviving an earthquake's worth of trafficDylan Jay
 
TTW FTW: Plone as the new wordpress
TTW FTW: Plone as the new wordpressTTW FTW: Plone as the new wordpress
TTW FTW: Plone as the new wordpressDylan Jay
 
Pyramid Lighter/Faster/Better web apps
Pyramid Lighter/Faster/Better web appsPyramid Lighter/Faster/Better web apps
Pyramid Lighter/Faster/Better web appsDylan Jay
 
Plone: The CMS that hits above it's weight
Plone: The CMS that hits above it's weightPlone: The CMS that hits above it's weight
Plone: The CMS that hits above it's weightDylan Jay
 
Funnelweb ploneconf2010
Funnelweb ploneconf2010Funnelweb ploneconf2010
Funnelweb ploneconf2010Dylan Jay
 
Plone for python programmers
Plone for python programmersPlone for python programmers
Plone for python programmersDylan Jay
 
TestBrowser Driven Development: How to get bulletproof code from lazy developers
TestBrowser Driven Development: How to get bulletproof code from lazy developersTestBrowser Driven Development: How to get bulletproof code from lazy developers
TestBrowser Driven Development: How to get bulletproof code from lazy developersDylan Jay
 

Mais de Dylan Jay (11)

5 things STILL! TOO! HARD! in Plone 5
5 things STILL! TOO! HARD! in Plone 55 things STILL! TOO! HARD! in Plone 5
5 things STILL! TOO! HARD! in Plone 5
 
The eggless Plone manifesto (or Plone the open source cms-as-a-service platf...
The eggless Plone manifesto (or Plone  the open source cms-as-a-service platf...The eggless Plone manifesto (or Plone  the open source cms-as-a-service platf...
The eggless Plone manifesto (or Plone the open source cms-as-a-service platf...
 
The goodies of zope, pyramid, and plone (2)
The goodies of zope, pyramid, and plone (2)The goodies of zope, pyramid, and plone (2)
The goodies of zope, pyramid, and plone (2)
 
Surviving an earthquake's worth of traffic
Surviving an earthquake's worth of trafficSurviving an earthquake's worth of traffic
Surviving an earthquake's worth of traffic
 
TTW FTW: Plone as the new wordpress
TTW FTW: Plone as the new wordpressTTW FTW: Plone as the new wordpress
TTW FTW: Plone as the new wordpress
 
Plone pwns
Plone pwnsPlone pwns
Plone pwns
 
Pyramid Lighter/Faster/Better web apps
Pyramid Lighter/Faster/Better web appsPyramid Lighter/Faster/Better web apps
Pyramid Lighter/Faster/Better web apps
 
Plone: The CMS that hits above it's weight
Plone: The CMS that hits above it's weightPlone: The CMS that hits above it's weight
Plone: The CMS that hits above it's weight
 
Funnelweb ploneconf2010
Funnelweb ploneconf2010Funnelweb ploneconf2010
Funnelweb ploneconf2010
 
Plone for python programmers
Plone for python programmersPlone for python programmers
Plone for python programmers
 
TestBrowser Driven Development: How to get bulletproof code from lazy developers
TestBrowser Driven Development: How to get bulletproof code from lazy developersTestBrowser Driven Development: How to get bulletproof code from lazy developers
TestBrowser Driven Development: How to get bulletproof code from lazy developers
 

Último

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard37
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)Samir Dash
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAnitaRaj43
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 

Último (20)

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

How to host an app for $20 in 20min using buildout and hostout

  • 1. Buildout and Hostout or “How to host an app for $20 in 20min” Dylan Jay [email_address] Technical Solutions Manager PretaWeb (Thanks to Darryl Cousins for slides 1-10 from NZPUG presentation)
  • 2. A Python Module A block of code imported by some other code
  • 3. A python module: hello.py We can import the method from the module: def helloworld (): print u&quot;Hello World from hello import helloworld
  • 4. A Python Package: hello A package is a module that contains other modules: hello/ __init__.py hello.py Now we must import the method from the module within the module. from hello.hello import helloworld
  • 5. Disutils Distutils was written so we have a unified way to install python modules. python setup.py install
  • 6. Disutils – creating a distribution To distribute the hello module we need have it in a directory with a setup.py file. workingdir/ setup.py hello/ __init__.py hello.py The setup.py file needs at the least the following. from distutils.core import setup setup(name=&quot;hello&quot;, )
  • 7. Disutils creating a distribution continued Now we can create a distribution tarball with disutils. python setup.py sdist Our directory now looks like this workingdir/ setup.py hello/ __init__.py hello.py dist/ hello-1.0.tar.gz If we unpack the source distribution it looks like this: Hello-1.0/ PKG-INFO setup.py hello/ __init__.py hello.py
  • 8. setuptools • Setuptools is built on top of distutils • uses the setup.py • uses eggs for distribution • allows us to save our modules as eggs to pypi Installing setuptools wget http://peak.telecommunity.com/dist/ez_setup.py python ez_setup.py
  • 9. Eggs To create an egg change the import line in setup.py from setuptools import setup setup(name=&quot;hello&quot;, version=&quot;1.0&quot;, ) We can call that with: python setup.py bdist_egg Which creates a binary egg in our dist directory dist/ hello-1.0-py2.4.egg
  • 10. pypi If we want that egg available on pypi and we have an account we can do that with a single command. python setup.py sdist upload Which all the world can use easy_install hello
  • 11. virtualenv If we want to install without affecting whole system $ easy_install virtualenv $ virtualenv myenv $ source myenv/bin/activate (myenv)$ easy_install hello . . . (myenv)$ deactivate
  • 12.
  • 13. Installing buildout $ easy_install zc.buildout $ cd myproj $ buildout init This creates the following directory structure myproj/ bin/ buildout parts/ develop-eggs/ buildout.cfg
  • 14. buildout.cfg Buildout does very little by itself [buildout] parts = A buildout is made of parts. Parts are instances of recipes. Recipes do the work. [buildout] parts = py [py] recipe = zc.recipe.egg interpreter = py eggs = hello
  • 15. Recipes – 185+ on pypi
  • 16. Running buildout $ bin/buildout Installing py. Generated interpreter 'myproj/bin/py'. $ bin/py >>> from hello import helloworld >>> helloworld() Hello World
  • 17. Buildout - Scripts You can generate scripts [buildout] parts = buildout1 buildout2 [buildout1] recipe = zc.recipe.egg eggs = zc.buildout==1.2.1 scripts = buildout=buildout1 [buildout2] recipe = zc.recipe.egg eggs = zc.buildout<=1.2.0 scripts = buildout=buildout2
  • 18. Buildout - Versions You can pin versions [buildout] parts = buildout1 buildout2 versions = versions [buildout1] recipe = zc.recipe.egg eggs = zc.buildout scripts = buildout=buildout1 [versions] zc.buildout = 1.2.1
  • 19. Buildout - Scripts are wrappers $ cat bin/buildout1 #!/bin/python import sys sys.path[0:0] = [ '/download-cache/eggs/zc.buildout-1.2.1-py2.4.egg', '/download-cache/eggs/setuptools-0.6c9-py2.4.egg', ] import zc.buildout.buildout if __name__ == '__main__': zc.buildout.buildout.main()
  • 20. Buildout – manages installation $ bin/buildout -v Uninstalling py. Installing buildout1. Installing 'zc.buildout==1.2.1'. We have the distribution that satisfies 'zc.buildout==1.2.1'. Adding required 'setuptools' required by zc.buildout 1.2.1. Picked: setuptools = 0.6c9 Generated script 'myproj/bin/buildout1'. Installing buildout2. Installing 'zc.buildout==1.2.0'. We have the distribution that satisfies 'zc.buildout==1.2.0'. Adding required 'setuptools' required by zc.buildout 1.2.0. Picked: setuptools = 0.6c9 Generated script 'myproj/bin/buildout2'.
  • 21. Buildout – variables and dependencies and distutils [ buildout ] parts = py [ py ] recipe = zc .recipe.egg Interpreter = py extra-paths= ${reportlab:output} [ reportlab ] recipe = collective.recipe. distutils url = http://www.reportlab.org/ftp/ReportLab_2_3.tar.gz output = ${buildout:directory}/parts/site-packages/
  • 22. Helloworld in Plone src/hello/hello/hello.py from Products.Five.browser import BrowserView class HelloWorld (BrowserView): def __call__ ( self ): return &quot;Hello World&quot; src/hello/hello/configure.zcml <configure xmlns:browser=&quot; http://namespaces.zope.org/browser &quot;> <browser:page name=&quot;hello&quot; class=&quot;.hello.HelloWorld&quot; permission=&quot;zope2.Public&quot; /> </configure>
  • 23. Helloworld in Plone buildout base.cfg [ buildout ] parts = instance develop = src /hello [zope2] recipe = plone .recipe.zope2install url = http://www.zope.org/Products/Zope/2.10.8/Zope-2.10.8-final.tgz [instance] recipe = plone .recipe.zope2instance zope2-location = ${zope2:location} user = dylan:jay eggs = hello Plone zcml = hello
  • 24. Run Helloworld $ bin/buildout -c base.cfg Develop: 'myproj/src/hello' Updating zope2. Updating fake eggs Installing instance. $ bin/instance fg 2009-06-08 20:24:54 INFO ZServer HTTP server started at Mon Jun 8 20:24:54 2009 Hostname: localhost Port: 8080 ... 2009-06-08 20:25:44 INFO Zope Ready to handle requests
  • 25. Production buildout extends base prod.cfg [ buildout ] extends = base. cfg parts += supervisor [instance] zeo -client = True zeo -address = ${zeo:zeo-address} [ zeo ] recipe = plone .recipe.zope2zeoserver zope2-location = ${zope2:location} Zeo -address = 127.0.0.1:9000 [varnish] recipe = plone .recipe.varnish:instance bind = 127.0.0.1:80 mode = foreground backends = ${instance:http-address} daemon = ${varnish-build:location}/ sbin / varnishd [varnish-build] recipe = zc .recipe. cmmi url = http://waix.dl.sourceforge.net/sourceforge/varnish/varnish-2.0.3.tar.gz [supervisor] recipe = collective.recipe.supervisor programs = 10 zeo ${zeo:location}/bin/ runzeo 20 instance1 ${instance:location}/bin/ runzope 70 cache ${buildout:bin-directory}/varnish ${varnish:location} true
  • 26. Hosting a buildout First get a server with root access ~$20USD p/m for 256mb Slicehost, Amazon ec2, etc
  • 27.
  • 28. Put collective.hostout in buildout.cfg [ buildout ] extends = base. cfg parts += hostout [ hostout ] recipe = collective. hostout host= myproj . slicehost . com buildout = prod . cfg start_cmd = ${buildout:bin-directory}/ supervisord stop_cmd = ${buildout:bin-directory}/ supervisorctl shutdown
  • 29. Run hostout $ bin/buildout Develop: 'myproj/src/hello' Updating zope2. Updating fake eggs Updating instance. Installing hostout. $ bin/hostout running setup script 'src/hello/setup.py'. … creating deployment file: versions.cfg prod.cfg base.cfg hello1.0dev_12...6-py2.4.egg logging into the following hosts as root: myproj.slicehost.com Password: Installing python Bootstrapping buildout in /var/local/buildout Unpacking deployment file Running buildout Running start command
  • 30. Hostout – with source control Doesn't need access to svn or git on the server
  • 31.