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 Pi3 device for MongoDB with these 6 Steps

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

a) Download RPI3 image

Click to download

b) unxz the device image:

Run $ unxz rpi3_initial_stable.img.xz

c) Write image onto the SD card with Raspberry Pi Imager 1.2

Step 2: Boot your RPi3

a) 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 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

a) Connect a LAN cable between your RPi3 and computer or router.
b) Open your terminal and run
$ pvr device scan
c) Claim your device

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

d) 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 server from your computer

mongo --host=10.42.0.231

You are Done!