PiTunnel includes a number of built in features that make it simple to deploy to a large number of devices.
A common approach to mass deployment is to set up a single Raspberry Pi with all the software and settings required for an application, and then to use a cloning tool like rpi-clone to clone the microSD card for each new device.
Registering New Cloned Devices
Each new device needs to be registered with the PiTunnel.com website, inorder to be recognized when creating tunnels. Usually this is performed during the execution of the installation script. However, to support mass deployment, PiTunnel includes an auto-registration feature that will automatially re-register an installation whenever the serial number of the device changes.
This is automatically performed at startup of your device, through execution of the command:
inside the pitunnel startup script:
This means that you don't need to do anything special - PiTunnel will detect that your device has a different serial number the first time the cloned card is booted, and will register the new device with PiTunnel.com.
The only thing you need to be aware of is that the first boot of your device may take longer due to this registration process, as the PiTunnel startup script will keep trying to contact the PiTunnel server to perform registration until the network connection of your device comes up. If this is a problem for your application, then you can skip this behaviour by commenting out the line
pitunnel --register-if-serial-updated in
/usr/local/lib/tunnel_client/pitunnel_start.conf, and instead executing
pitunnel --register-if-serial-updated in your own script once per new device which is running a cloned microSD card image.
An alternative to cloning is to run a setup script on each new device, that installs all prerequisite software for your application. In this case you just need to execute the PiTunnel installation script
curl https://pitunnel.com/install/None | sudo python once per new installation. Note: Do not execute this more than once per device, unless you are wanting to do a re-install, or to update a device to a newer version of PiTunnel.
For help with specific mass deployment scenarios, please contact our support team.