How to run Mule on the Raspberry Pi. You’d be shock how easy it is!

Share this:

If you follow me on LinkedIn, you’d have come across a few of my post of some simple hacks I’ve done using popular apps like Twitter and Telegram chatbot, all running of the Raspberry Pi. And since I work at MuleSoft, it’s only natural that I would use the Mule runtime as the core framework for the app development since it’s mostly a connectivity-based app. But before I digress further, I obviously need to first get Mule to be able to run on the Raspberry Pi. Here in this guide, you would see how easy it is to install the full enterprise edition of Mule. Not only that, you’d also see how you can manage and monitor the mule runtime on the Raspberry Pi it from the cloud using the Anypoint Runtime Manager!

Mule running on the Raspberry Pi

Mule running on the Raspberry Pi

A beginners guide to run Mule on the Raspberry Pi

Note that in this guide, the instructions would be based on using the MacOS as the primary host connecting to the Raspberry Pi via SSH on Terminal. If you’re using a Linux host or using Putty on a Windows machine, the general steps are the same but perhaps some different methods or commands that you’d need to use. Additionally, this guide is also based on the Enterprise Edition version of Mule Runtime which requires a license to run. You’re also allowed to run a 30-days trial of the EE runtime for R&D and testing purposes too. You can reach out to me or a local MuleSoft representative for more information on licensing of Mule.

1. Get the Raspberry Pi running with Raspbian

Firstly, assuming you have not already done so, you will need to install Raspbian on your Raspberry Pi. There are a lot of guides online including the official guide here to help you set it up. Once you’ve done so, boot up the Raspberry Pi with Raspbian and you’re pretty much ready to go. And guess what, there is nothing else you need to do or install on your Raspberry Pi or Raspbian to prepare it to run Mule, even with the enterprise edition version of Mule. Kinda awesome if you ask me.

Having said that, its always good to get Raspbian updated with the regular sudo apt-get update && sudo apt-get upgrade.

2. Copy the Mule EE installation file and the license file to your Raspberry Pi

Again, I assume that you’ve already downloaded the Mule EE installation file. I’m using the latest version of the Mule EE binary (typically named mule-ee-distribution-standalone-3.8.1.tar.gz). I also assume you have a valid license file to be copied over to the Raspberry Pi. I used SCP to copy the files to the Raspberry Pi.

scp /<path-to-file>/mule-ee-distribution-standalone-3.8.1.tar.gz pi@<ip-address-rpi>:mule-ee-distribution-standalone-3.8.1.tar.gz

You would then be prompted to key in the password for the pi user on the Raspberry Pi and the file would be copied over. Remember to replace the <path-to-file> and <ip-address-rpi> appropriately in the command. ?

Using SCP to copy the Mule installer to the Raspberry Pi

Using SCP to copy the Mule installer to the Raspberry Pi

Do the same with the Mule Enterprise Edition license file.

scp /<path-to-file>/mule-ee-license.lic pi@<ip-address-rpi>:mule-ee-license.lic

3. Installing the Mule EE installation file

If you are already familiar with the installation process of Mule Enterprise Edition, it’s no different here on the Raspberry Pi. That’s really the beauty of the lightweight nature of Mule. For those new to the Mule platform, behold how simple the installation process is. Ready? Just extract the tar archive and that’s it. Yes. It’s really that simple! ?

tar -xvf mule-ee-distribution-standalone-3.8.1.tar.gz

Installing Mule just by extracting the tar archive

Installing Mule just by extracting the tar archive

In the screenshot, you see that I’ve installed the Mule Runtime in a mule subdirectory, but that’s entirely up to your preference.

4. Lowering the default RAM allocation in the wrapper configuration

By default, the wrapper is configured to allocated 1GB of RAM for the JVM. This is obviously too much since the Raspberry Pi has limited RAM. Both the Raspberry Pi version 2 and 3 are equipped with 1GB of RAM, so I recommend configuring the wrapper to allocated a maximum of 512MB of RAM for Mule’s JVM.

To do so, edit the wrapper.conf file that is located in mule-enterprise-standalone-3.8.1/conf/

nano mule-enterprise-standalone-3.8.1/conf/wrapper.conf

Scroll down the file and look for the Java Heap Size configuration.

Using nano to edit the wrapper.conf file

Using nano to edit the wrapper.conf file

Edit them both the configuration to 512 MB as shown below:-

# Initial Java Heap Size (in MB)
wrapper.java.initmemory=512

# Maximum Java Heap Size (in MB)
wrapper.java.maxmemory=512

Once done, WriteOut (ctrl+O) and Exit (ctrl+X).

5. Install the license file and setup the Mule Agent to connect to ARM

If you have a valid license file, run the following command to install the license. Otherwise, you can skip this step and use the Mule runtime with a 30 days trial license that will be autogenerated upon the first run of the Mule Server.

Installing the Mule license file

Installing the Mule license file

Now, let’s also set up the runtime to be managed directly from the cloud using the Anypoint Platform’s Runtime Manager console. If don’t already have an Anypoint Platform ID, you can sign up for one here at https://anypoint.mulesoft.com/login/#/signup. Don’t worry. It’s free and comes with a 30-days trial for all the non-free components! Head over to the Runtime Manager console and click on the Servers tab, then click on the Add Server button.

Adding a new mule server to Runtime Manager

Adding a new mule server to Runtime Manager

Copy the generated “./amc_setup …..—12345 server-name” command. This will instruct the Mule Agent in the runtime to connect and register itself to your Anypoint Platform account. First, get into the /bin directory of Mule Server.

cd mule-enterprise-standalone-3.8.1/bin

Here, paste the amc_setup command you copied and remember to change the server-name in the command to any name you prefer.

Setting up the Mule Agent to register itself to the Runtime Manager

Setting up the Mule Agent to register itself to the Runtime Manager

Once completed, you should see a new Server with the name you provided registered in the Runtime Manager.

The Mule Runtime is now registered in the Runtime Manager

The Mule Runtime is now registered in the Runtime Manager

6. Finally, start Mule!

Yes, that’s all there is to it. Now you can start up Mule and begin to manage it directly from the Runtime Manager in the cloud. This includes deploying and monitoring your Mule applications too.

Again, for those new to Mule, you can start Mule simply by using the following command: –

./mule start

The “start” paramenter starts the Mule server in the terminal background. You can find out more about starting and stopping Mule here. If you want to know what’s happening in the server, you can simply tail the log files using the following command: –

 tail -f ../logs/mule_ee.log

Starting up Mule and looking at the server logs

Starting up Mule and looking at the server logs

As soon as the server starts up, the Runtime Manager console will display the server’s status as Running. And now, you can start to monitor and manage the Mule runtime just as any other on-premise Mule Servers in an enterprise datacenter.

Managing Mule runtime on the Raspberry Pi from Anypoint Runtime Manager

Managing Mule runtime on the Raspberry Pi from Anypoint Runtime Manager

Viewing the Mule Server dashboard on Anypoint Runtime Manager

Viewing the Mule Server dashboard on Anypoint Runtime Manager

Now you can deploy a Mule application to the Mule Runtime server on the Raspberry Pi

Now you can deploy a Mule application to the Mule Runtime server on the Raspberry Pi

That’s it! I hope this guide has been useful to you and can’t wait to see the kind of interesting IoT projects you run using Mule at the edge.

Check out more Mule tips in my Mule Cookbook.

Share this:

You may also like...

5 Responses

  1. Manik says:

    Which OS your using on raspberry pi3? I tried it with Raspberry OS but always gets this error when I do ‘sh mule start’ –

    Your machine’s hardware type (uname -m) was not recognized by the Service Wrapper as a supported platform.
    Please report this message along with your machine’s processor/architecture.

  2. Ken Ng says:

    You should be able to run this on Rasbian as was used in the article. Which version of Mule are you running? The Tanuki Service Wrapper has been updated to run on the ARM processor since Mule 3.7.x.

  3. John says:

    Hi, I get the same error as above. I have done the update and upgrade commands.

  4. Ken Ng says:

    What version of raspbian and Mule are you using?

  5. John says:

    Hi, all working now. Thanks. I was using v3.8.1, downloaded v3.8.4 and now all ok. Here is a link to easily find the latest mule version: https://github.com/mulesoft/mule/releases

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.