Conversation
per #48
jwreagor
left a comment
There was a problem hiding this comment.
LGTM, this was easy enough to review and caching would be better than firing two separate requests.
Update containerpilot, consul, consul-template
| RUN apt-get update \ | ||
| && apt-get install -y --no-install-recommends \ | ||
| bc \ | ||
| ca-certificates \ |
There was a problem hiding this comment.
This appears to be required for nginx:1.13
| @@ -1,18 +1,19 @@ | |||
| # A minimal Nginx container including ContainerPilot | |||
| FROM nginx:1.11 | |||
| FROM nginx:1.13 | |||
There was a problem hiding this comment.
The old 1.11 was too old for me to feel comfortable pushing a new image from.
| # Releases at https://releases.hashicorp.com/consul | ||
| RUN export CONSUL_VERSION=0.7.3 \ | ||
| && export CONSUL_CHECKSUM=901a3796b645c3ce3853d5160080217a10ad8d9bd8356d0b73fcd6bc078b7f82 \ | ||
| RUN export CONSUL_VERSION=0.7.5 \ |
There was a problem hiding this comment.
The next version should probably jump to Consul 0.8.x, but I'm staying on the 0.7 branch because of some bugs in the first releases of 0.8.
| unhandled() { | ||
| local accepts=$(curl -s --fail localhost/nginx-health | awk 'FNR == 3 {print $1}') | ||
| local handled=$(curl -s --fail localhost/nginx-health | awk 'FNR == 3 {print $2}') | ||
| local scraped=$(curl -s --fail localhost/nginx-health) |
There was a problem hiding this comment.
This is the most important change in this PR.
makefile
Outdated
| @@ -0,0 +1,59 @@ | |||
| # Makefile for building, shipping, and testing the container. | |||
There was a problem hiding this comment.
There was no makefile, and building the old way suddenly felt dirty.
There was a problem hiding this comment.
There's a Makefile in test/
There was a problem hiding this comment.
Which yes, is not a great place to put it but this component blueprint can't really be tested without an example backend, so the whole building and testing outside of a simple docker build has been done in test/ and examples/. Probably could use some improvements, which I was planning on tackling this Q as part of the general set of work to improve this.
There was a problem hiding this comment.
I guess I missed the /test
| unhandled() { | ||
| local accepts=$(curl -s --fail localhost/nginx-health | awk 'FNR == 3 {print $1}') | ||
| local handled=$(curl -s --fail localhost/nginx-health | awk 'FNR == 3 {print $2}') | ||
| local scraped=$(curl -s --fail localhost/nginx-health) |
There was a problem hiding this comment.
This is the key change
| local scraped=$(curl -s --fail localhost/nginx-health) | ||
| local active=$(echo ${scraped} | awk '/Active connections/{print $3}') | ||
| local waiting=$(echo ${scraped} | awk '/Reading/{print $6}') | ||
| local active=$(echo "${scraped}" | awk '/Active connections/{print $3}') |
There was a problem hiding this comment.
The result from curl -s --fail localhost/nginx-health is a multi-line string, so we need to quote it when echoing it.
|
I tested this in the WordPress blueprint (see autopilotpattern/wordpress#48), as well as an internal production blueprint. |
Caches the
curl -s --fail localhost/nginx-healthso that we can do consistent math on the values in it.Fixes #48