Building a Pylons Development OpenSolaris Container
Of course one of the cornerstone for effective blogging is to build trust and rapport with your audience. You do that by keeping promises, and also by not having advertisements or tags used in your template. But anyway, as promised in an earlier post on Rails Containers I’m going to outline how to create a simple Solaris Container for Pylons development.
I won’t spend quite as much as before on the setup of the zone. I’ll assume that you can go back there and read that one or one of the other good blogs on the topic. This post is more about Python and Pylons, with perhaps just a bit of PostgreSQL thrown in for good measure.
Let’s have some fun!
The Filesystem (ZFS of course)
Well now first we have to have a place to put our zone. Let’s create a new ZFS pool and filesystem. I’m going to put this one in a new home: /export/home/zones. I’m also going to create a 2GB file for it to use as its storage. We’ll use the “-n” flag to make it an empty file name, to be allocated later.
# mkdir -p -m 0700 /export/zones/pylons # ls /export/zones pylons # mkfile -n 2G /export/zones/pylons/disk1 # ls -l /export/zones/pylons total 48 -rw------T 1 root root 2147483648 Jul 3 10:22 disk1
Ok cool. Now let’s make us a new filesystem using that storage:
# zpool create pylons_zones /export/zones/pylons/disk1 # zpool list NAME SIZE USED AVAIL CAP HEALTH ALTROOT pylons_zones 1.98G 92.5K 1.98G 0% ONLINE - # zfs create pylons_zones/zone1 # zfs list NAME USED AVAIL REFER MOUNTPOINT pylons_zones 129K 1.95G 18K /pylons_zones pylons_zones/zone1 18K 1.95G 18K /pylons_zones/zone1
Ok I think we’re good now. Maybe let’s create a container?
The Container
We’ve got a Solaris box, we have a template without advertisements or tags, and we’ve got a file system. Now let’s create the container.
# zonecfg -z pylons pylons: No such zone configured Use 'create' to begin configuring a new zone. zonecfg:pylons> create zonecfg:pylons> set autoboot=false zonecfg:pylons> set zonepath=/pylons_zones/zone1 zonecfg:pylons> add net zonecfg:pylons:net> set physical=rge0 zonecfg:pylons:net> set address=192.168.1.50 zonecfg:pylons:net> end zonecfg:pylons> verify zonecfg:pylons> commit zonecfg:pylons> info zonename: pylons zonepath: /pylons_zones/zone1 brand: native autoboot: false bootargs: pool: limitpriv: scheduling-class: ip-type: shared inherit-pkg-dir: dir: /lib inherit-pkg-dir: dir: /platform inherit-pkg-dir: dir: /sbin inherit-pkg-dir: dir: /usr net: address: 192.168.1.50 physical: rge0 defrouter not specified zonecfg:pylons> exit
Ok that looks good, we’ve got a zone ready for use. Let’s install the base OS:
# zoneadm -z pylons install /pylons_zones/zone1 must not be group readable. /pylons_zones/zone1 must not be group executable. /pylons_zones/zone1 must not be world readable. /pylons_zones/zone1 must not be world executable. could not verify zonepath /pylons_zones/zone1 because of the above errors. zoneadm: zone pylons failed to verify
Argh, forgot to set that path to 0700. Let’s do that and try again:
# chmod 700 /pylons_zones/zone1 # zoneadm -z pylons install cannot create ZFS dataset pylons_zones/zone1: dataset already exists Preparing to install zone . Creating list of files to copy from the global zone. Copying <16490> files to the zone. Initializing zone product registry. Determining zone package initialization order. Preparing to initialize <1323> packages on the zone. Initializing package <63> of <1323>: percent complete: 4% ...
That takes a while.
Ok, when that’s finished you need to boot and configure the zone. I’ll assume that you’ve got that handled and that you’ve gotten it on your network (which should have been pretty easy given that we gave it a static IP) and that all is good. In the next installment we’ll install Pylons and its supporting frameworks (SQLAlchemy, Mako, memcached, you name it).
Read more from the Infrastructure, Pylons, Python category. If you would like to leave a comment, click here: . or stay up to date with this post via RSS, or you can
Trackback from your site.