Databases

Creating a database in Futrou v1.

You can run several database systems on a Serverlet. They are pre-installed and ready to use, and you manage each of them from the administration.

Supported databases

DatabaseUse
RedisA fast key-value database suitable for caching as well as primary data storage.
MariaDBA relational database, a fork of MySQL.
PostgreSQLAn advanced open-source relational database.
MongoDBA NoSQL document database.

Create the database in the Serverlet administration and put the credentials into your application’s configuration. Keep secrets out of your source code. When migrating, first create the service, import the data, and only then switch the connection details in the application.

MariaDB

MariaDB is an open-source relational database system, a fork of MySQL. It provides MySQL compatibility along with further improvements; it suits web applications, e-shops, and projects that need reliable relational data.

First use

MariaDB is disabled by default on a new Serverlet. Enable it in the administration on the Software card, or through the terminal:

bash
app enable mariadb
app start mariadb

Enabling MariaDB in the administration

Creating and managing databases

You create a new database and user account in the administration on the Databases card.

MariaDB management in the administration

From SSH, use the Futrou DB Manager:

text
db mariadb list
db mariadb add {database_name} {password}
db mariadb update {database_name} {new_password}
db mariadb del {database_name}

For example, db mariadb add my_db secret_password creates the database, the user, and the password. You connect to the database with the mysql command, or mysql -D database_name. The configuration is in /srv/config/mariadb/; the main file is my.cnf.

PostgreSQL

PostgreSQL is an advanced open-source relational database system. It suits demanding applications that need complex queries, high reliability, and transactional integrity.

First use

PostgreSQL is disabled by default. Enable and start it in the administration or over SSH:

bash
app enable postgresql
app start postgresql

Enabling PostgreSQL in the administration

Creating and managing databases

You add a database and a user in the administration on the Databases card.

PostgreSQL management in the administration

In the terminal, use the Futrou DB Manager:

text
db postgresql list
db postgresql add {database_name} {password}
db postgresql update {database_name} {new_password}
db postgresql del {database_name}

For example: db postgresql add my_db secret_password. To work in the console use psql, or psql -d database_name. The configuration is in /srv/config/postgresql/, the main file is postgresql.conf.

MongoDB

MongoDB is a NoSQL document database that stores data in BSON (Binary JSON) format. It suits applications with unstructured or semi-structured data, a flexible schema, and a need for horizontal scaling.

First use

MongoDB is disabled on a new Serverlet. Enable it on the Software card or with the commands:

bash
app enable mongodb
app start mongodb

Enabling MongoDB in the administration

Creating and managing databases

You create a new database and user account in the administration on the Databases card.

MongoDB management in the administration

From SSH, use the DB Manager:

text
db mongodb list
db mongodb add {database_name} {password}
db mongodb update {database_name} {new_password}
db mongodb del {database_name}

For example, db mongodb add my_db secret_password. Use mongosh to connect. The MongoDB configuration is in /srv/config/mongodb/mongod.conf.

Redis

Redis is a very fast key-value database. You can use it as a cache or even as primary data storage.

First use

Redis is disabled on a new Serverlet. Enable and start it in the administration or over SSH:

bash
app enable redis
app start redis

Enabling Redis in the administration

Control and configuration

Control Redis with the redis-cli command. The configuration is in /srv/config/redis/redis.conf. By default Redis has no password set and listens on TCP port 6379; set up appropriate security before exposing the service outside the Serverlet.

Last updated