Skip to content

Commit

Permalink
feat: add example how to use nginx to avoid overloading Artifactory b…
Browse files Browse the repository at this point in the history
…y scraping data by Prometheus. (#79)
  • Loading branch information
martinm82 authored Jun 22, 2022
1 parent 1cb07ed commit 7b761bc
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,23 @@ $ ./artifactory_exporter <flags>
### Docker

Set the credentials in `env_file_name` and you can deploy this exporter using the [peimanja/artifactory_exporter](https://registry.hub.docker.com/r/peimanja/artifactory_exporter/) Docker image:
:

```bash
$ docker run --env-file=env_file_name -p 9531:9531 peimanja/artifactory_exporter:latest <flags>
```

### Docker Compose

Running the exporter against an Artifactory instance with millions of artifacts will cause performance issues in case Prometheus will scrape too often.

To avoid such situations you can run nginx in front of the exporter and use it as a cache. The Artifactory responses will be cached in nginx and kept valid for `PROXY_CACHE_VALID` seconds. After that time any new request from Prometheus will re-request metrics from Artifactory and store again in the nginx cache.

Set the credentials in an environment file as described in the *Docker* section and store the file as `.env` next to `docker-compose.yml` and run the following command:

```bash
docker-compose up -d
```

## Install with Helm

[Helm](https://helm.sh) must be installed to use the charts.
Expand Down
30 changes: 30 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
version: "3.8"

services:
autoheal:
image: willfarrell/autoheal:latest
restart: always
volumes:
- '/var/run/docker.sock:/var/run/docker.sock'

proxy:
depends_on:
- exporter
image: decentralize/caching-proxy
restart: always
environment:
UPSTREAM: "http://exporter:9531"
MAX_SIZE: "100m"
PROXY_READ_TIMEOUT: "2400s"
PROXY_CACHE_VALID: "60s"
ports:
- 8088:80/tcp

exporter:
image: peimanja/artifactory_exporter
restart: always
ports:
- 9531:9531
command: --log.level=debug
env_file:
- .env

0 comments on commit 7b761bc

Please sign in to comment.