Decido di installare il fork di Influxdb3 in questo link github.
Utilizzo il docker-compose.yaml della documentazione Influxdb3 opportunamente personalizzato:
Originale:
services:
influxdb3-core:
image: influxdb:3-core
ports:
- 8181:8181
command:
- influxdb3
- serve
- --node-id=node0
- --object-store=file
- --data-dir=/var/lib/influxdb3/data
- --plugin-dir=/var/lib/influxdb3/plugins
volumes:
- type: bind
# Path to store data on your host system
source: ~/.influxdb3/data
# Path to store data in the container
target: /var/lib/influxdb3/data
- type: bind
# Path to store plugins on your host system
source: ~/.influxdb3/plugins
# Path to store plugins in the container
target: /var/lib/influxdb3/plugins
services:
influxdb3-core:
image: ghcr.io/metrico/influxdb3-unlocked:latest
ports:
- 8181:8181
command:
# - influxdb3
- serve
- --node-id=local1
- --object-store=file
- --data-dir=/var/lib/influxdb3/data
- --plugin-dir=/var/lib/influxdb3/plugins
volumes:
- type: bind
# Path to store data on your host system
source: /home/docker/influxdb3/data
# Path to store data in the container
target: /var/lib/influxdb3/data
- type: bind
# Path to store plugins on your host system
source: /home/docker/influxdb3/plugins
# Path to store plugins in the container
target: /var/lib/influxdb3/plugins
Dopo aver effettuato il deploy dello stack con Portainer trovo il seguente errore sui log del container:
Serve command failed: failed to initialize catalog: object store error: ObjectStore(Generic { store: "LocalFileSystem", source: UnableToCreateDir { source: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }, path: "/var/lib/influxdb3/data/local1" } })
In effetti l'inspect del container rivela che il container utilizza lo user influxdb3 che non esiste sul sistema host:
"OnBuild": null,
"OpenStdin": false,
"StdinOnce": false,
"Tty": false,
"User": "influxdb3",
"Volumes": null,
"WorkingDir": ""
Mentre sul sistema host le due directory passate come volumi hanno come proprietario l'utente docker.
Procedo a verificare UID e GID dell'utente influxdb3 all'interno del container:
docker@docker:~/influxdb3$ docker run --rm --entrypoint "" ghcr.io/metrico/influxdb3-unlocked cat /etc/passwd | grep influxdb3
influxdb3:x:1500:1500::/home/influxdb3:/bin/bash
Cambio quindi la ownership delle due directory:
# assegna ownership a UID/GID 1500:1500
sudo chown -R 1500:1500 /home/docker/influxdb3/data
sudo chown -R 1500:1500 /home/docker/influxdb3/plugins
# verifica
ls -ld /home/docker/influxdb3 /home/docker/influxdb3/data /home/docker/influxdb3/plugins
docker@docker:~/influxdb3$ ls -ld /home/docker/influxdb3 /home/docker/influxdb3/data /home/docker/influxdb3/plugins
drwxrwxr-x 4 docker docker 4096 Sep 24 19:14 /home/docker/influxdb3
drwxrwxr-x 3 1500 1500 4096 Sep 24 20:54 /home/docker/influxdb3/data
drwxrwxr-x 2 1500 1500 4096 Sep 24 19:14 /home/docker/influxdb3/plugins
A questo punto posso effettuare l'update dello stack su Portainer.
Seguo adesso la guida della documentazione influxdb.
influxdb3@14807335a332:/$ influxdb3 create token --admin
New token created successfully!
Token: apiv3_cmVe1GvIJtcqq7NTQMgtsL-zSD50WTxJyR7YHNpgxX3MRGVKsHM2T7bR3Ff0-O5iltFd6kbjSQnZAUId-1wVuA
HTTP Requests Header: Authorization: Bearer apiv3_cmVe1GvIJtcqq7NTQMgtsL-zSD50WTxJyR7YHNpgxX3MRGVKsHM2T7bR3Ff0-O5iltFd6kbjSQnZAUId-1wVuA
IMPORTANT: Store this token securely, as it will not be shown again.
Seguo la documentazione per l'installazione.
Aggiungo il servizio explorer al docker-compose.yaml che diventa:
services:
influxdb3-core:
image: ghcr.io/metrico/influxdb3-unlocked:latest
container_name: influxdb3-core
ports:
- 8181:8181
command:
# - influxdb3
- serve
- --node-id=local1
- --object-store=file
- --data-dir=/var/lib/influxdb3/data
- --plugin-dir=/var/lib/influxdb3/plugins
volumes:
- type: bind
# Path to store data on your host system
source: /home/docker/influxdb3/data
# Path to store data in the container
target: /var/lib/influxdb3/data
- type: bind
# Path to store plugins on your host system
source: /home/docker/influxdb3/plugins
# Path to store plugins in the container
target: /var/lib/influxdb3/plugins
influxdb3-explorer:
image: influxdata/influxdb3-ui:1.2.0
container_name: influxdb3-explorer
pull_policy: always
command: ["--mode=admin"]
ports:
- "8888:80"
volumes:
- /home/docker/influxdb3/db:/db:rw
- /home/docker/influxdb3/config:/app-root/config:ro
- /home/docker/influxdb3/ssl:/etc/nginx/ssl:ro
environment:
SESSION_SECRET_KEY: ${SESSION_SECRET_KEY:-changeme123456789012345678901234}
restart: unless-stopped
In una shell della macchina host creo le directory per il servizio explorer:
docker@docker:~/influxdb3$ mkdir -m 700 ./db
docker@docker:~/influxdb3$ mkdir -m 755 ./config
docker@docker:~/influxdb3$ mkdir -m 755 ./ssl
docker@docker:~/influxdb3$ ls -las
total 32
4 drwxrwxr-x 7 docker docker 4096 Sep 26 05:54 .
4 drwxr-x--- 5 docker docker 4096 Sep 24 19:13 ..
4 -rw-rw-r-- 1 docker docker 112 Sep 26 05:54 .env
4 drwxr-xr-x 2 docker docker 4096 Sep 26 05:07 config
4 drwxrwxr-x 3 1500 1500 4096 Sep 24 20:54 data
4 drwx------ 2 docker docker 4096 Sep 26 05:07 db
4 drwxrwxr-x 2 1500 1500 4096 Sep 24 19:14 plugins
4 drwxr-xr-x 2 docker docker 4096 Sep 26 05:08 ssl
Creo il file config/config.json
docker@docker:~/influxdb3$ cat > config/config.json << 'EOF'
{
"DEFAULT_INFLUX_SERVER": "http://192.168.1.155:8181",
"DEFAULT_INFLUX_DATABASE": "proxmox",
"DEFAULT_API_TOKEN": "apiv3_cmVe1GvIJtcqq7NTQMgtsL-zSD50WTxJyR7YHNpgxX3MRGVKsHM2T7bR3Ff0-O5iltFd6kbjSQnZAUId-1wVuA",
"DEFAULT_SERVER_NAME": "Local InfluxDB 3"
}
EOF
docker@docker:~/influxdb3$ cat config/config.json
{
"DEFAULT_INFLUX_SERVER": "http://192.168.1.155:8181",
"DEFAULT_INFLUX_DATABASE": "proxmox",
"DEFAULT_API_TOKEN": "apiv3_cmVe1GvIJtcqq7NTQMgtsL-zSD50WTxJyR7YHNpgxX3MRGVKsHM2T7bR3Ff0-O5iltFd6kbjSQnZAUId-1wVuA",
"DEFAULT_SERVER_NAME": "Local InfluxDB 3"
}
Per permettere la persistenza delle sessioni dopo il restart del container è necessario fornire una SESSION_SECRET_KEY che, di default, viene generata randomicamente alla partenza del container, la genero e la inserisco nel file .env:
docker@docker:~/influxdb3$ openssl rand -hex 32
9717a9665eed56d70325272df71304135dd421bb4c2883ae3ab206dd4ab988a4
Creo il file .env contenente il token
SESSION_SECRET_KEY=9717a9665eed56d70325272df71304135dd421bb4c2883ae3ab206dd4ab988a4
A questo punto debbo creare il db proxmox, verifico l'id del container in esecuzione con il comando:
docker@docker:~/influxdb3$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
90cc472f3fb0 portainer/portainer-ce:lts "/portainer" 21 hours ago Up 21 hours 0.0.0.0:8000->8000/tcp, [::]:8000->8000/tcp, 0.0.0.0:9443->9443/tcp, [::]:9443->9443/tcp, 9000/tcp portainer
14807335a332 ghcr.io/metrico/influxdb3-unlocked:latest "/usr/bin/entrypoint…" 34 hours ago Up 34 hours 0.0.0.0:8181->8181/tcp, [::]:8181->8181/tcp influxdb3-influxdb3-core-1
9ce6c349ce17 lscr.io/linuxserver/qbittorrent:latest "/init" 39 hours ago Up 38 hours qbittorrent
01eae27aa330 polkaned/expressvpn "/bin/bash /tmp/entr…" 39 hours ago Up 38 hours 0.0.0.0:6881->6881/tcp, 0.0.0.0:6881->6881/udp, [::]:6881->6881/tcp, [::]:6881->6881/udp, 0.0.0.0:8081->8080/tcp, [::]:8081->8080/tcp expressvpn
c62f2379af05 ghcr.io/requarks/wiki:latest "docker-entrypoint.s…" 3 days ago Up 38 hours 3443/tcp, 0.0.0.0:80->3000/tcp, [::]:80->3000/tcp wikijs-wiki-1
3de4bf1b8376 postgres:15-alpine "docker-entrypoint.s…" 3 days ago Up 38 hours 5432/tcp wikijs-wiki-db-1
98a6acaa5193 apache/tika:latest "/bin/sh -c 'exec ja…" 5 days ago Up 38 hours 9998/tcp paperless-tika-1
0060ec6c5975 ghcr.io/paperless-ngx/paperless-ngx:latest "/init" 6 days ago Up 38 hours (healthy) 0.0.0.0:8010->8000/tcp, [::]:8010->8000/tcp paperless-webserver-1
7d35ecf7b5fa triliumnext/trilium:latest "docker-entrypoint.s…" 2 weeks ago Up 38 hours (healthy) 0.0.0.0:8080->8080/tcp, [::]:8080->8080/tcp trilium-trilium-1
ed809b98ebb5 redis:8 "docker-entrypoint.s…" 2 weeks ago Up 38 hours 6379/tcp paperless-broker-1
ded83e6c8ae3 postgres:17 "docker-entrypoint.s…" 2 weeks ago Up 38 hours 5432/tcp paperless-db-1
82d733c01c35 edgd1er/webnut:latest "/docker-entrypoint.…" 5 weeks ago Up 38 hours (healthy) 0.0.0.0:6543->6543/tcp, [::]:6543->6543/tcp webnut
a10a8f830081 gotenberg/gotenberg:8.20 "/usr/bin/tini -- go…" 5 weeks ago Up 38 hours 3000/tcp paperless-gotenberg-1
E creo il database proxmox
docker@docker:~/influxdb3$ docker exec -it 14807335a332 influxdb3 create database --token apiv3_cmVe1GvIJtcqq7NTQMgtsL-zSD50WTxJyR7YHNpgxX3MRGVKsHM2T7bR3Ff0-O5iltFd6kbjSQnZAUId-1wVuA proxmox
Database "proxmox" created successfully
Modifico lo stack su Portainer con il nuovo docker-compose, inserisco la variabile di ambiente del file .env ed effettuo il deploy dello stack.