React and NodeJS Web application for graphing rocket telemetry data

base-station

system architecture

Necessary steps before running

  1. In the client directory, run:

npm install
npm install

installs the necessary dependencies for the client app

  1. In the node -server directory, run:

installs the necessary dependencies for the server app

How to run in production environment

In the node-server directory, run:

npm run prod

How to run in development environment

In the node-server directory, you can run:

npm run dev

Runs the app in the development mode. Open http://localhost:3000 to view it in your browser.

Running with custom environment variables on client

  1. In the client directory create a .env.local file
touch .env.local
  1. Add the following values to the .env.local file
REACT_APP_SERVER_URL=ws://<server hostname or ip address>:<server port> or http://<server hostname or ip address>:<server port>

Running with custom environment variables on server

  1. In the node-server directory create a .env file
touch .env
  1. Add the following values to the .env file

BROKER_URL=mqtt://<broker hostname or ip address>:<broker port>
PORT=<server port>
ORIGIN=http://<client hostname or ip address>:<client port>

Running with systemd

Suppose you are in the app directory /home/$USER/foo

  1. Create file, let’s call it foo.service
touch foo.service
  1. In the file add

[Unit]
Description=Foo application

[Service]
User=<USER>
WorkingDirectory=/home/<USER>/foo
ExecStart=/usr/bin/npm run prod
Restart=on-failure

[Install]
WantedBy=multi-user.target
  1. Copy unit into systemd folder
sudo cp foo.service /etc/systemd/system
  1. Reload daemon
sudo systemctl daemon-reload
  1. Enable start on boot
sudo systemctl enable foo.service

systemd on raspberrypi example

Suppose you are in the app directory /home/pi/Desktop/base-station

  1. Create file, let’s call it bs.service
touch bs.service
  1. In the file add

[Unit]
Description=Nakuja N2 base station software

[Service]
User=pi
WorkingDirectory=/home/pi/Desktop/base-station
ExecStart=/usr/bin/npm run prod
Restart=on-failure

[Install]
WantedBy=multi-user.target
  1. Copy unit into systemd folder
sudo cp bs.service /etc/systemd/system
  1. Reload daemon
sudo systemctl daemon-reload
  1. Enable start on boot
sudo systemctl enable bs.service

GitHub

View Github