Skip to main content
Upsun projects already include a variety of managed services, so you don’t have to subscribe to an external cache or search-engine services. As these services are included in your project, you can manage them through Git. They’re backed up along with the rest of your project. You can add new services and manage existing service configurations from your .upsun/config.yaml file. For example, to add a MariaDB database engine to your Express project, complete the following steps:

1. Create a new branch for testing

To create a new branch, run the following command:
Terminal

2. Add a MariaDB service

Configure the MariaDB service by adding a database service to your .upsun/config.yaml file: To connect the service to your application (APP_NAME), add the following relationship: Commit your change:
Terminal
Upsun now reads your configuration files and deploys your project using default container resources. If you don’t want to use those default resources, define your own resource initialization strategy, or amend those default container resources after your project is deployed.

3. Connect to the service

To configure your Express app so it uses your new database, you need a Node.s module named mysql2. To install it, run the following command:
Terminal
Wherever your application code attemps to connect to the database service, Upsun will automatically generate environment variables containing connection credentials as a function of the relationship name. In this example, the MariaDB service access is granted to the application container via the relationship database. Upsun will therefore generate the variable DATABASE_HOST (among many others), using this name. Here’s an example of how this credential variable naming convention is used to connect to a MariaDB service:
index.js
Commit and deploy your changes:
Terminal

4. Merge to production

When satisfied with your changes, merge them to the main branch:
Terminal
You can adjust your project resources at any time.

5. Remove the feature branch

Then, remove the feature branch:
Terminal
When the environment:delete CLI command is run, the CLI suggests you deactivate and delete your add-mysql-database environment. Make sure you opt in.

Tips and Tricks

You can get your project’s relationship information using the following command:
Last modified on March 25, 2026