Addons /

Using an Addon

Addons can be accessed by Combined or Deployment Services within the same Project.

important

Addons are not exposed publicly and can only interact with services in the same project.

Using an Addon in a Service

The use of an Addon will depend on the implementation in the application running on your Service. Your application should be configured to receive connection details from Environment Variables.

Example

You have service running a Node.js application that requires a persistent database, it gets a connection string from process.env.MONGODB_URI. You create a MongoDB Addon in the same Project for this purpose.

  1. Navigate to the Addons list and select the Addon
  2. Find and copy the the value of MongoSrv (a Connection string) in Connection details
Copy connection string
  1. Navigate to the Services list and select your Service
  2. Open the Environment page and enter your password if required
  3. Select Edit mode and click Add variable
  4. Enter the key used in your application in the Key field (in our case it is MONGODB_URI)
  5. Paste the value from MongoSrv into the Value field
Paste connection string
  1. Click Update & Redeploy to restart the Service with the new Environment Variable

Accessing an Addon

You can forward an Addon for local development using the Northflank CLI.

Use the CLI to access an Addon locally

  1. Install the Northflank CLI
  2. Ensure you have the necessary shell installed for the Addon you wish to access
  3. Log in on the Northflank CLI with a token that grants access to the Project containing the Addon
  4. Forward the port of the specific Addon, or forward all ports in the Project:
  • To forward a specific Addon:
northflank forward addon --project [project-name] --addon [addon-name]
  • To forward all ports:
northflank forward all

You can now connect to your Addon locally using the Admin connection string.

© 2021 Northflank Ltd. All rights reserved.

TermsPrivacy

contact@northflank.com