Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 5 Apr 2008 14:58:05 -0400
From:      "Philip M. Gollucci" <pgollucci@p6m7g8.com>
To:        Maxim Khitrov <mkhitrov@gmail.com>
Cc:        freebsd-ports@freebsd.org
Subject:   Re: FreeBSD Custom Package Server
Message-ID:  <47F7CBBD.4050107@p6m7g8.com>
In-Reply-To: <26ddd1750804041811p4bb2c4f5tbab3f9659f88e8bb@mail.gmail.com>
References:  <26ddd1750804041811p4bb2c4f5tbab3f9659f88e8bb@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Maxim Khitrov wrote:
> First question I have is if anyone is aware of software that already
> does this sort of thing? How well does it work? If not, I plan try to
> write this on my own.
$ id ftp
uid=14(ftp) gid=14(ftp) groups=14(ftp)

$ grep ^ftp /etc/inetd.conf
ftp	stream	tcp	nowait	root	/usr/libexec/ftpd	ftpd -4 -A -l -l -r M -s

$ mkdir -p /home/ftp/pub/FreeBSD/ports/distfiles
$ mkdir -p /home/ftp/pub/$ENV/FreeBSD/ports/$arch/package-$version

You can maintain 1 host with multiple jail(8)s.  Each will have a 
custom /etc/make.conf.  You can even different architectures for in 
different jails.
In my experience, you should have 1 jail for each different software 
stack (aka set of packages).  In large production environments, its very 
typical to have 'classes' of machines. AKA proxy machines, app machines, 
database machines.....  Each set would have a different set of packages.

On the clients just do
export 
PACKAGESIITE=ftp://ftp.host.tld/pub/$ENV/FreeBSD/ports/$arch/package-$version/Latest/

trailing '/' is important.

then
$ pkg_add -r $pkg

An example /etc/make.conf:

DISTDIR=/home/ftp/pub/FreeBSD/ports/distfiles
PACKAGES=/home/ftp/pub/FreeBSD/ports/amd64/packages-8-current

WITHOUT_DEBUG=        yes
WITHOUT_EXAMPLES=     yes
WITHOUT_IPV6=         yes
WITHOUT_NLS=          yes

WITH_MODPERL2=    yes
WITH_MYSQL=     yes

WITH_MYSQL_VER=   51
WITH_DBD_VER=   44
APACHE_PORT=  www/apache22
OVERRIDE_LINUX_BASE_PORT=     f8

BATCH=  yes

.if ${.CURDIR:M*/usr/ports/databases/mysql5*}
   BUILD_OPTIMIZED=      yes
   WITH_NDB=     yes
.endif

......

In ~/bin a good way to build stuff might be:

#!/bin/sh

pkgs="\
         shells/bash \
         security/sudo \
         editors/vim-lite \
         net/rsync \
         ftp/curl \
         devel/strace \
         sysutils/screen \
"

cd /var/db/pkg
pkg_delete -f *

for pkg in $pkgs; do
   cd /usr/ports/$pkg
   make fetch-recursive
done

for pkg in $pkgs; do
   cd /usr/ports/$pkg
   make all install
done

for pkg in $pkgs; do
   cd /usr/ports/$pkg
   make package-recursive
done

for pkg in $pkgs; do
   cd /usr/ports/$pkg
   make clean
done


If you pay attention to what you are doing, you can NFS mount the ports 
tree on the clients, b/c portupgrade needs it, and do something like the 
following to automatically install packages that have updates (via cron 
even)

In the build jails:
$ pkgdb -L
$ portsdb -u
$ pkgdb -u
$ portversion -l '<' -v
$ portsclean -C
$ portsclean -DD

$ PKG_PATH=$pkg_path portupgrade -abpPr
# runs portsclean -L
# runs pkgdb -aF

You don't need to ssh to them, you can just cron it on each client if 
you want:

$ for machine in $machines; do
   set -x
   ssh root@${machine}.domain.tld "PACKAGESITE=$pkgsite PACKAGES=/tmp 
portupgrade -abPPr"
   set +x
done

HTH


-- 
------------------------------------------------------------------------
Philip M. Gollucci (pgollucci@p6m7g8.com)
c:703.336.9354
Consultant / http://p6m7g8.net/Resume/resume.txt
http://riderway.com / http://ridecharge.com
1024D/EC88A0BF 0DE5 C55C 6BF3 B235 2DAB  B89E 1324 9B4F EC88 A0BF

Work like you don't need the money,
love like you'll never get hurt,
and dance like nobody's watching.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?47F7CBBD.4050107>