diff --git a/README.md b/README.md index 9f7da2b..6e581f1 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ # LoMeS - - **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 \ No newline at end of file diff --git a/assets/config/nginx/nginx.conf b/assets/config/nginx/nginx.conf deleted file mode 100644 index b8d2141..0000000 --- a/assets/config/nginx/nginx.conf +++ /dev/null @@ -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; - } -} diff --git a/assets/images/Mesh_Logo_White.svg b/assets/images/Mesh_Logo_White.svg deleted file mode 100644 index b1bcd57..0000000 --- a/assets/images/Mesh_Logo_White.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/assets/notes/FrontToBackend.md b/assets/notes/FrontToBackend.md deleted file mode 100644 index 84285ea..0000000 --- a/assets/notes/FrontToBackend.md +++ /dev/null @@ -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. \ No newline at end of file diff --git a/assets/notes/notes.md b/assets/notes/notes.md deleted file mode 100644 index 977af73..0000000 --- a/assets/notes/notes.md +++ /dev/null @@ -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 \ No newline at end of file diff --git a/assets/shell/shell_colors b/assets/shell/shell_colors deleted file mode 100644 index 72f5d7d..0000000 --- a/assets/shell/shell_colors +++ /dev/null @@ -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" \ No newline at end of file diff --git a/assets/shell/template.sh b/assets/shell/template.sh deleted file mode 100644 index 41439e3..0000000 --- a/assets/shell/template.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -### SHELL TEMPLATE diff --git a/assets/test/test.sh b/assets/test/test.sh deleted file mode 100755 index 1fb107a..0000000 --- a/assets/test/test.sh +++ /dev/null @@ -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}" diff --git a/dev_env_setup.sh b/dev_env_setup.sh deleted file mode 100755 index 2a5fd13..0000000 --- a/dev_env_setup.sh +++ /dev/null @@ -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