From 37992f12392872f39bb773bc08e05875a0a22faa Mon Sep 17 00:00:00 2001 From: James Deathe Date: Sat, 6 Oct 2018 17:53:27 +0100 Subject: [PATCH 1/4] #134: Adds lockfile to ensure varnishd is started before varnishncsa. --- CHANGELOG.md | 4 ++++ src/usr/sbin/varnishd-wrapper | 12 +++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ce81ab2..c95991b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ Summary of release changes for Version 1. CentOS-6 6.10 x86_64 - Varnish Cache 4.1. +### 1.5.1 - Unreleased + +- Adds lockfile to ensure varnishd is started before varnishncsa. + ### 1.5.0 - 2018-10-01 - Updates `gcc` package to 4.4.7-23. diff --git a/src/usr/sbin/varnishd-wrapper b/src/usr/sbin/varnishd-wrapper index bdf7d5f..2bace1d 100755 --- a/src/usr/sbin/varnishd-wrapper +++ b/src/usr/sbin/varnishd-wrapper @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# Create lock file +touch /var/lock/subsys/varnishd-wrapper + function set_varnish_vcl_conf () { local -r pattern_base64='^[A-Za-z0-9/+=]*$' @@ -48,14 +51,17 @@ readonly DAEMON_OPTS="-j unix,user=varnish,ccgroup=varnish -S /etc/varnish/secret -s ${VARNISH_STORAGE:-file,/var/lib/varnish/varnish_storage.bin,1G} " -readonly NICE=/bin/nice -readonly NICENESS=${VARNISH_NICENESS:-10} -readonly VARNISHD=/usr/sbin/varnishd +readonly NICE="/bin/nice" +readonly NICENESS="${VARNISH_NICENESS:-10}" +readonly VARNISHD="/usr/sbin/varnishd" printf -- \ "Starting Varnish Cache: \n %s\n" \ "${DAEMON_OPTS}" +# Release lock file +rm -f /var/lock/subsys/varnishd-wrapper + exec ${NICE} \ -n ${NICENESS} \ ${VARNISHD} \ From 8ab7539a14b79d7382ebb75260399f9e07a0be8a Mon Sep 17 00:00:00 2001 From: James Deathe Date: Sat, 6 Oct 2018 18:11:26 +0100 Subject: [PATCH 2/4] #135: Adds failure messages to healthcheck script. --- CHANGELOG.md | 1 + src/usr/bin/healthcheck | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c95991b..34fffe5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ CentOS-6 6.10 x86_64 - Varnish Cache 4.1. ### 1.5.1 - Unreleased - Adds lockfile to ensure varnishd is started before varnishncsa. +- Adds failure messages to healthcheck script. ### 1.5.0 - 2018-10-01 diff --git a/src/usr/bin/healthcheck b/src/usr/bin/healthcheck index 91e6a9e..b602886 100755 --- a/src/usr/bin/healthcheck +++ b/src/usr/bin/healthcheck @@ -11,6 +11,8 @@ if [[ ${VARNISH_AUTOSTART_VARNISHD_WRAPPER} == true ]] \ && ! ps axo command \ | grep -qE '^/usr/sbin/varnishd ' then + printf -- \ + "Process varnishd not running." exit 1 fi @@ -19,6 +21,8 @@ if [[ ${VARNISH_AUTOSTART_VARNISHD_WRAPPER} == true ]] \ && ! varnishadm vcl.show -v boot \ &> /dev/null then + printf -- \ + "Varnish not booted." exit 1 fi @@ -27,6 +31,8 @@ if [[ ${VARNISH_AUTOSTART_VARNISHNCSA_WRAPPER} == true ]] \ && ! ps axo command \ | grep -qE '^/usr/bin/varnishncsa ' then + printf -- \ + "Process varnishncsa not running." exit 1 fi From ca366ff4e1d6655c37ed9ac413dc56de336ca99e Mon Sep 17 00:00:00 2001 From: James Deathe Date: Sat, 6 Oct 2018 18:33:45 +0100 Subject: [PATCH 3/4] #135: Adds minor improvement to access log tests. --- test/shpec/operation_shpec.sh | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/test/shpec/operation_shpec.sh b/test/shpec/operation_shpec.sh index 2e86393..9ba62ea 100644 --- a/test/shpec/operation_shpec.sh +++ b/test/shpec/operation_shpec.sh @@ -889,23 +889,24 @@ function test_custom_configuration () 80/tcp )" - # Make a request to populate the access_log - curl -sI \ - -X GET \ - -H "Host: ${backend_hostname}" \ - http://127.0.0.1:${container_port_80}/ \ - &> /dev/null - # Ensure log file exists before checking it's contents counter=0 until docker exec \ varnish.pool-1.1.1 \ - bash -c "[[ -f /var/log/varnish/access_log ]]" + bash -c "[[ -s /var/log/varnish/access_log ]]" do if (( counter > 6 )) then break fi + + # Make a request to populate the access_log + curl -sI \ + -X GET \ + -H "Host: ${backend_hostname}" \ + http://127.0.0.1:${container_port_80}/ \ + &> /dev/null + sleep 0.5 (( counter += 1 )) done @@ -962,23 +963,24 @@ function test_custom_configuration () 80/tcp )" - # Make a request to populate the access_log - curl -sI \ - -X GET \ - -H "Host: ${backend_hostname}" \ - http://127.0.0.1:${container_port_80}/ \ - &> /dev/null - # Ensure log file exists before checking it's contents counter=0 until docker exec \ varnish.pool-1.1.1 \ - bash -c "[[ -f /var/log/varnish/access_log ]]" + bash -c "[[ -s /var/log/varnish/access_log ]]" do if (( counter > 6 )) then break fi + + # Make a request to populate the access_log + curl -sI \ + -X GET \ + -H "Host: ${backend_hostname}" \ + http://127.0.0.1:${container_port_80}/ \ + &> /dev/null + sleep 0.5 (( counter += 1 )) done From 43118b1b284b81f16c49fb76a408686ab54bb790 Mon Sep 17 00:00:00 2001 From: James Deathe Date: Tue, 9 Oct 2018 08:35:45 +0100 Subject: [PATCH 4/4] Release changes for 1.5.1/2.2.0. --- CHANGELOG.md | 2 +- Dockerfile | 2 +- README.md | 12 ++++++------ src/etc/systemd/system/centos-ssh-varnish@.service | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 34fffe5..14655aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ Summary of release changes for Version 1. CentOS-6 6.10 x86_64 - Varnish Cache 4.1. -### 1.5.1 - Unreleased +### 1.5.1 - 2018-10-09 - Adds lockfile to ensure varnishd is started before varnishncsa. - Adds failure messages to healthcheck script. diff --git a/Dockerfile b/Dockerfile index 5be27c5..1040154 100644 --- a/Dockerfile +++ b/Dockerfile @@ -72,7 +72,7 @@ ENV SSH_AUTOSTART_SSHD=false \ # ----------------------------------------------------------------------------- # Set image metadata # ----------------------------------------------------------------------------- -ARG RELEASE_VERSION="1.5.0" +ARG RELEASE_VERSION="1.5.1" LABEL \ maintainer="James Deathe " \ install="docker run \ diff --git a/README.md b/README.md index ab5b0c3..25d32f1 100644 --- a/README.md +++ b/README.md @@ -7,16 +7,16 @@ Docker Image including: ## Overview & links -- `centos-7`, `centos-7-2.1.0`, `2.1.0` [(centos-7/Dockerfile)](https://github.com/jdeathe/centos-ssh-varnish/blob/centos-7/Dockerfile) -- `centos-6`, `centos-6-1.5.0`, `1.5.0` [(centos-6/Dockerfile)](https://github.com/jdeathe/centos-ssh-varnish/blob/centos-6/Dockerfile) +- `centos-7`, `centos-7-2.2.0`, `2.2.0` [(centos-7/Dockerfile)](https://github.com/jdeathe/centos-ssh-varnish/blob/centos-7/Dockerfile) +- `centos-6`, `centos-6-1.5.1`, `1.5.1` [(centos-6/Dockerfile)](https://github.com/jdeathe/centos-ssh-varnish/blob/centos-6/Dockerfile) #### centos-6 -The latest CentOS-6 based release can be pulled from the `centos-6` Docker tag. It is recommended to select a specific release tag - the convention is `centos-6-1.5.0`or `1.5.0` for the [1.5.0](https://github.com/jdeathe/centos-ssh-varnish/tree/1.5.0) release tag. +The latest CentOS-6 based release can be pulled from the `centos-6` Docker tag. It is recommended to select a specific release tag - the convention is `centos-6-1.5.1`or `1.5.1` for the [1.5.1](https://github.com/jdeathe/centos-ssh-varnish/tree/1.5.1) release tag. #### centos-7 -The latest CentOS-7 based release can be pulled from the `centos-7` Docker tag. It is recommended to select a specific release tag - the convention is `centos-7-2.1.0`or `2.1.0` for the [2.1.0](https://github.com/jdeathe/centos-ssh-varnish/tree/2.1.0) release tag. +The latest CentOS-7 based release can be pulled from the `centos-7` Docker tag. It is recommended to select a specific release tag - the convention is `centos-7-2.2.0`or `2.2.0` for the [2.2.0](https://github.com/jdeathe/centos-ssh-varnish/tree/2.2.0) release tag. Included in the build are the [SCL](https://www.softwarecollections.org/), [EPEL](http://fedoraproject.org/wiki/EPEL) and [IUS](https://ius.io) repositories. Installed packages include [OpenSSH](http://www.openssh.com/portable.html) secure shell, [vim-minimal](http://www.vim.org/), are installed along with python-setuptools, [supervisor](http://supervisord.org/) and [supervisor-stdout](https://github.com/coderanger/supervisor-stdout). @@ -43,7 +43,7 @@ $ docker run -d -t \ --name varnish.pool-1.1.1 \ -p 80:80 \ --add-host httpd_1:172.17.8.101 \ - jdeathe/centos-ssh-varnish:1.5.0 + jdeathe/centos-ssh-varnish:1.5.1 ``` Now you can verify it is initialised and running successfully by inspecting the container's logs. @@ -76,7 +76,7 @@ $ docker run \ --ulimit nproc=65535 \ --env "VARNISH_STORAGE=malloc,256M" \ --add-host httpd_1:172.17.8.101 \ - jdeathe/centos-ssh-varnish:1.5.0 + jdeathe/centos-ssh-varnish:1.5.1 ``` Now you can verify it is initialised and running successfully by inspecting the container's logs: diff --git a/src/etc/systemd/system/centos-ssh-varnish@.service b/src/etc/systemd/system/centos-ssh-varnish@.service index 7d5a0ed..3a33b77 100644 --- a/src/etc/systemd/system/centos-ssh-varnish@.service +++ b/src/etc/systemd/system/centos-ssh-varnish@.service @@ -52,7 +52,7 @@ Environment="DOCKER_USER=jdeathe" Environment="DOCKER_CONTAINER_OPTS=" Environment="DOCKER_IMAGE_PACKAGE_PATH=/var/opt/scmi/packages" Environment="DOCKER_IMAGE_NAME=centos-ssh-varnish" -Environment="DOCKER_IMAGE_TAG=1.5.0" +Environment="DOCKER_IMAGE_TAG=1.5.1" Environment="DOCKER_PORT_MAP_TCP_80=8000" Environment="DOCKER_PORT_MAP_TCP_8443=8500" Environment="ULIMIT_MEMLOCK=82000"