Skip to main content
It exposes an HTTP API for client interaction. See the InfluxDB documentation for more information.

Supported versions

You can select the major and minor version. Patch versions are applied periodically for bug fixes and the like. When you deploy your app, you always get the latest available patches.

Deprecated versions

The following versions are still available in your projects, but they’re at their end of life and are no longer receiving security updates from upstream. To ensure your project remains stable in the future, switch to a supported version. See more information on how to upgrade to version 2.3 or later.

Relationship reference

For each service defined via a relationship to your application, Upsun automatically generates corresponding environment variables within your application container, in the $<RELATIONSHIP-NAME>_<SERVICE-PROPERTY> format. Here is example information available through the service environment variables themselves, or through the PLATFORM_RELATIONSHIPS environment variable.
You can obtain the complete list of available service environment variables in your app container by running upsun ssh env.Note that the information about the relationship can change when an app is redeployed or restarted or the relationship is changed. So your apps should only rely on the service environment variables directly rather than hard coding any values.

Usage example

1. Configure the service

To define the service, use the influxdb type: Note that changing the name of the service replaces it with a brand new service and all existing data is lost. Back up your data before changing the service.

2. Define the relationship

To define the relationship, use the following configuration:
You can define SERVICE_NAME as you like, so long as it’s unique between all defined services and matches in both the application and services configuration.The example above leverages default endpoint configuration for relationships. That is, it uses default endpoints behind the scenes, providing a relationship (the network address a service is accessible from) that is identical to the name of that service.Depending on your needs, instead of default endpoint configuration, you can use explicit endpoint configuration.With the above definition, the application container now has access to the service via the relationship SERVICE_NAME and its corresponding service environment variables.

Example configuration

Use in app

To use the configured service in your app, add a configuration file similar to the following to your project. This configuration defines a single application (myapp), whose source code exists in the <PROJECT_ROOT>/myapp directory.
myapp has access to the influxdb service, via a relationship whose name is identical to the service name (as per default endpoint configuration for relationships).
From this, myapp can retrieve access credentials to the service through the relationship environment variables.
myapp/.environment
# Set environment variables for common InfluxDB credentials.
# For more information, please visit https://docs.upsun.com/development/variables.html#service-environment-variables.
export INFLUX_USER="${INFLUXDB_USERNAME}"
export INFLUX_HOST="${INFLUXDB_HOST}"
export INFLUX_ORG="$(echo "$INFLUXDB_QUERY" | jq -r '.org')"
export INFLUX_TOKEN="$(echo "$INFLUXDB_QUERY" | jq -r '.api_token')"
export INFLUX_BUCKET="$(echo "$INFLUXDB_QUERY" | jq -r '.bucket')"
The above file — .environment in the myapp directory — is automatically sourced by Upsun into the runtime environment, so that the variable INFLUX_HOST can be used within the application to connect to the service. Note that INFLUX_HOST, and all Upsun-service environment variables like INFLUXDBDATABASE_HOST, are environment-dependent. Unlike the build produced for a given commit, they can’t be reused across environments and only allow your app to connect to a single service instance on a single environment. A file very similar to this is generated automatically for your when using the upsun ify command to migrate a codebase to Upsun.

Export data

To export your data from InfluxDB, follow these steps:
  1. Install and set up the influx CLI.
  2. Connect to your InfluxDB service with the Upsun CLI:
    upsun tunnel:single
    
    This opens an SSH tunnel to your InfluxDB service on your current environment and produces output like the following:
    SSH tunnel opened to <VariableBlock name="RELATIONSHIP_NAME" /> at: http://127.0.0.1:30000
    
  3. Get the username, password and token from the relationship by running the following command:
    upsun relationships -P <VariableBlock name="RELATIONSHIP_NAME" />
    
  4. Adapt and run InfluxDB’s CLI export command.
    influx backup --host <VariableBlock name="URL_FROM_STEP_2" /> --token <VariableBlock name="API_TOKEN_FROM_STEP_3" />
    

Upgrade to version 2.3 or later

From a previous 2.x version

From version 2.3 onward, the structure of relationships changes. If you’re using a prior 2.x version, your app might currently rely on pulling the bucket, org, api_token, or user values available in the PLATFORM_RELATIONSHIPS environment variable. If so, to ensure your upgrade is successful, make the following changes to your connection logic:
  • Rename the user key to username.
  • Move the org, bucket and api_token keys so they’re contained in a dictionary under the query key.
If you’re relying on any other attributes connecting to InfluxDB, they remain accessible as environment variable from the service environment variable, aside from those addressed above:

From a 1.x version

From version 2.3 onward, InfluxDB includes an upgrade utility that can convert databases from previous versions to version 2.3 or later. To upgrade from a 1.x version to 2.3 or later, change the service version in your .upsun/config.yaml file and push your project. Any existing data you had in your 1.x system is automatically upgraded for you into the 2.3+ system.
During an upgrade from a 1.x version to a 2.3 version or later, a new admin password and a new admin API token are automatically generated. Previous credentials can’t be retained.You can retrieve your new credentials through the service environment variables.
Last modified on March 10, 2026