Skip to content

Commit

Permalink
feat(bazarr) Adding exportarr to expose metrics to prometheus (#14761)
Browse files Browse the repository at this point in the history
**Description**
This adds exportarr to the bazarr application as bazarr is supported by
exportarr. This allows the user to have prometheus scrape for bazarr
metrics.

**⚙️ Type of change**

- [X] ⚙️ Feature/App addition
- [ ] 🪛 Bugfix
- [ ] ⚠️ Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] 🔃 Refactor of current code

**🧪 How Has This Been Tested?**
Created a personal catalog which I added to TrueNAS. I then installed
this app sourced from this catalog to ensure the questions + answers,
and actual installation works.

**📃 Notes:**
Exportarr for bazarr does not work without having the API key to access
bazarr set. I have added this as a question to the metrics part (see
below screenshot). Is this an acceptable way of doing this, or should it
be done differently? Unfortunately bazarr does not support setting the
api key via environment variables, so enabling metrics for a new
deployment requires 2 deployments. The first one without metrics enabled
to bootstrap bazarr, and then a second one to enable metrics and set the
api key.


![2023-11-20_12-26](https://github.com/truecharts/charts/assets/20680059/b9455821-6dc5-4f9e-bc8f-16461bbb394d)

Also, due to a bug in exportarr
(onedr0p/exportarr#244), exportarr does not
work when there are no series added/sonarr is not configured. Should
this be mentioned anywhere to the users of this chart?

**✔️ Checklist:**

- [X] ⚖️ My code follows the style guidelines of this project
- [X] 👀 I have performed a self-review of my own code
- [ ] #️⃣ I have commented my code, particularly in hard-to-understand
areas
- [ ] 📄 I have made corresponding changes to the documentation
- [ ] ⚠️ My changes generate no new warnings
- [ ] 🧪 I have added tests to this description that prove my fix is
effective or that my feature works
- [X] ⬆️ I increased versions for any altered app according to semantic
versioning

**➕ App addition**

If this PR is an app addition please make sure you have done the
following.

- [ ] 🪞 I have opened a PR on
[truecharts/containers](https://github.com/truecharts/containers) adding
the container to TrueCharts mirror repo.
- [ ] 🖼️ I have added an icon in the Chart's root directory called
`icon.png`

---

_Please don't blindly check all the boxes. Read them and only check
those that apply.
Those checkboxes are there for the reviewer to see what is this all
about and
the status of this PR with a quick glance._

---------

Signed-off-by: Kjeld Schouten <kjeld@schouten-lebbing.nl>
Co-authored-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com>
Co-authored-by: Kjeld Schouten <kjeld@schouten-lebbing.nl>
  • Loading branch information
3 people committed Dec 20, 2023
1 parent a756cd7 commit 417ba65
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 2 deletions.
2 changes: 1 addition & 1 deletion charts/stable/bazarr/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
kubeVersion: ">=1.24.0-0"
apiVersion: v2
name: bazarr
version: 15.1.3
version: 15.2.0
appVersion: 1.4.0
description:
Bazarr is a companion application to Sonarr and Radarr. It manages and
Expand Down
3 changes: 3 additions & 0 deletions charts/stable/bazarr/ci/default-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
metrics:
main:
apiKey: newsn7zz12j67l4cwovjt6cyq6raqzmz
9 changes: 9 additions & 0 deletions charts/stable/bazarr/questions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,15 @@ questions:
default: 568

# Include{resources}
# Include{metrics}
- variable: apiKey
label: "Bazarr API key"
description: "Can be found in the Bazarr settings"
schema:
type: string
default: ""
required: true
# Include{prometheusRule}
# Include{advanced}
# Include{addons}
# Include{codeserver}
Expand Down
70 changes: 69 additions & 1 deletion charts/stable/bazarr/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,85 @@ image:
repository: ghcr.io/onedr0p/bazarr
pullPolicy: IfNotPresent
tag: 1.4.0@sha256:c81c4d9cbec093d5a999cfa3cd1af01d3f00d6292d6f5c33608510cef0ed83c7
exportarrImage:
repository: tccr.io/truecharts/exportarr
pullPolicy: IfNotPresent
tag: v1.6.0@sha256:ee118701a2ebe8ccb5c25e1003fbed9ef7ce217d4e4b8b6df30cc2a0def818f8
service:
main:
ports:
main:
port: 6767
protocol: http
targetPort: 6767
metrics:
enabled: true
type: ClusterIP
targetSelector: exportarr
ports:
metrics:
enabled: true
port: 7879
targetSelector: exportarr

workload:
exportarr:
enabled: "{{ .Values.metrics.main.enabled }}"
type: Deployment
strategy: RollingUpdate
replicas: 1
podSpec:
containers:
exportarr:
primary: true
enabled: true
imageSelector: exportarrImage
args:
- bazarr
probes:
liveness:
enabled: true
type: http
path: /healthz
port: "{{ .Values.service.metrics.ports.metrics.port }}"
readiness:
enabled: true
type: http
path: /healthz
port: "{{ .Values.service.metrics.ports.metrics.port }}"
startup:
enabled: true
type: http
path: /healthz
port: "{{ .Values.service.metrics.ports.metrics.port }}"
env:
INTERFACE: 0.0.0.0
PORT: "{{ .Values.service.metrics.ports.metrics.port }}"
URL: '{{ printf "http://%v:%v" (include "tc.v1.common.lib.chart.names.fullname" $) .Values.service.main.ports.main.port }}'
APIKEY: "{{ .Values.metrics.main.apiKey }}"

persistence:
config:
enabled: true
mountPath: /config
targetSelector:
main:
main:
mountPath: /config
exportarr:
exportarr:
mountPath: /config
readOnly: true

metrics:
main:
enabled: true
type: "servicemonitor"
endpoints:
- port: metrics
path: /metrics
targetSelector: metrics
apiKey: ""

portal:
open:
enabled: true

0 comments on commit 417ba65

Please sign in to comment.