delivering applications with zc.buildout and a distributed model - Plone Conference 2008
1. delivering applications
with zc.buildout
and a distributed model
Tarek Ziadé <tarek.ziade@ingeniweb.com>
1
2. Who am I ?
New to Plone (~1 year) -> I worked on peripheral matters
Used to Zope (CPS core developer)
CTO at Ingeniweb - a Plone company (>20 developers)
Python fan - wrote some books about it
(even in english, because you don’t hear my accent in a book)
involved in plone.org migration, PSC, zc.buildout
2
3. It will look good on your desk
besides Martin Aspeli’s book
Special promotion during the PloneConf :
buy one book == get a big hug
3
4. Thanks !
* Andreas Jung
* Veda Williams
* David Glick
* Jeff Kowalczyk
* Youenn Boussard
* Christian Klinger
* Jesse Snyder
* Alec Mitchell
* John Habermann
* Maurits van Rees
* Jean-François Roche
* Martin Aspeli
* Alain Meurant
* Aleksandr Vladimirskiy
* Jon Stahl
* Alexander Limi
* Stephen McMahon
4
5. Part 1 - working with packages
Part 2 - working with zc.buildout
Part 3 - application lifecycle
5
23. Problems with packaging ?
#1 PyPI == SPOF
#2 packages need privacy sometimes
#3 plone.org/products is *dying*
23
23
24. Solutions ?
#1 PyPI == SPOF
Make a PyPI mirror
#2 packages need privacy sometimes
Run you own private PyPI
#3 plone.org/products is *dying*
Make plone.org/products PyPI compatible
24
24
25. #1 Make a PyPI mirror : Smart mirroring
easy_install collective.eggproxy
25
25
27. In zc.buildout : the index option
[buildout]
index = http://my.mirror:8888
all calls will go through the proxy
the mirror is filled on-demand
27
27
28. #2 Run your own private PyPI
PloneSoftwareCenter !
28
28
44. 5 hours in 2006
install python extra packages
get zope
install zope
create an instance
get extra products
read extra products doc
install extra products dependency
install extra products
doesn’t work
ahhh right, install python-ldap
checkout products in development
doesn’t work
ahhh right, wrong python-ldap version
start to work 44
44
55. zc.buildout best practices
#1 use the same layout for all your projects
#2 make sure all developers have the same environment
#3 use one cfg per target
55
55
56. #1 same layout for all projects
project1
docs
buildout
packages
releases
project2
docs
buildout
packages
releases
....
56
56
59. #2 make sure all developers have the same environment
Warning
Plone buildouts are source based
Windows developers
Get my Windows installer : python2.4.4-win32.zip
Google “An installer for a buildout-ready Windows”
59
59
60. #3 use one cfg per target
Typical buildout layout uses the extends feature
buildout.cfg
dev.cfg (extends buildout.cfg)
prod.cfg (extends buildout.cfg)
+ bootstrap.py
60
60
61. buildout.cfg :
[buildout]
parts =
one
two
[buildout]
parts =
dev.cfg : one
two
[buildout]
three
extends = buildout.cfg
develop =
parts =
...
three
develop =
...
61
61
62. demo
creating a fresh Plone 3 buildout (Paste)
adding the dev.cfg
hooking a new development package
adding a prod.cfg
62
62
64. end of part 2
questions ?
#1 use the same layout
for all projects
#2 make sure all developers
have the same environment
#3 use one cfg per target
64
64
68. Releasing packages
for package in packages:
raise the version
edit CHANGES.txt
create a branch (svn)
go to that branch
remove the dev tag (setup.cfg)
release it with “mregister sdist mupload -r somehwere”
release it with “mregister sdist mupload -r somehwereelse”
68
68
69. Releasing packages with collective.releaser:
for package in packages:
python setup.py release
69
69
73. Release the buildout
What packages should be frozen ?
- recipes
- your released packages
- exceptions (security fixes, major bug fixes)
73
73
74. Release the buildout
authentication: use lovely.buildouthttp
[buildout]
...
extensions=lovely.buildouthttp
...
repository:http://my-company.com/products
HOME/.buildout/.httpauth
pypi,http://my-company.com/products,tarek,hahaha
pypi,http://plone.org/products,tarek,hahaha
74
74
75. Release the buildout -> project layout
project
...
buildout
packages
release/0.1 <- tag for the buildout
$ cd buildout
$ svn cp . http://somewhere/releases/0.1
75
75
76. Release the buildout with collective.releaser :
with project_release
$ cd buildout
$ project_release
What version you are releasing ? 0.1
Added version file.
76
76
77. Build your release distribution
- bin/buildout on target system
- remove some stuff
- offline mode to ‘true’
- tar -czvf release-0.1.tgz release/0.1
77
77
78. Build your distribution with collective.releaser
with project_deploy
$ svn co http://somesvn/my_projet/releases/0.1 project
$ cd project
$ project_deploy prod.cfg
78
78