-
Notifications
You must be signed in to change notification settings - Fork 5
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 #8 from arvancloud/improve
Improve
- Loading branch information
Showing
5 changed files
with
99 additions
and
73 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,74 @@ | ||
name: Release | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
init: | ||
name: 🚩 Initialize | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Cancel previous workflow | ||
uses: styfle/[email protected] | ||
with: | ||
access_token: ${{ github.token }} | ||
|
||
docker: | ||
name: 🐳 Build Docker image | ||
runs-on: ubuntu-20.04 | ||
needs: init | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Get repository info | ||
uses: gacts/github-slug@v1 | ||
id: slug | ||
|
||
- name: Setup QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
- name: Setup Docker buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Login to Dockerhub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_LOGIN }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Get Current Date | ||
id: date | ||
run: echo "::set-output name=date::$(date +'%Y-%m-%d')" | ||
|
||
- name: Build & Push Docker image | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
file: Dockerfile | ||
push: true | ||
platforms: linux/amd64,linux/386,linux/arm64,linux/arm/v6,linux/arm/v7 | ||
build-args: | | ||
APP_VERSION=${{ steps.slug.outputs.version }}" | ||
DATE_CREATED=${{ steps.date.outputs.date }} | ||
tags: | | ||
r1cloud/cdn-exporter:${{ steps.slug.outputs.version }} | ||
r1cloud/cdn-exporter:latest | ||
- name: Run Trivy vulnerability scanner | ||
uses: aquasecurity/trivy-action@master | ||
with: | ||
image-ref: r1cloud/cdn-exporter:latest | ||
exit-code: "0" | ||
ignore-unfixed: true | ||
vuln-type: "os,library" | ||
severity: "CRITICAL,HIGH" | ||
format: "template" | ||
template: "@/contrib/sarif.tpl" | ||
output: "trivy-results.sarif" | ||
|
||
- name: Upload Trivy scan results to GitHub Security tab | ||
uses: github/codeql-action/upload-sarif@v2 | ||
with: | ||
sarif_file: "trivy-results.sarif" |
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 |
---|---|---|
@@ -1,21 +1,19 @@ | ||
# ar-prometheus-exporter | ||
# CDN Prometheus exporter | ||
|
||
![logo](.github/logo.svg) | ||
|
||
A very simple Prometheus exporter that exposes metrics from ArvanCloud API as described in the [documentation](https://www.arvancloud.ir/api/cdn/4.0). | ||
A very simple Prometheus exporter that exposes metrics from ArvanCloud CDN API as described in the [documentation](https://www.arvancloud.ir/api/cdn/4.0). | ||
|
||
## How-to | ||
|
||
You can run the exporter using Docker: | ||
|
||
```bash | ||
git clone [email protected]:arvancloud/ar-prometheus-exporter.git && cd ar-prometheus-exporter | ||
docker build -t ar-prometheus-exporter . | ||
docker run -d \ | ||
-p 9786:9786 \ | ||
-e DOMAINS=example.com,example.ir \ | ||
-e API_KEY=TOKEN_HERE \ | ||
ar-prometheus-exporter | ||
r1cloud/cdn-exporter | ||
``` | ||
|
||
### Metrics | ||
|
@@ -46,8 +44,3 @@ The exporter exposes the following metrics, all returned per PoP: | |
| `BASE_URL` | Arvan base URL | string | <https://napi.arvancloud.ir/cdn/4.0> | | ||
| `METRICS_PERIOD` | Arvan report period | enum(1h, 3h, 6h, 12h, 24h, 7d, 30d) | 3h | | ||
| `METRICS_PREFIX` | exported metrics prefix | string | `arvancloud_cdn_` | | ||
|
||
### 👨🏻💻 Contributors | ||
|
||
- SadeghHayeri [![https://github.com/sadeghhayeri](https://img.shields.io/github/followers/sadeghhayeri?color=red&label=Follow&logo=github&style=flat-square)](https://github.com/sadeghhayeri) | ||
- Yazdan [![https://github.com/yzdann](https://img.shields.io/github/followers/yzdann?color=red&label=Follow&logo=github&style=flat-square)](https://github.com/yzdann) |
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 |
---|---|---|
@@ -1,14 +1,10 @@ | ||
version: '3.2' | ||
service: | ||
ar-exporter: | ||
build: | ||
context: . | ||
dockerfile: ./dockerfile | ||
targer: app | ||
container_name: ar-exporter | ||
version: "3.9" | ||
|
||
services: | ||
cdn-exporter: | ||
image: r1cloud/cdn-exporter | ||
ports: | ||
- 9786:9786 | ||
- 9786:9786 | ||
environment: | ||
DOMAINS: example.com | ||
API_KEY: arvan-api-key | ||
network_mode: "bridge" | ||
DOMAINS: example.com | ||
API_KEY: arvan-api-key |