Okapi's storage question. How to deploy modules at different servers?

Let’s just take the ‘hello-vertx’ project as an example. First I start Okapi with the storage of postgreSQL. Then create the tenant: ‘testlib’ and the module:‘hello’, deploy this module and enable it for ‘testlib’. Of course these infomations have been stored into the ‘tenants’ and ‘modules’ tables of postgreSQL. The ‘hello’ module runs well. After executed all these steps, I tried stopping Okapi and restarting it. At this time, when I sent a GET request to the ‘/_/deployment/modules’ interface, Okapi just returned an empty Array:’[ ]’. This means the ‘hello’ module did not follow the Okapi to restart. **_

  • My Question is: Do I have to redeploy the module manually by sending the POST request to the ‘/_/deployment/modules’ interface?
    Has Okapi already implemented to deploy modules automatically? If so , how could I do this?

Another important question :
I want to deploy Okapi and hello-vertx on different servers. How to do this? What special configurations do I have to pay attention? How can Okapi deploy a remote-server module?

The core of your question may be if Okapi has implemented persistent data sending the POST request to the ‘/_/deployment/modules’ interface of Okapi .

  1. Yes, you have to deploy the module again. The reasoning behind this is that we did not want to store information about running processes in the database - processes can come and go, and the database would not be up to date anyway.

  2. The idea is that there should be an Okapi instance running on each of your servers, in ‘cluster’ mode. Then you can any of the Okapis to list all your nodes in /_/discovery/nodes. When you deploy your modules, you can specify which node to deploy on.

Alternatively, you can manage the deployment outside Okapi, and just post a deploymentDescriptor that has a URL to an already-running instance.

Is it true that the module will stop with Okpai stopping and restart again after Okapi has started in your mode of single node ?

When Okapi stops, it also stops all the modules it has started. But it does not restart them when you restart Okapi

Then how can I deploy okapi instances on different nodes with ‘cluster mode’ and make relationship with each other. Which section of the document introduces that?

I have to admit that it is not well explained in the guide. When you start
up Okapi, skip the ‘dev’ mode, and put ‘cluster’ instead. The reference
section mentions a few options you can give.

I know to replace ‘dev’ as ‘cluster’,but how to make these nodes work together? I did started Okapi on different computers. Even though in the ‘cluster’ mode, they would be working separately as independent nodes. What have to be configured in this situation? After I send request to the ‘/_/deployment/nodes’, there should be a multi-nodes Array returned.

It should be /_/discovery/nodes, not deployment.

I have opened a Jira issue for documenting this better. We get something in the guide within some days.

Ok, your answers are very helpful for us. Hope for the update of the guide :slight_smile: . Thanks a lot!

I just pushed some more text into the guide. Hope that answers some of your questions.

A word of warning: The clustering does not work on wireless networks, you need to run ethernet with cables.

Just to follow-up, the details that Heiki mentioned in his reply are in the Running in Cluster Mode section of the Okapi guide.