Skip to main content
Version: Next

Creating the repository database

During the initial setup, you must create the database structure required by the application. Before proceeding, ensure that the application server can successfully connect to the database server.

Creating the repository database and user

Follow the steps below to create a database and user.

MySQL or MariaDB

Use fallowing SQL to create a repository database and user on MySQL and MariaDB databases.

CREATE DATABASE executor_prod;

ALTER DATABASE executor_prod DEFAULT CHARSET=utf8 COLLATE utf8_general_ci;

GRANT ALL PRIVILEGES
ON executor_prod.*
TO 'executor_user'@<host_ip_address>
IDENTIFIED BY <strong_password>;

PostgreSQL

Use fallowing SQL to create a repository database and user on PostgreSQL database

-- 1. Create database with UTF-8 settings
CREATE DATABASE executor_prod
ENCODING 'UTF8'
LC_COLLATE 'en_US.utf8'
LC_CTYPE 'en_US.utf8'
TEMPLATE template0;

-- 2. Create user
CREATE USER executor_user WITH PASSWORD <strong_password>;

-- 3. Grant database privileges
GRANT ALL PRIVILEGES ON DATABASE executor_prod TO executor_user;

-- 4. Grant table + sequence privileges in schema
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO executor_user;
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO executor_user;

-- 5. Future default privileges
ALTER DEFAULT PRIVILEGES IN SCHEMA public
GRANT ALL ON TABLES TO executor_user;

ALTER DEFAULT PRIVILEGES IN SCHEMA public
GRANT ALL ON SEQUENCES TO executor_user;

Configure the database connection

To configure the database connection settings, edit the DATABASE_URL parameter located in:

/etc/executor/executor-api.env

Example PostgreSQL connection string:

DATABASE_URL="postgresql://<username>:<password>@<host>:<port>/<database_name>?schema=<schema_name>"

-- Example MySQL connection string:
DATABASE_URL="mysql://<username>:<password>@<host>:<port>/<database_name>"

Running the database migration

During the first installation, you must run a database migration to create the required tables and internal structures.

Execute the following command:

sudo sh /opt/executor/api/scripts/migrate.sh
warning

Do not run this step if the migration has already been executed. Running the migration multiple times may cause unexpected issues.

During this process:

  • The database connection is tested
  • The migration scripts are executed to set up the schema

Execute first-run script

The first-run script is an essential utility that initializes your Executor API environment after the initial installation. It performs critical setup tasks such as:

  • Creating the initial admin or system user
  • Setting up required database tables and relationships (via migrations)
  • Creating system jobs or default workflows required by Executor API

This script ensures that your application is ready to operate immediately after installation.

How to run

To execute the first-run setup, use:

sudo sh /opt/executor/api/scripts/first-run.sh
info
  • The script is idempotent: it will skip steps if they have already been performed.
  • It reads the database configuration from /etc/executor/executor-api.env
  • If the environment variable is missing, the script will exit safely without making changes.

By following these steps, your Executor API installation will be fully operational with all required system defaults properly configured.