marklogic-community / data-hub-central-community

Data Hub Central Community Edition (formerly Envision) provides a visual way to interact with and experience your true multi-model data hub. You can go from loading data, to integrating, exploring, validating, and exporting curated results using Envision's end to end components.
https://marklogic-community.github.io/data-hub-central-community/
Other
8 stars 12 forks source link

DHCCE initial execution expects MarkLogic on localhost #243

Closed sparnell closed 3 years ago

sparnell commented 3 years ago

Welcome Data Hub Central Community Edition enthusiast!

Let's get the most out of this ticket.

The issue

Initial execution of hub-central-community fails because it assumes MarkLogic is running on localhost and FINAL is available on port 8011.

What behavior are you expecting?

I was expecting the application to either honor the settings in application.properties (which seems to be missing a host property), or to read the DHF project's properties file before attempting to deploy code.

Tech details

Which Operating System are you using?

macOS Catalina (10.15.7) to host the project

Which version of MarkLogic are you using?

10.0-6.1

Which version of Data Hub are you using?

5.4.2

The devil is in the details...

Starting. Please wait...

modelsDir: /Users/sparnell/projects/dhf5/./conceptConnectorModels
Installing DHCCE Modules...

14:48:55.748 [main] ERROR o.s.boot.SpringApplication - Application run failed
java.lang.RuntimeException: Caught exception before writing was completed: java.net.ConnectException: Failed to connect to localhost/127.0.0.1:8011

application.properties

marklogic.username=admin
marklogic.password=admin
# note: marklogic.host is not in examples, but included to see if you jokers support it, but forgot to document it.
marklogic.host=reed
marklogic.port=8011
marklogic.managePort=8002
marklogic.adminPort=8001

gradle.properties

mlHost=reed
wpaven commented 3 years ago

@sparnell I'll have to test this. But you should be able to set mlHost in gradle.properties. The datahub project should be deployed prior to running CE.

sparnell commented 3 years ago

Regression maybe? Seems similar to this one: Not able to launch Envision

  1. Starting with empty directory, create build.gradle
  2. Execute gradle hubInit
  3. Edit gradle.properties, adding mlHost=remote host name
  4. Execute ./gradlew mlDeploy, confirm remote config
  5. Create application.properties as shown above
  6. Execute java -jar hub-central-community-5.4.2.jar

Result: fails almost immediately when attempting to connect to localhost port 8011

wpaven commented 3 years ago

did you try setting marklogic.host in application.properties? looking at the code, that should work. and yes, we should document it.

in your steps above, you may want to add a user with hub-central-developer role prior to deploying, this will be required for login. Otherwise appears correct.

Also, after setting marklogic.host in application.properties, execute jar as: java -jar -DforceInstall=true hub-central-community-5.4.2.jar

sparnell commented 3 years ago

Yes, I have set marklogic.host in application.properties. I may have a clue as to where the problem is. This is InstallService.java:

ManageClient manageClient = config.getManageClient();
AppDeployer appDeployer = 
    new SimpleAppDeployer(manageClient, config.getAdminManager(), 
        new DeployEnvisionModulesCommand(config.getModulesClient(), config.isMultiTenant()));

The ManageClient instance is getting configured from application.properties and has the required values set as expected. The DatabaseClient returned from config.getModulesClient() does not. The values appear to be from HubClientConfig.applyDefaultPropertyValues (localhost, etc.). When I run the application in a debugger, I'm not seeing any sign that these default values are being updated prior to the deployment command getting executed.

jheyssel commented 3 years ago

I have it up and running the way you describe. But, with initial connection error, also, and had to look at ML server logs to see that it was permissions. Often I find I don't have enough role-privileges assigned even to the admin user - admittedly not ideal ... my admin user had these and I successfully connected: "admin", "manage-admin", and "security"

I found I could use the "flow-developer" user found in gradle.properties and just cut and pasted user/pass into application.properties

I assume you know how to use ML Server admin console and check users and role permissions assigned to them ...

Hope this helps

sparnell commented 3 years ago

Thanks, but I don't think it's a permissions issue. By the time it fails, the only requests made are to localhost, not the remote host it should be using.

Not sure where hubConfigImpl should be getting it's config settings from, but it doesn't seem to be using the injected values in EnvisionConfig. It also doesn't seen to be reading the gradle property files for the DHF project.

It looks like a simple fix would be to add:

hubConfig.setHost(markLogicHost);

to setupHubConfig after the call to hubConfig.setMlPassword(password);