пятница, 31 августа 2012 г.

I really like it. It's a pure magic... It's pkgng.
So, my task is to deploy about 20-30 servers (jails) for practical courses in PostgreSQL. So, every student will have its own unique DBMS to crack and crash. Two years ago I said students to do:

# cd /usr/ports/databases/postgresql84-server/ && make install

So, for half a lesson we monitored building of postgresql... Cool.
Last year I've prebuilt necessary packages and put them in /var/packages/.
It was faster, a student just had to do:

# cd /var/packages
# pkg_add postgresql90-server*tbz

or something similar. But later we had to update database in one of tasks. Dealing with packages (and scripts to copy them to every jail was not pleasant. I even started to think about OpenVZ, debian and apt... However, i dislike the way of treating postgresql in Debian. It is overcomplicated by pg_ctlcluster, separation of config files from $PGDATA...
However, this time I looked at pkgng. And so far I happy.
To create package server I just installed pkg from ports:

# cd /usr/ports/ports-mgmt/pkg && make install

Added WITH_PKGNG=yes to /etc/make.conf, run pkg2ng, created required packages by

But when I tried to install postgresql-server, I was asked to update pkg:

# pkg install postgresql-server-9.1.5
Updating repository catalogue
Repository catalogue is up-to-date, no need to fetch fresh copy
New version of pkg detected; it needs to be installed first.
After this upgrade it is recommendedthat you do a full upgrade using: 'pkg upgrade'
The following packages will be installed:
Upgrading pkg: 1.0.r6 -> 1.0
The installation will free 12 MB
1 MB to be downloaded
Proceed with installing packages [y/N]: n
# pkg install pkg
Updating repository catalogue
Repository catalogue is up-to-date, no need to fetch fresh copy
New version of pkg detected; it needs to be installed first.
After this upgrade it is recommendedthat you do a full upgrade using: 'pkg upgrade'
The following packages will be installed:
Upgrading pkg: 1.0.r6 -> 1.0
The installation will free 12 MB
1 MB to be downloaded
Proceed with installing packages [y/N]: y
pkg-1.0.txz 100% 1686KB 1.7MB/s 1.7MB/s 00:00
Checking integrity... done
Upgrading pkg from 1.0.r6 to 1.0... done

After this I could quickly install postgresql:

# pkg install postgresql-server

The only inconvenience is a bootstrap problem. The bootstrap tool is necessary requirement to make work with pkg easier...