Skip to content
Ernestas Kulik edited this page Apr 1, 2020 · 3 revisions

This guide will show you how to set up a database for FAF from scratch if you are not familiar with any of the database engines. If you need an advanced database setup, you most likely know how to do it. The only requirements on FAF side are a read-write database and an appropriate RFC1738-formatted URL in /etc/faf/faf.conf (Storage section, ConnectString option).

PostgreSQL

PostgreSQL is the preferred (and best tested) database engine. You need to install postgresql-server, postgresql, python-psycopg2 and postgresql-semver packages:

# dnf install postgresql-server postgresql python-psycopg2 pg-semver

Next you need to initialize the postgresql database:

# postgresql-setup --initdb --unit postgresql

Then start (and enable) the service:

# systemctl enable --now postgresql

When the database enging is running, you need to create a user and an actual database for FAF. Become postgres user and use the command line utility psql to do that. Type in the following commands:

CREATE USER faf;
CREATE DATABASE faf;
GRANT ALL PRIVILEGES ON DATABASE faf TO faf;

As the faf user in the faf database CREATE EXTENSION semver; (you might need to make the faf user superuser: ALTER USER faf WITH superuser;)
If everything works you should see something like this:

# sudo -u postgres psql
psql (9.2.4)
Type "help" for help.

postgres=# CREATE USER faf;
CREATE ROLE
postgres=# CREATE DATABASE faf;
CREATE DATABASE
postgres=# GRANT ALL PRIVILEGES ON DATABASE faf TO faf;
GRANT
postgres=# \q

# sudo -u faf psql
psql (9.2.4)
Type "help" for help.

postgres=# CREATE EXTENSION semver;
CREATE EXTENSION
postgres=# \q

As PostgreSQL defaults to ident authentication, which will map unix user names into PostgreSQL user names, unix user faf has now all required privileges on faf database. The last thing you need to do is update the /etc/faf/faf.conf file. Under Storage section, there is ConnectString option, which in this case should equal to
postgresql:///faf
This is the default, so if you did not touch the default config at all, there is a high chance it will work without touching /etc/faf/faf.conf.

MySQL / MariaDB

Despite their high popularity, FAF is not able to run on neither MySQL nor MariaDB at the moment. The first reason is the lack of a semantic versioning extension. Also, there are several engine-specific limitations that FAF does not respect (64K maximum row size, 768B maximum primary key size, and probably more of them). Although we would like to add the support, the issue has a quite low priority. Anybody interested in porting FAF to MySQL / MariaDB is welcome.

SQLite

SQLite is not supported due to the lack of a semantic versioning extension.

Clone this wiki locally