Deploying an InfluxDB App
Introduction
InfluxDB is a high-performance time-series database with an HTTP API and UI. Deploying InfluxDB with a Dockerfile on Klutch.sh gives you reproducible builds, managed secrets, and durable storage for metrics—all from klutch.sh/app. This guide covers installation, repository prep, a production-ready Dockerfile, deployment steps, Nixpacks overrides, and best practices for secure, scalable observability data.
Prerequisites
- A Klutch.sh account (create one)
- A GitHub repository containing your InfluxDB configuration (GitHub is the only supported git source)
- Docker familiarity and basic knowledge of InfluxDB buckets, orgs, and tokens
- Adequate persistent storage for time-series data and WAL
For platform basics, see the Quick Start.
Architecture and ports
- InfluxDB serves HTTP on port
8086for both API and UI. - On Klutch.sh, choose HTTP traffic and set the internal container port to
8086. - If you expose additional TCP services (rare for InfluxDB), run them as separate Klutch.sh TCP apps; external TCP port is
8000. - Persistent storage is required for
/var/lib/influxdb2.
Repository layout
influxdb/├── config/ # Optional custom configs or init scripts├── Dockerfile # Must be at repo root for auto-detection├── README.md└── .env.example # Template only; no secretsKeep secrets out of Git; store them in Klutch.sh environment variables.
Installation (local) and starter commands
Quick local run for testing:
docker run --rm -p 8086:8086 \ -v $(pwd)/data:/var/lib/influxdb2 \ -e DOCKER_INFLUXDB_INIT_MODE=setup \ -e DOCKER_INFLUXDB_INIT_USERNAME=admin \ -e DOCKER_INFLUXDB_INIT_PASSWORD=StrongPass123! \ -e DOCKER_INFLUXDB_INIT_ORG=example-org \ -e DOCKER_INFLUXDB_INIT_BUCKET=example-bucket \ influxdb:2Optional start.sh for portability and Nixpacks fallback:
#!/usr/bin/env bashset -euo pipefailexec influxd runMake it executable with chmod +x start.sh.
Dockerfile for InfluxDB (production-ready)
Place this Dockerfile at the repo root; Klutch.sh auto-detects it (no Docker selection in the UI):
FROM influxdb:2.7
WORKDIR /app
# Optional: Copy custom configuration or scriptsCOPY config /etc/influxdb2
EXPOSE 8086CMD ["influxd", "run", "--engine-path", "/var/lib/influxdb2"]Notes:
- Pin the image tag for reproducible builds.
- If you mount TLS certs, place them via a volume and reference in your config.
Environment variables (Klutch.sh)
Set these in the Klutch.sh app settings (Secrets tab) before deploying:
DOCKER_INFLUXDB_INIT_MODE=setupDOCKER_INFLUXDB_INIT_USERNAME=adminDOCKER_INFLUXDB_INIT_PASSWORD=<strong-password>DOCKER_INFLUXDB_INIT_ORG=example-orgDOCKER_INFLUXDB_INIT_BUCKET=example-bucketDOCKER_INFLUXDB_INIT_ADMIN_TOKEN=<admin-token>INFLUXD_HTTP_BIND_ADDRESS=:8086
If you deploy without the Dockerfile and need Nixpacks overrides:
NIXPACKS_BUILD_CMD=go build -o influxd ./cmd/influxdNIXPACKS_START_CMD=./influxd run --engine-path /var/lib/influxdb2NIXPACKS_GO_VERSION=1.21
These keep InfluxDB compatible with Nixpacks defaults when a Dockerfile is absent.
Attach persistent volumes
In Klutch.sh storage settings, add mount paths and sizes (no names required):
/var/lib/influxdb2— required for data, WAL, and metadata./etc/influxdb2— optional if you want to persist custom configuration.
Ensure these paths are writable inside the container.
Deploy InfluxDB on Klutch.sh (Dockerfile workflow)
- Push your repository (with the Dockerfile at the root) to GitHub.
- Open klutch.sh/app, create a project, and add an app.
- Connect the GitHub repository; Klutch.sh automatically detects the Dockerfile.
- Choose HTTP traffic for InfluxDB.
- Set the internal port to
8086. - Add the environment variables above (setup credentials, org/bucket, admin token, and any
NIXPACKS_*overrides if you temporarily deploy without the Dockerfile). - Attach persistent volumes for
/var/lib/influxdb2(and/etc/influxdb2if desired), choosing sizes that fit your retention policy. - Deploy. Your InfluxDB instance will be reachable at
https://example-app.klutch.sh; add a custom domain if needed.
For companion services like Telegraf or Redis, create separate apps and connect via service URLs; TCP apps expose externally on port 8000.
Health checks and production tips
- Use the
/healthendpoint for monitoring. - Enforce HTTPS at the edge; forward HTTP to port 8086 internally.
- Rotate admin tokens and passwords regularly; keep them only in Klutch.sh secrets.
- Monitor disk usage on
/var/lib/influxdb2and resize before it fills. - Pin image and Go versions to avoid unexpected upgrades.
InfluxDB on Klutch.sh combines reproducible Docker builds with managed secrets, durable volumes, and flexible HTTP/TCP routing. With the Dockerfile at the repo root and ports set to 8086 for the app (8000 externally for TCP companions), you can run a reliable time-series database without extra YAML or workflow overhead.