May 2011
2 posts
This Python breakfast just got tastier. A major update to the way Virtualenv Burrito works was released this weekend. There is now full support for extension points and a less hackish way of managing the packages1 under the hood.
Already have Virtualenv Burrito installed? Run this:
virtualenv-burrito upgrade
New to Virtualenv Burrito? Read about it or run this:
curl -s https://raw.github.com/brainsik/virtualenv-burrito/master/virtualenv-burrito.sh | bash
Virtualenv Burrito’s goal is to have a working virtualenv + virtualenvwrapper environment with just one command. Read about it on Github or see the original announcement.
March 2011
1 post
Over the weekend I finished1 a tool called Virtualenv Burrito. It’s goal was to be a single command which would setup Virtualenv and Virtualenvwrapper so you could start hacking on Python projects as quickly as possible. As a bonus, it installs the virtualenv-burrito
command which will upgrade those packages to the latest versions I’ve tested.
Virtualenv Burrito was inspired by Pycon sprinters wasting precious time setting up virtual environments instead of sprinting. For many people, it’s sadly complicated to get a virtualenv + virtualenvwrapper environment. The worst part, it’s almost always yak shaving in the way of a real goal.
No more! To have a working virtualenv + virtualenvwrapper environment, run this command2:
curl -s https://raw.github.com/brainsik/virtualenv-burrito/master/virtualenv-burrito.sh | bash
That’s it. Whenever you login, you’ll have the full arsenal of virtualenvwrapper commands at your disposal.
Virtualenv quickstartCreate a new virtualenv:
mkvirtualenv newname
Once activated, pip install (without using sudo) whichever Python packages you want. They’ll only be available in that virtualenv. Make as many virtualenvs as you like.
To switch to another virtualenv you’ve created:
workon othername
Upgrade
To get the latest tested virtualenv + virtualenvwrapper packages:
virtualenv-burrito upgrade
Credits
The real hard work is done by the creators of Virtualenv and Virtualenvwrapper. Virtualenv is maintained by Ian Bicking. Virtualenvwrapper is maintained by Doug Hellman.
-
For this release, extension points (e.g., postactivate) are not supported. While this doesn’t affect the project goal of getting people coding quickly, it’s a cool feature, and (more importantly) I need it for work. :-) I’ll be adding support soon and making it available via
virtualenv-burrito upgrade
. ↩ -
Truth be told, I think piping the web into your shell is insane. Be safe, and read the code. ↩
February 2011
7 posts
Although it’s been a few years since I switched from full-time Sysadmin to full-time Coder, being in a startup means getting saddled with an opsy task now and again regardless of your “title”.
The problem: We bought a bunch of servers which need minimal OS, IP and a hostname before they’re racked. In otherwords, we want to drop them in a datacenter, turn them on, and leave knowing there’s remote SSH access. Data centers are environmentally hostile (hot rows, cold rows, too loud). It’s ideal to get in and out as quickly as possible and do any remaining config while listening to music and having a cup of tea.
The solution: An automated Ubuntu install using preseeding. One goal is to get a solution setup as quickly as possible. We don’t have 100s or 1000s of servers that need install, but we don’t want to setup temporary network infrastructure, and we don’t want all the developers (there’s not many) sitting around hitting <enter>
every few minutes. In my past life I may have gone for netbooting and a DHCP server handing out the IPs and hostnames, but this life lead to the shorter road of burning an Ubuntu Server disc with a preseed file.
Open an existing Ubuntu Server image and copy it’s contents somewhere. I used rsync -a
to copy the image volume to my drive. This directory is the contents of the new disc image. All that’s needed is a preseed file and modifying the boot config to load it.
Start with the example Maverick preseed file. The comments are good so you can get most of the way just going through it. However, I ended up in a short trial and error process to get it fully baked.
Gotcha 1: LVM partitioningDuring LVM partitioning, the install got stuck while waiting for confirmation on “Write the changes to disk and configure LVM?”:
Set this undocumented (AFAICT) option:
d-i partman-lvm/confirm_nooverwrite boolean true
Gotcha 2: Apt security update from the network
Althought this doesn’t stop the install, it takes a while for Apt to give up trying to contact the host. To keep things speedy, disable it by setting a null security repo host:
d-i apt-setup/security_host string
Bonus: Setup the apt/sources.list
With all the Apt repositories disabled, no useful lines are added to /etc/apt/sources.list
. This doesn’t matter too much if next you’ll be running an install script on the box (fix the sources.list in the script), but if not, it’s an annoying yak you’ll shave when you want to upgrade or install a package. Regardless, it’s so easy to make it right, you might as well:
d-i preseed/late_command string echo 'deb http://us.archive.ubuntu.com/ubuntu/ maverick main restricted universe multiverse' >> /target/etc/apt/sources.list; echo 'debhttp://us.archive.ubuntu.com/ubuntu/ maverick-updates main restricted universe multiverse' >> /target/etc/apt/sources.list; echo 'deb http://security.ubuntu.com/ubuntu maverick-security main restricted universe multiverse' >> /target/etc/apt/sources.list
Your preseed config is done so save it to preseed/local.seed
(or whatever/wherever) in the directory you made.
To make the CD use your seed on boot, modify isolinux/isolinux.cfg
to timeout quick and use the file you saved. Mine looks like this:
# D-I config version 2.0
include menu.cfg
default autoinstall
prompt 0
timeout 1
ui gfxboot bootlogo
LABEL autoinstall
menu label ^Minimal autoinstall
kernel /install/vmlinuz
append preseed/file=/cdrom/preseed/local.seed debian-installer/locale=en_US console-setup/layoutcode=us localechooser/translation/warn-light=true localechooser/translation/warn-severe=true initrd=/install/initrd.gz ramdisk_size=16384 root=/dev/ram rw quiet --
Creating the disc image
To make a bootable ISO you’ll need mkisofs. If you’re on Mac OS X (like me) you can use MacPorts — sudo port install cdrtools
— or the hipster package manager1, Homebrew. Once you have the tool you need, just follow this command-line:
mkisofs -r -V 'Ubuntu Autoinstaller' -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o custom_ubuntu_autoinstaller.iso /path/to/your/files
And … your done. Use Virtualbox to test the boot image and tweak the preseed file to make it do what you want. Don’t forget to re-run the mkisofs
command whenver you change the seed or isolinux.cfg
files!
-
Just kidding. I’m a fan of mxcl’s projects. Got Audioscrobbler.app running right now! ↩