Migrate databases#

After installing or upgrading the platform, you must perform the database migrations to initialize, configure, and bootstrap the platform databases.

This procedure consists of the following steps:

  • Export variable values to use them during the database migration.

  • Stop all platform services.

  • Initialize, perform, and validate the database migrations.

  • Start the platform services.

Export the platform admin user credentials#

Before begining the database migrations, set and export the platform admin user credentials:

  • Assign appropriate values to the variables, and then export them:

EIQ_ADMIN_USERNAME=admin
EIQ_ADMIN_PASSWORD=
EIQ_ADMIN_EMAIL=
  • EIQ_ADMIN_USERNAME: defines the user name of the user that is granted admin-level access rights to the platform.
    There must always be at least one platform admin user.
    You can change the default platform admin user name value.
    Default value: admin

  • EIQ_ADMIN_PASSWORD: defines the password associated with the platform admin user.
    For more information, see Password guidelines and limitations

  • EIQ_ADMIN_EMAIL: defines a valid email address associated with the platform admin user.
    The platform sends automated messages and notifications to this email address.

Set the platform CLI#

The platform command line interface includes a set of tools and utilities to support system administrators with platform setup, configuration, and management tasks.

  • Assign the path of the platform command line interface to the variable.
    This makes it easier to invoke the command line tool in the bash session:

eiq_platform=/opt/eclecticiq-platform-backend/bin/eiq-platform
  • eiq_platform: leave as is/do not change it.
    Defines the predefined path value to the platform command line interface tool.

Stop the services#

  • Stop all platform services:

# Stop all platform services
systemctl stop eclecticiq-platform-backend-services
systemctl stop eclecticiq-platform-backend-workers

Set the secret key#

  • Start and enable the secret setter service to set the platform secret key:

# Start and enable the secret setter service
systemctl start eclecticiq-secrets-setter
systemctl enable eclecticiq-secrets-setter

Run data migrations#

  • Migrate the PostgreSQL database:

# Migrate the PostgreSQL database
$eiq_platform database upgrade
  • After migrating the PostgreSQL database, proceed to load the database fixtures:

# Load the fixtures
$eiq_platform database load-fixtures
  • Migrate the Elasticsearch database:

# Migrate the Elasticsearch database
yes | $eiq_platform search upgrade
  • After migrating the Elasticsearch database, proceed to install the Kibana dashboards:

# Install the Kibana dashboards
$eiq_platform search install-dashboards
  • After installing the Kibana dashboards, proceed to validate the Elasticsearch upgrade to make sure it completed correctly:

# Validate search functionality
$eiq_platform search validate
  • Then, upgrade the Neo4j graph database:

# Upgrade the Neo4j database
$eiq_platform graph upgrade
  • Finally, configure Statsite, and load the Statsite mapping template:

# Configure Statsite mapping
es_url=$(< /etc/eclecticiq/platform_settings.py grep SEARCH_URL | grep -o "[a-z]\+://[^']\+" | head -1)
curl -X POST -H "Content-Type: application/json" ${es_url}/_index_template/statsite-template -d @/opt/statsite/etc/elasticsearch_template.json

Start and enable the services#

As a last step after completing the database upgrade process, start the platform services.

  • Run this command to start the platform services, and to enable them to automatically start at system boot:

# start/enable platform services
systemctl start eclecticiq-platform-backend-services
systemctl enable eclecticiq-platform-backend-services

The database migration process is completed.