Difference between revisions of "Project/Spitfire/Apps"

From initLab
Jump to navigation Jump to search
(Created page with "There are several apps/scripts, running on our main Lab server (spitfire.initlab.org). They run as user '''apps'''. To access them, login as root, and use the following comma...")
 
Line 23: Line 23:
'''pm2 start 23'''
'''pm2 start 23'''


More info about PM2: https://pm2.keymetrics.io/docs/usage/quick-start/
[https://pm2.keymetrics.io/docs/usage/quick-start/ More info about PM2]


If you want to check or manage the status the whole process manager (pm2), please use the systemd unit '''pm2-apps.service''' as root. It is responsible for starting the process manager and all apps on system boot.
If you want to check or manage the status the whole process manager (pm2), please use the systemd unit '''pm2-apps.service''' as root. It is responsible for starting the process manager and all apps on system boot.
Line 54: Line 54:


*'''pm2 save''' (this will add the app to startup list)
*'''pm2 save''' (this will add the app to startup list)
== Description of each app ==
* 433MHz<->MQTT ([https://github.com/initLab/uart-rf-mqtt uart-rf-mqtt]): Bridges the serial interface with Arduino board and RF 433MHz RX/TX boards, with the MQTT server so other apps can send commands to RF devices (door bells, door opening modules), and receive commands from RF-enabled devices (e.g. remote control fobs).
* BLE->MQTT ([https://github.com/initLab/mi-hygrothermograph-mqtt mi-hygrothermograph-mqtt]): Receives Xiaomi thermo/humidity sensor readings on BLE, decrypts the packets and sends the readings over MQTT.
* MQTT->collectd ([https://github.com/initLab/mqtt-proxy mqtt-proxy]): Receives sensor or appliance readings on MQTT and writes the readings to collectd using the plain text protocol on collectd's UNIX socket.
* gosho ([https://github.com/initLab/gosho gosho]): Provides [[Project/Fauna|Fauna]]-compliant API, and either presents a dummy data, or communicates with a NetControl device, to read and change init Lab's door lock (currently not operational, but prevents "undefined door status" message in Fauna).
* initLabNotifier ([https://github.com/initLab/irc-notifier irc-notifier]): An IRC bot, which announces some events that happen at the Lab, and has a couple of useful commands (use !help in the IRC channel, or on private message with the bot).

Revision as of 19:16, 4 July 2021

There are several apps/scripts, running on our main Lab server (spitfire.initlab.org). They run as user apps.

To access them, login as root, and use the following command:

sudo -iu apps

Status monitoring and management

You can see the running apps using:

pm2 list

or see a log browser and live metrics using:

pm2 monit

These apps restart automatically on crash. In order to stop any of them, note its number in pm2 list, and issue the command:

pm2 stop 23 (where 23 is the ID of the app)

Then to start:

pm2 start 23

More info about PM2

If you want to check or manage the status the whole process manager (pm2), please use the systemd unit pm2-apps.service as root. It is responsible for starting the process manager and all apps on system boot.

systemctl start pm2-apps

systemctl stop pm2-apps

systemctl restart pm2-apps

systemctl status pm2-apps

Add a new app

As user apps:

  • git clone URL-OF-APP
  • cd DIR-OF-APP
  • npm install
  • create/adjust the app config, if necessary
  • cd ..
  • edit ecosystem.config.js, be careful about trailing commas
  • pm2 reload ecosystem.config.js (this will start the new app, if properly added and configured)
  • pm2 save (this will add the app to startup list)


Description of each app

  • 433MHz<->MQTT (uart-rf-mqtt): Bridges the serial interface with Arduino board and RF 433MHz RX/TX boards, with the MQTT server so other apps can send commands to RF devices (door bells, door opening modules), and receive commands from RF-enabled devices (e.g. remote control fobs).
  • BLE->MQTT (mi-hygrothermograph-mqtt): Receives Xiaomi thermo/humidity sensor readings on BLE, decrypts the packets and sends the readings over MQTT.
  • MQTT->collectd (mqtt-proxy): Receives sensor or appliance readings on MQTT and writes the readings to collectd using the plain text protocol on collectd's UNIX socket.
  • gosho (gosho): Provides Fauna-compliant API, and either presents a dummy data, or communicates with a NetControl device, to read and change init Lab's door lock (currently not operational, but prevents "undefined door status" message in Fauna).
  • initLabNotifier (irc-notifier): An IRC bot, which announces some events that happen at the Lab, and has a couple of useful commands (use !help in the IRC channel, or on private message with the bot).