-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for Triton discovery #18
Conversation
… container names by test harness
image := $(namespace)/prometheus | ||
testImage := $(namespace)/prometheus-testrunner | ||
|
||
#dockerLocal := DOCKER_HOST= DOCKER_TLS_VERIFY= DOCKER_CERT_PATH= docker |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not work on my Mac with Docker Machine. Replacing it with dockerLocal := docker
does.
Error is:
$ make build
DOCKER_HOST= DOCKER_TLS_VERIFY= DOCKER_CERT_PATH= docker build -f test/Dockerfile -t=autopilotpattern/prometheus-testrunner:branch-triton-support .
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
make: *** [test-runner] Error 1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, that's unfortunate and is because Docker Machine uses DOCKER_HOST
, etc. and Docker for Mac does not. The reason we're doing this is because we want the person (or Jenkins job) running the tests to be able to set their credentials to point to the environment-under-test but then run the tests from the local machine so that the keys never leave the machine running the tests.
This will effect every blueprint where we're doing testing this way. I'm certainly open to new suggestions on how to tackle it though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is now fixed by using https://github.com/joyent/triton-docker-cli, though the code here hasn't been updated.
COPY examples/triton/docker-compose.yml /src/triton/docker-compose.yml | ||
|
||
# install tests | ||
COPY test/testing/testcases.py /src/testcases.py |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Step 7 : COPY test/testing/testcases.py /src/testcases.py
lstat test/testing/testcases.py: no such file or directory
make: *** [test-runner] Error 1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I'm an idiot. That was a submodule and I need to fetch its contents.
@@ -1,31 +0,0 @@ | |||
# Prometheus demonstration of the autopilot pattern |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new pattern is to put this in /examples/triton
@@ -1,19 +0,0 @@ | |||
prometheus: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new pattern is to put this in /examples/docker/docker-compose.yml
RUN set -ex \ | ||
&& export CONSUL_VERSION=0.7.5 \ | ||
&& export CONSUL_CHECKSUM=40ce7175535551882ecdff21fdd276cef6eaab96be8a8260e0599fadb6f1f5b8 \ | ||
&& curl --retry 7 --fail -vo /tmp/consul.zip "https://releases.hashicorp.com/consul/${CONSUL_VERSION}/consul_${CONSUL_VERSION}_linux_amd64.zip" \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding Consul as a coprocess, per #8
"services": [ | ||
{ | ||
"name": "prometheus", | ||
"port": 9090, | ||
"health": ["curl", "-so", "/dev/null", "http://localhost:9090/metrics"], | ||
"health": ["curl", "-fso", "/dev/null", "http://localhost:9090/metrics"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We expect if the request fails that curl
will return a non-zero exit, yes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes 👍
"poll": 10, | ||
"ttl": 25 | ||
} | ||
], | ||
"coprocesses": [{{ if .CONSUL_AGENT }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consul co-process, per #8
etc/prometheus.yml.ctmpl
Outdated
dns_suffix: 'cmon.{{env "TRITON_DC"}}.triton.zone' | ||
endpoint: 'cmon.{{env "TRITON_DC"}}.triton.zone' | ||
tls_config: | ||
- ca_file: '{{env "TLSCA_PATH"}}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These var names are incorrect and need to be fixed.
These must match the new vars added to https://github.com/autopilotpattern/prometheus/pull/18/files#diff-86aea33913dc22bc9ba97b5f7b8c956e
examples/triton/docker-compose.yml
Outdated
|
||
|
||
# Consul acts as our service catalog and is used to coordinate global state among | ||
# our Redis containers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redis?
@@ -0,0 +1,4 @@ | |||
echo CONSUL=prometheus-consul.svc.${TRITON_ACCOUNT}.${TRITON_DC}.cns.joyent.com > /src/triton/_env |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will need updating to include the changes in /examples/triton/setup.sh
- Make the config file (appear to) work
de150b6
to
c02a952
Compare
@@ -4,55 +4,83 @@ FROM alpine:3.4 | |||
# artisanally hand-rolling curl and the rest of our stack we'll just use | |||
# Alpine so we can use `docker build`. | |||
|
|||
RUN apk add --update curl | |||
RUN apk add --update \ | |||
bash \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It turns out the -n
test in the prestart.sh
is bash-specific. Of all the choices I had to fix it, I decided to add bash.
"name": "consul-agent (host:{{ .CONSUL }})", | ||
"command": ["/usr/local/bin/consul", "agent", | ||
"-data-dir=/var/lib/consul", | ||
"-config-dir=/etc/consul", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The alignment of these two dirs with the dirs created in the Dockerfile is frustratingly important.
@@ -1,8 +1,8 @@ | |||
# my global config | |||
global: | |||
scrape_interval: 15s # By default, scrape targets every 15 seconds. | |||
evaluation_interval: 15s # By default, scrape targets every 15 seconds. | |||
# scrape_timeout is set to the global default (10s). | |||
evaluation_interval: 13s # |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The examples show the evaluation_interval
slightly shorter than the scrape_interval
, so...
Fixes #19
|
||
# Are we on Triton? Do we _not_ have a user-defined DC? | ||
# Set the DC automatically from mdata | ||
if [ -n ${TRITON_DC} ] \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@geek did you spot this one?
Closing in favor of #21 |
Carries from #17:
This addresses code review questions and issues in addition to the above.
Next steps:
/README.md
with more details, including:/examples/triton/README.md
with more detail, including a note about copying the user's TLS key/test/tests.sh
so that it sets all the correct env varsdocker
anddocker-compose
commands