reTHINK-project / dev-catalogue

Development tree for the catalogue
Other
0 stars 1 forks source link

Issue with deprecation of -domain parameter for the cataloge-database #42

Closed sdruesedow closed 8 years ago

sdruesedow commented 8 years ago

I have an issue with the deprecation of the -domain parameter, because I'm not able anymore to receive valid sourcePackageUrls.

My setup is as follows: Im not using --net=host for the deployment of the broker and the database, instead I use a custom network (--net=rethink). This allows the use of the built-in docker-DNS to address containers by their name. The name of my containers are "catalogue-broker" and "catalogue-database". They can access each other via these host names.

In front of the catalogue I have the reverse proxy in the same custom network that also uses these hostnames for its rules. The proxy does the https stuff and passes to the http port of the broker.

In the former version I provided the catalogue-database with the -domain param for my external domain (dev.rethink.tlabscloud.com) that is handled by the proxy and all was fine. That domain was used for the generation of the sourcePackageURLs - it worked well.

With the deprecation of the -domain parameter I'm not able anymore to specify the external domain (the one handled by the proxy). The sourcePackageURLs now contain the host "catalogue-broker" which has - of course - no meaning for the browser where the runtime runs in.

I'd like to get it back - please! ;-)

sdruesedow commented 8 years ago

Just for completenes - here are the printed out configs for the broker:

2016-08-30 08:53:18,954 I BrokerConfig File 'brokerconf.json' doesn't exist. 2016-08-30 08:53:18,955 I BrokerConfig Loading default Configuration...
2016-08-30 08:53:18,962 I CatalogueBroker Starting Catalogue Broker based on config:
{
"host": "catalogue-broker",
"coapHost": "catalogue-broker",
"keystorePath": "/opt/reTHINK/catalogue/ssl/keystore",
"keystorePassword": "OBF:1vub1vnw1shm1y851vgl1vg91y7t1shw1vn61vuz",
"truststorePath": "/opt/reTHINK/catalogue/ssl/keystore",
"truststorePassword": "OBF:1vub1vnw1shm1y851vgl1vg91y7t1shw1vn61vuz",
"keystoreManagerPassword": "OBF:1vub1vnw1shm1y851vgl1vg91y7t1shw1vn61vuz",
"sourcePackageURLProtocol": "https",
"httpPort": 80,
"httpsPort": 443,
"coapPort": 5683,
"coapsPort": 5684,
"logLevel": 2,
"defaultDescriptors": {}
}
2016-08-30 08:53:18,966 I NetworkConfig Storing standard properties in file Californium.properties
2016-08-30 08:53:19,087 I CatalogueBroker Starting CoAP Server...
2016-08-30 08:53:19,090 I CoapServer Starting server
2016-08-30 08:53:19,091 I CoapEndpoint Starting endpoint at catalogue-broker/172.18.0.4:5683
2016-08-30 08:53:19,096 I CoapEndpoint Starting endpoint at catalogue-broker/172.18.0.4:5684
2016-08-30 08:53:19,099 I DTLSConnector DTLS connector listening on [/172.18.0.4:5684] with MTU [1,500] using (inbound) datagram buffer size [16,474 bytes] 2016-08-30 08:53:19,099 I LeshanServer LWM2M server started at coap:///172.18.0.4:5683, coaps:///172.18.0.4:5684.
2016-08-30 08:53:19,111 I log Logging initialized @586ms <<<

sdruesedow commented 8 years ago

and for the database:

2016-08-30 08:57:15,368 I DatabaseConfig File 'dbconf.json' doesn't exist. 2016-08-30 08:57:15,369 I DatabaseConfig Loading default Configuration... 2016-08-30 08:57:15,370 W DatabaseConfig -domain is deprecated and will be ignored! Catalogue Broker modifies sourcePackageURL on-the-fly! 2016-08-30 08:57:15,376 I CatalogueDatabase Starting Catalogue Database based on config: { "brokerHost": "catalogue-broker/5683", "coapHost": "catalogue-database", "endpoint": "DB_1979787584", "catalogueObjectsPath": "/catalogue-database", "brokerPort": 5683, "coapPort": 0, "coapsPort": 0, "lifeTime": 60, "logLevel": 3 } 2016-08-30 08:57:15,486 W CatalogueDatabase Defining default instance by calling it 'default' is not supported anymore. Please use the Catalogue Broker option '-default' instead. Folder /catalogue-database/protocolstub/default will be skipped... 2016-08-30 08:57:15,622 I CatalogueDatabase Catalogue Database is running <<<

Endebert commented 8 years ago

Hi @sdruesedow ,

in the current version, the Catalogue Broker hostname is used for generating/adapting the sourcePackageURL. Could you please try and set the Broker configuration, so that "dev.rethink.tlabscloud.com" is now your "host".

I believe something like this should work:

Broker:

{
  "host": "dev.rethink.tlabscloud.com",
  "coapHost": "catalogue-broker",
  ...
}

Database:

{
  "brokerHost": "catalogue-broker",
  "brokerPort": 5683,
  "coapHost": "catalogue-database",
  ...
}

Hopefully this fixes your problem. Please let me know if this results in problems accessing the Broker (because of the changed hostname), if need be I can add another option to manually override the host/domain used for sourcePackageURLs.

sdruesedow commented 8 years ago

I'll try ... thanks!

sdruesedow commented 8 years ago

hmm ... seems that the "...jetty.server.ServerConnector" tries to bind to that host name during startup, which does not work.

Endebert commented 8 years ago

Ok, sorry for the trouble, I will add a new option to manually set the sourcePackageURL host on the broker as soon as I can.

Endebert commented 8 years ago

@sdruesedow I updated the Catalogue Broker, so you can manually set the sourcePackageURL hostname that is used when generating/adapting the sourcePackageURL with either setting sourcePackageURLHost in the config file, or using the option "-sourcePackageURLHost".

Just FYI, I also now set the protocol for sourcePackageURLs to always be "hyperty-catalogue://", so if you have some logic implemented that tries to do a HTTP request to that URL, you have to exchange the protocol with https.

sdruesedow commented 8 years ago

tested successfully - Thanks Robert !