Database Providers
Database is an integral part of any application. DOM Cloud provides a free, opt-in MariaDB 10.11 and PostgreSQL 16.4 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.
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 behello_world_db
- Check the correct database name from PhpMyAdmin or PhpPgAdmin
- For example with username
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.
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
).
Supported PostgreSQL Extensions
These optional PostgreSQL extensions can be activated using CREATE EXTENSION
clause on a given database:
Extension Name | Description | Link |
---|---|---|
btree_gin | Provides support for GIN (Generalized Inverted Index) indexing for B-tree data types. | Documentation |
btree_gist | Provides support for GiST (Generalized Search Tree) indexing for B-tree data types. | Documentation |
citext | A case-insensitive text data type extension. | Documentation |
cube | Provides data types and functions to support multidimensional cubes. | Documentation |
dict_int | Provides an example dictionary template for integers. | Documentation |
earthdistance | Provides functions for calculating great-circle distances between points on the Earth's surface. | Documentation |
fuzzystrmatch | Provides functions to perform "fuzzy" string matching, including soundex and levenshtein distance. | Documentation |
hstore | A key-value store within PostgreSQL, allowing you to store sets of key/value pairs within a single PostgreSQL value. | Documentation |
intarray | Provides support for indexed arrays of integers. | Documentation |
isn | Provides data types for various international standard numbers, such as ISBN, ISMN, and ISSN. | Documentation |
lo | Provides support for large objects within PostgreSQL. | Documentation |
ltree | Provides a data type for representing labels of data stored in a hierarchical tree-like structure. | Documentation |
pgcrypto | Provides cryptographic functions for PostgreSQL, including encryption, decryption, hashing, and more. | Documentation |
pg_trgm | Provides functions and operators for determining the similarity of text based on trigram matching. | Documentation |
plpgsql | PostgreSQL's procedural language for SQL, allowing for control structures, complex calculations, and error handling in SQL scripts. | Documentation |
seg | Provides a "seg" data type for representing line segments in two-dimensional space. | Documentation |
tablefunc | Provides functions for manipulating tables, such as crosstab functions. | Documentation |
tcn | Provides support for Triggered Change Notification, allowing for notification of changes in the database. | Documentation |
tsm_system_rows | A table sampling method that returns a specified number of rows. | Documentation |
tsm_system_time | A table sampling method that returns rows from a table based on the system time. | Documentation |
unaccent | Provides a dictionary and function to remove accents (diacritics) from strings. | Documentation |
uuid-ossp | Provides functions to generate universally unique identifiers (UUIDs). | Documentation |
pg_uuidv7 | Provides support for UUID version 7, a new type of universally unique identifier. | Documentation |
postgis | A spatial database extender for PostgreSQL, providing support for geographic objects. | Documentation |
postgis_raster | Extends PostGIS with raster data support, allowing the storage, query, and analysis of raster data types. | Documentation |
postgis_sfcgal | Extends PostGIS with advanced 3D capabilities provided by the SFCGAL library. | Documentation |
postgis_tiger_geocoders | Provides geocoding functions using the U.S. Census TIGER/Line data. | Documentation |
postgis_topology | Extends PostGIS with topology support, allowing the representation of topological structures. | Documentation |
address_standardizer | Standardizes address data for geocoding purposes. | Documentation |
address_standardizer_data_us | Provides US address data for the address standardizer extension. | Documentation |
pgrouting | Extends PostGIS with geospatial routing functionality. | Documentation |
timescaledb | An extension that provides scalable time-series data management built on PostgreSQL. | Documentation |
vector | A vector data type extension, useful for implementing machine learning models and similar functionalities. | Documentation |
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.