Deploy MongoDB to a Raspberry Pi3 via Pantacor Hub

Pantavisor and Pantacor Hub enable product makers to manage and easily update embedded devices. Pantavisor is the framework for containerized embedded Linux development that connects devices and containerizes the embedded firmware user-land as well as any apps you want to run on the device. In this tutorial, we’ll show you how to install Pantavisor on to a Raspberry Pi3, then you’ll learn how to claim your device and make it available from the  Pantacor Hub dasboard. Finally, you’ll prepare and deploy MongoDB onto the device and then connect to it from your laptop.

Prepare your Raspberry Pi 3 for MongoDB

Step 1: Flash the RPi3 initial stable image onto your SD card.

Download the Raspberry Pi 3 image

Click to download

unxz the device image:

Run $ unxz rpi3_initial_stable.img.xz

Write image onto the SD card with Raspberry Pi Imager

Step 2: Boot your RPi3

Insert the SD card and the power supply

Step 3: Sign up for Pantacor hub
Step 4: Download & Install a CLI tool “pvr”

Note: pvr is a CLI tool that is used to interact with your device through the Pantacor Hub platform. With pvr, you can share and revision your firmware and projects as simply as with a git tree. After you’ve downloaded it, move the pvr binary to your bin folder.

Linux(AMD64): Download Linux(ARM32v6): Download Darwin(AMD64): Download

pvr clone; pvr commit; pvr post

To install from github source code:

$ go get gitlab.com/pantacor/pvr
$ go build -o ~/bin/pvr gitlab.com/pantacor/pvr

Note: You need “GOLANG” to be installed in your system for building pvr from github source code.

Step 5: Detect and claim your device

Connect a LAN cable between your RPi3 and computer or router.

Open your terminal and run

$ pvr device scan

Claim your device

$ pvr claim -c merely-regular-gorilla https://api.pantahub.com:443/devices/5f1b9c44e193a5000afa9901

Log into Pantacor Hub and check whether the newly claimed device appeared in the dashboard or not.

Step 6: Clone the device to your computer using the clone URL for your device

$ pvr clone https://pvr.pantahub.com/sirinibin/presently_learning_pelican/0 presently_learning_pelican

Now your device is ready to deploy your MongoDB app

Deploy MongoDB to the device with following 3 Steps:

#1: Add “mongodb” onto the device

$ pvr app add mongodb --from=andresvidal/rpi3-mongodb3

#2: Deploy the changes
$ pvr add .
$ pvr commit
$ pvr post
#3: Connect to MongoDB from your computer

mongo --host=10.42.0.231

You are Done!

Final Thoughts

In this tutorial, we described how to deploy a containerized version of the popular database, MongoDB and Adminer onto your Pantavisor-enabled device. Pantavisor doesn’t run Docker containers natively, but it does use Docker images as a great source of root file systems for containers that are run by the Pantavisor with LXC.

Take a deeper dive into managing Pantavisor Linux on your device locally with our front-end utilities Pantabox. 

We’re really excited for you to try Pantabox and Pantavisor Linux and we’d love to hear your thoughts. Try one of the guides or join us in the Pantavisor community forum.

Facebook
Twitter
LinkedIn