Skip to main content

Connecting to Services

Beta

This feature is currently in beta and only available through nctl. Cockpit support is not yet implemented.

Deploio applications can connect to On-Demand Services such as databases and key-value stores by declaring service references on the application. Nine automatically injects the connection credentials as environment variables into the app at runtime.

Under the hood, Nine automatically creates and manages an encrypted ServiceConnection in the target service's project. No manual networking setup is required.

Supported Services

The following service types can be referenced from a Deploio application:

Add a Service Reference

Each service reference requires a destination (the service to connect to).

Coming soon

Managing service references in Cockpit is not yet available. We're currently working on the implementation. For now, please use nctl.

Injected Environment Variables

When service references are configured, Nine injects the connection details as environment variables into every instance of the application. Variable names use the format NINE_<IDENTIFIER>_<NAME>_<KEY>:

  • <IDENTIFIER> is a short code for the service type, such as KVS, PG, or MYSQL. Each table below shows the identifier for its service type.
  • <NAME> is the reference name you assign in --service <name>=... (the name part), uppercased with non-alphanumeric characters replaced by _. For example, the reference name cache becomes CACHE.
  • <KEY> identifies the connection detail, such as FQDN, PORT, or PASSWORD.

The variable names use the reference name you chose, not the target service's resource name. For example, --service cache=keyvaluestore/my-kvs produces variables like NINE_KVS_CACHE_FQDN — using cache, not my-kvs.

A new release is required

Adding or changing a service reference does not update a running instance on its own. Nine injects the variables only when a new release is created. If your change doesn't already produce a new release, trigger one by using the --retry-release function of nctl:

nctl update app my-app --retry-release

A new release redeploys the application: Deploio rolls out new instances with the updated environment and replaces the running ones. Expect a deployment cycle, and plan the change accordingly.

The available variables depend on the service type:

VariableDescription
NINE_KVS_<NAME>_FQDNHostname. Uses private networking DNS when private networking is configured; otherwise the public hostname.
NINE_KVS_<NAME>_PORTPort (always 6379).
NINE_KVS_<NAME>_USERUsername.
NINE_KVS_<NAME>_PASSWORDPassword.
NINE_KVS_<NAME>_CA_CERTCA certificate. Only injected when a CA certificate is present.

Verifying the Injected Variables

Coming soon

Viewing the injected variables in Cockpit is not yet available. We're currently working on the implementation. For now, please use nctl.