diff --git a/heartbeat/varnish b/heartbeat/varnish index d93dd107b..3112ae982 100755 --- a/heartbeat/varnish +++ b/heartbeat/varnish @@ -1,409 +1,404 @@ #!/bin/sh # # # Varnish # # Description: Manage varnish instances as a HA resource # # Author: Léon Keijser # # License: GNU General Public License (GPL) # # See usage() for more details # # OCF instance parameters: -# OCF_RESKEY_pidfile -# OCF_RESKEY_varnishd -# OCF_RESKEY_vcl_file +# OCF_RESKEY_pid +# OCF_RESKEY_binary +# OCF_RESKEY_config # OCF_RESKEY_instance_name # OCF_RESKEY_listen_address -# OCF_RESKEY_mgmt_if +# OCF_RESKEY_mgmt_address # OCF_RESKEY_ttl # OCF_RESKEY_varnish_user # OCF_RESKEY_varnish_group # OCF_RESKEY_backend_type # OCF_RESKEY_backend_size # OCF_RESKEY_backend_file # OCF_RESKEY_worker_threads # ####################################################################### # Initialization: - -: ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/resource.d/heartbeat} -. ${OCF_FUNCTIONS_DIR}/.ocf-shellfuncs +: ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/lib/heartbeat} +. ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs ####################################################################### # Set default paramenter values -OCF_RESKEY_varnishd_default=/usr/sbin/varnishd -OCF_RESKEY_vcl_file_default=/etc/varnish/default.vcl +OCF_RESKEY_binary_default=varnishd +OCF_RESKEY_config_default=/etc/varnish/default.vcl OCF_RESKEY_instance_name_default=myinstance -OCF_RESKEY_pidfile_default=/var/run/varnishd_${OCF_RESKEY_instance_name}.pid +OCF_RESKEY_pid_default=/var/run/varnishd_${OCF_RESKEY_instance_name}.pid OCF_RESKEY_listen_address_default=127.0.0.1:8080 -OCF_RESKEY_mgmt_if_default=127.0.0.1:2222 +OCF_RESKEY_mgmt_address_default=127.0.0.1:2222 OCF_RESKEY_ttl_default=600 OCF_RESKEY_varnish_user_default=varnish OCF_RESKEY_varnish_group_default=varnish OCF_RESKEY_backend_type_default=malloc OCF_RESKEY_backend_size_default=1G OCF_RESKEY_backend_file_default=/var/lib/varnish/${OCF_RESKEY_instance_name_default}.bin OCF_RESKEY_worker_threads_default=100,3000,120 -: ${OCF_RESKEY_varnishd=${OCF_RESKEY_varnishd_default}} -: ${OCF_RESKEY_vcl_file=${OCF_RESKEY_vcl_file_default}} +: ${OCF_RESKEY_binary=${OCF_RESKEY_binary_default}} +: ${OCF_RESKEY_config=${OCF_RESKEY_config_default}} : ${OCF_RESKEY_instance_name=${OCF_RESKEY_instance_name_default}} -: ${OCF_RESKEY_pidfile=${OCF_RESKEY_pidfile_default}} +: ${OCF_RESKEY_pid=${OCF_RESKEY_pid_default}} : ${OCF_RESKEY_listen_address=${OCF_RESKEY_listen_address_default}} -: ${OCF_RESKEY_mgmt_if=${OCF_RESKEY_mgmt_if_default}} +: ${OCF_RESKEY_mgmt_address=${OCF_RESKEY_mgmt_address_default}} : ${OCF_RESKEY_ttl=${OCF_RESKEY_ttl_default}} : ${OCF_RESKEY_varnish_user=${OCF_RESKEY_varnish_user_default}} : ${OCF_RESKEY_varnish_group=${OCF_RESKEY_varnish_group_default}} : ${OCF_RESKEY_backend_type=${OCF_RESKEY_backend_type_default}} : ${OCF_RESKEY_backend_size=${OCF_RESKEY_backend_size_default}} : ${OCF_RESKEY_backend_file=${OCF_RESKEY_backend_file_default}} : ${OCF_RESKEY_worker_threads=${OCF_RESKEY_worker_threads_default}} meta_data() { cat < 1.0 -Varnish Resource Agent. Manages varnish instances - +The Varnish Resource Agent can manage several varnishd +instances throughout the cluster. It does so by creating +a unique PID file and requires a unique listen address +and name for each instance. -Varnish resource agent +Manage several Varnish instances - + The VCL configuration file that varnish should manage, for example "/etc/varnish/default.vcl". VCL file - + The name of the instance that should be given to varnish Instance name - + Write the process's PID to the specified file. The default will include the specified instance_name, ie.: "/var/run/varnish_production.pid". Unlike what this help message shows. It is most likely not necessary to change this parameter. Listen address - + Listen on this address:port, for example "192.168.1.1:80" Listen address - + Provide a management interface, for example "127.0.0.1:2222" Management interface - + Specifies a hard minimum time to live for cached documents. -The default is 600. TTL - + Specifies the name of an unprivileged user to which the child process should switch before it starts accepting connections. -The default is varnish. Unprivileged user Specifies the name of an unprivileged group to which the child process should switch before it starts accepting connections. -The default is varnish. Unprivileged group Use the specified storage backend. Valid options are 'malloc' for memory and 'file' for a file backend. -The default is malloc. Backend type Specify the size of the backend. For example "1G". -The default is 1G. Backend size Specify the backend filename if you use backend_type file. For example /var/lib/varnish/mybackend.bin Backend file Start at least min but no more than max worker threads with the specified idle timeout. Syntax: min[,max[,timeout]] For example: 100,3000,120 Worker threads END } ####################################################################### varnish_usage() { cat <