How to have a buildout config that extends another buildout config

Buildout is a pretty useful tool, but the documentation is somewhat lacking. I needed to have specialized buildouts for dev and staging that extend a more general buildout. I couldn’t find this in the buildout docs, but I found it here.

In my case, I needed a buildout for staging that omits software that we already have installed via RPMs. Luckily it’s possible:

$ cat staging.cfg 
extends = buildout.cfg
eggs -=

As you might guess, += and = also work and do what you’d expect.

How to open a port to an EC2 instance

To open a port to an EC2 instance, do:

  • ec2-authorize -p <port number> <security group> (from any machine with the ec2 command-line tools)
  • If the server has iptables: sudo /sbin/iptables -A INPUT -p tcp --dport <port number> -j ACCEPT (on the server)

Speaking of iptables, here’s:

Ubuntu One: Getting an OAuth token

The first small modest step towards writing an Ubuntu One client, if I ever get the inclination to do so:

{"consumer_secret": "...", "token": "...", "consumer_key": "...", "name": "Ubuntu One @ ...


Python txLoadBalancer

The idea of a Python-based load balancer, txLoadBalancer, piqued my interest. It took a bit of futzing around to actually get it running, because the distribution doesn’t specify its dependencies or include a sample config file.

$ mkvirtualenv --no-site-packages txLoadBalancer-test
$ bin/pip install txLoadBalancer twisted pycrypto pyasn1 pyopenssl
$ mkdir etc
$ curl -L > etc/config.xml
$ bin/twistd -noy ./bin/txlb.tac 

Aside from the web interface, you can connect to the program with ssh:

$ ssh -p 7002 admin@localhost

This gives you a Python though I don’t yet know how to do anything useful with it 🙂

Dropbox + glibc 2.4 buildout

I wrote a previous post on how I got Dropbox working on my DreamHost VPS. It was tricky because the DreamHost VPS had glibc 2.3 and the Dropbox binary needs glibc 2.4.

Those instructions were somewhat complex and I’ve been messing around a bit with Buildout lately, so I thought it would be fun to develop a buildout recipe that automates it. So here you go:

This buildout downloads and compiles glibc 2.4 and installs it in a sandbox with the Dropbox software. It also sets up Supervisor and uses it to manage the Dropbox daemon.

Try it and let me know if it works for you. Of course if you find problems or have enhancements, you can fork it and send me pull requests.

Python tool of the day: yolk

I just stumbled upon yolk.

It does a bunch of things related to package management, but the simplest and arguably most useful is to just list installed packages.

marcabramowitz@Marc-Abramowitzs-MacBook-Pro:~$ yolk -l
Django          - 1.3          - active development (/usr/local/lib/python2.7/site-packages)
Python          - 2.7.1        - active development (/usr/local/Cellar/python/2.7.1/lib/python2.7/lib-dynload)
distribute      - 0.6.16       - active development (/usr/local/lib/python2.7/site-packages)
ipython         - 0.10.2       - active development (/usr/local/lib/python2.7/site-packages)
meld3           - 0.6.7        - active development (/usr/local/lib/python2.7/site-packages)
mercurial       - 1.8.2        - active development (/usr/local/lib/python2.7/site-packages)
pip             - 1.0.1        - active development (/usr/local/lib/python2.7/site-packages)
pyodbc          - 2.1.8        - active development (/usr/local/lib/python2.7/site-packages)
setuptools      - 0.6c11       - active development (/usr/local/lib/python2.7/site-packages)
supervisor      - 3.0a10       - active development (/usr/local/lib/python2.7/site-packages)
virtualenv      - 1.6          - active development (/usr/local/lib/python2.7/site-packages)
virtualenvwrapper - 2.7.1        - active development (/usr/local/lib/python2.7/site-packages)
wsgiref         - 0.1.2        - active development (/usr/local/Cellar/python/2.7.1/lib/python2.7)
yolk            - 0.4.1        - active development (/usr/local/lib/python2.7/site-packages)

Although now that I think about it, you could get almost the same info from pip:

marcabramowitz@Marc-Abramowitzs-MacBook-Pro:~$ pip freeze

though yolk can do some other nice things like display dependencies:

marcabramowitz@Marc-Abramowitzs-MacBook-Pro:~$ yolk -d supervisor
supervisor 3.0a10

and entry points:

marcabramowitz@Marc-Abramowitzs-MacBook-Pro:~$ yolk --entry-points paste.paster_create_template
   paste_deploy = paste.deploy.paster_templates:PasteDeploy

   basic_package = paste.script.templates:BasicPackage

   pylons_minimal = pylons.util:MinimalPylonsTemplate

   pylons = pylons.util:PylonsTemplate

and querying for the latest goodies on pypi:

(yolk)marcabramowitz@Marc-Abramowitzs-MacBook-Pro:~/python/virtualenvs/yolk$ yolk --latest-releases=4
django-dynamic-choices 0.1.6
pydub 0.4.2
collective.portlet.calendar 0.5
sslsnoop 0.7.1
TexDO 0.1.1
haystack 0.7
thumbor 0.7.12
webapp2 1.2
django-thumbnail-works 0.2.1
Beacon 1.3-alpha