Initialize database using Docker
The purpose of this tutorial is to show how to initialize a database MariaDB required for Soffid IAM installation.installation using Docker.
Prerequisites
FirstYou ofshould all,create a Docker network, that network allows you souldto installconnect acontainers database required into the Soffidsame IAMbridge installation.network to communicate:
The
sudo supporteddocker databasesnetwork are:create -d MySQL bridge MariaDB
PostgreSQL
Oracle
Microsoft SqlServer
NETWORK_NAME
MySQL/MariaDB
First step will be initialize MariaDB with Docker, in this case we attach the container to an exist network:
sudo docker run -d --name mariadb-service --network=NETWORK_NAME -e "MYSQL_ROOT_PASSWORD=ADMIN_PASSWORD" mariadb
Then, you must connect to the created docker:
sudo docker exec -i -t ID_CONTAINER /bin/bash
In order to configure MySQL database you need access to the database administration tool (mysql) with superuser permissions using a TCP/IP connection. If needed, please create a user for the Soffid installation. If you don't have such a user, or don't know its password, please access MySQL as root, execute the mysql tool and create the user with grant command (where ADMIN_USER is the user to be used during the installation process to create the soffid repository database and ADMIN_PASSWORD is the required password).
use soffid; grant all privileges on *.* to ADMIN_USER@localhost identified by 'ADMIN_PASSWORD' with grant option; |
In addition, in order to be able to manage big files, like process definition or software addons, we have to modify max_allowed_packet parameter on MySQL. This parameter is commonly allocated on the /etc/mysql/my.cnf file.
[mysqld] max_allowed_packet=128M |
If the version of MariaDB is 10.1.38, or newer, the recommended value for max_allowed_packet is 512M
Note: in the case we will obtain the next 'The size of BLOB/TEXT data inserted in one transaction is greater than 10% of redo log size. Increase the redo log size using innodb_log_file_size.' error trying to upload an addon, we may update the default value of this mysql/mariadb parameter. This parameter is commonly allocated on the /etc/mysql/my.cnf file.
[mysqld] innodb_log_file_size=256M |
If you are installing on a Ubuntu 18.04 server, default character set is set to utf8mb4. Using this character set can cause problems, as many index sizes will exceed maximum key size of 767 bytes. To prevent this problem, change following settings:
[mysqld] character-set-server = Latin1 collation-server = Latin1_general_ci |
Alternatively, if UTF character set is required, write the following settings:
[mysqld] character-set-server = utf8mb4 collation-server = utf8mb4_general_ci innodb_large_prefix = 1 innodb_file_format = Barracuda innodb_file_per_table = 1 |
Following this link you will find the steps to setup a two nodes database cluster.
Video Tutorial
MariaDB initialization using Docker
MariaDB initialization in Kubernetes
Oracle
A new database instance should be created. Optionally two tablespaces should be created (SOFFID_DATA and SOFFID_INDEX) to separate soffid tables and indexes.
|
To create the tablespace is necessary to provide the full path name, its size and MANAGEMENT AUTOALLOCATE option. The autoallocate option is needed because the tables are not sized by database creation scripts. Also, the Oracle Listener must have a TCP/IP port accepting connections.
Microsoft SQLServer
You must enable the SQL Server Browser Service at startup and the authentication method have to be set to “SQL Server and Windows Authentication mode”.
In addition, you must ensure that 'READ_COMMITTED_SNAPSHOT" parameter is enabled, you can do so with the following command:
|