Create Project and Access Hub Central

Before you begin

You need:

Important: When you run the Deploy command, it automatically uploads a Template Driven Extraction (TDE) schema to the MarkLogic database. With Template Driven Extraction, you can convert documents to rows in MarkLogic and search for documents using SQL or the Optic API. View the TDE in the MarkLogic Server Query Console.

Procedure

  1. Create a directory for your Data Hub project. This directory will be referred to as "your project root" or simply "root".
  2. Open a command-line window, and go to your project root directory.
  3. In your project root directory, create a build.gradle file with the Grade Properties plugin setting and the Data Hub plugin setting.

    Copy the following to your build.gradle file and replace the com.marklogic.ml-data-hub version number with the Data Hub version that you are using.

       plugins {
          // Gradle Properties plugin
          id 'net.saliman.properties' version '1.4.6'
    
          // Data Hub plugin
          id 'com.marklogic.ml-data-hub' version 'VERSION_NUMBER'
      }
    
    net.saliman.properties Gradle Properties plugin Allows you to create different environments for your Gradle deployment and set up a gradle-env.properties file, where env is the environment name. When running a Gradle task, you can specify the target environment with the environmentName option. For more information, see https://github.com/stevesaliman/gradle-properties-plugin.
    com.marklogic.ml-data-hub Data Hub plugin Extends the ml-gradle plugin with Data Hub-specific commands.
  4. Initialize your Data Hub project.
    gradle hubInit -i
  5. Create a JSON file to store a Hub Central user in the your-project-root/src/main/ml-config/security/users directory.

    The following step will create a MarkLogic user for every user defined by files in this directory, overwriting if necessary. For developers, MarkLogic recommends the hub-central-developer role to start. Create a file named `hub-central-developer.json` from the following template:

     {
      "user-name": "user-name",
      "description": "description",
      "password": "password",
      "role": [
        "hub-central-developer",
        "data-hub-developer",
        "pii-reader"
      ]
    }
    
    Important: Because this process overwrites users, MarkLogic recommends choosing usernames not already in use. If you supply the name of an existing user, such as the MarkLogic Server admin, be aware that the roles in the JSON file will replace the roles already assigned to that existing user.
    Note: For additional details about Hub Central roles, see Default Hub Central Roles.
  6. Specify an existing username and password (ex. MarkLogic admin) for the Data Hub plugin to use when communicating with MarkLogic Server. See Set the Security Credentials Using Gradle.
  7. Deploy your Data Hub project to a Data Hub instance.
    gradle mlDeploy -i
  8. Download the marklogic-data-hub-central-VERSION_NUMBER.war file.
  9. Run the Hub Central .war.
    • To use the default port number for the internal web server (port 8080):
      java -jar marklogic-data-hub-central-VERSION_NUMBER.war
    • To use a few configured properties set using the command line; e.g., port 8020 used by the STAGING app server:
      java -jar marklogic-data-hub-central-VERSION_NUMBER.war --mlStagingPort=8020
    • To use many configured properties placed in a single external configuration file; e.g., gradle.properties file (single-environment gradle properties):
      java -jar marklogic-data-hub-central-VERSION_NUMBER.war --spring.config.additional-location=file:/path/to/project/gradle.properties
    • To use many configured properties placed in multiple external configuration files; e.g., gradle.properties and gradle-prod.properties files (multiple-environment gradle properties):
      java -jar marklogic-data-hub-central-VERSION_NUMBER.war --spring.config.additional-location=file:/path/to/project/gradle.properties,file:/path/to/project/gradle-prod.properties
      Important: The gradle.properties file should be set before the gradle-env.properties file. This ensures that environment-specific properties have priority over the other properties.

    For the full list of configurable properties, see Data Hub Properties.

    Note: If you are using Windows and a firewall alert appears, click Allow access.

What to do next

Learn how to Create a Flow Using Gradle.

Note: After the project is initialized, all project team members must use the Gradle wrapper in the initialized project to run Gradle tasks. This ensures that everyone uses the same version of Gradle.