Skip to content

SolarNode Managed Deploy Guide

Matt Magoffin edited this page Oct 16, 2017 · 6 revisions

SolarNode: managed deployment with Amazon S3

The SolarNode Deploy Guide describes how to deploy the SolarNode platform using a base platform and additional components. This guide describes how to make use of the S3 Setup and S3 Backup plugins to make management of a set of similar nodes easier by storing the settings on Amazon S3.

Customizing the OS image

This guide assumes you're starting from a SolarNode OS image, such as the Raspberry Pi SolarNode image. You will then make changes to that image so you can then deploy as many nodes as you like using your specific configuration.

For Linux based images, the easiest way to customize the image file is to attach a loop device to the file, and then mount the SOLARNODE partition from that device. In Debian derivatives, the mount package provides the losetup tool for managing loop devices.

For example, if you are using the aforementioned Raspberry Pi image you'd have an image file named solarnode-deb8-pi-1GB.img. You can attach a loop device like this:

sudo losetup -P -f --show solarnode-deb8-pi-1GB.img

That will print out the name of the loop device that was attached, for example /dev/loop0. That will also have created devices like /dev/loop0p1 for any partitions found in the image file. In the case of the Raspberry Pi, there are two partitions: a boot partition and a root (SOLARNODE) partition. The root partition is the one you'll want to mount, like this:

mkdir /mnt/SOLARNODE
sudo mount /dev/loop0p2 /mnt/SOLARNODE

Those commands will mount the SolarNode image as /mnt/SOLARNODE and from there you can start to modify the image. Once you've finished your changes, you must both unmount the filesystem and disconnect the loop device:

sudo umount /mnt/SOLARNODE
sudo losetup -d /dev/loop0

At this point, your image file can be copied to the boot media (e.g. an SD card). For example you can use a USB based SD card reader and copy the image using dd along the lines of:

sudo dd of=/dev/sdd conv=sync,noerror,notrunc bs=2M if=solarnode-deb8-pi-1GB.img

In that example, dev/sdd is the SD card device assigned when it was inserted into a USB card reader. You would need to adjust that to match whatever device is assigned on your system.

Initial SolarNode configuration

The S3 credentials and other settings must be available when SolarNode starts up if the initial update from S3 is to work properly. This can be accomplished by adding a few of configuration files to your customized SolarNode OS image, so SolarNode is configured properly when it first boots up.

First, the conf/services/net.solarnetwork.node.backup.s3.S3BackupService.cfg file is where the S3 credentials, bucket name, and region settings are configured. A typical file looks like this:

regionName = us-west-1
bucketName = mybucket
accessToken = ABABABABABABABABABAB
accessSecret = asdfjkl/asdfjk/asdfjkl/asdfjkl/asdfjkl/a
objectKeyPrefix = solarnode-backups/

Next, the conf/services/net.solarnetwork.node.setup.s3.S3SetupManager.cfg file is where you can customize the S3 path that SolarNode will look for setup package versions at. By default, it will look in solarnode-backups/setup-meta/ but if you need to manage different sets of nodes with different configuration needs, then you can customize that in this file. For example you might need to manage sets of nodes deployed on different types of hardware. In that scenario you could create different configuration groups by adding a hardware name to the S3 path. A typical file looks like this:

objectKeyPrefix = solarnode-backups/raspberry-pi/

Note that setup-meta/ will automatically be appended to this value, so you shouldn't add that here.

Finally, the conf/services/net.solarnetwork.node.backup.DefaultBackupManager.cfg file is where you can configure SolarNode to use the S3 Backup service by default, rather than the local file-based service. A typical file looks like this:

preferredBackupServiceKey = net.solarnetwork.node.backup.s3.S3BackupService
Clone this wiki locally