2013-05-06
tinderbox 4.0.0を使ってみる
FreeBSDのportsをbuildするためのシステムであるtinderboxの最新版4.0.0がリリースされていたので、FreeBSD 9.1-RELEASEにインストールして使ってみた。
4.0.0になっていろいろと新機能が使えるようになっている。
- SQLiteサポート
- tinderbuildがjail(8)を使うようになった
- WebuiがPDOを使うようになった
- md(4)を使った多様なファイルシステムを使えるようになった
- tinderbox 3.3からのアップグレードに対応した
- ドキュメントが一新された
これ以外にも、細かいところでlftpを使ったjail構築でtxz方式の新しいリリースパッケージに対応してたり、src/portsの更新にsubversionが使えるようになっていたりと、最近のFreeBSDを使うなら絶対に更新すべき。
インストールはports-mgmt/tinderboxから、設定は以下の通り。せっかくなのでSQLiteを使うことにして、lsofはkernel sourceをインストールしていないのでoffにした。
┌────────────────────────── tinderbox-4.0.0 ─────────────────────────────┐ │ ┌────────────────────────────────────────────────────────────────────┐ │ │ │ [x] CHECK_ROOT Check if ./tc is run by uid 0 │ │ │ │ [x] EMAILS Support for build failure/completion emails │ │ │ │ [x] LOG_COMPRESS Support bzip'ing the logs │ │ │ │ [ ] LSOF For killMountProcesses() when using nullfs │ │ │ │───────────────────────────────── DB ───────────────────────────────│ │ │ │ [ ] PGSQL PostgreSQL database support │ │ │ │ [ ] MYSQL MySQL database support │ │ │ │ [x] SQLITE SQLite database support │ │ │ │──────────────────────────────── WEB ───────────────────────────────│ │ │ │ (*) APACHE Apache server support │ │ │ │ ( ) HIAWATHA Hiawatha server │ │ │ │ ( ) LIGHTTPD Lighttpd server support │ │ │ │ ( ) NGINX Nginx server │ │ │ └────────────────────────────────────────────────────────────────────┘ │ ├────────────────────────────────────────────────────────────────────────┤ │ < OK > <Cancel> │ └────────────────────────────────────────────────────────────────────────┘
# cd /usr/local/tinderbox/scripts # ./tc Setup Welcome to the Tinderbox Setup script. This script will guide you through some of the automated Tinderbox setup steps. Once this script completes , you should review the documentation in /usr/local/tinderbox/scripts/README or on the web at http://tinderbox.marcuscom.com/ to complete your setup. Hit <ENTER> to get started:
ここでEnterキーを押して
INFO: Checking prerequisites ... DONE. INFO: Creating default configuration files ... DONE. INFO: Beginning database configuration. Enter database driver (mysql pgsql sqlite): sqlite Enter database name (full or relative paths allowed) [tinderbox]: Is this setting correct: Database name : tinderbox (y/N)y
sqliteを選択してDB名を入力、yを入力したらあとは自動的にセットアップされる。
INFO: Checking for prerequisites for sqlite database driver ... DONE. INFO: Loading Tinderbox schema into /usr/local/tinderbox/scripts/tinderbox ... DONE. INFO: Database configuration complete. Congratulations! The scripted portion of Tinderbox has completed successfully. You should now verify the settings in /usr/local/tinderbox/scripts/tinderbox.ph are correct for your environment, then run "/usr/local/tinderbox/scripts/tc init" to complete the setup. Be sure to checkout http://tinderbox.marcuscom.com/ for further instructions.
セットアップが終わったら、設定ファイルを編集する。tinderbox.phは$TINDERBOX_HOST, $TINDERBOX_URI, $SUBJECTあたりをお好みで変更する。
# Configurable options $TINDERBOX_HOST = 'http://tinderbox.example.com'; $TINDERBOX_URI = '/tb'; $SUBJECT = 'Example Tinderbox:'; $SENDER = 'tinderbox@example.com'; $SMTP_HOST = 'mail.example.com'; # These should probably be left alone $LOGS_URI = $TINDERBOX_URI . '/logs'; $SHOWBUILD_URI = $TINDERBOX_URI . '/index.php?action=list_buildports&build='; $SHOWPORT_URI = $TINDERBOX_URI . '/index.php?action=describe_port&id='; 1;
webui/inc_ds.php.distを元にしてinc_ds.phpを作成する。SQLiteを使うので、DB_DRIVERとDB_PATHを設定すればOK。
<?php $DB_DRIVER = 'sqlite'; $DB_PATH = '../tinderbox'; # sqlite only ?>
webui/inc_tinderbox.php.distを元にしてinc_tinderbox.phpを作成する。tinderbox_nameとtemplate_dirを好みで設定すれば、ほかはそのままで問題なし。template_dirはdefaultよりpaefchenが個人的な好み。
Apacheでwebuiにアクセスできるよう、Aliasを設定する。こんなファイルを/usr/local/etc/apache22/Includes/tinderbox.confとして作成する。
Alias /tb/logs/ "/usr/local/tinderbox/logs/" Alias /tb/packages/ "/usr/local/tinderbox/packages/" Alias /tb/errors/ "/usr/local/tinderbox/errors/" Alias /tb/wrkdirs/ "/usr/local/tinderbox/wrkdirs/" Alias /tb/ "/usr/local/tinderbox/scripts/webui/" <Directory /usr/local/tinderbox/scripts/webui> DirectoryIndex index.php Allow from all </Directory> <Directory ~ /usr/local/tinderbox/(packages|logs|errors|wrkdirs)> Options Indexes Allow from all </Directory>
jailを作成する。ftpサーバはほかに近いミラーサーバがあれば、そっちを指定するとネットワークに優しい。
# ./tc createJail -j 9.1 -d "FreeBSD 9.1-RELEASE" -t 9.1-RELEASE -u LFTP -H ftp.jp.freebsd.org
portsを作成する。
# ./tc createPortsTree -p FreeBSD -d "FreeBSD ports tree" -u SVN -P http -H svn.freebsd.org -D ports/head -w http://svnweb.freebsd.org/ports/
buildを作成する。
# ./tc createBuild -b 9.1-FreeBSD -j 9.1 -p FreeBSD -d "9.1-RELEASE with FreeBSD ports tree"
バックグラウンドでbuildするために、/etc/rc.confでtinderdを使う設定をする。
tinderd_enable="YES" tinderd_directory="/usr/local/tinderbox/scripts" tinderd_flags="-nullfs"
あとはばりばりと使うだけ。
# ./tc addPort -b 9.1-FreeBSD -d lang/perl5.14 # ./tc addBuildPortsQueueEntry -b 9.1-FreeBSD -d lang/perl5.14
2013-05-05
netatalk 3.0.1から3.0.3へのアップグレードが失敗する
netatalk 3.0.3がportsになっていたのでportupgradeを使ってアップグレードしようとしたら、build errorでmakeが失敗した。
afp_config.c: In function 'configinit': afp_config.c:136: error: too few arguments to function 'load_volumes' gmake[3]: *** [afpd-afp_config.o] Error 1 gmake[3]: Leaving directory `/usr/ports/net/netatalk3/work/netatalk-3.0.1/etc/afpd' gmake[2]: *** [all-recursive] Error 1 gmake[2]: Leaving directory `/usr/ports/net/netatalk3/work/netatalk-3.0.1/etc' gmake[1]: *** [all-recursive] Error 1 gmake[1]: Leaving directory `/usr/ports/net/netatalk3/work/netatalk-3.0.1' gmake: *** [all] Error 2 *** [do-build] Error code 1
エラーメッセージはこんなかんじ。
ざっと調査したところ、共有ライブラリの問題だったので、古いnetatalk 3.0.1をアンインストールしてから3.0.3をインストールして解決した。
後から気づいたけど、PRになってた。Googleでは引っかからなかったので気づかなかったよ。
2013-01-10
ZFSでsnapshotを使うならfreebsd-snapshotがやっぱり便利
再びZFSな環境に戻ってきたので、過去のエントリを参考にして、freebsd-snapshotによるsnapshotのローテーションを設定した。
ZFSのsnapshotはUFSより高速に作成・削除ができるので、使い勝手は最高。理論上は2^64まで作成できるので、世代管理も十分。
zfs set snapdir=visible しておけば、.zfsの下にsnapshotが見えるようになるので、後からあのファイルだけ救出、なんてときも簡単。ZFSってステキ。
参考
- FreeBSD Snapshot Management Environmentを使ってZFSのスナップショットを簡単に使う - mteramotoの日記
- FreeBSD UFS Snapshot Management Environmentを使って定期的にSnapshotを作成する - mteramotoの日記
- ZFS スナップショット : やっぱり Sun がスキ!
- Chapter 7 Working With Oracle Solaris ZFS Snapshots and Clones
- FreeBSD UFS/ZFS Snapshot Management Environment
- sysutils/freebsd-snapshot
2013-01-09
ディスクを交換してZFS poolの容量を増やす方法
今回のサーバ更新では、3TBのHDDを2台ミラー構成してZFS poolを作成した。今はこれで十分な容量だけど、将来的に容量が不足した場合はどうにかして容量を増やす必要がある。この場合、だいたい以下2つの方法がある。
前者は、ディスク増設の物理的なスペースが必要になる、一度addしたら解除できない、などいろいろと考えることが多いので、後者でいきたいところ。
将来に備えて、手順をメモしておく。
- 1台目のHDDを交換する
- zpool replace "プール名" "ディスク名"で交換したHDDを認識させる
- resilver完了まで待つ
- 2台目のHDDを交換する
- zpool replace "プール名" "ディスク名"で交換したHDDを認識させる
- resilver完了まで待つ
- zpool online -e "プール名"でZFSが認識する容量を拡張する
プール名とディスク名は、そのときの状況によって読み替えるべし。poolのautoexpandが有効になっていれば、最後の手順は不要かも。
参考
2013-01-08
portscoutがfreebsd.orgに登場
freebsd-ports@freebsd.orgのMLを見ていたら、portscoutさんからメールが来てるな〜、ってportscout!!
確認してみると、http://portscout.freebsd.org/が登場してるじゃないの。いつからか分からないけど、知らなかったよ。ここなら稼働率も期待できそうだし、自分用のportscoutを作る意味は無くなったと言えよう。