Kevin McGahey - October 16, 2018

Database Code Lines

The Elusive Bitnami System Database

If you want to spin up a fast API solution, DreamFactory is a great way to do that with a Bitnami install. Within minutes you can have a fully documented and secure REST API to utilize. Just like any program bundle, there are lots of features to learn and interact with.  Outside of a Docker Swarm or AWS ELB setup, it is pretty hard to find a way to spin up a DreamFactory instance faster. We are going to dive in a bit further to find out how to interact with the system database.

NOTE: If you change the schema or a setting inside of this database, the system may become unstable and lose some or all functionality.  This is only recommended for advanced users.

One feature that is hidden within the Bitnami install is the ability to see the system database that is managing your DreamFactory instance.  In the image below, the MySQL DreamFactory instance system database is shown.

DreamFactory System Database
GitHub Clone DreamFactory System Database

Inside of a Bitnami instance, things are different.  If you select the MySQL database that ships with the instance you will not see a schema.  Fear not,  there is an easy solution!

Bitnami MySQL Database Schema
Bitnami MySQL Database Schema – NOT The System DB Though

Understanding that there would be no way for you to log into the instance without a system database, let alone be able to see anything in the Schema tab, means it must be somewhere.  But where? The system database is not picked up by default as a service in Bitnami.  If you are interacting with the DreamFactory admin interface in any way at all, you have a properly configured system database.

Where is the System Database, and How Do I Get There?

To interact with the system database in Bitnami, you just need to take a look at your .env file.  This file is located inside of the htdocs folder, which is inside of the install path (this can be seen on the config tab). The system database credentials will be in the Database Settings section. Bitnami names the system database by default something similar to bitnami_dreamfactory or bn_dreamfactory.

You will notice that you can access the system database endpoints regardless of not being able to change the schema in the Schema tab.  If you migrate to one of the system endpoints in the API docs tab, the info will still be returned as normal.  Below is an example of the GET /system/environment endpoint in my local Bitnami instance:

Insomnia Bitnami System Environment
Insomnia Bitnami System Environment Endpoint

Under the Services tab, you can create a new MySQL database service and use the credentials from your .env file to add the system database to your API Docs and Schema tabs, so that you can interact with them. With the discovery of the system database available you can now see full Swagger documentation.  Furthermore, you can interact with the endpoints as normal. For example, you can use the endpoint GET /_schema to see the schema as shown below.

Bitnami MySQL System Database Schema Call
Bitnami MySQL System Database Schema Call

From there you can run amok in the system database.  Again, one last warning, please realize that if you are not careful, you might CRUD your way into a non-functioning system.  The bright side to that as we said up top…you can just spin up another and that my friends, is the beauty of Bitnami.

Related reading: Synchronizing Database Data Using An API