0

我想将 varnishlog 日志记录添加到此 buildpack:https ://github.com/chregu/cf-varnish-buildpack

当 buildpack 开始将 Varnish 错误记录到磁盘/stderr 时,如何添加要启动的第二个进程?

4

1 回答 1

1

buildpack 可以生成后台进程。对于您指向的 buildpack,该bin/release文件表明它将boot.sh在启动时启动。因此,您可以修改以使用添加到命令boot.sh的常用 shell 语法在后台启动您想要的任何内容。&例如:

export APP_ROOT=$HOME
export LD_LIBRARY_PATH=$APP_ROOT/varnish/lib:$LD_LIBRARY_PATH
if [ -z "$VARNISH_MEMORY_LIMIT" ]; then
    VARNISH_MEMORY_LIMIT=$MEMORY_LIMIT
fi

# Start some logging process in the background
start_my_logging.sh &

# check varnish config
$APP_ROOT/varnish/sbin/varnishd -C -f $APP_ROOT/varnish/etc/varnish/default.vcl 2>&1

# TODO, Make MEMORY_LIMIT adjustable, this now comes from CF itself
exec $APP_ROOT/varnish/sbin/varnishd -n /home/vcap/tmp/varnish -F -f $APP_ROOT/varnish/etc/varnish/default.vcl -a 0.0.0.0:$VCAP_APP_PORT -t 120 -w 50,1000,120 -s malloc,$VARNISH_MEMORY_LIMIT -T 127.0.0.1:6082 -p http_resp_hdr_len=32768 2>&1
# ------------------------------------------------------------------------------------------------
于 2015-05-01T21:17:30.603 回答