-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
I tried to populate PROXMOX_EXPORTER_PROXMOX_TOKEN and PROXMOX_EXPORTER_PROXMOX_TOKEN_ID using docker secrets but failed to do so.
I expected to use the trick I saw in Authentik: set environment variable with file:///run/secrets/SOMESECRET.
That way, when processed in go code variable is set with the contents of file /run/secrets/SOMESECRET. Unfortunately, that did not work.
I'm not a GO expert in any approximation, but hopefully something similar to this https://github.com/goauthentik/authentik/blob/a6225ad7a7880a5e1e63225e81084e27c35fe626/internal/config/struct.go could be implementd for exporter?
Here's my log
#####################
## This works
#####################
$ cat -> compose.yaml
services:
exporter:
image: ghcr.io/starttoaster/proxmox-exporter:latest
ports:
- 8080:8080
volumes:
- /etc/pki/ca-trust/source/anchors/localCA.crt:/etc/ssl/certs/localCA.crt:ro # local CA certificate
environment:
PROXMOX_EXPORTER_LOG_LEVEL: 'debug'
PROXMOX_EXPORTER_PROXMOX_API_INSECURE: 'false'
PROXMOX_EXPORTER_PROXMOX_ENDPOINTS: 'https://pve.lan:8006/'
PROXMOX_EXPORTER_PROXMOX_TOKEN: '5f8ebe64-e70d-4840-aef4-7cac331dddd2'
PROXMOX_EXPORTER_PROXMOX_TOKEN_ID: 'proxmox-exporter@pve!proxmox-exporter'
PROXMOX_EXPORTER_SERVER_PORT: '8080'
# PROXMOX_EXPORTER_PROXMOX_TOKEN: file:///run/secrets/PROXMOX_EXPORTER_PROXMOX_TOKEN
# PROXMOX_EXPORTER_PROXMOX_TOKEN_ID: file:///run/secrets/PROXMOX_EXPORTER_PROXMOX_TOKEN_ID
# secrets:
# - PROXMOX_EXPORTER_PROXMOX_TOKEN
# - PROXMOX_EXPORTER_PROXMOX_TOKEN_ID
# secrets:
# PROXMOX_EXPORTER_PROXMOX_TOKEN:
# file: ./token.txt
# PROXMOX_EXPORTER_PROXMOX_TOKEN_ID:
# file: ./id.txt
$ docker compose up
Attaching to exporter-1
exporter-1 | time=2024-08-23T15:56:56.044Z level=DEBUG msg="Creating Proxmox client" endpoint=https://pve.lan:8006/ hostname=pve.lan
exporter-1 | time=2024-08-23T15:56:56.059Z level=INFO msg="Starting server" port=8080
exporter-1 | time=2024-08-23T15:57:28.154Z level=DEBUG msg="finished requests for node data" node=pve
exporter-1 | time=2024-08-23T15:57:46.808Z level=DEBUG msg="proxmox request was found in cache for GetNodes"
exporter-1 | time=2024-08-23T15:57:46.808Z level=DEBUG msg="proxmox request was found in cache for GetNodeQemu" node=pve
exporter-1 | time=2024-08-23T15:57:46.808Z level=DEBUG msg="proxmox request was found in cache for GetNodeLxc" node=pve
exporter-1 | time=2024-08-23T15:57:46.808Z level=DEBUG msg="proxmox request was found in cache for GetNodeStorage" node=pve
exporter-1 | time=2024-08-23T15:57:46.809Z level=DEBUG msg="proxmox request was found in cache for GetNodeDisksList" node=pve#####################
## This failed
#####################
$ cat -> token.txt
5f8ebe64-e70d-4840-aef4-7cac331dddd2
$ cat -> id.txt
proxmox-exporter@pve!proxmox-exporter
$ cat -> compose.yaml
services:
exporter:
image: ghcr.io/starttoaster/proxmox-exporter:latest
ports:
- 8080:8080
volumes:
- /etc/pki/ca-trust/source/anchors/localCA.crt:/etc/ssl/certs/localCA.crt:ro # local CA certificate
environment:
PROXMOX_EXPORTER_LOG_LEVEL: 'debug'
PROXMOX_EXPORTER_PROXMOX_API_INSECURE: 'false'
PROXMOX_EXPORTER_PROXMOX_ENDPOINTS: 'https://pve.lan:8006/'
# PROXMOX_EXPORTER_PROXMOX_TOKEN: '5f8ebe64-e70d-4840-aef4-7cac331dddd2'
# PROXMOX_EXPORTER_PROXMOX_TOKEN_ID: 'proxmox-exporter@pve!proxmox-exporter'
PROXMOX_EXPORTER_SERVER_PORT: '8080'
PROXMOX_EXPORTER_PROXMOX_TOKEN: file:///run/secrets/PROXMOX_EXPORTER_PROXMOX_TOKEN
PROXMOX_EXPORTER_PROXMOX_TOKEN_ID: file:///run/secrets/PROXMOX_EXPORTER_PROXMOX_TOKEN_ID
secrets:
- PROXMOX_EXPORTER_PROXMOX_TOKEN
- PROXMOX_EXPORTER_PROXMOX_TOKEN_ID
secrets:
PROXMOX_EXPORTER_PROXMOX_TOKEN:
file: ./token.txt
PROXMOX_EXPORTER_PROXMOX_TOKEN_ID:
file: ./id.txt
$ docker compose up
Attaching to exporter-1
exporter-1 | time=2024-08-23T16:01:00.184Z level=DEBUG msg="Creating Proxmox client" endpoint=https://pve.lan:8006/ hostname=pve.lan
exporter-1 | time=2024-08-23T16:01:03.199Z level=DEBUG msg="banning client" name=pve.lan duration=1m0s
exporter-1 | time=2024-08-23T16:01:03.199Z level=INFO msg="Starting server" port=8080
exporter-1 | time=2024-08-23T16:01:09.487Z level=ERROR msg="request to get node list was not successful. It's possible all clients are banned"Metadata
Metadata
Assignees
Labels
No labels