如何向 [Cloud Foundry] buildpacks 添加额外的进程?
How to add additional process to [Cloud Foundry] buildpacks?
我想将 varnishlog 日志记录添加到此 buildpack:https://github.com/chregu/cf-varnish-buildpack
当 buildpack 开始将 Varnish 错误记录到 disk/stderr 时,如何添加要启动的第二个进程?
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
# ------------------------------------------------------------------------------------------------
我想将 varnishlog 日志记录添加到此 buildpack:https://github.com/chregu/cf-varnish-buildpack
当 buildpack 开始将 Varnish 错误记录到 disk/stderr 时,如何添加要启动的第二个进程?
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
# ------------------------------------------------------------------------------------------------