Database

The primary database used by InterDiode is PostgreSQL (from 14 to 18), MySQL (from 8.4 to 9.7) or MariaDB (from 10.11 to 12.3). It is used to store all the data related to users, permissions, resources, and transfers.

PostgreSQL is the default database and is recommended for production use due to its robustness, performance, and advanced features. MySQL and MariaDB are also supported as alternatives.

The database connection is configured using the DATABASE_URL environment variable.

If the database is hosted on a different server than InterDiode, make sure that the database server is accessible from the InterDiode server and that the necessary ports are open. An SSL/TLS connection is strongly recommended to secure communications between InterDiode and the database if they are hosted on different servers. SSL arguments can be passed in the database URL, as shown in the example below.

export DATABASE_URL=postgresql://username:password@hostname:port/database_name\
   ?ssl_check_hostname=true\
   &ssl_cert_reqs=required\
   &ssl_certfile=/secrets/localhost.crt\
   &ssl_keyfile=/secrets/localhost.key\
   &ssl_ca_certs=/secrets/CA.crt

SSL-related files must be mounted in all InterDiode Docker containers.

PostgreSQL Setup

Recommended settings for PostgreSQL include:

  • client_encoding: 'UTF8',

  • default_transaction_isolation: 'read committed',

  • timezone: 'UTC'.

Create a user and a database with UTF-8 charset and case-sensitive collation (C is a common collation for PostgreSQL) and grant all privileges on the database to the user created first.

CREATE ROLE "user-interdiode" WITH LOGIN PASSWORD 'password-interdiode';
CREATE DATABASE "database-interdiode" WITH OWNER "user-interdiode" ENCODING 'UTF8' LC_COLLATE 'en_US.UTF-8' LC_CTYPE 'en_US.UTF-8' TEMPLATE template0;
GRANT ALL PRIVILEGES ON DATABASE "database-interdiode" TO "user-interdiode";

MySQL/MariaDB Setup

Recommended settings for MySQL/MariaDB include to use the InnoDB storage engine, which is fully transactional and supports foreign key references.

Create a user and a database with UTF-8 charset and case-sensitive collation (utf8mb4_bin is a common collation for both MySQL/MariaDB) and grant all privileges on the database to the user created first.

SET old_passwords=0;
CREATE USER 'user-interdiode'@'%' IDENTIFIED BY 'password-interdiode';
CREATE DATABASE database-interdiode CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_bin';
GRANT ALL PRIVILEGES ON database-interdiode.* TO 'user-interdiode';
FLUSH PRIVILEGES;

Cache storage

InterDiode uses Redis (from 7.0 to 8.8) as a cache and queue storage.

The Redis connection is configured using the REDIS_URL environment variable.

If the Redis server is hosted on a different server than InterDiode, make sure that it is accessible from the InterDiode server and that the necessary ports are open. An SSL/TLS connection is strongly recommended to secure communications between InterDiode and the Redis server if they are hosted on different servers. SSL arguments can be passed in the Redis URL, as shown in the example below, using rediss:// protocol for secure SSL connections, and redis:// for plain, unsecure, connections.

export REDIS_URL=rediss://username:password@hostname:port/1\
   ?ssl_check_hostname=true\
   &ssl_certfile=/secrets/localhost.crt\
   &ssl_keyfile=/secrets/localhost.key\
   &ssl_ca_certs=/secrets/CA.crt