Using Managed Databases with the Resource Manager

Intro

Managed Databases are a fully managed, high performance database cluster service. Using managed databases is a powerful alternative to installing, configuring, maintaining, and securing databases by hand.
Managed databases are highly scalable, backed up every day automatically and offer zero downtime in an event of failure.

In this tutorial we will show you how to setup Managed Databases on Digital Ocean, but support for more providers is coming soon!

Creating a Database Cluster

Open the Resource Manager:

The first thing we need to do is to connect to the cloud provider.

Select Cloud Providers and add a new one:

We select Digital Ocean and add our API key, then click Connect:

Click OK when after you connect to the cloud provider:

Under the cloud provider right click Database Clusters:

And select Create New Database Cluster:

Add a name for the database cluster:

Select a database engine - we select MySQL:

Select the datacenter location:

And then select the cluster size from the dropdown:

Enter the number of the nodes to be used according to your needs. You can learn more about the nodes here: https://docs.digitalocean.com/products/databases/#high-availability

Click Create in order to create the database cluster:

You can see a loader showing that the cluster is being created:

It will take a few minutes to finish this and you can check the progress in the Digital Ocean control panel:

Creating Databases in the Cluster

Once our Database Cluster is created, we can create databases in it. A single cluster can contain multiple databases. When you create the cluster a default database is created:

We can have different databases per target, so let’s create two databases here. One for our development target and one for the production/live target. Right click Databases and select Create New Database:

We give it some meaningful name such as myproject_dev:

We do the same for the production databases:

We call it myproject_live:

And we are done. We’ve created a Database Cluster and added 2 databases inside it.

Assign Database per Target

The next step is to assign the dev databases to our development target and the live database to our production target. Open the project settings:

Select the Development target:

Scroll down to the Database section and select Cloud Database from the dropdown:

Select your database cluster:

And select the dev database we created:

Now switch to the Production Target:

And do the same, scroll down to the Database section, select Cloud Database and select your cluster:

Then select the live database:

Click Save and you are done:

A direct database connection will be created for each of the targets in the Database Manager:

Also, a Server Connect Database Connection will be created in the Server Connect Globals:

You can manage your Database Tables, Structure and Content in the Database Manager, just as you normally do with your database connections.

6 Likes

Awesome! Thank you so much!!

1 Like

This is really amazing thank you so much Wappler team

2 Likes

Absolutely incredible. Thank you

1 Like

Great stuff, and love to see that Linode has been added into the mix.

Do you know @George if you’ll be able to use the Wappler interface if you already have a Managed Database service created (with Linode for instance)? Or would it need to be created initially from Wappler in order for Wappler to manage it?

For now we only support Digital Ocean Managed Databases, soon there will be more providers added.

Yes you will be able to import existing provider database clusters, no need to be created in Wappler. You just import them for each project you want to use.

Thanks for the reply

This was music to my ears - I think I actually shouted out loud a bit when I read it earlier this week.

However, in my testing on new projects I wasn’t able to get this to work on Windows, Mac, or Ubuntu - I could set up the resources (such as a server or database cluster on DO).

I could select different cloud databases for Development and other targets, but that seemed to be all beyond seeing the items listed in the Resource Manager. Maybe I’m missing a step?

Thanks in advance :slight_smile:

(I did peek at the .json file for the project and see the entries in the resource manager section of the json, but there are no DB connections shown in the UI under globals or database manager.)

I’ve been thrilled with the updates to Wappler 5 and look forward to being able to use v5 in production soon!

PS - I wasn’t able to install beta 9 or 10 on Ubuntu 22.04 (the latest LTS). Dependencies fail as reported by others. It still works great on 20.04, though.!

Please report all issues you find in separate topics.

OK - done:

I’ve reported the new item here, although I’m not really sure it is an issue or if I don’t know how this feature is intended to work.

The Ubuntu dependency issue has been noted on another thread recently, so I added my experience there as well.

Very excited about the Wappler 5 features! One question regarding redis: if a site built previously on Wappler leveraging docker uses redis would that require two database clusters on DO if we were looking to migrate to DO database hosting? One cluster for MySQL and one for redis?

You can migrate just your MySQL database to managed database and leave the Redis in the docker as before.

1 Like