Jak korzystać z poudriere

Ten przepis dotyczy uruchomienia własnego jaila z poudriere w celu budowania paczek dla pozostałych jail-i. Niemniej niektóre ogólne rzeczy są przydatne również dla serwerów bez jail-i.

Konfiguracja poudriere jail inside

Konfiguracja zfs na potrzeby poudriere w jail

zfs create -o jailed=on  -o mountpoint=/usr/jails/pkg.wtp3.local sys/data/u/jails/pkg.wtp3.local
zfs create -o jailed=on -o canmount=on -o mountpoint=/pkg sys/data/pkg
zfs create -p -o poudriere:type=data -o atime=off -o mountpoint=/pkg/data sys/data/pkg/data
zfs create -o exec=on sys/data/pkg/data/.m
zfs create -o compression=off sys/data/pkg/data/cache
zfs create -o compression=lz4 sys/data/pkg/data/logs
zfs create -o compression=off sys/data/pkg/data/packages
zfs create -o compression=off sys/data/pkg/data/wrkdirs
zfs create -p -o compression=lz4 -o atime=off -o mountpoint=/pkg/ports/default sys/data/pkg/ports/default
zfs create -p -o exec=on sys/data/pkg/jails

/etc/fstab

# --- JAILS ---------------------------------------------------------------------------
#
sys/data/u/jails/pkg.wtp3.local /usr/jails/pkg.wtp3.local zfs   rw,noatime,nfsv4acls    0 0

# --- Dodatki do JAILS -----------------------------------------------------------------
#
sys/data/pkg                    /usr/jails/pkg.wtp3.local/pkg           zfs     rw,noexec,nosuid,noatime,nfsv4acls      0 0
sys/data/pkg/data               /usr/jails/pkg.wtp3.local/pkg/data      zfs     rw,noexec,nosuid,noatime,nfsv4acls      0 0
sys/data/pkg/data/.m            /usr/jails/pkg.wtp3.local/pkg/data/.m   zfs     rw,nosuid,noatime,nfsv4acls             0 0
sys/data/pkg/data/cache         /usr/jails/pkg.wtp3.local/pkg/data/cache zfs    rw,noexec,nosuid,noatime,nfsv4acls      0 0
sys/data/pkg/data/logs          /usr/jails/pkg.wtp3.local/pkg/data/logs zfs     rw,noexec,nosuid,noatime,nfsv4acls      0 0
sys/data/pkg/data/packages      /usr/jails/pkg.wtp3.local/pkg/data/packages zfs rw,noexec,nosuid,noatime,nfsv4acls      0 0
sys/data/pkg/data/wrkdirs       /usr/jails/pkg.wtp3.local/pkg/data/wrkdirs zfs  rw,noexec,nosuid,noatime,nfsv4acls      0 0
sys/data/pkg/jails              /usr/jails/pkg.wtp3.local/pkg/jails     zfs     rw,nosuid,noatime,nfsv4acls             0 0
sys/data/pkg/ports              /usr/jails/pkg.wtp3.local/pkg/ports     zfs     rw,noexec,nosuid,noatime,nfsv4acls      0 0
sys/data/pkg/ports/default      /usr/jails/pkg.wtp3.local/pkg/ports/default zfs rw,noexec,nosuid,noatime,nfsv4acls      0 0
/usr/src                        /usr/jails/pkg.wtp3.local/usr/src               nullfs  ro,late                         0 0
/usr/obj                        /usr/jails/pkg.wtp3.local/usr/obj               nullfs  ro,late                         0 0

Zamontowanie katalogów /usr/src oraz /usr/obj potrzebne w celu wykonania jaila ze źródeł systemu (własna konfiguracja)

Konfiguracja /etc/jail.conf

pkg_wtp3_local {
        host.hostname = "pkg.stenda.jails";
        path = "/usr/jails/pkg.wtp3.local";
        ip4.addr += "10.20.11.32/32";
        ip4.addr += "127.0.0.1/32";
        allow.raw_sockets = 0;
        exec.clean;
        exec.consolelog = "/var/log/jails/pkg.wtp3.local_console.log";
        mount +=  "procfs /usr/jails/pkg.wtp3.local/proc procfs rw 0 0";
        allow.set_hostname = 0;
        persist;
        children.max=10;
        allow.mount;
        allow.mount.tmpfs;
        allow.mount.devfs;
        allow.mount.procfs;
        allow.mount.zfs;
        allow.mount.nullfs;
        allow.raw_sockets;
        allow.socket_af;
        allow.sysvipc;
        allow.chflags;
        enforce_statfs=1;
        ip6=inherit;
        ip4=inherit;
}

/!\ WAŻNE poudriere wymaga, aby interfejs lo0 posiadał adres 127.0.0.1. W przeciwnym przypadku nie ma możliwości uruchomienia budowania paczek.

Utworzenie brakujących katalogów

Poprzez konsolę jaila należy utworzyć brakujące katalogi:

mkdir -p /var/cache/ccache /var/cache/distfiles

Załadowanie potrzebnych modułów jądra

Ręcznie w celu pierwszego uruchomienia:

kldload tmpfs

W pliku /boot/loader.conf w celu uruchomienia przy uruchamianiu serwera:

# TMPFS na potrzeby poudriere
#
tmpfs_load="YES"

Instalacja oraz konfiguracja poudriere

Zainstalowanie poudriere

pkg install -y poudriere ccache ports-mgmt/dialog4ports

Plik konfiguracyjny

Wersja dla jail

--- poudriere.conf.sample       2016-08-14 01:59:19.000000000 +0200
+++ poudriere.conf      2016-08-17 23:56:33.541134000 +0200
@@ -9,7 +9,7 @@
 # You need at least 7GB of free space in this pool to have a working
 # poudriere.
 #
-#ZPOOL=tank
+ZPOOL=sys/data

 ### NO ZFS
 # To not use ZFS, define NO_ZFS=yes
@@ -26,17 +26,16 @@
 #
 # Also note that every protocols supported by fetch(1) are supported here, even
 # file:///
-# Suggested: https://download.FreeBSD.org
-FREEBSD_HOST=_PROTO_://_CHANGE_THIS_
+FREEBSD_HOST=http://ftp.freebsd.org

 # By default the jails have no /etc/resolv.conf, you will need to set
-# RESOLV_CONF to a file on your hosts system that will be copied has
+# REVOLV_CONF to a file on your hosts system that will be copied has
 # /etc/resolv.conf for the jail, except if you don't need it (using an http
 # proxy for example)
 RESOLV_CONF=/etc/resolv.conf

 # The directory where poudriere will store jails and ports
-BASEFS=/usr/local/poudriere
+BASEFS=/pkg

 # The directory where the jail will store the packages and logs
 # by default a zfs filesystem will be created and set to
@@ -49,8 +48,8 @@ USE_PORTLINT=no

 # When building packages, a memory device can be used to speedup the build.
 # Only one of MFSSIZE or USE_TMPFS is supported. TMPFS is generally faster
-# and will expand to the needed amount of RAM. MFS is a slower since it
-# uses UFS and several abstraction layers.
+# and will expand to the needed amount of RAM. MFS is a bit slower, but is
+# more mature and can have its memory usage capped.

 # If set WRKDIRPREFIX will be mdmfs of the given size (mM or gG)
 #MFSSIZE=4G
@@ -71,17 +70,21 @@ USE_TMPFS=yes

 # How much memory to limit jail processes to for *each builder*
 # in GiB (default: none)
-#MAX_MEMORY=8
+MAX_MEMORY=2

 # If set the given directory will be used for the distfiles
 # This allows to share the distfiles between jails and ports tree
-DISTFILES_CACHE=/usr/ports/distfiles
+DISTFILES_CACHE=/var/cache/distfiles
+
+# If set the ports or source tree marked to use csup method will use the defined mirror
+# Note: csup is deprecated. Use svn instead.
+#CSUP_HOST=cvsup._CHANGE_THIS_.freebsd.org

 # If set the ports tree or source tree marked to use svn will use the defined
-# mirror (default: svn.FreeBSD.org)
+# mirror (default: svn0.us-west.FreeBSD.org)
 # The full mirror list is available here:
 # http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/svn.html#svn-mirrors
-#SVN_HOST=svn.FreeBSD.org
+SVN_HOST=svn0.us-east.FreeBSD.org

 # Automatic OPTION change detection
 # When bulk building packages, compare the options from kept packages to
@@ -89,7 +92,7 @@ DISTFILES_CACHE=/usr/ports/distfiles
 # will be deleted and the port will be rebuilt.
 # Valid options: yes, no, verbose
 # verbose will display the old and new options
-#CHECK_CHANGED_OPTIONS=verbose
+CHECK_CHANGED_OPTIONS=yes

 # Automatic Dependency change detection
 # When bulk building packages, compare the dependencies from kept packages to
@@ -98,16 +101,16 @@ DISTFILES_CACHE=/usr/ports/distfiles
 # as DEFAULT_RUBY_VERSION, PERL_VERSION, WITHOUT_X11 that change dependencies
 # for many ports.
 # Valid options: yes, no
-#CHECK_CHANGED_DEPS=yes
+CHECK_CHANGED_DEPS=yes


 # Path to the RSA key to sign the PKGNG repo with. See pkg-repo(8)
-#PKG_REPO_SIGNING_KEY=/etc/ssl/keys/repo.key
+PKG_REPO_SIGNING_KEY=/usr/local/etc/ssl/poudriere/pkg.bsdserwis.com.key


 # ccache support. Supply the path to your ccache cache directory.
 # It will be mounted into the jail and be shared among all jails.
-#CCACHE_DIR=/var/cache/ccache
+CCACHE_DIR=/var/cache/ccache
 #

 # parallel build support.
@@ -117,11 +120,11 @@ DISTFILES_CACHE=/usr/ports/distfiles
 # by specifying the -J flag to bulk/testport.
 #
 # Example to define PARALLEL_JOBS to one single job
-# PARALLEL_JOBS=1
+PARALLEL_JOBS=2

 # How many jobs should be used for preparing the build? These tend to
 # be more IO bound and may be worth tweaking. Default: Same as PARALLEL_JOBS
-# PREPARE_PARALLEL_JOBS=1
+PREPARE_PARALLEL_JOBS=1


 # If set, failed builds will save the WRKDIR to ${POUDRIERE_DATA}/wrkdirs
@@ -129,10 +132,10 @@ DISTFILES_CACHE=/usr/ports/distfiles

 # Choose the default format for the workdir packing: could be tar,tgz,tbz,txz
 # default is tbz
-# WRKDIR_ARCHIVE_FORMAT=tbz
+WRKDIR_ARCHIVE_FORMAT=tar

 # Disable linux support
-# NOLINUX=yes
+NOLINUX=yes

 # By default poudriere sets FORCE_PACKAGE
 # To disable it (useful when building public packages):
@@ -160,21 +163,21 @@ DISTFILES_CACHE=/usr/ports/distfiles

 # Timestamp every line of build logs
 # Default: no
-#TIMESTAMP_LOGS=no
+TIMESTAMP_LOGS=yes

 # URL where your POUDRIERE_DATA/logs are hosted
 # This will be used for giving URL hints to the HTML output when
 # scheduling and starting builds
-#URL_BASE=http://yourdomain.com/poudriere/
+URL_BASE=https://pkg.wtp3.local/poudriere/


 # This defines the max time (in seconds) that a command may run for a build
 # before it is killed for taking too long. Default: 86400
-#MAX_EXECUTION_TIME=86400
+MAX_EXECUTION_TIME=86400

 # This defines the time (in seconds) before a command is considered to
 # be in a runaway state for having no output on stdout. Default: 7200
-#NOHANG_TIME=7200
+NOHANG_TIME=7200


 # The repository is updated atomically if set yes. This leaves the
@@ -233,11 +236,11 @@ DISTFILES_CACHE=/usr/ports/distfiles

 # Define format for build duration times
 # Default: %H:%M:%S
-#DURATION_FORMAT="%H:%M:%S"
+DURATION_FORMAT="%H:%M:%S"

 # Use colors when in a TTY
 # Default: yes
-#USE_COLORS=yes
+USE_COLORS=yes

 # Only build what is requested. Do not rebuild build deps if nothing requested
 # depends on them. This can create an inconsistent repository if you often

Wersja bez jail

--- /usr/local/etc/poudriere.conf.sample        2019-02-02 19:32:54.000000000 +0100
+++ /usr/local/etc/poudriere.conf       2019-02-09 20:54:49.556009000 +0100
@@ -9,14 +9,14 @@
 # You need at least 7GB of free space in this pool to have a working
 # poudriere.
 #
-#ZPOOL=zroot
+ZPOOL=sda

 ### NO ZFS
 # To not use ZFS, define NO_ZFS=yes
 #NO_ZFS=yes

 # root of the poudriere zfs filesystem, by default /poudriere
-# ZROOTFS=/poudriere
+ZROOTFS=/pkg

 # the host where to download sets for the jails setup
 # You can specify here a host or an IP
@@ -27,7 +27,7 @@
 # Also note that every protocols supported by fetch(1) are supported here, even
 # file:///
 # Suggested: https://download.FreeBSD.org
-FREEBSD_HOST=_PROTO_://_CHANGE_THIS_
+FREEBSD_HOST=https://download.FreeBSD.org

 # By default the jails have no /etc/resolv.conf, you will need to set
 # RESOLV_CONF to a file on your hosts system that will be copied has
@@ -36,7 +36,7 @@ FREEBSD_HOST=_PROTO_://_CHANGE_THIS_
 RESOLV_CONF=/etc/resolv.conf

 # The directory where poudriere will store jails and ports
-BASEFS=/usr/local/poudriere
+BASEFS=/pkg

 # The directory where the jail will store the packages and logs
 # by default a zfs filesystem will be created and set to
@@ -68,11 +68,11 @@ USE_TMPFS=yes

 # How much memory to limit tmpfs size to for *each builder* in GiB
 # (default: none)
-#TMPFS_LIMIT=8
+TMPFS_LIMIT=4

 # How much memory to limit jail processes to for *each builder*
 # in GiB (default: none)
-#MAX_MEMORY=8
+MAX_MEMORY=4

 # How many file descriptors to limit each jail process to (default: 1024)
 # This can also be set per PKGBASE, such as MAX_FILES_RStudio=2048.
@@ -83,13 +83,13 @@ USE_TMPFS=yes
 # This allows to share the distfiles between jails and ports tree
 # If this is "no", poudriere must be supplied a ports tree that already has
 # the required distfiles.
-DISTFILES_CACHE=/usr/ports/distfiles
+DISTFILES_CACHE=/var/cache/distfiles

 # If set the ports tree or source tree marked to use svn will use the defined
 # mirror (default: svn.FreeBSD.org)
 # The SSL fingerprints are published here:
 # https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/svn.html#svn-mirrors
-#SVN_HOST=svn.FreeBSD.org
+SVN_HOST=svn0.us-east.FreeBSD.org

 # Automatic OPTION change detection
 # When bulk building packages, compare the options from kept packages to
@@ -97,7 +97,7 @@ DISTFILES_CACHE=/usr/ports/distfiles
 # will be deleted and the port will be rebuilt.
 # Valid options: yes, no, verbose
 # verbose will display the old and new options
-#CHECK_CHANGED_OPTIONS=verbose
+CHECK_CHANGED_OPTIONS=yes

 # Automatic Dependency change detection
 # When bulk building packages, compare the dependencies from kept packages to
@@ -122,14 +122,14 @@ DISTFILES_CACHE=/usr/ports/distfiles


 # Path to the RSA key to sign the PKG repo with. See pkg-repo(8)
-#PKG_REPO_SIGNING_KEY=/etc/ssl/keys/repo.key
+PKG_REPO_SIGNING_KEY=/usr/local/etc/ssl/poudriere/pkg.bsdserwis.com.key


 # ccache support. Supply the path to your ccache cache directory.
 # It will be mounted into the jail and be shared among all jails.
 # It is recommended that extra ccache configuration be done with
 # ccache -o rather than from the environment.
-#CCACHE_DIR=/var/cache/ccache
+CCACHE_DIR=/var/cache/ccache

 # Static ccache support from host.  This uses the existing
 # ccache from the host in the build jail.  This is useful for
@@ -156,11 +156,11 @@ DISTFILES_CACHE=/usr/ports/distfiles
 # by specifying the -J flag to bulk/testport.
 #
 # Example to define PARALLEL_JOBS to one single job
-# PARALLEL_JOBS=1
+PARALLEL_JOBS=3

 # How many jobs should be used for preparing the build? These tend to
 # be more IO bound and may be worth tweaking. Default: PARALLEL_JOBS * 1.25
-# PREPARE_PARALLEL_JOBS=1
+PREPARE_PARALLEL_JOBS=1


 # If set, failed builds will save the WRKDIR to ${POUDRIERE_DATA}/wrkdirs
@@ -171,7 +171,7 @@ DISTFILES_CACHE=/usr/ports/distfiles
 # WRKDIR_ARCHIVE_FORMAT=tbz

 # Disable linux support
-# NOLINUX=yes
+NOLINUX=yes

 # By default poudriere sets FORCE_PACKAGE
 # To disable it (useful when building public packages):
@@ -190,7 +190,7 @@ DISTFILES_CACHE=/usr/ports/distfiles

 # By default MAKE_JOBS is disabled to allow only one process per cpu
 # Use the following to allow it anyway
-# ALLOW_MAKE_JOBS=yes
+ALLOW_MAKE_JOBS=yes

 # List of packages that will always be allowed to use MAKE_JOBS
 # regardless of ALLOW_MAKE_JOBS. This is useful for allowing ports
@@ -199,12 +199,12 @@ DISTFILES_CACHE=/usr/ports/distfiles

 # Timestamp every line of build logs
 # Default: no
-#TIMESTAMP_LOGS=no
+TIMESTAMP_LOGS=yes

 # URL where your POUDRIERE_DATA/logs are hosted
 # This will be used for giving URL hints to the HTML output when
 # scheduling and starting builds
-#URL_BASE=http://yourdomain.com/poudriere/
+URL_BASE=http://pkg.bsdserwis.com/


 # This defines the max time (in seconds) that a command may run for a build

Korzystanie z poudriere

Wygenerowanie certyfikatu dla podpisywania budowanych pakietów

/!\ Certyfikat (jego nazwa) musi być zgodny z wartością wpisaną do pliku konfiguracyjngo /usr/local/etc/poudriere.conf

mkdir -p /usr/local/etc/ssl/poudriere
/usr/local/bin/openssl genrsa -out /usr/local/etc/ssl/poudriere/poudriere.key 4096
/usr/local/bin/openssl rsa -in /usr/local/etc/ssl/poudriere/poudriere.key -pubout -out /usr/local/etc/ssl/poudriere/poudriere.crt

ports

Utworzenie drzewa

poudriere ports -c

aktualizacja drzewa

Trzeba dopisać do zadania w crontabie:

poudriere ports -u

jails (ale dla poudriere, nie globalny dla systemu)

Utworzenie "jail" dla wybranego OS

poudriere jail -c -j 111x64 -v 11.1-RELEASE -a amd64

Aktualizacja wybranego OS

poudriere jail -u -j 111x64

Utworzenie "jail" na postawie źródeł serwera

poudriere jail -c -a amd64 -j 11x64 -m src=/usr/src -f 11x64 -v 11.2-STABLE

# w przypadku problemów z utworzeniem drzewa katalogów
zfs create sys/data/pkg/jails/11x64
poudriere jail -c -a amd64 -j 11x64 -m src=/usr/src -f none -v 11.2-STABLE

Aktualizacja OS na podstawie źródeł

poudriere jail -u -j 11x64

/!\ Aktualizacja nie podmienia pliku konfiguracyjnego login.conf dla danego jail. Dlatego też konieczne jest aktualizacja pliku "ręcznie", aby budowane pakiety były poprawnie oznaczone

default:\
        :passwd_format=sha512:\
        :copyright=/etc/COPYRIGHT:\
        :welcome=/etc/motd:\
        :setenv=MAIL=/var/mail/$,BLOCKSIZE=K,UNAME_r=10.3-STABLE,UNAME_v=FreeBSD 10.3-STABLE,OSVERSION=1003503:\
[...]

Dodatkowo może być konieczna modyfikacja pliku konfiguracyjnego samego poudriere:

echo "11.2-STABLE" > /usr/local/etc/poudriere.d/jails/11x64/version

Utworzenie odpowiedniego make.conf dla danego jaila

vi /usr/local/etc/poudriere.d/11x64-make.conf

Trzeba utworzyć na podstawie istniejącego w systemie pliku (a właściwie plików)

CPUTYPE?=       nocona

MASTER_SITE_BACKUP?=    \
        http://ftp.bsdserwis.com/pub/FreeBSD/ports/distfiles/${DIST_SUBDIR}/ \
        http://distcache.ath.pl/${DIST_SUBDIR}/ \
        http://distcache.FreeBSD.org/ports-distfiles/${DIST_SUBDIR}/

# --- domy/slne wersje dla wybranych aplikacji ----------------------------
#
DEFAULT_VERSIONS+=              apache=2.4
DEFAULT_VERSIONS+=              mysql=5.6
DEFAULT_VERSIONS+=              pgsql=9.5
DEFAULT_VERSIONS+=              perl=5.28

# --- opcje globalne dla wszystkich ports ---------------------------------
#
OPTIONS_UNSET+=                 X11

# --- opcje dla poszczeg/olnych ports -------------------------------------
#
security_apg_SET=               CRACKLIB
graphics_ImageMagick-nox11_UNSET=MODULES

# --- u/zycie pkgng -------------------------------------------------------
#
WITH_PKGNG=                     yes
NO_WARNING_PKG_INSTALL_EOL=     yes

# --- ustawienia dotycz/ace wydruk/ow (np. teTeX) -------------------------
#
PAPERSIZE=              a4
A4=                     yes

SVN_UPDATE=             yes
SVN=                    /usr/local/bin/svn

WANT_MYSQL_VER=         56
WITH_MYSQL_VER=         56
WITH_OPENSSL_PORT=      yes
WITH_OPENLDAP_VER=      24
WANT_OPENLDAP_VER=      24
WITH_BDB_VER=           5
WITH_SENDMAIL_BASE=     yes
X11BASE=                ${LOCALBASE}

# This setting to build kernel without -Werror:
WERROR=

# --- uz/ycie CLANG zamiast GCC -----------------------------------------------
#
CC=             clang
CXX=            clang++
CPP=            clang-cpp

Utworzenie listy pakietów do budowania

vi /usr/local/etc/poudriere.d/93x64.pkglist

Która to może powstać na podstawie zainstalowanych pakietów:

pkg info -o -aq | sort -d

i w wyniku powstanie plik:

ports-mgmt/dialog4ports
databases/rrdtool
databases/ruby-bdb
databases/sqlite3
devel/apr1
devel/autoconf
devel/autoconf-wrapper
devel/automake
devel/automake-wrapper
devel/bison
dns/bind-tools
dns/idnkit
dns/ldns
dns/libidn
dns/unbound
editors/vim
ftp/curl
ftp/ncftp3
ftp/wget
graphics/cairo
graphics/graphite2
graphics/png
lang/ocaml
lang/perl5.20
lang/python2
lang/python27
lang/ruby21
misc/help2man
dns/nsd
lang/perl5.20
mail/postfix
mail/ssmtp
net/liboping
net-mgmt/collectd5
net-mgmt/ipcalc
net-mgmt/net-snmp
net/mtr
net/netcat
net/openntpd
net/trafshow
net/unison
net-mgmt/collectd5
security/apg
security/ca_root_nss
security/clamav
security/cracklib
security/ipfmeta
security/libgcrypt
security/libgpg-error
security/libssh2
security/nmap
security/openssh-portable
security/openssl
security/sudo
security/xinetd
shells/bash
sysutils/afio
sysutils/daemontools
sysutils/dmidecode
sysutils/ezjail
sysutils/freebsd-snapshot
sysutils/lsof
sysutils/moreutils
sysutils/screen
sysutils/smartmontools
textproc/expat2
textproc/fex
www/apache24
www/nginx

Nie należy się martwić o zależności - zostaną odpowiednio uwzględnione. Tak więc lista może być o wiele krótsza - zawierać pakiety naprawdę niezbędne.

Wygenerowanie opcji dla każdego z budowanych pakietów

Dla pojedynczego pakietu:

poudriere options -j 11x64 -c security/apg

Albo dla całej listy:

poudriere options -j 11x64 -cf /usr/local/etc/poudriere.d/93x64.pkglist

Wykonanie ograniczonych list pakietów

Możliwe jest określenie mniejszych list (tzw. sets) pakietów do budowania. Jest to bardzo użyteczne np. w przypadku różnych wersji php (php71, php72). W tym celu należy utworzyć (ograniczoną) listę pakietów do budowania w ramach zestawu. Korzystanie z zestawów wygląda następująco:

poudriere options -j 11x64 -f /usr/local/etc/poudriere.d/buildlists/php71 -z php71

Budowanie pakietów

poudriere bulk -f /usr/local/etc/poudriere.d/93x64.pkglist -j 93x64

Wyczyszenie nieużywanych pakietów

W celu usunięcia z repozytorium starych, nieużywanych pakietów należy wykonać polecenie:

poudriere pkgclean -j 11x64 -z php72 -f /usr/local/etc/poudriere.d/buildlists/php71 -n

Podanie opcji -n lub -y powoduje odpowiednio:

  1. symulację, jakie pakiety zostaną usunięte (czyli automatyczna odpowiedź NIE na pytanie, czy usuwać)

  2. trwałe usunięcie zbędnych pakietów (czyli automatyczna odpowiedź TAK na pytanie, czy usuwać)

Co jest istotne, jako paramatry polecenia poudriere pkgclean podajemy listę pakietów, które MAJĄ POZOSTAĆ w repozytorium. Jest to spójne (parametry poudriere) z innymi poleceniami. Po prostu jest odwrócona logika :-)

Utworzenie własnego repozytorium

Konfiguracja witryny webowej z repozytorium

Można skorzystać z tego przepisu w celu uruchomienia nginx. W przypadku konfiguracji apache wygląda to następująco:

<Directory /opt/poudriere/data/packages>
    Options Indexes FollowSymLinks
    Order allow,deny
    Allow from all
</Directory>

<VirtualHost 188.165.252.223:80 2001:41d0:2:c7df::1:80>
    ServerName pkg.bsdserwis.com
    DocumentRoot /opt/poudriere/data/packages
    ErrorLog /var/log/httpd/pkg.bsdserwis.com/error.log
    CustomLog /var/log/httpd/pkg.bsdserwis.com/access.log combined
</VirtualHost>

Konfiguracja klienta

Przegranie klucza

Po pierwsze trzeba przegrać poudriere.crt na serwery, które mają korzystać z tego repozytorium:

mkdir -p /usr/local/etc/ssl/certs/
fetch http://ca.bsdserwis.com/pkg.bsdserwis.com.crt -o /usr/local/etc/ssl/certs/pkg.bsdserwis.com.crt

Konfiguracja repozytorium

mkdir -p /usr/local/etc/pkg/repos

vi /usr/local/etc/pkg/repos/pkg.bsdserwis.com.conf

Zaś zawartość tego pliku jest następująca:

pkg.bsdserwis.com: {
  url: "http://pkg.bsdserwis.com/10x64-default",
  mirror_type: "http",
  signature_type: "pubkey",
  pubkey: "/usr/local/etc/ssl/certs/pkg.bsdserwis.com.crt",
  enabled: yes
}

Dodatkowo można wyłączyć repozytorium globalne:

echo "FreeBSD: { enabled: no }" > /usr/local/etc/pkg/repos/FreeBSD.conf

/!\ UWAGA!!! Konfiguracja poszczególnych repozytoriów została umieszczona w autorskim repozytorium konfiguracji /!\

Aktualizacja ustawień pkg

Już pozostaje tylko wykonać polecenie:

# poniższą linijkę warto dopisać do zadania /etc/daily.local
#
pkg update -q && pkg version -vRL=

Instalowanie wybranych pakietów

Co warto zainstalować w środowisku jail to już jest opisane w instrukcji uruchamiania środowiska jail.

Alternatywny konfig dla pourdiere na serwerze HQ

--- poudriere.conf.sample       2015-05-30 13:39:31.689236000 +0200
+++ poudriere.conf      2015-03-12 11:58:24.910000627 +0100
@@ -9,7 +9,7 @@
 # You need at least 7GB of free space in this pool to have a working
 # poudriere.
 #
-#ZPOOL=tank
+ZPOOL=tank

 ### NO ZFS
 # To not use ZFS, define NO_ZFS=yes
@@ -26,16 +26,16 @@
 #
 # Also note that every protocols supported by fetch(1) are supported here, even
 # file:///
-FREEBSD_HOST=_PROTO_://_CHANGE_THIS_
+FREEBSD_HOST=ftp://ftp.freebsd.org

 # By default the jails have no /etc/resolv.conf, you will need to set
-# RESOLV_CONF to a file on your hosts system that will be copied has
+# REVOLV_CONF to a file on your hosts system that will be copied has
 # /etc/resolv.conf for the jail, except if you don't need it (using an http
 # proxy for example)
 RESOLV_CONF=/etc/resolv.conf

 # The directory where poudriere will store jails and ports
-BASEFS=/usr/local/poudriere
+BASEFS=/opt/poudriere

 # The directory where the jail will store the packages and logs
 # by default a zfs filesystem will be created and set to
@@ -84,7 +84,7 @@
 # mirror (default: svn0.us-west.FreeBSD.org)
 # The full mirror list is available here:
 # http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/svn.html#svn-mirrors
-#SVN_HOST=svn0.us-west.FreeBSD.org
+SVN_HOST=svn0.us-east.FreeBSD.org

 # Automatic OPTION change detection
 # When bulk building packages, compare the options from kept packages to
@@ -92,7 +92,7 @@
 # will be deleted and the port will be rebuilt.
 # Valid options: yes, no, verbose
 # verbose will display the old and new options
-#CHECK_CHANGED_OPTIONS=verbose
+CHECK_CHANGED_OPTIONS=yes

 # Automatic Dependency change detection
 # When bulk building packages, compare the dependencies from kept packages to
@@ -101,7 +101,7 @@
 # as DEFAULT_RUBY_VERSION, PERL_VERSION, WITHOUT_X11 that change dependencies
 # for many ports.
 # Valid options: yes, no
-#CHECK_CHANGED_DEPS=yes
+CHECK_CHANGED_DEPS=yes


 # Path to the RSA key to sign the PKGNG repo with. See pkg-repo(8)
@@ -110,7 +110,7 @@

 # ccache support. Supply the path to your ccache cache directory.
 # It will be mounted into the jail and be shared among all jails.
-#CCACHE_DIR=/var/cache/ccache
+CCACHE_DIR=/var/cache/ccache
 #

 # parallel build support.
@@ -120,7 +120,7 @@
 # by specifying the -J flag to bulk/testport.
 #
 # Example to define PARALLEL_JOBS to one single job
-# PARALLEL_JOBS=1
+#PARALLEL_JOBS=1

 # How many jobs should be used for preparing the build? These tend to
 # be more IO bound and may be worth tweaking. Default: Same as PARALLEL_JOBS
@@ -132,7 +132,7 @@

 # Choose the default format for the workdir packing: could be tar,tgz,tbz,txz
 # default is tbz
-# WRKDIR_ARCHIVE_FORMAT=tbz
+WRKDIR_ARCHIVE_FORMAT=tar

 # Disable linux support
 # NOLINUX=yes
@@ -163,21 +163,21 @@

 # Timestamp every line of build logs
 # Default: no
-#TIMESTAMP_LOGS=no
+TIMESTAMP_LOGS=yes

 # URL where your POUDRIERE_DATA/logs are hosted
 # This will be used for giving URL hints to the HTML output when
 # scheduling and starting builds
-#URL_BASE=http://yourdomain.com/poudriere/
+URL_BASE=http://rtm.bsdserwis.com/poudriere/


 # This defines the max time (in seconds) that a command may run for a build
 # before it is killed for taking too long. Default: 86400
-#MAX_EXECUTION_TIME=86400
+MAX_EXECUTION_TIME=86400

 # This defines the time (in seconds) before a command is considered to
 # be in a runaway state for having no output on stdout. Default: 7200
-#NOHANG_TIME=7200
+NOHANG_TIME=7200


 # The repository is updated atomically if set yes. This leaves the
@@ -236,11 +236,11 @@

 # Define format for build duration times
 # Default: %H:%M:%S
-#DURATION_FORMAT="%H:%M:%S"
+DURATION_FORMAT="%H:%M:%S"

 # Use colors when in a TTY
 # Default: yes
-#USE_COLORS=yes
+USE_COLORS=yes

 # Only build what is requested. Do not rebuild build deps if nothing requested
 # depends on them. This can create an inconsistent repository if you often

Jak poprawić zawartość jail dla poudriere

Zgodnie z dokumentacją poudriere montując jaila korzysta ze snapshota o nazwie clean dla danego jaila. Może być w tym pomocne polecenie (skrypt) snapshot:

snapshot list | grep poudriere
/opt/poudriere/jails/93amd64    777MB    0.0%      0KB    0.0%  clean
/opt/poudriere/jails/a1amd64    881MB    0.1%    140KB    0.0%  clean
/opt/poudriere/jails/10x64    704MB    0.0%      0KB    0.0%  clean

Zatem po modyfikacji jaila (np. ręcznym dograniu bibliotek związanych z libmilter) należy wykonać następujące polecenia:

zfs destroy tank/poudriere/jails/10x64@clean
zfs snapshot tank/poudriere/jails/10x64@clean

Potem już będzie poprawnie działać poudriere bulk.

Źródła w sieci internet


{i} (c) 2004 - 2026 BSD Serwis Krzysztof Stryjek. W przypadku błędów, poprawek proszę kontaktować się z administratorem wiki.


  1. Otwiera się w nowym oknie/nowej karcie przeglądarki. (1 2 3 4)

PoudriereBinaryPkg (ostatnio edytowane 2019-02-09 20:03:45 przez wtps0n)