feat(db): add influx in db stack
This commit is contained in:
2
db/.env.template
Normal file
2
db/.env.template
Normal file
@@ -0,0 +1,2 @@
|
||||
INFLUX_PORT=8181
|
||||
UI_PORT=8093
|
||||
67
db/docker-compose.yml
Normal file
67
db/docker-compose.yml
Normal file
@@ -0,0 +1,67 @@
|
||||
services:
|
||||
influxdb:
|
||||
image: influxdb:3-core
|
||||
ports:
|
||||
- "${INFLUX_PORT}:8181"
|
||||
entrypoint: |
|
||||
/bin/sh -c '
|
||||
RAW_TOKEN=$$(cat /run/secrets/admin-token) &&
|
||||
echo "{\"name\":\"admin\",\"token\":\"$$RAW_TOKEN\"}" > /tmp/admin-token.json &&
|
||||
exec influxdb3 serve \
|
||||
--node-id=node0 \
|
||||
--object-store=file \
|
||||
--data-dir=/var/lib/influxdb3/data \
|
||||
--admin-token-file=/tmp/admin-token.json \
|
||||
--disable-authz=health
|
||||
'
|
||||
secrets:
|
||||
- admin-token
|
||||
volumes:
|
||||
- influxdb3_data:/var/lib/influxdb3
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:8181/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 5
|
||||
|
||||
explorer:
|
||||
image: influxdata/influxdb3-ui
|
||||
ports:
|
||||
- "${UI_PORT}:80"
|
||||
environment:
|
||||
DEFAULT_INFLUX_SERVER: "http://influxdb:${INFLUX_PORT}"
|
||||
DEFAULT_INFLUX_DATABASE: "provence"
|
||||
DEFAULT_SERVER_NAME: "PI-E2EEDA"
|
||||
depends_on:
|
||||
influxdb:
|
||||
condition: service_healthy
|
||||
secrets:
|
||||
- admin-token
|
||||
entrypoint: >
|
||||
/bin/sh -c '
|
||||
export DEFAULT_API_TOKEN=$$(cat /run/secrets/admin-token)'
|
||||
restart: unless-stopped
|
||||
|
||||
init-influx:
|
||||
image: influxdb:3-core
|
||||
restart: "no"
|
||||
depends_on:
|
||||
influxdb:
|
||||
condition: service_healthy
|
||||
secrets:
|
||||
- admin-token
|
||||
entrypoint: |
|
||||
/bin/sh -c '
|
||||
influxdb3 create database \
|
||||
--host "http://influxdb:$${INFLUX_PORT:-8181}" \
|
||||
--token "$$(cat /run/secrets/admin-token)" \
|
||||
provence || echo "Database provence already exists"
|
||||
'
|
||||
|
||||
volumes:
|
||||
influxdb3_data:
|
||||
|
||||
secrets:
|
||||
admin-token:
|
||||
file: ./secrets/admin-token.txt
|
||||
Reference in New Issue
Block a user