-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #99 from usabilla/feature/php-prometheus-exporter
Static file Prometheus exporter
- Loading branch information
Showing
13 changed files
with
245 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
|
||
set -eEuo pipefail | ||
|
||
declare -r IMAGE="prometheus-exporter-file" | ||
|
||
declare -r DOCKER_FILE="http" | ||
|
||
declare -r VERSION_NGINX=$1 | ||
|
||
# I could create a placeholder like nginx:x.y-alpine in the Dockerfile itself, | ||
# but I think it wouldn't be a good experience if you try to build the image yourself | ||
# thus that's the way I opted to have dynamic base images | ||
declare -r IMAGE_ORIGINAL_TAG="nginx:1.[0-9][0-9]?-alpine" | ||
|
||
declare -r IMAGE_TAG="nginx:${VERSION_NGINX}-alpine" | ||
declare -r USABILLA_TAG_PREFIX="usabillabv/php" | ||
declare -r USABILLA_TAG="${USABILLA_TAG_PREFIX}:${IMAGE}" | ||
|
||
TAG_FILE="./tmp/build-${IMAGE}.tags" | ||
|
||
sed -E "s/${IMAGE_ORIGINAL_TAG}/${IMAGE_TAG}/g" "Dockerfile-${DOCKER_FILE}" | docker build --pull -t "${USABILLA_TAG}" \ | ||
--build-arg=NGINX_VHOST_TEMPLATE=prometheus-exporter-file --target="http" -f - . \ | ||
&& echo "${USABILLA_TAG}" >> "${TAG_FILE}" | ||
|
||
for USABILLA_TAG_EXTRA in "${@:2}" | ||
do | ||
docker tag "${USABILLA_TAG}" "${USABILLA_TAG_PREFIX}:${USABILLA_TAG_EXTRA}" \ | ||
&& echo "${USABILLA_TAG_PREFIX}:${USABILLA_TAG_EXTRA}" >> "${TAG_FILE}" | ||
done |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
18 changes: 18 additions & 0 deletions
18
src/http/nginx/conf/prometheus-exporter-file/vhost.conf.template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
server { | ||
listen 80; | ||
listen [::]:80; | ||
server_name ${NGINX_SERVER_NAME}; | ||
|
||
root ${NGINX_DOCUMENT_ROOT}; | ||
charset UTF-8; | ||
|
||
error_page 500 502 503 504 /50x.html; | ||
location = /50x.html { | ||
root /usr/share/nginx/html; | ||
} | ||
|
||
location / { | ||
sendfile on; | ||
sendfile_max_chunk 1m; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
# | ||
# A simple script to start a Docker container | ||
# and run Testinfra in it | ||
# Original script: https://gist.github.com/renatomefi/bbf44d4e8a2614b1390416c6189fbb8e | ||
# Author: @renatomefi https://github.com/renatomefi | ||
# | ||
|
||
set -eEuo pipefail | ||
|
||
# The first parameter is a Docker tag or image id | ||
declare -r DOCKER_TAG="$1" | ||
|
||
declare -r TEST_SUITE="prometheus_exporter_file_e2e" | ||
|
||
# Finally, run the tests! | ||
docker run --net="host" --rm -t \ | ||
-v "$(pwd)/test/e2e:/tests" \ | ||
-v "$(pwd)/tmp/test-results:/results" \ | ||
-v /var/run/docker.sock:/var/run/docker.sock:ro \ | ||
renatomefi/docker-testinfra:2 \ | ||
-m "$TEST_SUITE" --junitxml="/results/http-e2e-$DOCKER_TAG.xml" \ | ||
--verbose --tag="$1" |
Oops, something went wrong.