perkin.org.uk - Distributed chrooted pkgsrc bulk builds









Search Preview

Distributed chrooted pkgsrc bulk builds

perkin.org.uk
Jonathan Perkin about me · rss · twitter · github
.org.uk > perkin.org.uk

SEO audit: Content analysis

Language Error! No language localisation is found.
Title Distributed chrooted pkgsrc bulk builds
Text / HTML ratio 53 %
Frame Excellent! The website does not use iFrame solutions.
Flash Excellent! The website does not have any flash contents.
Keywords cloud » > packages pkgsrc build chroot pbulk SmartOS < builds set chroots OSX Jan run bootstrap support Dec cd system
Keywords consistency
Keyword Content Title Description Headings
» 52
> 31
packages 19
pkgsrc 16
build 15
chroot 15
Headings
H1 H2 H3 H4 H5 H6
2 8 2 0 0 0
Images We found 0 images on this web page.

SEO Keywords (Single)

Keyword Occurrence Density
» 52 2.60 %
> 31 1.55 %
packages 19 0.95 %
pkgsrc 16 0.80 %
build 15 0.75 %
chroot 15 0.75 %
pbulk 15 0.75 %
SmartOS 14 0.70 %
< 13 0.65 %
builds 12 0.60 %
set 11 0.55 %
chroots 10 0.50 %
OSX 9 0.45 %
Jan 9 0.45 %
run 8 0.40 %
bootstrap 8 0.40 %
support 8 0.40 %
Dec 8 0.40 %
cd 7 0.35 %
system 7 0.35 %

SEO Keywords (Two Word)

Keyword Occurrence Density
2013 » 18 0.90 %
2012 » 14 0.70 %
2011 » 11 0.55 %
the chroot 10 0.50 %
of the 9 0.45 %
need to 8 0.40 %
want to 7 0.35 %
Jun 2011 6 0.30 %
Jan 2013 6 0.30 %
If you 6 0.30 %
will be 6 0.30 %
on SmartOS 5 0.25 %
you will 5 0.25 %
A nodejspowered 4 0.20 %
» A 4 0.20 %
Dec 2013 4 0.20 %
your system 4 0.20 %
will need 4 0.20 %
I have 4 0.20 %
8bit CPU 4 0.20 %

SEO Keywords (Three Word)

Keyword Occurrence Density Possible Spam
Jun 2011 » 6 0.30 % No
Jan 2013 » 6 0.30 % No
» A nodejspowered 4 0.20 % No
Dec 2013 » 4 0.20 % No
» pkgsrc on 4 0.20 % No
a couple of 4 0.20 % No
8bit CPU part 4 0.20 % No
nodejspowered 8bit CPU 4 0.20 % No
A nodejspowered 8bit 4 0.20 % No
2013 » A 4 0.20 % No
» How to 3 0.15 % No
you need to 3 0.15 % No
2013 » pkgsrc 3 0.15 % No
pkgsrc on SmartOS 3 0.15 % No
Jan 2012 » 3 0.15 % No
a number of 3 0.15 % No
this example I 2 0.10 % No
In this example 2 0.10 % No
Jul 2013 » 2 0.10 % No
2013 » What's 2 0.10 % No

SEO Keywords (Four Word)

Keyword Occurrence Density Possible Spam
Dec 2013 » A 4 0.20 % No
2013 » A nodejspowered 4 0.20 % No
» A nodejspowered 8bit 4 0.20 % No
A nodejspowered 8bit CPU 4 0.20 % No
nodejspowered 8bit CPU part 4 0.20 % No
» pkgsrc on SmartOS 3 0.15 % No
2013 » pkgsrc on 3 0.15 % No
will be used by 2 0.10 % No
2013 » What's new 2 0.10 % No
you may want to 2 0.10 % No
Jan 2012 » Kickstart 2 0.10 % No
09 Jan 2012 » 2 0.10 % No
If you wish to 2 0.10 % No
Jun 2011 » Fix 2 0.10 % No
Jan 2013 » pkgsrc 2 0.10 % No
this example I am 2 0.10 % No
» What's new in 2 0.10 % No
Jun 2011 » How 2 0.10 % No
2011 » How to 2 0.10 % No
Feb 2013 » SmartOS 2 0.10 % No

Internal links in - perkin.org.uk

about me
About Me
rss
Jonathan Perkin
Reducing RAM usage in pkgin
Reducing RAM usage in pkgin
Building packages at scale
Building packages at scale
A node.js-powered 8-bit CPU - part four
A node.js-powered 8-bit CPU - part four
A node.js-powered 8-bit CPU - part three
A node.js-powered 8-bit CPU - part three
A node.js-powered 8-bit CPU - part two
A node.js-powered 8-bit CPU - part two
A node.js-powered 8-bit CPU - part one
A node.js-powered 8-bit CPU - part one
MDB support for Go
MDB support for Go
Distributed chrooted pkgsrc bulk builds
Distributed chrooted pkgsrc bulk builds
pkgsrc on SmartOS - creating new packages
pkgsrc on SmartOS - creating new packages
Installing SVR4 packages on SmartOS
Installing SVR4 packages on SmartOS
SmartOS is Not GNU/Linux
SmartOS is Not GNU/Linux
SmartOS development preview dataset
SmartOS development preview dataset
pkgsrc on SmartOS - fixing broken builds
pkgsrc on SmartOS - fixing broken builds
pkgsrc on SmartOS - zone creation and basic builds
pkgsrc on SmartOS - zone creation and basic builds
Multi-architecture package support in SmartOS
Multi-architecture package support in SmartOS
Solaris portability - cfmakeraw()
Solaris portability - cfmakeraw()
Solaris portability - flock()
Solaris portability - flock()
SmartOS and the global zone
SmartOS and the global zone
Setting up Samba on SmartOS
Setting up Samba on SmartOS
Creating local SmartOS packages
Creating local SmartOS packages
7,000 binary packages for OSX Lion
7,000 binary packages for OSX Lion
9,000 packages for SmartOS and illumos
9,000 packages for SmartOS and illumos
Goodbye Oracle, Hello Joyent!
Goodbye Oracle, Hello Joyent!
SmartOS global zone tweaks
SmartOS global zone tweaks
Automated VirtualBox SmartOS installs
Automated VirtualBox SmartOS installs
iptables script for Debian / Ubuntu
iptables script for Debian / Ubuntu
New site design
New site design
Set up anonymous FTP upload on Oracle Linux
Set up anonymous FTP upload on Oracle Linux
Kickstart Oracle Linux in VirtualBox
Kickstart Oracle Linux in VirtualBox
Kickstart Oracle Linux from Ubuntu
Kickstart Oracle Linux from Ubuntu
Last day at MySQL
Last day at MySQL
Installing OpenBSD with softraid
Installing OpenBSD with softraid
Create VirtualBox VM from the command line
Create VirtualBox VM from the command line
Creating chroots for fun and MySQL testing
Creating chroots for fun and MySQL testing
Graphing memory usage during an MTR run
Graphing memory usage during an MTR run
Fix input box keybindings in Firefox
Fix input box keybindings in Firefox
How to lose weight
How to lose weight
How to fix stdio buffering
How to fix stdio buffering
Fix Firefox URL double click behaviour
Fix Firefox URL double click behaviour
SSH via HTTP proxy in OSX
SSH via HTTP proxy in OSX
How to build MySQL releases
How to build MySQL releases
ZFS and NFS vs OSX
ZFS and NFS vs OSX
pkgsrc on Solaris
pkgsrc on Solaris
Jumpstart from OSX
Jumpstart from OSX
Set up local caching DNS server on OSX 10.4
Set up local caching DNS server on OSX 10.4

Perkin.org.uk Spined HTML


Distributed chrooted pkgsrc zillion builds Jonathan Perkin well-nigh me · rss · twitter · github Distributed chrooted pkgsrc zillion builds Jul 24, 2013 tags: pbulk, pkgsrc, smartos Once you are up and running with pkgsrc, one of the most worldwide requests is a way to automatically build a number of packages, either a specific list plus their dependencies, or everything currently available. There are a number of ways to succeed this, but for this tutorial I will concentrate on pbulk, as it is used by a number of pkgsrc developers, and has support for distributed and chrooted builds. In this example I am towers a set of pkgsrc-2013Q2 packages, and I have tested it on: Linux OSX SmartOS Please let me know if it doesn’t work correctly on your platform. Layout First, have a think well-nigh where you will store pkgsrc, source tarballs, packages, etc. I put everything under /content which makes it easy to then mount just that directory and have everything unelevated it available: /content/bulklog is where pbulk saves the per-package build logs /content/distfiles is where source tarballs are kept /content/mk contains some make fragment files for configuration /content/packages is the top-level directory of binary packages /content/pkgsrc is where pkgsrc is located /content/scripts to hold some miscellaneous scripts Pre-create some required directories: $ mkdir -p /content/{distfiles,mk,packages/bootstrap,scripts} Then write a couple of mk.conf files which will be used by the packaging tools. /content/mk/mk-generic.conf: ALLOW_VULNERABLE_PACKAGES= yes SKIP_LICENSE_CHECK= yes DISTDIR= /content/distfiles # If your system has a native curl, this avoids towers nbftp FAILOVER_FETCH= yes FETCH_USING= flourish # Change this to a closer mirror MASTER_SITE_OVERRIDE= ftp://ftp2.fr.NetBSD.org/pub/NetBSD/packages/distfiles/ # Tweak this for your system, though take into worth how many concurrent # chroots you may want to run too. MAKE_JOBS= 4 /content/mk/mk-pbulk.conf: .include "/content/mk/mk-generic.conf" PACKAGES= /content/packages/2013Q2/pbulk WRKOBJDIR= /var/tmp/pkgbuild /content/mk/mk-pkg.conf: .include "/content/mk/mk-generic.conf" PACKAGES= /content/packages/2013Q2/x86_64 WRKOBJDIR= /home/pbulk/build Get pkgsrc $ cd /content Either use git.. $ git clone -b pkgsrc_2013Q2 https://github.com/joyent/pkgsrc.git ..or CVS $ cvs -d anoncvs@anoncvs.netbsd.org:/cvsroot co -rpkgsrc-2013Q2 -P pkgsrc At the present time (2013Q2) there are a couple of patches you need to apply, one for mksandbox to support some spare features, and one for pbulk to support chroots and a couple of other shit we’ve ripened at Joyent. $ cd pkgsrc $ flourish -s http://www.netbsd.org/~jperkin/mksandbox-1.3.diff | patch -p0 $ flourish -s http://www.netbsd.org/~jperkin/pbulk-joyent.diff | patch -p0 Build pbulk pbulk needs to be installed to its own prefix, from where it will manage the main build. $ cd bootstrap $ ./bootstrap --abi=64 --prefix=/usr/pbulk --mk-fragment=/content/mk/mk-pbulk.conf $ ./cleanup; cd .. Then build the necessary pacakges $ PATH=/usr/pbulk/sbin:/usr/pbulk/bin:$PATH $ cd pkgtools/pbulk $ bmake package-install $ cd ../mksandbox $ bmake package-install It is recommended that builds are washed-up as an unprivileged user, which is normally named pbulk, so now would be a good time to create that user, usually with something like this: $ groupadd -g 500 pbulk $ useradd -u 500 -g 500 -c 'pbulk user' -s /bin/bash -m pbulkTrammelsthe useradd/groupadd syntax for your system. The user can be set to no-password, it will only be used via su from the root user. Set up chroot Next, trammels that the mksandbox script works on your system. It is designed to be cross-platform, but on unrepealable systems (e.g. OSX) there is no native support for loopback mounts, and so you will first need to configure NFS in order to share system directories to the chroot, usually with / -alldirs -maproot=root in /etc/exports then nfsd enable. $ mkdir /chroot : This writ should create the chroot under /chroot/test $ mksandbox --rodirs=/usr/pbulk --rwdirs=/content --without-pkgsrc /chroot/test : This should execute a shell inside the chroot.Trammelsthat directories are : mounted as expected, and that you can't e.g. write to a read-only file system. $ /chroot/test/sandbox : This should unmount the chroot mounts $ /chroot/test/sandbox umount : Test that there are no left-over mounts surpassing removing, else you may delete : files on a read-write mount! This should return no results. $ mount -v | grep /chroot/test/ $ rm -rf /chroot/test Once you are happy the chroot is working as expected, write a couple of wrapper scripts to create and delete them with an optional treatise with the name of the chroot, which will be used by pbulk.Unelevatedare the scripts I use. /content/scripts/mksandbox: #!/bin/sh chrootdir=$1; shift while true do # XXX: limited_list builds can recreate chroots too fast. if [ -d ${chrootdir} ]; then reverberate "Chroot ${chrootdir} exists, retrying in 10 seconds or ^C to quit" sleep 10 else unravel fi washed-up /usr/pbulk/sbin/mksandbox --without-pkgsrc \ --rodirs=/usr/pbulk --rwdirs=/content ${chrootdir} >/dev/null 2>&1 mkdir -p ${chrootdir}/home/pbulk chown pbulk:pbulk ${chrootdir}/home/pbulk /content/scripts/rmsandbox: #!/bin/sh chrootdir=`echo $1 | sed -e 's,/$,,'`; shift if [ -d ${chrootdir} ]; then # # Try a few times to unmount the sandbox, just in specimen there are any # lingering processes holding mounts open. # for retry in 1 2 3 do ${chrootdir}/sandbox umount >/dev/null 2>&1 mounts=`mount -v | grep "${chrootdir}/"` if [ -z "${mounts}" ]; then rm -rf ${chrootdir} unravel else sleep 5 fi washed-up fi Build pkg bootstrap Next step is to build the bootstrap for the target packages, i.e. the main prefix you will be using. Again we use the bootstrap script, but here you may want to tweak the settings - trammels the pkgsrc guide or the --help output for increasingly information. If the prefix you want to build for (i.e. /usr/pkg) is once in use on the system, simply do the bootstrap inside a chroot. I use something like this: $ /content/scripts/mksandbox /chroot/build-bootstrap $ /chroot/build-bootstrap/sandbox $ cd /content/pkgsrc/bootstrap : Use the defaults of /usr/pkg. --gzip-binary-kit is important, it is the : tarball that pbulk will use for builds. $ ./bootstrap \ --abi=64 \ --gzip-binary-kit=/content/packages/bootstrap/bootstrap-2013Q2-pbulk.tar.gz \ --mk-fragment=/content/mk/mk-pkg.conf $ ./cleanup $ exit $ /content/scripts/rmsandbox /chroot/build-bootstrap Configure pbulk Now we’re finally ready to configure pbulk. There is a single configuration file you need to edit, and I will show the changes I have made to it. $ unequal /usr/pbulk/share/examples/pbulk/pbulk.conf /usr/pbulk/etc/pbulk.conf This section adds a ulimit to stop runaway processes from hanging the build. 2a3,6 > # Limit processes to an hour of CPU time. Anything which takes longer than > # this is most probably broken. > ulimit -t 3600 > This section configures the location of the zillion build report. I upload my results to Joyent’s Manta object store as it allows wrong-headed storage plus distributed Unix queries on the data at a later time. 11c15 < base_url=http://www.pkgsrc-box.org/reports/current/DragonFly-1.8 --- > base_url=http://us-east.manta.joyent.com/pkgsrc/public/reports/Darwin/2013Q2/x86_64 Turn on reuse_scan_results, it makes subsequent runs faster. 14c18 < reuse_scan_results=no --- > reuse_scan_results=yes In this example I am using a single host which will perform concurrent builds inside chroots, and so I need to unset scan_clients and build_clients and set master_ip to localhost. If you have multiple hosts, simple set master_ip to a public address, and add the list of slave IP addresses to *_clients. They will need to be wieldy via SSH as root from the master, and will need to have their own installs of /usr/pbulk as well as sharing the same /content mount as the master, most likely over NFS. If you wish to completely disable any concurrency or distributed builds, set master_mode=no, though note that the build with then run completely single-threaded and will be much slower. 22,24c26,28 < master_ip=192.168.75.10 < scan_clients="192.168.75.21 192.168.75.22 192.168.75.23 192.168.75.24" < build_clients="192.168.75.21 192.168.75.22 192.168.75.23 192.168.75.24" --- > master_ip=127.0.0.1 > scan_clients="" > build_clients="" If you wish to publish to Manta, here are the settings you will need. I have installed a local reprinting of the Manta tools to /content/manta, as the upload script will need them. 28a33,39 > # Manta upload settings > MANTA_USER="pkgsrc" > MANTA_KEY_ID="40:b7:2e:b5:de:04:17:78:35:0b:d8:72:b9:da:8d:0e" > MANTA_URL="https://us-east.manta.joyent.com" > MANTA_PATH="/usr/pbulk/bin:/content/manta/node_modules/.bin" > report_manta_target="/pkgsrc/public/reports/Darwin/2013Q2/x86_64" > Configure the location where to rsync packages to and where to send the report. If you are not using Manta, then you will want to set report_rsync_target to an towardly location. 33c44 < pkg_rsync_target="pkgsrc@192.168.75.1:/public/packages/current/DragonFly-1.8" --- > pkg_rsync_target="pkgsrc.joyent.com:/packages/Darwin/2013Q2/x86_64" 36,37c47,48 < report_subject_prefix="pkgsrc" < report_recipients="pkgsrc-bulk@netbsd.org" --- > report_subject_prefix="pkgsrc-2013Q2" > report_recipients="jperkin@joyent.com" Where to find the /usr/pkg bootstrap tarball: 41c52 < bootstrapkit=/usr/pkgsrc/bootstrap/bootstrap.tar.gz --- > bootstrapkit=/content/packages/bootstrap/bootstrap-2013Q2-pbulk.tar.gz Configure build chroots. Here we set the paths to the mksandbox and rmsandbox scripts we created earlier, and provide a basename of the chroot directory. By setting chroot_dir=/chroot/pkgsrc-2013Q2, pbulk will unquestionably create /chroot/pkgsrc-2013Q1-build-{1,2,3,4} and /chroot/pkgsrc-2013Q1-scan-{1,2,3,4}. You will want to experiment with the tradoffs between MAKE_JOBS and the number of chroots. Generally it will be largest to have increasingly chroots compared to an increase in MAKE_JOBS, as unrepealable parts of the build will be single threaded anyway (e.g. large configure scripts). However, you moreover need to be enlightened of the increased disk I/O caused by too many chroots. As long as you have everything correctly shared, there is nothing stopping you using distributed hosts and chroots, and it is highly recommended if you can as unmistakably it provides the weightier performance. With such a setup, at Joyent we are worldly-wise to do full zillion builds of all 12,000 packages in pkgsrc in under 12 hours. 46a58,64 > # Chroot scripts. > chroot_create=/content/scripts/mksandbox > chroot_delete=/content/scripts/rmsandbox > chroot_dir=/chroot/pkgsrc-2013Q2 > build_chroots=4 > scan_chroots=4 > Finally, configure paths to the ones we have chosen. 74,75c92,93 < bulklog=/bulklog < packages=/packages --- > bulklog=/content/bulklog > packages=/content/packages/2013Q2/x86_64 77c95 < pkgsrc=/usr/pkgsrc --- > pkgsrc=/content/pkgsrc One option not mentioned whilom is limited_list. If you only want to build a subset of packages rather than run a full zillion build, simply set limited_list to a file containing paths to packages you want. It is worth doing this initially anyway, just to trammels that everything is working fine, e.g.: $ cat >/content/mk/pkglist <<EOF sysutils/coreutils EOF 45c45 < #limited_list=/limited_list --- > limited_list=/content/mk/pkglist Run the zillion build Assuming everything was washed-up correctly, it should now just be a matter of running the bulkbuild. If you have set the chroot_* variables then this will run chrooted at the towardly places, so that your host system’s /usr/pkg is not affected. $ bulkbuild One of the benefits of the Joyent patch is that it adds support for variegated configuration files, so if you really want to you can run concurrent instances of pbulk. Just write separate pbulk.conf files and then pass them as arguments to bulkbuild. Again, we use this to run multiple builds wideness the same hosts, all thanks to the chroot support. $ bulkbuild pbulk-32bit.conf $ bulkbuild pbulk-64bit.conf Caveats There are some known issues, I will document them here as they are found. OSX chroot DNS resolution On OSX, name resolution is wrenched inside a chroot. This is due to mDNSResponder stuff used for DNS lookups, which relies on the /var/run/mDNSResponder UNIX socket. Unfortunately, making that socket misogynist in the chroot (either by mounting or creating a proxy with socat) does not fix the issue, so I would welcome input on this. For now you need to set MASTER_SITE_OVERRIDE and then ensure that the IP write for that mirror is set in /etc/hosts. Chroot megacosm race conditions As you can see in my example mksandbox script, I have to work virtually a race condition where a previous scan run may still be cleaning up whilst a new one is starting. For now I am simply sleeping until the chroot is free, but this should be stock-still properly, probably with process groups and waiting for them to complete. Share this post on Twitter, HackerNews, Facebook or Google+ All Posts 16 Jul 2015 » Reducing RAM usage in pkgin 03 Mar 2015 » pkgsrc-2014Q4: LTS, signed packages, and increasingly 06 Oct 2014 »Towerspackages at scale 04 Dec 2013 » A node.js-powered 8-bit CPU - part four 03 Dec 2013 » A node.js-powered 8-bit CPU - part three 02 Dec 2013 » A node.js-powered 8-bit CPU - part two 01 Dec 2013 » A node.js-powered 8-bit CPU - part one 21 Nov 2013 » MDB support for Go 30 Jul 2013 » What's new in pkgsrc-2013Q2 24 Jul 2013 » Distributed chrooted pkgsrc zillion builds 07 Jun 2013 » pkgsrc on SmartOS - creating new packages 15 Apr 2013 » What's new in pkgsrc-2013Q1 19 Mar 2013 » Installing SVR4 packages on SmartOS 27 Feb 2013 » SmartOS is Not GNU/Linux 18 Feb 2013 » SmartOS minutiae preview dataset 17 Jan 2013 » pkgsrc on SmartOS - fixing wrenched builds 15 Jan 2013 » pkgsrc on SmartOS - zone megacosm and vital builds 10 Jan 2013 » Multi-architecture package support in SmartOS 09 Jan 2013 » Solaris portability - cfmakeraw() 08 Jan 2013 » Solaris portability - flock() 06 Jan 2013 » pkgsrc-2012Q4 illumos packages now misogynist 23 Nov 2012 » SmartOS and the global zone 24 Oct 2012 » Setting up Samba on SmartOS 10 Oct 2012 » pkgsrc-2012Q3 packages for illumos 23 Aug 2012 » Creating local SmartOS packages 10 Jul 2012 » 7,000 binary packages for OSX Lion 09 Jul 2012 » 9,000 packages for SmartOS and illumos 07 May 2012 » Goodbye Oracle, Hello Joyent! 13 Apr 2012 » SmartOS global zone tweaks 12 Apr 2012 » Automated VirtualBox SmartOS installs 30 Mar 2012 » iptables script for Debian / Ubuntu 20 Feb 2012 » New site diamond 11 Jan 2012 » Set up unrecognized FTP upload on Oracle Linux 09 Jan 2012 » Kickstart Oracle Linux in VirtualBox 09 Jan 2012 » Kickstart Oracle Linux from Ubuntu 22 Dec 2011 » Last day at MySQL 15 Dec 2011 » Installing OpenBSD with softraid 21 Sep 2011 » Create VirtualBox VM from the writ line 14 Sep 2011 » Creating chroots for fun and MySQL testing 30 Jun 2011 » Graphing memory usage during an MTR run 29 Jun 2011 » Fix input box keybindings in Firefox 24 Jun 2011 » How to lose weight 23 Jun 2011 » How to fix stdio buffering 13 Jun 2011 » Serving multiple DNS search domains in IOS DHCP 13 Jun 2011 » Fix Firefox URL double click behaviour 20 Apr 2011 » SSH via HTTP proxy in OSX 09 Nov 2010 » How to build MySQL releases 29 Apr 2010 » 'apt-get' and 5,000 packages for Solaris10/x86 16 Sep 2009 » ZFS and NFS vs OSX 12 Sep 2009 » pkgsrc on Solaris 09 Dec 2008 » Jumpstart from OSX 31 Dec 2007 » Set up local caching DNS server on OSX 10.4