Create Project and Access Hub Central
Before you begin
You need:
- Java JRE (OpenJDK) 8
- MarkLogic Server (See Version Compatibility.)
- Gradle 6.4 up to the latest 6.x release
Procedure
- Create a directory for your Data Hub project. This directory will be referred to as "your project root" or simply "root".
- Open a command-line window, and go to your project root directory.
- 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. - Initialize your Data Hub project.
gradle hubInit -i
- Create a JSON file to store a Hub Central user in the your-project-root/src/main/ml-config/security/users directory.
Example JSON file contents for the hub-central-developer role:
{ "user-name": "user-name", "description": "description", "password": "password", "role": [ "hub-central-developer", "data-hub-developer", "pii-reader" ] }
Important: MarkLogic recommends using a JSON file to store new users, not existing users. If you supply the name of an existing user, such as the MarkLogic Server admin, be aware that roles specified 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. - Specify the username and password for the Data Hub plugin to use when communicating with MarkLogic Server. See Set the Security Credentials Using Gradle.
- Deploy your Data Hub project to a Data Hub instance.
gradle mlDeploy -i
- Download the marklogic-data-hub-central-VERSION_NUMBER.war file.
- 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.Note: If you are using both QuickStart and Hub Central, there will be a port conflict on port 8080. - To use the default port number for the internal web server (port 8080):
What to do next
- 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.