This section contains instructions for configuring the Storage Integration on The Things Stack Enterprise distributions.
Note:The Storage Integration is already configured on The Things Stack Cloud and Community Edition distributions. To enable and use the integration for specific Applications, follow the instructions in the Enable/Disable and Retrieve Messages sections.
The Storage Integration requires configuration for the underlying storage provider used, along with a few options for tuning performance and memory usage.
You can configure PostgreSQL, or any other PostgreSQL-compatible database (e.g. TimescaleDB). A base-line configuration can be found below. Add the following section into your existing
ttn-lw-stack.yml configuration file. See Storage Integration Options for more details.
Note:This will use the same database instance that is used for the Identity Server as well. In production deployments, this should be a different database.
The Storage Integration has special configuration options for TimescaleDB, that are set as flags when the database is initialized:
--timescaledb.chunk-time-interval- this configures the chunk time interval. It accepts values in hours, and is set to
168hours by default.
--timescaledb.retention-days- this sets the number of days for the retention policy. It accepts values in days, and is set to
30days by default.
--timescaledb.enable-retention-policy=false- this enables or disables the retention policy for TimescaleDB. If enabled, data older than the retention-days will be deleted.
Warning:The last configuration option will have immediate effect and delete messages older than the retention-days value.
Initialize the configured database with:
ttn-lw-stack storage-db init
If you are using TimescaleDB, as mentioned in the TimescaleDB Options section above, the following configuration options are also available:
--timescaledb.chunk-time-interval --timescaledb.enable-retention-policy --timescaledb.retention-days
If you are using Docker Compose to run The Things Stack (as shown in Installing The Things Stack guide), initialize the configured database with:
docker-compose run --rm stack storage-db init
If everything went well, upon restart, you should be able to see the following log message:
INFO Initialized Storage Integration namespace=applicationserver/io/packages/storage provider=postgres