inst/doc/networked_receivers.md

Networked Receivers

Sensorgnomes with network access can connect directly to sensorgnome.org to have their raw data processed by the tag finder. All server-side scripts mentioned below are part of the motusServer package.

Self-registration

Network Data Sync

Each networked sensorgnome (SG) is periodically sync'd with the server like so:

  1. syncServer (an R process runningmotusServer::syncServer()) watches the SYNC folder (/sgm_local/sync)

  2. when a file is written to SYNC, if its name is a receiver serial number SERNO (e.g. SG-0816BBBK03AF) then syncServer creates a new processing job of type syncReceiver and adds it to the priority queue

  3. an idle, priority processServer (R process running motusServer::processServer() with queue number >= 100) claims the job

  4. processServer uses rsync to update the contents of /sgm/file_repo/SERNO, fetching only those files with the correct receiver serial number, and which are new or have grown since the previous sync (or manual data upload)

  5. processServer then creates a new job of type newFiles whose job folder contains symlinks to all of the new or updated files copied from the receiver in step 4

  6. processServer runs the newFiles job, which invokes the tag finder on each boot session covered by the new files, typically running it with the --resume option if the new files are all later than the last point at which the boot session was processed. This will generate one new batch of data per processed boot session. Batches created with the --resume option might extend runs created in previous batches for the same boot session.

### Triggering a Sync ###

This section explains how serial-number files are written to SYNC (see step 2, above).

In summary, while a receiver is connected to sensorgnome.org via ssh, a data sync is run on average every 60 minutes, but no sooner than 30 minutes from the time of initial connection. The randomized interval between sync jobs is to smooth out the load on the server from syncing multiple networked receivers.

Move to New Server

A few issues: - SG software is set to connect to sensorgnome.org:59022

SSH server for networked sensorgnome receivers

This is a fork of openssh's sshd which supports a new option for keys in the authorized_keys file: single_remote_forwarding_port=N, which means the client connecting using that key can only map a single remote (i.e. server) port, namely the one specified as N. This is used to give each sensorgnome a unique tunnel port (in the range 40000...65535 ). When the SG connects to the server, it will map the tunnel port on the server back to its own ssh server on port 22. This lets us ssh into the SG, without requiring that the SG's ssh server listen on any external network interfaces, and without any firewall openings required on the SG's network. (The SG must of course be able to reach our server with an outgoing ssh connection to port 59022 on sensorgnome.org or sgdata.motus.org )

e.g. The Old Cut sensorgnome SG-5113BBBK2972 has tunnel port 40407. When connected to the server, it can be reached from the server by doing:

ssh -p 40407 bone@localhost

(and then entering the password bone).



jbrzusto/motusServer documentation built on May 19, 2019, 8:19 a.m.