Compare commits

...

55 Commits

Author SHA1 Message Date
SpudGunMan
126f81fbd3 Update README.md 2025-10-23 23:38:26 -07:00
SpudGunMan
337d43a7af Update README.md 2025-10-23 23:32:53 -07:00
SpudGunMan
8c3121d5d6 Update entrypoint.sh 2025-10-23 23:29:26 -07:00
SpudGunMan
1d577c9ec5 Update compose.yaml 2025-10-23 23:12:28 -07:00
SpudGunMan
3540b8f110 Update entrypoint.sh 2025-10-23 23:10:15 -07:00
SpudGunMan
3fdebf3bf9 Update entrypoint.sh 2025-10-23 23:07:54 -07:00
SpudGunMan
430279809e Update entrypoint.sh 2025-10-23 23:06:02 -07:00
SpudGunMan
7ba3a78718 Update entrypoint.sh 2025-10-23 23:04:25 -07:00
SpudGunMan
c329391450 Update entrypoint.sh 2025-10-23 23:03:55 -07:00
SpudGunMan
6bc3c3e980 Update entrypoint.sh 2025-10-23 23:00:36 -07:00
SpudGunMan
48788ceda8 Update entrypoint.sh 2025-10-23 22:57:50 -07:00
SpudGunMan
8f5bae3b05 Update README.md 2025-10-23 22:55:18 -07:00
SpudGunMan
17c693c2f7 Update entrypoint.sh 2025-10-23 22:55:16 -07:00
SpudGunMan
ff91356c2a Update compose.yaml 2025-10-23 22:45:54 -07:00
SpudGunMan
180d9f4728 Update compose.yaml 2025-10-23 22:43:27 -07:00
SpudGunMan
1202a076d1 Update compose.yaml 2025-10-23 22:42:55 -07:00
SpudGunMan
9b62d7f4d8 Update compose.yaml 2025-10-23 22:42:00 -07:00
SpudGunMan
9451d23c09 Update compose.yaml 2025-10-23 22:40:48 -07:00
SpudGunMan
dcdef40e89 Update Dockerfile 2025-10-23 22:28:25 -07:00
SpudGunMan
817dde42f2 Update Dockerfile 2025-10-23 22:23:39 -07:00
SpudGunMan
b384d2d5b1 Update entrypoint.sh 2025-10-23 22:18:56 -07:00
SpudGunMan
4db46f16f2 Update compose.yaml 2025-10-23 22:15:12 -07:00
SpudGunMan
5590391f7e Update compose.yaml
i get no security!
2025-10-23 22:11:22 -07:00
SpudGunMan
ccb505f37f confounded 2025-10-23 22:09:34 -07:00
SpudGunMan
d883927572 enhance 2025-10-23 21:57:50 -07:00
SpudGunMan
b0109be3b0 Update README.md 2025-10-23 21:52:13 -07:00
SpudGunMan
98af757d93 enhance 2025-10-23 21:50:54 -07:00
SpudGunMan
f8746ff348 Create null 2025-10-23 21:46:59 -07:00
SpudGunMan
32fbfba3e9 config 2025-10-23 21:45:23 -07:00
SpudGunMan
d2501bf353 Update compose.yaml 2025-10-23 21:38:19 -07:00
SpudGunMan
db9d7d9790 Update README.md 2025-10-23 21:34:56 -07:00
SpudGunMan
c6b5a1c708 docker
i never enjoy docker
2025-10-23 21:26:32 -07:00
SpudGunMan
a36f1580b3 Update entrypoint.sh 2025-10-23 21:24:59 -07:00
SpudGunMan
f051e95986 Update entrypoint.sh 2025-10-23 21:24:45 -07:00
SpudGunMan
bafcfad190 Update entrypoint.sh 2025-10-23 21:21:43 -07:00
SpudGunMan
8b2059c444 Update compose.yaml 2025-10-23 21:07:43 -07:00
SpudGunMan
fd4b5607d7 Update compose.yaml 2025-10-23 21:02:42 -07:00
SpudGunMan
df30ee9cc4 Update compose.yaml 2025-10-23 20:53:26 -07:00
SpudGunMan
c1135ecadf cleanup 2025-10-23 20:40:00 -07:00
SpudGunMan
899702eecc Update compose.yaml 2025-10-23 20:26:55 -07:00
SpudGunMan
d4604d8cbd Update compose.yaml 2025-10-23 20:23:03 -07:00
SpudGunMan
c674b0a404 Update scheduler.py 2025-10-23 20:18:42 -07:00
SpudGunMan
d59ddfd517 fix for Malice
sorry this was so painfull
2025-10-23 20:15:15 -07:00
SpudGunMan
f68c533488 errorLoggin 2025-10-23 20:08:42 -07:00
SpudGunMan
6e47d71028 Update Dockerfile 2025-10-23 20:00:02 -07:00
SpudGunMan
f9af9b756d Update compose.yaml
how did I miss this
2025-10-23 19:57:18 -07:00
SpudGunMan
c19d442190 Update compose.yaml 2025-10-23 19:53:01 -07:00
SpudGunMan
4c2d0cdebb Update compose.yaml 2025-10-23 19:49:01 -07:00
SpudGunMan
612dbf01d3 Update compose.yaml 2025-10-23 19:47:40 -07:00
SpudGunMan
28846b24a6 Update compose.yaml 2025-10-23 19:40:43 -07:00
SpudGunMan
cd398375a2 Update compose.yaml 2025-10-23 19:33:40 -07:00
SpudGunMan
01372a0f2c Update compose.yaml 2025-10-23 19:30:08 -07:00
SpudGunMan
8254ec5baf Update compose.yaml 2025-10-23 19:23:25 -07:00
SpudGunMan
549e12ffc1 Update Dockerfile 2025-10-23 18:50:47 -07:00
SpudGunMan
d940cdf534 Update Dockerfile 2025-10-23 15:57:34 -07:00
13 changed files with 124 additions and 131 deletions

View File

@@ -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"]

View File

@@ -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

View File

@@ -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

View File

@@ -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 = ""

View File

@@ -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()

View File

@@ -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`

View File

@@ -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

View File

24
script/docker/config.yaml Normal file
View 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

View File

@@ -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"

View File

@@ -1,2 +0,0 @@
REM launch meshing-around container with a terminal
docker run -it --entrypoint /bin/bash meshing-around

View File

@@ -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

View File

@@ -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