Skip to content

React and NodeJS Web application for graphing rocket telemetry data

Notifications You must be signed in to change notification settings

cmucheru/N2-Avionics-BaseStation

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

74 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

base-station

system architecture

architecture

Steps to run mosquitto influx and telegraf

  1. Install docker desktop

Docker desktop download instructions found here

  1. in the root directory create a file named influxdb.env
touch influxdb.env
  1. In influxdb.env set the following environment variables
DOCKER_INFLUXDB_INIT_MODE=setup
DOCKER_INFLUXDB_INIT_USERNAME=avionics
DOCKER_INFLUXDB_INIT_PASSWORD=987654321
DOCKER_INFLUXDB_INIT_ORG=nakuja
DOCKER_INFLUXDB_INIT_BUCKET=telemetry
DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=mysupersecrettoken
  1. In the root directory run:
docker compose up -d
  1. influxb dashboard is now availabe at localhost:8086
http://localhost:8086
  1. Sign in with username and password set in influxdb.env
username=avionics
password=987654321
  1. Everything is ready for use

Steps to run web app

  1. In the client directory, run:
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

About

React and NodeJS Web application for graphing rocket telemetry data

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 83.9%
  • HTML 13.4%
  • CSS 2.7%