Nextcloud on a Pantavisor Device

Nextcloud is a really nice way to store and share your files without requiring them to be pushed to a cloud based service.

Installing Nextcloud

Installing Nextcloud is really straight forward using pvr. Follow these steps to install your Nextcloud app.

Step 1 – Preparing the application

  • Clone your device using pvr clone https://pvr.pantahub.com/<your_userid>/<your_device>

Step 2 – Installation

Install the app using pvr as follows

pvr app install --from=nextcloud nextcloud

The above command will pull the docker image from and install it to your cloned directory. Once this is done you just need to post an update to your device as follows,

  1. pvr add .
  2. pvr commit
  3. pvr post
Note

You should be one level above the nextcloud directory when executing the above command.

Step 3 – Configuring Network Traffic

By default the above nextcloud image runs an apache web server at port 80 inside the container. Since Pantavisor currently runs all containers in the same network namespace, if you’ve a webserver configured at port 80 already you’ll have to move it to another port.

You should now be able to configure nextcloud by pointing your browser to the device’s IP / Hostname.

Running the image on QEMU – X86_64

You can also use QEMU to run the x86_64 pantavisor image above. This is really nice when you want to test out the feature before deploying it to the live device.

Since nextcloud would probably consume much larger storage space than what is available on the x64 image. It’s better to have the image resized to a bit larger value to allow actual usage for testing out the image. We’ll do this in 2 steps

  • Convert the raw x64 image generated to qcow2 format qemu-img convert -O qcow2 x64-uefi-pv-4096MiB.img x64-uefi-pv-4096MiB.qcow2
  • Resize the qcow2 format image to a larger value qemu-img resize x64-uefi-pv-4096MiB.qcow2 +10G

The above example increase the size by 10G but you are free to use any appropriate value. Since the qcow2 format doesn’t actually occupy disk space unless written to it’s a faster way to increase the image size.

Configuring networking with QEMU – X86_64

In order to be able to use the above qcow2 image we’ve to make some allow traffic to move across qemu and our host. This can be achieved using the --hostfwd option of QEMU as shown below

sudo qemu-system-x86\_64 -enable-kvm -bios /usr/share/qemu/ovmf-x86\_64-opensuse-code.bin -m 1G  -hda out/x64-uefi/x64-uefi-pv-4096MiB.qcow2  -nographic -netdev user,id=n1,hostfwd=tcp::8022-:8022,hostfwd=tcp::80-:80,hostfwd=tcp::443-:443  -device e1000,netdev=n1

In the above command we’ll be able to forward traffic from host to QEMU at the following ports

Host PortQEMU PortProtocolDescription
80228022tcpInbound from host
8080tcpInbound from host
443443tcpInbound from host

Note

Since we’re using host ports {80, 443} which are privileged ports we need to run the above command as root user. If you’re using non-priviliged ports for Host then you don’t need to run above command as root user.

The setup shown above doesn’t use HTTPS therefore you may not be able to use it from the nextcloud app. In order to make it work with the nextcloud app we’ll have to setup a secure server which we’ll take a look in the next blog.

The following shows the setup screen when using QEMU

Running nextcloud in pantavisor inside QEMU