PortGate

Blueprints · Docker & Databases

Production 15 min · Docker

InfluxDB on localhost

Publishes InfluxDB on 127.0.0.1. Replace the password before the first start.

Why this should not be public

An InfluxDB 2.x instance that has not been set up lets the first visitor run the setup and become its admin. After setup, its API still writes and deletes your metrics.

Live config

Baked-in protections

Step 1 · yaml

Compose file

/opt/influxdb-loopback/compose.yaml

Written under the compose directory. It is not started. The image tag is the release this blueprint was checked with: look at the project's release notes and use the newest patched tag.

services:
  app:
    image: influxdb:2.7
    ports:
      - "127.0.0.1:8086:8086"
    environment:
      DOCKER_INFLUXDB_INIT_MODE: setup
      DOCKER_INFLUXDB_INIT_USERNAME: admin
      DOCKER_INFLUXDB_INIT_PASSWORD: change-me
      DOCKER_INFLUXDB_INIT_ORG: portgate
      DOCKER_INFLUXDB_INIT_BUCKET: app
    security_opt:
      - no-new-privileges:true
    restart: unless-stopped

Step 2 · bash

Start script

/opt/influxdb-loopback/up.sh

Review the image tag and the password, then run this yourself.

#!/bin/sh
set -eu
cd "/opt/influxdb-loopback"
if grep -q 'change-me' compose.yaml; then
  echo "Replace change-me before starting."
  exit 1
fi
docker compose up -d

Step 3 · bash

Read-only check

/root/portgate-blueprints/influxdb-loopback-check.sh

Prints status. It does not change the service.

#!/bin/sh
set -eu
if command -v docker >/dev/null 2>&1; then
  docker ps --format '{{.Names}} {{.Ports}}' || echo "Docker is installed but the daemon did not answer."
else
  echo "Docker is not installed. The compose file is staged only."
fi