eclipse / packages

IoT Packages project
https://eclipse.org/packages
Eclipse Public License 2.0
46 stars 66 forks source link

Connection between Hono and Ditto - New tenant - Failed #468

Closed paulocabrita-ionos closed 1 year ago

paulocabrita-ionos commented 1 year ago

Hello everyone.

I'm following the tour: https://www.eclipse.org/packages/packages/cloud2edge/tour/ and my aim is to create a new tenant, create some devices, send data to Hono and manipulate Ditto. Everything works fine except that Ditto does not receive any data.

I also noticed that the site has instructions to create a new connection between Hono and Ditto using AMQP but... the example that is also deployed uses Kafka. The example uses the domain "org.eclipse.packages.c2e".

If I add devices to the "org.eclipse.packages.c2e" domain everything works fine.

My curls are the following:

Like I said, if I use the tenant from the example "org.eclipse.packages.c2e", it works fine but not when I create a new tenant.

I think this a related issue:

Also, I think it should be great to update the "tour" site in order to have instructions to connect Hono and Ditto using Kafka.

Does anyone have a working new kafka connection running with a new tenant?

Please advise.

Thanks PJC

BHUVANESHWARI967 commented 1 year ago

Hi, Did you get any solution for this?

paulocabrita-ionos commented 1 year ago

Hi.

Unfortunately, no.

I have to give it a try again but with an another version.

Are you facing the same issue?

BHUVANESHWARI967 commented 1 year ago

Hi,

Was you connection getting created?

While I try to create connection it throws error saying "The connection Id is invalid". Do you know what should be given as connection id for amqp or kafka connection?

calohmn commented 1 year ago

@paulocabrita-ionos I have created PR #493 to update the cloud2edge tour to create a Kafka connection there. One thing that is missing in the connection payload shown in the issue text above is the "ca" entry with the Kafka broker self-signed certificate - I think this is needed for the used "validateCertificates": true option. The c2e tour instructions will include adding this ca entry. In general, #493 isn't merged yet - as noted in the comments there I still see an issue in using that connection.

@BHUVANESHWARI967 You could already have a look at the updated tour chapter in the PR with an example Kafka connection JSON that gets created successfully. Following the instructions there requires the setCloud2EdgeEnv.sh file updated in that PR.

calohmn commented 1 year ago

@paulocabrita-ionos @BHUVANESHWARI967 The PR #493 has been merged now. Along with cloud2edge chart version 0.5.0, the updated c2e tour is online, including the updated chapter about creating the connection. (To follow the steps there, the setCloud2EdgeEnv.sh script has to be downloaded again.)

One issue in the used connection JSON above is, that the authorizationContext value (pre-authenticated:hono-connection) should be unique to the connection, containing pre-authenticated:hono-connection-skynet for example.

paulocabrita-ionos commented 1 year ago

@calohmn thanks a lot. I will take a look and tell something ASAP.

paulocabrita-ionos commented 1 year ago

@calohmn I followed the new tour guide and I had success creating a new tenant using Kafka.

If you agree, I close this issue.

Just a side note: the script setCloud2EdgeEnv.sh has an issue. It's assuming that the NODE_IP is being populated using the InternalIP field but if we use an external K8S there is no InternalIP, there'se the ExternalIP field. I installed the package using NodePort on a IONOS K8S. In that case, the populate of all the environment variables will fail.

calohmn commented 1 year ago

If you agree, I close this issue.

Yes, I think this can be closed.

Regarding the setCloud2EdgeEnv.sh script, does it work when replacing the NODE_IP=... line with

NODE_IP=$(kubectl get nodes -o jsonpath='{.items[0].status.addresses[?(@.type=="ExternalIP")].address}' 2> /dev/null)
if [[ -z "$NODE_IP" ]] ; then
  NODE_IP=$(kubectl get nodes -o jsonpath='{.items[0].status.addresses[?(@.type=="InternalIP")].address}' 2> /dev/null)
fi

?

paulocabrita-ionos commented 1 year ago

I updated my previous answer because of some type-os.

I did something similar with the script. What you suggested worked :) So I think that the script can be updated on the repo.

Closing this issue.

Thanks ;)