Database Migration from DMC Demo Mode to Production Mode

For customers wishing to move from Demo Mode to Production Mode, use the steps in this section to ensure there is no data loss during your conversion.

Part 1: Backup existing database and some cluster.config properties in Demo Mode

  1. Login to the Demo Mode instance
  2. If DMC is actively running, stop all services with the following command:
  3. Example: sudo datical-control service stop all

  4. If your Postgres database is running on the same server, start postgresql service with the following command:
  5. sudo datical-control service start postgresql
    OR
    See DMC production mode for instructions on installing Postgres on another machine.

  6. Execute pg_dump to backup the Liquibase Enterprise database.
  7. Example of pg_dump command run:

    <datical-service-install-dir>/postgresql13/bin/pg_dump 
    -F t datical > ~/datical_database_backup.tar

    pg_dump command option notes:
    -F argument selects the format of the output

    t argument is tar format of backup file

    datical argument is the default name of the database in demo mode

    > argument is to specify where backup file should be saved

    Note: Liquibase Enterprise will save the database backup to ~/datical_database_backup.tar file.

  8. Save the two properties listed below from the <datical-service-install-dir>/config/cluster.properties file.

    Tip: These properties will be added to a new configuration file on a new instance. This is covered in Part 3: Step 5 on this page.

    • datical.keycloak.internalPassword
    • datical.keycloak.internalClientSecret properties

Part 2: Re-install DMC in PROD mode, Create a Liquibase Enterprise database, and Create a User

Note: The backup database operates on “datical“ database and uses 'datical' user. These both have to exist for the pg_restore operation to run successfully in the next steps.

  1. Create a production mode database. Connect your Postgres database via a 3rd party tool such as pgAdmin. Find the steps to create a production mode database here: DMC production mode.
    Copy
    Create Database Example Commands
    CREATE DATABASE "datical"
        WITH OWNER = "datical"
        ENCODING = 'UTF8'
        CONNECTION LIMIT = -1;
  2. Then create a 'datical' database user.

    Note: This password for the datical user should be exactly the same as it was on the DEMO database.

    Copy
    Create user Example Command
    CREATE USER "datical" WITH PASSWORD '<password>';
  3. Re-install DMC in production mode in a different directory.

    Note: If you use the same directory you will not be able to select Production Mode.

  4. Use the same datical user and password that existed on DEMO mode.

Part 3: Restore backup and update properties in cluster config properties file

  1. Login to the Prod Instance that was created in Part 2, Step 3.
  2. If DMC is actively running, stop all services with the following three commands:
  3. sudo datical-control service stop proxy
    sudo datical-control service stop datical-service
    sudo datical-control service stop keycloak

  4. Copy the backup file and save it in a secure location. Ensure that the Demo Mode pg_dump backup taken in Part 1, Step 4 is in a secure location on the Production Mode instance.
  5. Execute pg_restore to populate the database using the Demo Mode data dump.
  6. Example of pg_restore command run:

    <datical-service-install-dir>/pg_restore -c -Ft -d datical < /home/datical/datical_database_backup.tar

    -c argument is to clean database before restore
    -F argument selects the format of the output
    t argument is tar format of backup file
    -d argument is to specify database name for restore
    < argument is to specify backup file location which will be used for restore

  7. Then you need to update datical.keycloak.internalPassword, datical.keycloak.internalClientSecret properties in <datical-service-install-dir>/config/cluster.properties file with values copied from Demo Mode.

    Tip: This is mentioned in Part 1: Step 5 at the top of this page.

  8. Start all services by running the three commands below to establish the DMC Production Mode successfully.
  9. sudo datical-control service start keycloak
    sudo datical-control service start datical-service
    sudo datical-control service start proxy

Warning: Both Demo Mode and Production Mode installations must be on the same DMC version in order to perform the migration. An older database instance may have a different table structure from newer tables which are required for keycloak, enterprise-service backend, or may not have some table structures at all.