Git Product home page Git Product logo

meshinfo's Introduction

MeshInfo

Realtime web UI to run against a Meshtastic regional or private mesh network.

Docker Image GitHub Release GitHub commit activity

Overview

MeshInfo is written in Python and connects to an MQTT server that is receiving Meshtastic messages for the purpose of visualizing and inspecting traffic. It (currently) uses a filesystem to persist content, such as node info and telemetry. There are plans to optionally support Postgres and SQLite3 as optional persistance storage methods.

To make deployment to run an instance for your mesh easy, Docker support is included. We recommend using Docker Compose with a personalized version of the docker-compose.yml file to most easily deploy it, but any seasoned Docker user can also use the Docker image alone.

If you use MeshInfo and have a publicly accessible instance, we'd like to know! Drop a note to [email protected] with details and we'll link it below.

See an example instance running on the Sacramento Valley Mesh.

If you are running a high elevation node, preferrably a Router or Repeater node, you might be interested in getting on the notification list for a cavity filter that Kevin and Trevor are having made.

If you're interested in aeronautical (ADS-B/ACARS/VDL/HFDL/SATCOM) or ship tracking (AIS), please take a look at sister project Airframes / Airframes Github.

Screenshots

MeshInfo Screenshot 1 MeshInfo Screenshot 2 MeshInfo Screenshot 3 MeshInfo Screenshot 4 MeshInfo Screenshot 5

Supported Meshtastic Message Types

  • neighborinfo
  • nodeinfo
  • position
  • telemetry
  • text
  • traceroute

Features

Current

  • Chat
  • Map
  • Nodes
  • Node Neighbors
  • Mesh Messages
  • MQTT Messages
  • Telemetry
  • Traceroutes

Upcoming

  • Statistics
  • Overview of Routes

Chat

If you're using this and have questions, or perhaps you want to join in on the dev effort and want to interact collaboratively, come chat with us on #meshinfo on the SacValleyMesh Discord.

Running

Docker Compose (preferred for 24/7 servers)

Setup

Clone the repo
git clone https://github.com/MeshAddicts/meshinfo.git
cd meshinfo
Edit Configuration
  1. Copy and then edit the config.json.sample to config.json.
  2. Copy Caddyfile.sample to Caddyfile then edit the Caddyfile and be sure it is setup for your hostname (FQDN if requiring Let's Encrypt cert to be generated) and your email address for the TLS line.
  • Caddy will request a cert of the FQDN, be sure to specify any subdomain. For example: https://meshinfo.domain.com.

  • If you only wish to use a self-signed certificate and are OK with the browser warnings about this, change the TLS line from your email address to tls internal.

  • If you are using a reverse proxy other than Caddy, change the FQDN to :80 then set your reverse proxy's upstream config to listen to port 80.

  1. Edit the docker-compose.yml (or docker-compose-dev.yml if you are going to use that one) and adjust any port mappings for caddy if you wish to have it run on anything other than 80/443. Keep in mind that if you are not using a FQDN and ports 80/443, Caddy will fail to provision a Let's Encrypt certificate. This is because Let's Encrypt requires 80/443 to be accessible and this is not a limitation of Caddy nor MeshInfo.

To Run

Change to the directory.

cd meshinfo
docker compose pull && docker compose down && docker compose up -d && docker compose ps && docker compose logs -f meshinfo

To Update

git fetch && git pull && docker compose pull && docker compose down && docker compose up -d && docker compose ps && docker compose logs -f meshinfo

Directly (without Docker)

Be sure you have Python 3.12.4 or higher installed.

pip install -r requirements.txt
python main.py

Development

Building a local Docker image

Clone the repository.

git clone https://github.com/MeshAddicts/meshinfo.git

If already existing, be sure to pull updates.

git fetch && git pull

Build. Be sure to specify a related version number and suffix (this example dev5 but could be your name or initials and a number) as this will help prevent collisions in your local image cache when testing.

scripts/docker-build.sh 0.0.1dev5

Running via Docker Compose while developing

docker compose -f docker-compose-dev.yml up --build --force-recreate

You will need to CTRL-C and run again if you make any changes to the python code, but not if you only make changes to the templates.

Release

Tag the release using git and push up the tag. The image will be build by GitHub automatically (see: https://github.com/MeshAddicts/meshinfo/actions/workflows/docker.yml).

git tag v0.0.0 && git push && git push --tags

Contributing

We happily accept Pull Requests!

TODO: Need to rewrite this section.

meshinfo's People

Contributors

afairclo avatar armooo avatar daviesgeek avatar dependabot[bot] avatar elements avatar kevinelliott avatar quimnut avatar simmerv avatar stefanthoss avatar vidplace7 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

meshinfo's Issues

Feature: Nets

This is probably more along the lines of a BBS, but the ability to send out a message to which people must DM a check-in would be great for building a network map

Feature: Backups

Initial capability to backup data.

  1. On some (configurable in config.json) interval, backup all the JSON data (eventually include DB(s))
  2. Optionally allow for backing up of the statically rendered HTML too

Feat: Allow selection of "my" node

Right now we can only ever see DX information from the single node configured int the config.json. It'd be great to have the ability to store a selection so you can see the mesh from your node's POV

Feature: Add Redis for caching

We will want a redis component to cache some fragments and/or even pages to improve general performance, eventually. The API and the main loop would make the most use of this, but the bot might as well.

App Icons

We need to create some kind of an app icon for MeshInfo. And then we need to put it in place for:

  • public/favicon.ico
  • public/apple-touch-icon.png
  • public/apple-touch-icon-precomposed.png

Totally fine to put something quick and random as a temporary stopgap.

MQTT client id to be semi-dynamic

Current default client_id is meshinfo, which is totally fine if only a single client with this ID will connect to a MQTT server. If it collides with another, it disconnects that client. Therefore, we should make client_id in the Config be renamed to client_id_prefix and then have it generate a dynamic (or saved) suffix, perhaps a UUID (one with the timestamp decodable perhaps).

Add first pass of tests

We need some tests, it's only right for us to do this when there's more than 1 dev. First dev to implement some tests gets 3 cookies.

Move save() to async

Right now the save() functionality (which persists to JSON files and/or renders HTML files) is blocking and will interrupt the MQTT queue/stream, and also will block API requests. We need to make this an async operation.

We will likely need to make not only the method call async, but also do a .copy() on the objects so that other operations do not modify the contents of the references while it iterates.

Design: Logo

We need someone with design chops to make a logo for MeshAddicts and also for meshinfo.

Add MapBox option

Add the option to use MapBox. This might be challenging to maintain two map implementations, but the value is that the host can benefit from more premium map features if willing to pay for MapBox (though the free tier offers a ton of value, especially for small sites, which these Meshtastic mesh sites should be).

@daviesgeek I will coordinate with you when this becomes a need in the React app (and can help a lot).

Move Caddyfile to Caddyfile.sample

Need to make this more friendly for users.

  • move Caddyfile to Caddyfile.sample
  • add Caddyfile to .gitignore
  • update README.md with cp Caddyfile.sample Caddyfile and instructions to edit during setup steps

Add node gateway source

We need the ability to see how a node got to us. Much like Meshmap, we need to know who reported or "gated" the packet(s).

Feature: Initial API endpoints

Now that we are looking to start moving to the SPA using React, we want to expose the data via an API. This API could also be used by the community of users that a MeshInfo is serving, perhaps to help power other projects.

Initial batch of endpoints considered are:

  • /v1/nodes - Paginated array of all known nodes (or with some params, a filtered array of nodes)
  • /v1/nodes/:id - Gets a node info (intelligently between hex and int ids)
  • /v1/nodes/:id/texts
  • /v1/nodes/:id/telemetry
  • /v1/nodes/:id/traceroutes
  • /v1/server/config - The server's configuration (useful for showing server details on UI)
  • /v1/telemetry - Paginated array of telemetry (filterable)
  • /v1/traceroutes - Paginated array of traceroutes (filterable)

Add consistent images for each hardware type

Some of the pages will use the hardware info of the nodes in order to display an image of the hardware. Preferably these should all go in public/images/hardware and be named based on their corresponding hardware integer ID (defined at https://buf.build/meshtastic/protobufs/docs/main:meshtastic#meshtastic.HardwareModel), thus a Heltec V3 is 43.png.

The images should have the following requirements:

  • consistent sizing
  • named NUM.png
  • put in public/images/hardware/
  • consistent in style as much as possible (though I recognize this is not perfect)
  • alpha for the background if possible, otherwise white

Move config into json or yaml

Right now config is defined in config.py as a dict, but realistically this is not ideal.

We probably need something that combines a standard JSON/YAML plus some additional dynamic massaging.

Feature: Dynamic Mesh Name Styling

This is "neat"

image

but it doesn't work well for anyone running their own instance.

We need to dynamically style this based on the Mesh Name defined in the config.json.

Docker container crash: UnicodeDecodeError: 'utf-8' codec can't decode bytes

Getting a somewhat consistent crash of the meshinfo docker container with the following error:
UnicodeDecodeError: 'utf-8' codec can't decode bytes in position 1-2: invalid continuation byte

Full log: https://pastebin.ai/je0yo8ckb2

The container then restarts itself. Seems to happen somewhat consistently a few times per hour.
If you need to see the actual message being processed when it crashes, I may be able to retrieve that from the mqtt server before another one comes in and I become unsure which one is correct.

Any ideas?

NaN values in telemetry

A new node had some invalid telemetry today on .328

meshinfo_1 | | File "templates/static/node.html.j2", line 43, in block 'content'
meshinfo_1 | | {{ node.telemetry.temperature | round(1) }}°C
meshinfo_1 | | ^^^^^^^^^^^^^^^^^
meshinfo_1 | | File "/usr/local/lib/python3.12/site-packages/jinja2/filters.py", line 1169, in do_round
meshinfo_1 | | return round(value, precision)
meshinfo_1 | | ^^^^^^^^^^^^^^^^^^^^^^^
meshinfo_1 | | TypeError: type str doesn't define round method

nodes.json had;

"telemetry": {
  "relative_humidity": "NaN",
  "temperature": "NaN"
}

It also ended up in telenetry.json

meshinfo_1 | | File "templates/static/telemetry.html.j2", line 173, in block 'content'
meshinfo_1 | | {{ item.payload.temperature | round(2) }} °C

Refactor main.py

The main.py has bloated significantly, which was expected since this first started as an exploration but as become a real project since. We need to refactor it so that things are more modular and potentially testable.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.