# InfluxDB

> Time series: metrics, sensor readings and events

Time series: metrics, sensor readings and events, written and queried by time.
InfluxDB 2, queried with Flux or InfluxQL, beside your database rather than in
place of it.

Your application finds it at `INFLUXDB_URL` (`INFLUXDB_HOST`, port 8086), with
the organisation in `INFLUXDB_ORG`, a first bucket in `INFLUXDB_BUCKET` and an
operator token in `INFLUXDB_TOKEN`, which is what its client libraries are
configured with. All of them are in its [environment](variables.md). The token
is made for each environment and never changes; make more buckets, and tokens
of their own for other readers, through its API.

```php
$client = new InfluxDB2\Client([
  'url' => getenv('INFLUXDB_URL'),
  'token' => getenv('INFLUXDB_TOKEN'),
  'org' => getenv('INFLUXDB_ORG'),
  'bucket' => getenv('INFLUXDB_BUCKET'),
]);
```

Its data is kept on the machine's own disk and survives a restart. It is
**in the nightly backup**, beside your database and files: what `influx
backup` writes, kept offsite, and restored from the environment's
**Backups** tab with its users and tokens ([Backups](backup-storage.md)).
Moved to another machine, its data goes with it
([what a move costs](upgrade.md#what-each-move-costs-in-downtime)).
It needs at least 1 GB of its machine's memory (see
[what each service needs](stacks.md#what-each-service-needs)).

The platform turns off what reaches outside the container: usage statistics
to InfluxData, templates fetched from a URL, and requests from tasks to
private addresses.

From your own computer — the web interface, a desktop client — `vallic tunnel <env> influxdb` opens it on `http://127.0.0.1:8086`. See [Tunnels](shell.md#tunnels-to-your-services).

## Versions

| Version | Status |
| --- | --- |
| `2.9.1` | Supported, and the default |
| `2.8.0` | Supported |

Pin the version, not the build: name `2.9.1` and the platform matches it to the
current build, so a security rebuild reaches you without anybody editing a
repository.

The version you name is the one your environment runs from the next deploy.
This service keeps data, and not every version can read another's — before
you change it, read [Changing a service's version](service-versions.md).

## What you can change

In [`vallic.yaml`](configuration.md) — what each one does is on [Service settings](service-settings.md):

```yaml
services:
  - influxdb:
      version: '2.9.1'
      environment:
        INFLUXD_LOG_LEVEL: …
        INFLUXD_SESSION_LENGTH: …
        INFLUXD_SESSION_RENEW_DISABLED: …
        INFLUXD_QUERY_QUEUE_SIZE: …
        INFLUXD_INFLUXQL_MAX_SELECT_POINT: …
        INFLUXD_INFLUXQL_MAX_SELECT_SERIES: …
        INFLUXD_INFLUXQL_MAX_SELECT_BUCKETS: …
        INFLUXD_STORAGE_WRITE_TIMEOUT: …
```

Anything not on this list refuses the deploy, naming the variable — rather
than being accepted and quietly ignored.
