Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

MuleSoft IoT: MuleSoft, Git, Docker, and Raspberry Pi

DZone's Guide to

MuleSoft IoT: MuleSoft, Git, Docker, and Raspberry Pi

Learn how to utilize MuleSoft's capabilities, Git, and Docker containers to start a project using a Raspberry Pi with these basic setup instructions.

· IoT Zone
Free Resource

Learn how Bluetooth mesh helps you create industrial-grade networks. Download the mesh overview.

My vision for using MuleSoft for railways and airways started with Europe, mainly Germany, so that all humans could reap the benefits of an app. So, let's go through a little example using Docker, MuleSoft, MMC, and a Raspberry Pi.

MuleSoft Capabilities

  • Design Documents: Architecture for MuleSoft in a three-layer design. For IoT, the basic structure involves MuleSoft cloud services, utility apps, and backend apps in the cloud.

  • MuleSoft Anypoint Engine for IoT applications.

  • Mulesoft Runtime Engine to expose APIs to deliver logical capabilities that we make in IoT.

  • Required tools apart from MuleSoft: Docker, Git, Salesforce (or even MySQL), and a Raspberry Pi with a MuleSoft standalone server (MMC).

Basic Setup

  • Maven setup: MAVEN_HOME and an .m2 repository

  • Git setup: SSH folder in which three files will reside: id_rsa, id_rsa.pub, and known_hosts

  • Anypoint Studio integration with GIT with SSH key

Generate an RSA Key in Anypoint Studio:

Window->Preferences->General->Network Connections->SSH2->Key Management->Generate RSA Key

In Key Management, save the ssh-rsa key without a passphrase.

In GitLab, go to Profile Settings -> SSH Keys -> Add key {Give title and the key generated from Anypoint studio (Ex: C:\Users\kapil\.ssh\id_rsa_pub)}

You can import any GitLab project into Anypoint Studio with SSH Configuration. Click yes for the first time when importing a project. It will ask permission to make a fingerprint. You can check it in Known Hosts, for example: gitlab.ops.tiaa-cref.org ssh-rsa .........key......

Start With Docker (Windows Platform)

Basic steps for Docker:

  • Docker base image for Mule ESB

  • Create and export the ZIP file

  • Deploy in the Docker image

  • Start the Docker container

  • Test

Dockerfile

From Java:8

MAINTAINER kapil.arora0069@gmail.com

ENV MULE_HOME /opt/mule

ENV MULE_VERSION 3.85


Commands

Run set -x \

&& cd /opt \

&& curl -o german_transportation.zip https://repository.mulesoft.org/nexus/content/repositories/releases/org/mule/distributions/mule-standalone/{mule_version}/mule....zip

&& unzip german_transportation.zip

&& mv mule-standalone-$mule_version mule

&& rm german_transportation.zip


WORKDIR $MULE_HOME

  • VOLUME $MUOLE_HOME/apps

  • VOLUME $MUOLE_HOME/config

  • VOLUME $MUOLE_HOME/domains

  • VOLUME $MUOLE_HOME/logs

ENTRYPOINT ["./bin/mule"]

C:\Docker_Folder\docker build --tag kapil -app #(This will be the Docker image with Java 8 & Mule 3.8.5)

C:\Docker_Folder\kapil\german_transportation.zip

From kapil -app folder

Add german_transportation.zip from $MULE_HOME/app/

EXPOSE 9004:9004

doctest build -tag kapil -app

docker images #(This will show all images)

docker run -t -i -p 9004:9004 .....


Installing Docker on a Raspberry Pi

  • Raspberry Pi with Docker

  • Run Docker installer: -curl -SSL https://get.docker.com | sh

  • Auto start Docker (requiring registration): -sudo systemctl enable docker

For a deeper look into Bluetooth mesh, check out this technical insight for developers.

Topics:
iot ,mulesoft ,git ,raspberry pi ,docker containers ,tutorial

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}