Raspberry Pis provide much of the important functionality available on the nEDM system. In particular, many devices may be controlled by scripts running on these devices. This page documents how one can setup and run Raspberry Pis on the local nEDM network.
The Raspberry Pis that run on the internal network have the following characteristics:
Setting up a new Raspberry Pi is simple.
Download the current image here and flash to a new SD card (can be < 64 MB).
wget https://github.com/nEDM-TUM/HimbeereCouch/raw/master/nEDM/rasb_pi.img.gz
gunzip -c rasb_pi.img.gz | sudo dd of=/dev/sd_card
where /dev/sd_card
is the correct path to the SD card.
Then you should be able to plug in to the local nEDM network (via Ethernet) and you’re all set.
Note: This must be on the nEDM network because it relies upon access to the raid server’s NFS.
The next step is to ensure that communication with the CouchDB server is available and that a new user account is setup. To figure out which credentials you need, you need to login in to the new Raspberry Pi.
There are several tricks you can use here to grab the IP address:
nmap
with sudo
(to output MAC IDs):nmap -sP gateway.nedm1/24 | grep -B 2 Raspberry | awk '{ if ( $1 == "Nmap" ) printf "%s:\t", $5; if ( $1 == "MAC" ) print $3; }'
Once you have the IP address, you can login and grab the user credentials, as outlined here.
The set up of the NFS boot generally used instructions which were found on the web.
The Netboot relies upon a setup in the DHCP server on the Gateway
machine, in particular that the following
settings are in the dhcpd.conf
file:
class "raspberries" {
match if ( substring(hardware,1,3) = b8:27:eb );
default-lease-time 115200;
option root-path "192.168.1.9:/volume1/Raspberries/boot/current,tcp,vers=3";
}
which ensures that the Raspberry Pis use the given path as their root file path.
As noted, all Raspberry Pis mount the NFS drive read-only. To change (e.g.
update or install new software), then the drive must re-mounted rw. After one
logs in as root
(see the wiki), then the ro
(read-only) and rw
(read-write) alias commands should be available. A normal
update would look like:
rw # Make read-write
# ... Perform updates to the file system
# ... install new software, etc.
ro # Make read-only
The aliases are (for reference):
alias rw='mount -o remount,rw /'
alias ro='mount -o remount,ro /'
Note that this will automatically propagate to the other systems. It could be,
however, that the devices need to be restarted either using the command
reboot
or by pulling and reinserting the power cable (safe on the read-only
system).
himbeerecouch
/pynedm
himbeerecouch
is a python module, installed on the Netboot
distribution, which is used by the Raspberry Pis to pull the code from the
database that should be run. See the documentation
for more details about how this works. To update the software, use the
command:
/etc/init.d/rspby install
pynedm
is a software package which
implements much of the functionality needed in the nEDM experiment. It is
installed on the Raspberry Pis automatically when himbeerecouch
is installed.
The himbeerecouch
daemon is run using supervisor
and configured via the
file (/etc/supervisor/conf.d/raspberry.conf
):
[program:raspberry]
command=python -c 'import himbeerecouch.prog as p; p.run("/etc/rspby/server")'
autostart=true
autorestart=true
stopsignal=INT
redirect_stderr=true
stdout_logfile=/var/log/rspby_daemon.log
There is a terminado server running on the Raspberry Pis which allows visualization and interaction with the terminal via the web interface.
These are two daemons which are configured via:
/etc/supervisor/conf.d/log.conf
:[program:rspy_log]
command=sudo -u daq sh -c 'cd /home/daq/terminado_server && python log.py'
autostart=true
autorestart=true
stderr_logfile=/var/log/rspby_log.err
stdout_logfile=/var/log/rspby_log.log
/etc/supervisor/conf.d/terminado.conf
:[program:terminado]
command=sudo -u daq sh -c 'cd /home/daq/terminado_server && python server.py'
autostart=true
autorestart=true
stderr_logfile=/var/log/terminado.err
stdout_logfile=/var/log/terminado.log
At the moment, Raspberry Pis are being used to run:
See the admin page for more details.