.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 adatabase service to your .upsun/config.yaml file:
To connect the service to your application (APP_NAME), add the following relationship:
Commit your change:
Terminal
3. Connect to the service
To configure your Express app so it uses your new database, you need a Node.s module namedmysql2.
To install it, run the following command:
Terminal
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
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.