openremote / fleet-management

The Fleet Management/Telematics implementation on top of the OpenRemote open-source IoT device management platform.
https://openremote.io/fleet-telematics/
Other
14 stars 4 forks source link

Deploy on AWS #24

Open radokristof opened 4 days ago

radokristof commented 4 days ago

I would like to deploy the fleet-management domain to AWS. Also my devices are using AWS IoT Core.

Does somewhere an example exists? How different this is from the regular openremote installation? It has cloudformation templates and openremote-cli. Can I use any of them for this?

Thank you in advance!

pankalog commented 4 days ago

Good morning @radokristof,

To deploy the fleet-management domain on AWS, I'd use the straightforward way of an EC2 instance with the correct DNS and traffic rules. The tutorial applies to all Linux-based machines, so EC2 would work as well.

The issue at hand here is that you have connected the devices to AWS IoT Core. The way that we connect Teltonika devices to OpenRemote is by using the "AWS IOT Custom" protocol, but we actually connect to an OpenRemote server, and we perform communication using that, directly from/to the device(s).

Unfortunately, there's no out-of-the-box way to connect devices connected to IoT Core to OpenRemote for fleet management. With the help of mTLS authentication, you could now connect OpenRemote to the AWS IoT Core platform using an MQTT agent, but it wouldn't be any different than using a normal OpenRemote deployment.

There is the thought of introducing a Teltonika-specific agent, that allows connection to a broker, to monitor for messages that are sent to a broker, but let us know how you'd like to proceed.

radokristof commented 5 hours ago

Dear @pankalog!

First of all, thank you for your detailed answer.

To deploy the fleet-management domain on AWS, I'd use the straightforward way of an EC2 instance with the correct DNS and traffic rules. The tutorial applies to all Linux-based machines, so EC2 would work as well.

I will check the tutorial and try to run it on AWS as well. Local run (via docker) already succeeded.

Unfortunately, there's no out-of-the-box way to connect devices connected to IoT Core to OpenRemote for fleet >management. With the help of mTLS authentication, you could now connect OpenRemote to the AWS >IoT Core platform using an MQTT agent, but it wouldn't be any different than using a normal OpenRemote deployment.

Why wouldn't it be different? As I understand, in this case openRemote would connect to AWS IoT Core as a "client", so it would act as a middleware.

There is the thought of introducing a Teltonika-specific agent, that allows connection to a broker, to monitor for messages that are sent to a broker, but let us know how you'd like to proceed.

How would it be different from the current setup / use-case?

pankalog commented 2 hours ago

Good morning @radokristof ,

Why wouldn't it be different? As I understand, in this case openRemote would connect to AWS IoT Core as a "client", so it would act as a middleware.

The current implementation uses an MQTT Handler to intercept MQTT messages that are sent to devices/received from devices. MQTT handlers are part of the MQTT broker that OpenRemote hosts, and the Teltonika handler reads (handles) all messages that are sent to the topics that look like {realmID}/{userID}/teltonika/{IMEI}/<command or data> in the MQTT broker.

As such, it's not easy to move those "handlers" out of the OpenRemote broker and into some other broker in the form of an MQTT client, without at least some adaption of the code. It's also an issue of creating a "standard" around this, so that OpenRemote would know where to subscribe to find the devices.

How would it be different from the current setup / use-case?

The agent would basically build on top of the standard OpenRemote MQTT agent, and then it would have to subscribe to certain topics to automatically discover all assets. This has not really been researched upon, but we do have the motivation to create an MQTT client-or-broker-agnostic approach, so that users can either subscribe to devices on a separate broker and/or use the OpenRemote broker. Theoretically, to configure the MQTT Agent, you should be able to simply configure the MQTT connection to the remote broker and the wildcarded MQTT topic to automatically discover new devices, so that they're automatically imported and functional in OpenRemote.

Use-case wise, it wouldn't change much, it would basically mean that the devices would be configured to connect to AWS IoT Core, and the configuration of OpenRemote would change a bit. Other than that, the same features and the same asset types would be used for the vehicles.

Let me know if I can help!