Tuesday, May 16, 2017

A Checklist For New Base Stations


Hardware: Beaglebone Black (BBB) with v0.2 custom cape
SD card with console image (NO graphical interface. Edit /boot/uEnv.txt to enable flasher)

Important note: The watchdog will reboot the Beaglebone if it is not fed more frequently than once every five minutes. Keep the cape off the bone until software to feed the dog is configured.

Features that require verification:
  • Real-Time Clock (RTC)
    • Verify that the RTC has the correct UTC time
    • Verify that the BBB is configured to use the WDT
      • sudo i2cdetect -y -r 2 should show "UU" at address 0x68
      • BBB has the correct time after boot (remove power for > 1 minute, then restore power, without Internet connection)
  • Watchdog Timer (WDT)
    • Verify that the WDT is fed
      • Linux uptime should be > 5 minutes
    • Verify that the WDT is active
      • BBB is rebooted if WDT is not fed
      • When in shutdown state, BBB is powered up by WDT within 5 minutes
  • Four hardware serial ports
    • Tx/Rx test, loopback test
    • Both 3V3 TTL and RS232 levels
  • The latest application software
    • git pull ...
    • sampling.py is running upon power up 
  • System software all up-to-date
    • sudo apt update && sudo apt upgrade -y
    • Apache/MySQL are disabled (if installed)
  • RabbitMQ link active and using TLS
    • User does not have administrator tag
    • Queue to_uhm is empty or near empty
  • Daily backup scheduled in crontab
  • Reverse SSH link active
  • "Heartbeat" active (check heartbeat.py)
  • Remaining disk space >1GB


During initial setup:
  • Use 5V 2A power adapter and Ethernet cable. No SD card required.
  • sudo apt install git
    • cd /opt/scripts/tools..., git pull, expand...
  • RTC must be tested without internet (SSH through the emulated Ethernet connection over USB)
    • RTC must have the correct time (sudo hwclock -r -f /dev/rtc1)
    • On boot, BBB's own clock must be correct (date and sudo hwclock -r -f /dev/rtc)
  • Update system clock; apt update, upgrade etc.; tools and library installation
    • cd ~ && git clone https://github.com/stanleylio/fishie.git node
    • Check node/setup/setup.sh to see required libraries
  • Setup Real-time Clock (RTC)
    • Install NTP
    • Set internal and external clock
    • Setup service to set system clock on boot
    • Verify (shutdown, completely remove power (mandatory), then power on without internet and check that the clock is correct)
  • Set hostname
    • Edit /etc/hostname and /etc/hosts
    • Base stations are named base-NNN
  • Generate new RSA key pair: ssh-keygen
  • Setup Watchdog Timer (WDT)
    • Verify (bone should restart within 15 minutes if dog is not fed)
    • Setup sampling_core.py and sampling.py (which feed the dog in a loop), or
    • Put "remove before flight section" in crontab: python ~/node/drivers/watchdog.py
  • Setup automated backup and "phone home" etc.
    • Database dump, configs etc.
    • rsync to glazerlab-e5 (uhcmbackup)
    • python node/send2server.py crontab every hour
    • (optional) Reverse SSH to glazerlab-i7
  • Setup supervisord 
  • Enable I2C 1 and 2, UART 1, 2, 4, and 5; disable HDMI
    • /boot/uEnv.txt
    • Verify the files in /dev (i2c*, rtc*, ttyOX)
  • Create MySQL database uhcm, create tables
    • (optional) Enable remote access
  • Setup RabbitMQ
    • Create local user
    • Setup Shovel to i7
    • (optional) Create remote user
    • (optional) Enable management plugin
    • (optional) Enable Web STOMP
  • Full acceptance test
    • Receive message from XBee, retrieve latest reading in database, verify that messages appear on the real-time rtcomm.html page
    • Check uptime periodically over several days