forked from iarv/meshing-around
Compare commits
55 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
126f81fbd3 | ||
|
|
337d43a7af | ||
|
|
8c3121d5d6 | ||
|
|
1d577c9ec5 | ||
|
|
3540b8f110 | ||
|
|
3fdebf3bf9 | ||
|
|
430279809e | ||
|
|
7ba3a78718 | ||
|
|
c329391450 | ||
|
|
6bc3c3e980 | ||
|
|
48788ceda8 | ||
|
|
8f5bae3b05 | ||
|
|
17c693c2f7 | ||
|
|
ff91356c2a | ||
|
|
180d9f4728 | ||
|
|
1202a076d1 | ||
|
|
9b62d7f4d8 | ||
|
|
9451d23c09 | ||
|
|
dcdef40e89 | ||
|
|
817dde42f2 | ||
|
|
b384d2d5b1 | ||
|
|
4db46f16f2 | ||
|
|
5590391f7e | ||
|
|
ccb505f37f | ||
|
|
d883927572 | ||
|
|
b0109be3b0 | ||
|
|
98af757d93 | ||
|
|
f8746ff348 | ||
|
|
32fbfba3e9 | ||
|
|
d2501bf353 | ||
|
|
db9d7d9790 | ||
|
|
c6b5a1c708 | ||
|
|
a36f1580b3 | ||
|
|
f051e95986 | ||
|
|
bafcfad190 | ||
|
|
8b2059c444 | ||
|
|
fd4b5607d7 | ||
|
|
df30ee9cc4 | ||
|
|
c1135ecadf | ||
|
|
899702eecc | ||
|
|
d4604d8cbd | ||
|
|
c674b0a404 | ||
|
|
d59ddfd517 | ||
|
|
f68c533488 | ||
|
|
6e47d71028 | ||
|
|
f9af9b756d | ||
|
|
c19d442190 | ||
|
|
4c2d0cdebb | ||
|
|
612dbf01d3 | ||
|
|
28846b24a6 | ||
|
|
cd398375a2 | ||
|
|
01372a0f2c | ||
|
|
8254ec5baf | ||
|
|
549e12ffc1 | ||
|
|
d940cdf534 |
19
Dockerfile
19
Dockerfile
@@ -8,7 +8,13 @@ ENV PYTHONUNBUFFERED=1 \
|
||||
TZ=America/Los_Angeles
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y gettext tzdata locales nano && \
|
||||
apt-get install -y \
|
||||
build-essential \
|
||||
python3-dev \
|
||||
gettext \
|
||||
tzdata \
|
||||
locales \
|
||||
nano && \
|
||||
sed -i 's/^# *\(en_US.UTF-8 UTF-8\)/\1/' /etc/locale.gen && \
|
||||
locale-gen en_US.UTF-8 && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
@@ -17,7 +23,7 @@ WORKDIR /app
|
||||
|
||||
# Install dependencies first for better caching
|
||||
COPY requirements.txt /app/
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
RUN pip install --no-cache-dir -r /app/requirements.txt
|
||||
|
||||
# Copy the rest of the application
|
||||
COPY . /app
|
||||
@@ -26,7 +32,12 @@ COPY config.template /app/config.ini
|
||||
RUN chmod +x /app/script/docker/entrypoint.sh
|
||||
|
||||
# Add a non-root user and switch to it
|
||||
RUN useradd -m appuser
|
||||
USER appuser
|
||||
# RUN useradd -m appuser && usermod -a -G dialout appuser
|
||||
# USER appuser
|
||||
|
||||
# Expose Meshtastic TCP API port from the host
|
||||
#EXPOSE 4403
|
||||
# Meshing Around Web Dashboard port
|
||||
#EXPOSE 8420
|
||||
|
||||
ENTRYPOINT ["/bin/bash", "/app/script/docker/entrypoint.sh"]
|
||||
|
||||
@@ -110,7 +110,7 @@ git clone https://github.com/spudgunman/meshing-around
|
||||
- **Automated Installation**: [install.sh](INSTALL.md) will automate optional venv and requirements installation.
|
||||
- **Launch Script**: [laynch.sh](INSTALL.md) only used in a venv install, to launch the bot and the report generator.
|
||||
|
||||
### Docker Installation - handy for windows
|
||||
### Docker Installation - Good for Windows!
|
||||
See further info on the [docker.md](script/docker/README.md)
|
||||
|
||||
## Full list of commands for the bot
|
||||
|
||||
56
compose.yaml
56
compose.yaml
@@ -1,38 +1,50 @@
|
||||
# Docker Compose configuration for Meshing Around.
|
||||
# This setup includes the main Meshing Around service, with optional Ollama and Prometheus Node Exporter services.
|
||||
# Adjust device mappings, ports, and configurations as needed for your environment.
|
||||
services:
|
||||
meshing-around:
|
||||
stdin_open: true
|
||||
tty: true
|
||||
ports:
|
||||
- 8420:8420
|
||||
devices: # Optional if using meshtasticd. Pass through radio device.
|
||||
- /dev/ttyUSB0 # Replace this with your actual device!
|
||||
#- /dev/ttyAMA0 # Example
|
||||
#devices:
|
||||
#- /dev/ttyUSB0:/dev/tty #update your config.ini to /dev/tty
|
||||
#- /dev/ttyACM0:/dev/tty #if using serial select proper port
|
||||
volumes:
|
||||
- /data/meshing-around/config.ini:/app/config.ini:rw
|
||||
image: ghcr.io/SpudGunMan/meshing-around:test-all-changes
|
||||
- .:/app:rw
|
||||
image: ghcr.io/spudgunman/meshing-around:main
|
||||
container_name: meshing-around
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
- OLLAMA_API_URL=http://ollama:11434
|
||||
extra_hosts:
|
||||
#- "host.docker.internal:host-gateway" # Enables access to host services from within the container.
|
||||
user: "1000:1000" # run as non-root user for better security
|
||||
- "host.docker.internal:host-gateway"
|
||||
#user: "1000:1000"
|
||||
#user: "10999:10999"
|
||||
networks:
|
||||
- meshing-around-network
|
||||
|
||||
meshtasticd: # Runs a virtual node. Optional, but can be used to link meshing-around directly to mqtt.
|
||||
debug-console:
|
||||
image: ghcr.io/spudgunman/meshing-around:main
|
||||
container_name: debug-console
|
||||
command: ["/bin/bash"]
|
||||
stdin_open: true
|
||||
tty: true
|
||||
volumes:
|
||||
- .:/app:rw
|
||||
networks:
|
||||
- meshing-around-network
|
||||
|
||||
meshtasticd:
|
||||
ports:
|
||||
- 4403:4403
|
||||
- 443:443
|
||||
volumes:
|
||||
- ./script/docker:/etc/meshtasticd:rw
|
||||
restart: unless-stopped
|
||||
container_name: meshtasticd
|
||||
image: meshtastic/meshtasticd:beta
|
||||
image: meshtastic/meshtasticd:daily-debian
|
||||
networks:
|
||||
- meshing-around-network
|
||||
|
||||
ollama: # Used for enabling LLM interactions.
|
||||
ollama:
|
||||
ports:
|
||||
- 11434:11434 # Ollama API port
|
||||
volumes:
|
||||
- /data/ollama:/root/.ollama
|
||||
- 11434:11434
|
||||
container_name: ollama
|
||||
image: ollama/ollama:latest
|
||||
restart: unless-stopped
|
||||
@@ -40,4 +52,10 @@ services:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:11434/api/tags"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 5
|
||||
retries: 5
|
||||
networks:
|
||||
- meshing-around-network
|
||||
|
||||
networks:
|
||||
meshing-around-network:
|
||||
external: true
|
||||
|
||||
@@ -258,8 +258,8 @@ def get_NOAAweather(lat=0, lon=0, unit=0):
|
||||
if not weather_data.ok:
|
||||
logger.warning("Location:Error fetching weather data from NOAA for location")
|
||||
return ERROR_FETCHING_DATA
|
||||
except (requests.exceptions.RequestException):
|
||||
logger.warning("Location:Error fetching weather data from NOAA for location")
|
||||
except Exception:
|
||||
logger.warning(f"Location:Error fetching weather data error: {Exception}")
|
||||
return ERROR_FETCHING_DATA
|
||||
# get the forecast URL from the JSON response
|
||||
weather_json = weather_data.json()
|
||||
@@ -269,8 +269,8 @@ def get_NOAAweather(lat=0, lon=0, unit=0):
|
||||
if not forecast_data.ok:
|
||||
logger.warning("Location:Error fetching weather forecast from NOAA")
|
||||
return ERROR_FETCHING_DATA
|
||||
except (requests.exceptions.RequestException):
|
||||
logger.warning("Location:Error fetching weather forecast from NOAA")
|
||||
except Exception:
|
||||
logger.warning(f"Location:Error fetching weather data error: {Exception}")
|
||||
return ERROR_FETCHING_DATA
|
||||
|
||||
# from periods, get the detailedForecast from number of days in NOAAforecastDuration
|
||||
@@ -409,8 +409,8 @@ def getWeatherAlertsNOAA(lat=0, lon=0, useDefaultLatLon=False):
|
||||
if not alert_data.ok:
|
||||
logger.warning("Location:Error fetching weather alerts from NOAA")
|
||||
return ERROR_FETCHING_DATA
|
||||
except (requests.exceptions.RequestException):
|
||||
logger.warning("Location:Error fetching weather alerts from NOAA")
|
||||
except Exception:
|
||||
logger.warning(f"Location:Error fetching weather data error: {Exception}")
|
||||
return ERROR_FETCHING_DATA
|
||||
|
||||
alerts = ""
|
||||
@@ -483,8 +483,8 @@ def getActiveWeatherAlertsDetailNOAA(lat=0, lon=0):
|
||||
if not alert_data.ok:
|
||||
logger.warning("Location:Error fetching weather alerts from NOAA")
|
||||
return ERROR_FETCHING_DATA
|
||||
except (requests.exceptions.RequestException):
|
||||
logger.warning("Location:Error fetching weather alerts from NOAA")
|
||||
except Exception:
|
||||
logger.warning(f"Location:Error fetching weather data error: {Exception}")
|
||||
return ERROR_FETCHING_DATA
|
||||
|
||||
alerts = ""
|
||||
|
||||
@@ -10,7 +10,20 @@ async def setup_scheduler(
|
||||
schedulerValue, schedulerTime, schedulerInterval, logger, BroadcastScheduler):
|
||||
|
||||
# methods available for custom scheduler messages
|
||||
from mesh_bot import tell_joke, welcome_message, handle_wxc, handle_moon, handle_sun, handle_riverFlow, handle_tide, handle_satpass
|
||||
try:
|
||||
from mesh_bot import (
|
||||
tell_joke,
|
||||
welcome_message,
|
||||
handle_wxc,
|
||||
handle_moon,
|
||||
handle_sun,
|
||||
handle_riverFlow,
|
||||
handle_tide,
|
||||
handle_satpass,
|
||||
)
|
||||
except ImportError as e:
|
||||
logger.warning(f"Some mesh_bot schedule features are unavailable by option disable in config.ini: {e} comment out the use of these methods in your custom_scheduler.py")
|
||||
|
||||
schedulerValue = schedulerValue.lower().strip()
|
||||
schedulerTime = schedulerTime.strip()
|
||||
schedulerInterval = schedulerInterval.strip()
|
||||
|
||||
@@ -1,25 +1,17 @@
|
||||
# How do I use this thing?
|
||||
This is not a full turnkey setup for Docker yet but gets you most of the way there!
|
||||
This is not a full turnkey setup for Docker yet?
|
||||
|
||||
## Setup New Image
|
||||
`docker build -t meshing-around .`
|
||||
`docker pull ghcr.io/spudgunman/meshing-around:main`
|
||||
|
||||
there is also [script/docker/docker-install.bat](script/docker/docker-install.bat) which will automate this.
|
||||
`docker network create meshing-around-network`
|
||||
|
||||
## Ollama Image with compose
|
||||
still a WIP
|
||||
`docker compose up -d`
|
||||
`docker compose run meshtasticd`
|
||||
|
||||
## Edit the config.ini in the docker
|
||||
To edit the config.ini in the docker you can
|
||||
`docker run -it --entrypoint /bin/bash meshing-around -c "nano /app/config.ini"`
|
||||
`docker compose run meshing-around`
|
||||
|
||||
there is also [script/docker/docker-terminal.bat](script/docker/docker-terminal.bat) which will open nano to edit.
|
||||
ctl+o to write out and exit editor in shell
|
||||
`docker compose run ollama`
|
||||
|
||||
## other info
|
||||
1. Ensure your serial port is properly shared.
|
||||
2. Run the Docker container:
|
||||
```sh
|
||||
docker run --rm -it --device=/dev/ttyUSB0 meshing-around
|
||||
```
|
||||
|
||||
|
||||
|
||||
`docker compose run debug-console`
|
||||
@@ -1,51 +0,0 @@
|
||||
# OLD Docker Compose configuration for Meshing Around application with optional services.
|
||||
# This setup includes the main Meshing Around service, with optional Ollama and Prometheus Node Exporter services.
|
||||
# Adjust device mappings, ports, and configurations as needed for your environment.
|
||||
|
||||
configs:
|
||||
me_config:
|
||||
file: ./config.ini # Path to the configuration file for Meshing Around.
|
||||
# Windows users may need to adjust the path format, e.g., C:/path/to/config.ini
|
||||
|
||||
services:
|
||||
meshing-around:
|
||||
build:
|
||||
context: ../..
|
||||
configs:
|
||||
- source: me_config
|
||||
target: /app/config.ini
|
||||
devices: # Optional if using meshtasticd. Pass through radio device.
|
||||
- /dev/ttyAMA10 # Replace this with your actual device!
|
||||
#- /dev/ttyUSB0 # Example for USB device
|
||||
user: 1000:1000 # run as non-root user for better security.
|
||||
extra_hosts:
|
||||
# - "host.docker.internal:host-gateway" # Enables access to host services from within the container.
|
||||
container_name: meshing-around
|
||||
restart: unless-stopped
|
||||
#tty: true # Enable only if interactive terminal is needed.
|
||||
ports:
|
||||
#- "8420:8420" # web report interface
|
||||
#- "443:443" # HTTPS interface meshtasticD
|
||||
environment:
|
||||
- OLLAMA_API_URL=http://ollama:11434
|
||||
|
||||
# Uncomment the following service if you want to enable Ollama for local LLM API access.
|
||||
# ollama:
|
||||
# image: ollama/ollama:0.5.1
|
||||
# volumes:
|
||||
# - ./ollama:/root/.ollama
|
||||
# - ./ollama-entrypoint.sh:./entrypoint.sh
|
||||
# container_name: ollama
|
||||
# pull_policy: always
|
||||
# tty: true
|
||||
# restart: always
|
||||
# entrypoint:
|
||||
# - /usr/bin/bash
|
||||
# - /script/docker/entrypoint.sh
|
||||
# ports:
|
||||
# - "11434:11434"
|
||||
# healthcheck:
|
||||
# test: "curl -f http://localhost:11434/api/tags | grep -q llama3.2:3b"
|
||||
# interval: 30s
|
||||
# timeout: 10s
|
||||
# retries: 20
|
||||
0
script/docker/config.d/null
Normal file
0
script/docker/config.d/null
Normal file
24
script/docker/config.yaml
Normal file
24
script/docker/config.yaml
Normal file
@@ -0,0 +1,24 @@
|
||||
### Template config.yaml
|
||||
---
|
||||
Lora:
|
||||
GPIO:
|
||||
GPS:
|
||||
I2C:
|
||||
Display:
|
||||
Touchscreen:
|
||||
Input:
|
||||
Logging:
|
||||
LogLevel: info # debug, info, warn, error
|
||||
# TraceFile: /var/log/meshtasticd.json
|
||||
# AsciiLogs: true # default if not specified is !isatty() on stdout
|
||||
Webserver:
|
||||
Port: 443 # Port for Webserver & Webservices
|
||||
RootPath: /usr/share/meshtasticd/web # Root Dir of WebServer
|
||||
# SSLKey: /etc/meshtasticd/ssl/private_key.pem # Path to SSL Key, generated if not present
|
||||
# SSLCert: /etc/meshtasticd/ssl/certificate.pem # Path to SSL Certificate, generated if not present
|
||||
General:
|
||||
MaxNodes: 200
|
||||
MaxMessageQueue: 100
|
||||
ConfigDirectory: /etc/meshtasticd/config.d/
|
||||
# MACAddress: AA:BB:CC:DD:EE:FF
|
||||
MACAddressSource: eth0
|
||||
@@ -1,6 +0,0 @@
|
||||
REM batch file to install docker on windows
|
||||
REM docker compose up -d
|
||||
cd ../../
|
||||
docker build -t meshing-around .
|
||||
REM docker-compose up -d
|
||||
docker run -it --entrypoint /bin/bash meshing-around -c "nano /app/config.ini"
|
||||
@@ -1,2 +0,0 @@
|
||||
REM launch meshing-around container with a terminal
|
||||
docker run -it --entrypoint /bin/bash meshing-around
|
||||
@@ -1,6 +1,16 @@
|
||||
#!/bin/bash
|
||||
# instruction set the meshing-around docker container entrypoint
|
||||
# Substitute environment variables in the config file (what is the purpose of this?)
|
||||
# envsubst < /app/config.ini > /app/config.tmp && mv /app/config.tmp /app/config.ini
|
||||
# Run the bot
|
||||
exec python /app/mesh_bot.py
|
||||
|
||||
# if no config.ini exists, copy the default one
|
||||
if [ ! -f /app/config.ini ]; then
|
||||
cp /app/config.template /app/config.ini
|
||||
|
||||
ls -l /app/config.ini
|
||||
# Set type = tcp in [interface]
|
||||
sed -i '/^\[interface\]/,/^[^[]/ s/^type = .*/type = tcp/' /app/config.ini
|
||||
# Remove any commented or uncommented hostname lines in [interface]
|
||||
sed -i '/^\[interface\]/,/^[^[]/ s/^#\? *hostname = .*$//' /app/config.ini
|
||||
# Add hostname = meshtasticd:4403 after [interface]
|
||||
sed -i '/^\[interface\]/a hostname = UPDATE-DOCKER-IP' /app/config.ini
|
||||
fi
|
||||
# Run the bot as appuser (if you want to drop privileges)
|
||||
exec python /app/mesh_bot.py
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Start Ollama in the background.
|
||||
/bin/ollama serve &
|
||||
# Record Process ID.
|
||||
pid=$!
|
||||
|
||||
# Pause for Ollama to start.
|
||||
sleep 5
|
||||
|
||||
echo "🔴 Retrieve gemma3:270m model..."
|
||||
ollama pull gemma3:270m
|
||||
echo "🟢 Done!"
|
||||
|
||||
# Wait for Ollama process to finish.
|
||||
wait $pid
|
||||
Reference in New Issue
Block a user