Compare commits
5 commits
dev-stable
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| f66835cb9e | |||
| e1ff33a39a | |||
| c499dbe172 | |||
| b24c17cb46 | |||
| 001a8e2399 |
9 changed files with 0 additions and 316 deletions
22
README.md
22
README.md
|
|
@ -1,7 +1,5 @@
|
|||
# LoMeS
|
||||
|
||||
<!--<img src="https://meshtastic.org/design/logo/svg/Mesh_Logo_White.svg" alt="Meshtastic" width="100" height="100">-->
|
||||
|
||||
**LOcal MEshtastic Server** _in development_
|
||||
|
||||
Idea is to:
|
||||
|
|
@ -12,23 +10,3 @@ Idea is to:
|
|||
- and **maybe** connect to mobile clients in the far future.
|
||||
- check progress [here](https://lab.c95.org/fr4nz/LoMeS/src/branch/main/assets/notes/notes.md)
|
||||
---
|
||||
|
||||
## Hardware
|
||||
|
||||
for now everything will be developed and tested on Raspberry Pi 3B and newer acting as server and as LoRa Modules RAK WisBlock 4631 with RAK 19007 Board as well as Heltec V3 connected via USB/UART.
|
||||
|
||||
## Hard & Firmware
|
||||
|
||||
- Raspberry Pi 4B | _RPI OS lite (Debian 13 | Trixie)_
|
||||
- RAK Wisblock | _FW 2.6.11_
|
||||
- Heltec V3 | _FW 2.6.11_
|
||||
|
||||
## Development Setup
|
||||
|
||||
1. Flash Raspberry Pi OS lite 64bit
|
||||
2. Install dependencies:
|
||||
```bash
|
||||
sudo apt install --install-suggests -y nginx python3-meshtastic python3-flask python3-requests
|
||||
```
|
||||
3. Configure `nginx` the way you need | _or use the example config located [here](https://lab.c95.org/fr4nz/LoMeS/src/branch/main/assets/config/nginx/nginx.conf) edit at least lines 9 & 15 - 18 to your needs_
|
||||
4. Start developing
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
###########################################################
|
||||
### ###
|
||||
### MESHPI NGINX CONFIG ###
|
||||
### ###
|
||||
###########################################################
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name DOMAIN IPADDR;
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
server_name DOMAIN IPADDR;
|
||||
|
||||
ssl_certificate /etc/nginx/ssl/CERTNAME.crt;
|
||||
ssl_certificate_key /etc/nginx/ssl/CERTNAME.key;
|
||||
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
ssl_ciphers HIGH:!aNULL:!MD5;
|
||||
|
||||
ssl_session_cache shared:SSL:10m;
|
||||
ssl_session_timeout 10m;
|
||||
|
||||
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ =404;
|
||||
root /var/www/html;
|
||||
index index.html;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg width="100%" height="100%" viewBox="0 0 100 55" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
|
||||
<g transform="matrix(0.802386,0,0,0.460028,-421.748,-122.127)">
|
||||
<g transform="matrix(0.579082,0,0,1.01004,460.975,-39.6867)">
|
||||
<path d="M250.908,330.267L193.126,415.005L180.938,406.694L244.802,313.037C246.174,311.024 248.453,309.819 250.889,309.816C253.326,309.814 255.606,311.015 256.982,313.026L320.994,406.536L308.821,414.869L250.908,330.267Z" style="fill:white;"/>
|
||||
</g>
|
||||
<g transform="matrix(0.582378,0,0,1.01579,485.019,-211.182)">
|
||||
<path d="M87.642,581.398L154.757,482.977L142.638,474.713L75.523,573.134L87.642,581.398Z" style="fill:white;"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1 KiB |
|
|
@ -1,26 +0,0 @@
|
|||
To send commands from a Python script to a web server, you can use HTTP requests. The requests library is a popular and user-friendly option for making HTTP calls in Python.
|
||||
For example, you can send a POST request with data to a specific URL:
|
||||
|
||||
import requests
|
||||
|
||||
data = {"key": "value"}
|
||||
response = requests.post("http://example.com/api", data=data)
|
||||
|
||||
Alternatively, you can use the built-in urllib module, though requests is generally preferred for its simplicity and readability.
|
||||
|
||||
For sending data from a Raspberry Pi to a web server, you can use tools like curl in a cron job to periodically send data from a Python script to a server endpoint.
|
||||
For instance:
|
||||
|
||||
curl -X POST -d "$(python /path/to/script.py)" http://example.com/receive.php
|
||||
|
||||
This approach allows the script to output data, which is then sent to the server via HTTP POST.
|
||||
|
||||
If you are building a web server in Python to receive commands, you can use the http.server module to create a simple server that handles incoming requests.
|
||||
For example, a basic server can be started with:
|
||||
|
||||
python3 -m http.server 8000
|
||||
|
||||
This starts a server on port 8000, accessible via http://localhost:8000.
|
||||
You can extend this server to process incoming commands by defining custom request handlers using BaseHTTPRequestHandler.
|
||||
|
||||
For more advanced use cases, frameworks like Flask or Django can be used to create robust web servers capable of handling complex command logic and data processing.
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
# Notes
|
||||
## To Do
|
||||
1. [ ] define actions and plan
|
||||
2. [ ] create simple web interface with flask and nginx
|
||||
3. [ ] communicate with Meshtastic device via web interface
|
||||
|
||||
## Follow up
|
||||
### Backend
|
||||
[meshtastic-cli-receive-text](https://github.com/brad28b/meshtastic-cli-receive-text)
|
||||
|
||||
### Web app
|
||||
[flask web app tutorial](https://www.digitalocean.com/community/tutorials/how-to-make-a-web-application-using-flask-in-python-3)
|
||||
|
||||
[w3schools How to's](https://www.w3schools.com/howto/default.asp)
|
||||
|
||||
## Timeline
|
||||
|
||||
### Backend
|
||||
- Environment setup script in development
|
||||
|
||||
### Frontend
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
## SOME COLOR
|
||||
BLK="\e[0;30m"
|
||||
RED="\e[0;31m"
|
||||
GRN="\e[0;32m"
|
||||
ORN="\e[0;33m"
|
||||
BLU="\e[0;34m"
|
||||
MGT="\e[0;35m"
|
||||
CYN="\e[0;36m"
|
||||
LGR="\e[0;37m"
|
||||
DGR="\e[1;30m"
|
||||
LRD="\e[1;31m"
|
||||
LGN="\e[1;32m"
|
||||
YEL="\e[1;33m"
|
||||
LBL="\e[1;34m"
|
||||
LPR="\e[1;35m"
|
||||
LCY="\e[1;36m"
|
||||
WHT="\e[1;37m"
|
||||
CRS="\e[0m"
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
### SHELL TEMPLATE
|
||||
|
|
@ -1,99 +0,0 @@
|
|||
#!/bin/bash
|
||||
source assets/shell/shell_colors
|
||||
### DEPENDENCY CHECK & INSTALLER
|
||||
|
||||
pkgs="openssl nginx"
|
||||
|
||||
echo -e "\n${CYN} Dependency and Privilege Check running...${CRS}\n"
|
||||
|
||||
### PRIVILEGES
|
||||
|
||||
if (( $(id -u) == 0 )); then
|
||||
echo -e "${GRN} Privilege check passed...${CRS}\n"
|
||||
|
||||
else
|
||||
echo -e "${RED} Privilege check failed... Please run script with sudo or as root!${CRS}\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
### DEPENDENCIES
|
||||
|
||||
if command -v "$pkgs" >/dev/null 2>&1; then
|
||||
echo -e "${GRN} Dependency check passed...${CRS}\n"
|
||||
|
||||
else
|
||||
echo -e "${YEL} Dependencies not met.${CRS}\n"
|
||||
|
||||
while true; do
|
||||
echo -e " ${YEL}Do you wish to install via APT? (${GRN}Y${YEL}/${RED}n${YEL})${CRS}"
|
||||
read -p " --> " install
|
||||
echo ""
|
||||
if [[ "$install" = "" || "$install" = "y" || "$install" = "Y" ]]; then
|
||||
sudo apt update && sudo apt install --install-suggests -y $pkgs --simulate ## DEV
|
||||
echo -e "\n${GRN} Dependencies installed. Proceeding...${CRS}\n"
|
||||
break
|
||||
|
||||
elif [[ "$install" == "n" || "$install" = "N" ]]; then
|
||||
echo -e "\n${RED} Missing dependencies... Exiting!${CRS}\n"
|
||||
exit 1
|
||||
|
||||
else
|
||||
echo -e "\n${YEL} Invalid response... Try again...\n\n ${GRN}Y ${YEL}= (Yes, install dependencies and continue)\n ${RED}N ${YEL}= (No, don't install dependencies and exit)${CRS}\n "
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
### NGINX SETUP & CONFIG
|
||||
|
||||
###### CERTIFICATION
|
||||
|
||||
while true; do
|
||||
echo -e " ${YEL}Configure SSL and create a self signed cetrificate? (Y/n)${CRS}"
|
||||
read -p " --> " installSSL
|
||||
if [[ "$installSSL" = "" || "$installSSL" = "y" || "$installSSL" = "Y" ]]; then
|
||||
echo -e " ${YEL}Enter path to certificates folder${CRS}"
|
||||
read -p " default = /etc/nginx/ssl --> " cert_path
|
||||
if ! [ "$cert_path" ]; then
|
||||
cert_path=/etc/nginx/ssl
|
||||
elif [[ "$cert_path" = "." ]]; then
|
||||
cert_path=$PWD
|
||||
else
|
||||
:
|
||||
fi
|
||||
echo ""
|
||||
echo -e " ${YEL}Enter file name for certificate and key${CRS}"
|
||||
read -p " default --> $HOSTNAME --> " cert_name
|
||||
if ! [ "$cert_name" ]; then
|
||||
cert_name=$HOSTNAME
|
||||
else
|
||||
:
|
||||
fi
|
||||
echo ""
|
||||
sudo mkdir -p "$cert_path"
|
||||
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout "$cert_path"/"$cert_name".key -out "$cert_path"/"$cert_name".crt
|
||||
echo -e "\n${GRN} SSL certificate files ${YEL}$cert_name.crt ${GRN}and ${YEL}$cert_name.key ${GRN}created and stored in ${YEL}$cert_path${CRS}\n"
|
||||
break
|
||||
elif [[ "$installSSL" == "n" || "$installSSL" = "N" ]]; then
|
||||
echo -e "\n${RED} No encryption established${CRS}\n"
|
||||
break
|
||||
else
|
||||
echo -e "\n${YEL} Invalid response... Try again...\n\nY = (Yes, configure SSL certificate and continue)\nN = (No, leave unencrypted and continue)${CRS}\n "
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
echo -e "${YEL} Your current hostname is ${CYN}$HOSTNAME${CRS} would you like to change it?${CRS}"
|
||||
|
||||
# ask for network interface & get IP
|
||||
# ask to change hostname in /etc/hosts & /etc/hostname
|
||||
|
||||
### DEV STATUS
|
||||
|
||||
#sudo cp -R assets/config/nginx/nginx.conf /etc/nginx/sites-enabled/
|
||||
## JEFF
|
||||
# utilise sed to edit config
|
||||
# test nginx config
|
||||
# restart nginx
|
||||
## JEFF END
|
||||
|
||||
echo -e "${GRN}\nScript ran through...${CRS}"
|
||||
|
|
@ -1,82 +0,0 @@
|
|||
#!/bin/bash
|
||||
source assets/shell/shell_colors
|
||||
### DEPENDENCY CHECK & INSTALLER
|
||||
|
||||
pkgs="openssl nginx"
|
||||
|
||||
echo -e "\n${CYN} Dependency and Privilege Check running...${CRS}\n"
|
||||
|
||||
### PRIVILEGES
|
||||
|
||||
if (( $(id -u) == 0 )); then
|
||||
echo -e "${GRN} Privilege check passed...${CRS}\n"
|
||||
|
||||
else
|
||||
echo -e "${RED} Privilege check failed... Please run script with sudo or as root!${CRS}\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
### DEPENDENCIES
|
||||
|
||||
if command -v "$pkgs" >/dev/null 2>&1; then
|
||||
echo -e "${GRN} Dependency check passed...${CRS}\n"
|
||||
|
||||
else
|
||||
echo -e "${YEL} Dependencies not met.${CRS}\n"
|
||||
|
||||
while true; do
|
||||
echo -e " ${YEL}Do you wish to install via APT? (${GRN}Y${YEL}/${RED}n${YEL})${CRS}"
|
||||
read -p " --> " install
|
||||
echo ""
|
||||
if [[ "$install" = "" || "$install" = "y" || "$install" = "Y" ]]; then
|
||||
sudo apt update && sudo apt install --install-suggests -y $pkgs --simulate ## DEV
|
||||
echo -e "\n${GRN} Dependencies installed. Proceeding...${CRS}\n"
|
||||
break
|
||||
|
||||
elif [[ "$install" == "n" || "$install" = "N" ]]; then
|
||||
echo -e "\n${RED} Missing dependencies... Exiting!${CRS}\n"
|
||||
exit 1
|
||||
|
||||
else
|
||||
echo -e "\n${YEL} Invalid response... Try again...\n\n ${GRN}Y ${YEL}= (Yes, install dependencies and continue)\n ${RED}N ${YEL}= (No, don't install dependencies and exit)${CRS}\n "
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
### NGINX SETUP & CONFIG
|
||||
|
||||
###### CERTIFICATION
|
||||
|
||||
while true; do
|
||||
echo -e " ${YEL}Configure SSL and create a self signed cetrificate? (Y/n)${CRS}"
|
||||
read -p " --> " installSSL
|
||||
if [[ "$installSSL" = "" || "$installSSL" = "y" || "$installSSL" = "Y" ]]; then
|
||||
echo -e " ${YEL}Enter path to certificates folder${CRS}"
|
||||
read -p " default = /etc/nginx/ssl --> " cert_path
|
||||
if ! [ "$cert_path" ]; then
|
||||
cert_path=/etc/nginx/ssl
|
||||
elif [[ "$cert_path" = "." ]]; then
|
||||
cert_path=$PWD
|
||||
else
|
||||
:
|
||||
fi
|
||||
echo ""
|
||||
echo -e " ${YEL}Enter file name for certificate and key${CRS}"
|
||||
read -p " default --> $HOSTNAME --> " cert_name
|
||||
if ! [ "$cert_name" ]; then
|
||||
cert_name=$HOSTNAME
|
||||
else
|
||||
:
|
||||
fi
|
||||
echo ""
|
||||
sudo mkdir -p "$cert_path"
|
||||
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout "$cert_path"/"$cert_name".key -out "$cert_path"/"$cert_name".crt
|
||||
echo -e "\n${GRN} SSL certificate files ${YEL}$cert_name.crt ${GRN}and ${YEL}$cert_name.key ${GRN}created and stored in ${YEL}$cert_path${CRS}\n"
|
||||
break
|
||||
elif [[ "$installSSL" == "n" || "$installSSL" = "N" ]]; then
|
||||
echo -e "\n${RED} No encryption established${CRS}\n"
|
||||
break
|
||||
else
|
||||
echo -e "\n${YEL} Invalid response... Try again...\n\nY = (Yes, configure SSL certificate and continue)\nN = (No, leave unencrypted and continue)${CRS}\n "
|
||||
fi
|
||||
done
|
||||
Loading…
Add table
Add a link
Reference in a new issue