Use one of two database configurations to deploy Creatio:
-
Use a remote DBMS (recommended)
-
Use a local PostgreSQL server.
If you already have a PostgreSQL server running on the intended machine, skip to step II.
If you have set up sysadmin (with privileges to log in, create and modify databases) and public (unprivileged) user roles, skip to step III.
I. Install PostgreSQL
PostgreSQL is unavailable in most standard repositories. To install PostgreSQL on Linux:
-
Log in as root:
-
Add the PostgreSQL repository:
-
Import the signing key of the PostgreSQL repository:
-
Update the package lists:
-
Install PostgreSQL:
-
Log out from your root session:
II. Create PostgreSQL user
A fresh installation of PostgreSQL is not ready for deploying Creatio immediately. If you plan to use a fresh installation of PostgreSQL, you need to create a user that can log in to the database using a password and has sufficient privileges to create and update a database. By default, no such user will be available.
We recommend to create two database users in PostgreSQL:
-
A user with the “sysadmin” role, who has maximum access privileges on the database server level. This user will restore the Creatio database from a backup file and assign access permissions.
-
A user with the “public” role, whose permissions are limited. You will need this user to set up a secure connection to the restored Creatio database using PostgreSQL authentication.
If your PostgreSQL instance already has sysadmin (privileged) and public (unprivileged) user roles, skip this step.
To create PostgreSQL users:
-
Log in as postgres:
-
Open PostgreSQL shell:
-
Create a sysadmin user:
pg_sysadmin – user who will be granted sysadmin privileges. This user will restore the Creatio database from a backup file and assign access permissions
-
Make pg_sysadmin a system administrator:
-
Allow pg_sysadmin to log in:
-
Set a password for pg_sysadmin:
pg_password – sysadmin user password for connecting to the PostgreSQL server.
-
Create a public user:
pg_user – public user for connecting to the PostgreSQL server. You will need this user to set up a connection to the restored Creatio database.
-
Allow pg_user to log in:
-
Set a password for pg_user:
pg_password – public user password for connecting to the PostgreSQL server.
-
Exit the PostgreSQL shell:
-
Log out from your postgres session:
III. Restore PostgreSQL database
To restore a PostgreSQL database from a backup file, you will need psql and pg_restore utilities. Both are part of the postgresql-client-common package.
If you install postgresql-12 locally using apt-get, APT will install postgresql-client-common as a dependency for postgresql-12.
If you plan to use a remote PostgreSQL database without installing the PostgreSQL DBMS on your server, install the postgresql-client-common package manually by running:
To restore the Creatio database from a backup file:
-
Enter DB connection password in the environment variable:
pg_syspassword – pg_sysadmin user password for connecting to the PostgreSQL server.
-
Create a database where the backup data will be restored:
pg_server_address – PostgreSQL server address
pg_server_port – PostgreSQL server port
pg_sysadmin – sysadmin user for connecting to the PostgreSQL server
pg_dbname – name of the PostgreSQL DB where the instructions will be executed
pg_dbname_creatio – name of the PostgreSQL DB which will host Creatio tables
pg_user – the "public" user who will be granted permission to use and update the Creatio database
-
If you are using AWS RDS:
-
Download the ChangeTypesOwner.sql script.
-
In the script, replace the “postgres” value with a valid Postgres username.
-
Run the updated ChangeTypesOwner.sql script.
-
-
Navigate to the application directory:
/path/to/application/directory/ – the directory with Creatio setup files.
-
Navigate to the database directory:
-
Restore the database from the backup file:
pg_server_address – PostgreSQL server address
pg_server_port – PostgreSQL server port
pg_sysadmin – sysadmin user for connecting to the PostgreSQL server
pg_dbname_creatio – name of the PostgreSQL DB to insert backup tables. Use the name you specified in the "CREATE DATABASE" command on step 2.
-
Download the CreateTypeCastsPostgreSql.sql file.
-
Execute type conversion:
pg_server_ip – PostgreSQL server address
pg_server_port – PostgreSQL server port
pg_sysadmin – sysadmin user for connecting to the PostgreSQL server
pg_dbname_creatio – name of the PostgreSQL DB where the instructions will be executed
/path/to/CreateTypeCastsPostgreSql.sql – path to the CreateTypeCastsPostgreSql.sql file.
IV. Change the database owner (optional)
Creatio lets you replace the owner of the database and its objects to a non-administrator user (not a superuser) during the restoration. Use the ChangeDbObjectsOwner script for that. For Postgres version 10 and earlier: Download the script. For Postgres version 11 and later: Download the script.
To restore the database on behalf of a non-administrator user:
- Replace the database owner:
pg_server_port – PostgreSQL server port
pg_sysadmin – sysadmin user for connecting to the PostgreSQL server This user must be an administrator (superuser) or have the “ALTER DATABASE” privileges.
pg_user – the placeholder to replace with the actual username of the new database owner. You will need this user to set up a connection to the Creatio database.
pg_dbname_creatio – the name of the database whose owner is being changed. - Replace the owner of the database objects:
pg_server_port – PostgreSQL server port
pg_sysadmin – sysadmin user for connecting to the PostgreSQL server This user must be an administrator (superuser) or the Creatio database owner.
pg_user – the placeholder to replace with the actual username of the new database owner. You will need this user to set up a connection to the Creatio database.
pg_dbname_creatio – the name of the database whose owner is being changed.
/path/toChangeDbObjectsOwner.sql – the path to the previously saved toChangeDbObjectsOwner.sql file.
You can ignore this step. In that case, the user who ran the pg_restore command will remain the owner of the database and its objects. Normally, this is the postgres user.