You cannot install data API Builder on Raspberry or can you?
By Rob Litjens
For a specific home project at my fathers place I needed to add data to a database which was in the cloud. The only thing was that that project could only do restfull requests. Because I played with data API Builder (DAB) quite intensive I thought about pulling up a dab server on a raspberry Pi. Of course my first attempts failed. I first wanted to run the package from the cloud straight by downloading binaries and see if that would work. The second attempt was to run it through a docker container. This failed also. But it gave some output which was useful… Or not?
The case is here that the architecture of a RaspberryPi (RPI) is different to what DAB expects. The RPI is base on Linux/AMD64, while the RPI is Linux/ARM64. That made think if it was possible to circumvent the issue. Talking to a friend from Microsoft (CoPilot) showed me that he did not know the answer. Looking around on the internet I found some directions. There was Box64, QEMU and more. From reading the documentation and trying to create a setup I was thinking about the following:
- Install the 64 bit RaspberryPi OS (use the latest, always) using RaspberryPi Image Manager a. Create a user ID b. Set the region c. Set SSH enabled
- Install BOX64
- Install Docker
- Install docker-compose
- Install portainer
- Install Emulator
- install data API Builder
Install the RaspberryPI
To install the Raspberry PI (i suggest a RPI4 or RPI5 when available), just go the website of RaspberryPI.com and use the installer. Headless is Ok if you are familiar with it.
Installing box64
This is a process that takes some time. You will download a lot of binaries from the internet and compile them. I thought on making a video of it, but it takes to long. I probably will add a shortened one soon, but for now i just give you the commands
sudo apt install build-essential mono-runtime git cmake
cd ..
sudo git clone https://github.com/ptitSeb/box64
cd box64
sudo mkdir build;
cd build;
sudo cmake .. -DRPI4ARM64=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo
sudo make -j2
sudo make install
sudo systemctl restart systemd-binfmt
Install Docker
Easiest way is to run the script provided by Docker.
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
After the installation of Docker, you do need to configure networking. I would advise you to look at the documentation section below for some additional information
Install Docker Compose
After the installation of Docker I recommend you to install Docker Compose at well. The commands are simple:
Sudo apt install docker-compose -y
Configure Portainer
After docker-Compose I like to install Portainer, just for a nice GUI (yes, I am still a Windows Guy). For this you need to execute the following Command:
sudo docker pull portainer/portainer-ce:latest
After downloading the container, you need to start it, using this command
sudo docker run -d -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest
If you have this all up and running, you can reach your portainer image at port 9000 (😉 exit 10 at the Rotterdam Harbour).
data API Builder image
After this you are ready to host containers on your raspberryPi, also for x86 images like…. DataAPIBuilder. We pull the image with this command:
docker pull mcr.microsoft.com/azure-databases/data-api-builder:latest
After this we need to enable it, but using the platform AMD64 as a parameter
docker run -it -v <host-directory>:/App/<container-directory> -p 5000:5000 mcr.microsoft.com/azure-databases/data-api-builder:<tag> --ConfigFileName <configuration-file> --platform=Linux/AMD64
Of course, you need to change settings according to the configuration on your RPI….
Conclusion
Despite we think it is not possible to run Linux/AMD64 images on ARM64 servers, it is possible. An RPI is an ideal playground for this. Images like Microsoft data API Builder are so small that it is easy to do. In my testlab I have connected the RPI data API Builder to an Azure SQL, but it is possible to do use on prem/in house database servers like MySQL also.
The other reason Another reason for me to write this manual is a preparation for the Festive Tech Calendar. They are raising money for the Raspberry Pi organisation. If you find this manual helpfull or just want to support the RaspberryPi organisation please consider to support it via Justgiving Festive Tech Calendar for RPI organisation
Just have fun!
Documentation
- RaspberryPi OS install
- How to Install Box86, Box64 and Wine on Raspberry Pi OS Bullseye 64-bit | Medium
- skyajal/rpi4-docker: Guides for deploying Docker on Raspberry Pi4 using Ubuntu 20.04 LTS 64 bit and Raspbian OS 64 bit (github.com)
- Setup Docker Compose on Raspberry Pi - Pi-Wiki
- Installing Portainer to the Raspberry Pi - Pi My Life UpInstalling docker and docker-compose on a Raspberry Pi 4 – Marcel Zuidwijk