Difference between revisions of "Project/Spitfire/Apps"
Line 66: | Line 66: | ||
* 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). | * 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). | ||
== Diagram of the services == | |||
[[File:Initlab-apps.png|thumb|left]] |
Latest revision as of 20:07, 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
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).