The Raspberry Pi 3 is the third generation Raspberry Pi, on this i will be installing Mulesoft enterprise runtime standalone with latest Java 8 running inside a Docker container. The Instance will register itself with Anypoint platform runtime manager.
The raspberry features:
- A 1.2GHz 64-bit quad-core ARMv8 CPU
- 1 GB Memory
- 802.11n Wireless LAN + Ethernet, Bluetooth
- Micro SD card slot
- 4xUSB, 1xHDMI
Raspbian is the raspberry’s officially supported operating system which we will be using. First Setup your raspberry pi with a minimal installation, as we won’t be using desktop. When installation has completed, you can ssh into your raspberry with the default pi user and raspberry password.
user@remote:~ ssh pi@ip
Make sure you have the latest kernel as docker support has only been added recently. do an update to get the latest base system.
pi@raspberrypi:~ sudo su - pi@raspberrypi:~ apt-get update && upgrade
This guide has been tested with the below kernel version.
pi@raspberrypi:~ $ uname -a Linux raspberrypi 4.9.24-v7+ #993 SMP Wed Apr 26 18:01:23 BST 2017 armv7l GNU/Linux
Installing docker on raspberry pi 3
Fetch and execute installation script:
root@raspberrypi:~# curl -sSL https://get.docker.com | sh
Add pi user to docker group to be able to run docker without root privileges.
root@raspberrypi:~# usermod -aG docker pi
Verify your docker installation as the pi user:
root@raspberrypi:~# exit pi@raspberrypi:~ docker version Client: Version: 17.04.0-ce API version: 1.28 Go version: go1.7.5 Git commit: 4845c56 Built: Mon Apr 3 18:22:23 2017 OS/Arch: linux/arm Server: Version: 17.04.0-ce API version: 1.28 (minimum version 1.12) Go version: go1.7.5 Git commit: 4845c56 Built: Mon Apr 3 18:22:23 2017 OS/Arch: linux/arm Experimental: false
Setup Anypoint platform access management
- organizations - Add Business Group
Add your organisation. e.g. redpill-linpro
- enviroments - Add Enviroment
Add your enviroments e.g. Production and Test
- subscription - Check Subscription
Check that your subscription is valid. It is possible to run this during the 30 day trial, and the runtime will continue to work even after expiration if it has not been shut down in the meantime, but you won’t be able to register new instances.
Configure docker image
The docker image has been based on https://github.com/kenngyc/Dockerfiles but since this image has not been prepared to run on ARM a fork has been created. To check out sources
git clone https://github.com/simonvalter/Dockerfiles.git
The changes that were needed to make this run is to base it on a raspbian docker image and hence get a Java version installed that will run on arm.
There also seems to be a bug in the /muleruntime/bin/mule start script where it decides to use armel wrapper for all arm.
armv*) if [ -z "`readelf -A /proc/self/exe | grep Tag_ABI_VFP_args`" ] ; then DIST_ARCH="armel" DIST_BITS="32" else echo "Warning: An armhf architecture has been detected and this is not currently supported. The armel version of the wrapper will be used instead." DIST_ARCH="armel" DIST_BITS="32" fi
instead we will change it to the correct wrapper using the DIST_ARCH=”armhf”
The /muleruntime/conf/wrapper.conf is also using excessive memory for running on the 1GB available memory that the raspberry has, which will cause failure on startup. Instead the initial heap and max heap size has been decreased from the default 1024 MB
# Initial Java Heap Size (in MB) wrapper.java.initmemory=256 # Maximum Java Heap Size (in MB) wrapper.java.maxmemory=512
Build docker image
Get latest mule runtime:
Configure Dockerfile to use latest version:
set ARG muleVersion=3.8.4
Build image with the tag simv/mule-docker-ee and version 1
docker build -t simv/mule-docker-ee:1 .
Starting the container
Start the container, giving your anypoint platform credentials, your organization and environment and ports to listen on as arguments.
./startDockerContainer.sh 1 user password redpill-linpro Production 80 443
Deploying mule application
After starting the container you should be able to see the server registered in anypoint platform runtime manager.
- runtime manager - servers
For each restart a new server instance will be registered with a random name.
To deploy your application you go to deploy application and upload your mule app.
- runtime manager - applications
Thats it. Within seconds you should see it deployed and running on your raspberry.