Skip to main content

Database Providers

Database is an integral part of any application. DOM Cloud provides a free, opt-in MariaDB and PostgreSQL database instance for every website in every tier.

Initializing the Database

Databases is opt-in, disabled by default. To enable it, go to deploy tab and execute one of these:

features:
- mysql
features:
- postgresql

See the section in MariaDB or PostgreSQL for more information.

To view and edit the database using online tools, use PhpMyAdmin or PhpPgAdmin. Both available from manage tab.

info

You can't create or drop database from PhpMyAdmin, PhpPgAdmin or any external database client. You have to do that from Webmin UI or deployment script.

Using the Database

After activating the database, you can provide the database credentials to your app:

  • Hostname: localhost (because the database always live in the same server)
  • Username: Same username with server (see from manage tab)
  • Password: Same password with server (see from manage tab)
  • Database name: Usually username with suffix + _db unless you've created another DB
    • For example with username hello-world then database name will be hello_world_db
    • Check the correct database name from PhpMyAdmin or PhpPgAdmin
caution

Username and password is always different from the default. Don't assume root username with empty password will work for you.

Remote Access

Remote Access is used to manage databases using your local software -- such as DBeaver, HeidiSQL or TablePlus.

PostgreSQL permits remote access by default.

MySQL is more grained and doesn't allow remote access by default. You need to change it by go to the Webmin -> Databases -> Remote access then add %.%.%.% and %:%:% (next line above localhost) to allowed hosts list.

info

When connecting with Remote Access, the hostname is your website domain or the server's IP address, not localhost.

Timestamp

Our server always sets the clock in UTC.

A good idea to handle timezone is done by client processing (Javascript), both after getting the data from database/AJAX and before sending data/Posts to server.

If you don't care about timezone and you think it's safe to assume that your website is only accessed in one timezone, you can set the timezone in the backend using date_default_timezone_set for PHP or TZ env for non-PHP (set it to passenger's env_var_list).

Other Database System

Only three database system is supported: MariaDB, PostgreSQL, SQLite. For caching we recommend you to leverage filesystem.

You can also use third party databases that's also cheap (or even free) such as Redis Labs, Firebase Firestore or MongoDB Atlas, just make sure the cluster is close enough within our server.

If you wish to spin up a custom database server, you might be better deploy your website using docker.