This commit is contained in:
Louis King
2025-12-03 17:02:57 +00:00
parent 7ddff65570
commit e6b3ceb639
12 changed files with 56 additions and 125 deletions

View File

@@ -1,4 +1,4 @@
# MeshCore Hub - Environment Configuration Example
# MeshCore Hub - Docker Compose Environment Configuration
# Copy this file to .env and customize values
# ===================
@@ -8,46 +8,41 @@
# Logging level (DEBUG, INFO, WARNING, ERROR, CRITICAL)
LOG_LEVEL=INFO
# MQTT Broker Settings
MQTT_HOST=localhost
MQTT_PORT=1883
# MQTT Broker Settings (internal use)
MQTT_USERNAME=
MQTT_PASSWORD=
MQTT_PREFIX=meshcore
# External MQTT port mapping
MQTT_EXTERNAL_PORT=1883
MQTT_WS_PORT=9001
# ===================
# Interface Settings
# ===================
# Mode of operation (RECEIVER or SENDER)
INTERFACE_MODE=RECEIVER
# Serial port for MeshCore device
# Serial port for receiver device
SERIAL_PORT=/dev/ttyUSB0
# Serial port for sender device (if separate)
SERIAL_PORT_SENDER=/dev/ttyUSB1
# Baud rate for serial communication
SERIAL_BAUD=115200
# Use mock device for testing (true/false)
MOCK_DEVICE=false
# ===================
# Collector Settings
# ===================
# Database connection URL
# SQLite: sqlite:///./meshcore.db
# PostgreSQL: postgresql://user:password@localhost/meshcore
DATABASE_URL=sqlite:///./meshcore.db
# Optional node address override (64-char hex string)
NODE_ADDRESS=
NODE_ADDRESS_SENDER=
# ===================
# API Settings
# ===================
# API Server binding
API_HOST=0.0.0.0
# External API port
API_PORT=8000
# API Keys for authentication
# Generate secure keys for production!
# API Keys for authentication (generate secure keys for production!)
# Example: openssl rand -hex 32
API_READ_KEY=
API_ADMIN_KEY=
@@ -55,16 +50,10 @@ API_ADMIN_KEY=
# Web Dashboard Settings
# ===================
# Web Server binding
WEB_HOST=0.0.0.0
# External web port
WEB_PORT=8080
# API connection for web dashboard
API_BASE_URL=http://localhost:8000
API_KEY=
# Network Information (displayed on web dashboard)
NETWORK_DOMAIN=
NETWORK_NAME=MeshCore Network
NETWORK_CITY=
NETWORK_COUNTRY=
@@ -73,5 +62,5 @@ NETWORK_RADIO_CONFIG=
NETWORK_CONTACT_EMAIL=
NETWORK_CONTACT_DISCORD=
# Path to members JSON file
MEMBERS_FILE=members.json
# Path to members JSON file (mounted into container)
MEMBERS_FILE_PATH=./data/members.json

View File

@@ -50,7 +50,7 @@ jobs:
uses: docker/build-push-action@v5
with:
context: .
file: docker/Dockerfile
file: Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
@@ -60,6 +60,6 @@ jobs:
- name: Test Docker image
if: github.event_name == 'pull_request'
run: |
docker build -t meshcore-hub-test -f docker/Dockerfile .
docker build -t meshcore-hub-test -f Dockerfile .
docker run --rm meshcore-hub-test --version
docker run --rm meshcore-hub-test --help

2
.gitignore vendored
View File

@@ -26,6 +26,8 @@ share/python-wheels/
*.egg
MANIFEST
uv.lock
/docker-compose.yml
# PyInstaller
# Usually these files are written by a python script from a template

View File

@@ -274,9 +274,12 @@ meshcore-hub/
├── alembic/
│ ├── env.py
│ └── versions/
── docker/
── Dockerfile
└── docker-compose.yml
── etc/
── mosquitto.conf # MQTT broker configuration
├── data/
│ └── members.json # Network members data
├── Dockerfile # Docker build configuration
└── docker-compose.yml # Docker Compose services
```
## MQTT Topic Structure

View File

@@ -333,7 +333,10 @@ meshcore-hub/
│ └── web/ # Web dashboard
├── tests/ # Test suite
├── alembic/ # Database migrations
├── docker/ # Docker configuration
├── etc/ # Configuration files (mosquitto.conf)
├── data/ # Data files (members.json)
├── Dockerfile # Docker build configuration
├── docker-compose.yml # Docker Compose services
├── PROMPT.md # Project specification
├── SCHEMAS.md # Event schema documentation
├── PLAN.md # Implementation plan

View File

@@ -31,7 +31,7 @@ services:
- "${MQTT_EXTERNAL_PORT:-1883}:1883"
- "${MQTT_WS_PORT:-9001}:9001"
volumes:
- ./mosquitto.conf:/mosquitto/config/mosquitto.conf:ro
- ./etc/mosquitto.conf:/mosquitto/config/mosquitto.conf:ro
- mosquitto_data:/mosquitto/data
- mosquitto_log:/mosquitto/log
healthcheck:
@@ -46,8 +46,8 @@ services:
# ==========================================================================
interface-receiver:
build:
context: ..
dockerfile: docker/Dockerfile
context: .
dockerfile: Dockerfile
container_name: meshcore-interface-receiver
profiles:
- interface-receiver
@@ -82,8 +82,8 @@ services:
# ==========================================================================
interface-sender:
build:
context: ..
dockerfile: docker/Dockerfile
context: .
dockerfile: Dockerfile
container_name: meshcore-interface-sender
profiles:
- interface-sender
@@ -118,8 +118,8 @@ services:
# ==========================================================================
interface-mock-receiver:
build:
context: ..
dockerfile: docker/Dockerfile
context: .
dockerfile: Dockerfile
container_name: meshcore-interface-mock-receiver
profiles:
- mock
@@ -149,8 +149,8 @@ services:
# ==========================================================================
collector:
build:
context: ..
dockerfile: docker/Dockerfile
context: .
dockerfile: Dockerfile
container_name: meshcore-collector
profiles:
- collector
@@ -183,8 +183,8 @@ services:
# ==========================================================================
api:
build:
context: ..
dockerfile: docker/Dockerfile
context: .
dockerfile: Dockerfile
container_name: meshcore-api
profiles:
- api
@@ -225,8 +225,8 @@ services:
# ==========================================================================
web:
build:
context: ..
dockerfile: docker/Dockerfile
context: .
dockerfile: Dockerfile
container_name: meshcore-web
profiles:
- web
@@ -253,7 +253,7 @@ services:
- NETWORK_CONTACT_DISCORD=${NETWORK_CONTACT_DISCORD:-}
- MEMBERS_FILE=${MEMBERS_FILE:-}
volumes:
- ${MEMBERS_FILE_PATH:-./members.json}:/app/members.json:ro
- ${MEMBERS_FILE_PATH:-./data/members.json}:/app/members.json:ro
command: ["web"]
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8080/health')"]
@@ -267,8 +267,8 @@ services:
# ==========================================================================
db-migrate:
build:
context: ..
dockerfile: docker/Dockerfile
context: .
dockerfile: Dockerfile
container_name: meshcore-db-migrate
profiles:
- migrate

View File

@@ -1,66 +0,0 @@
# MeshCore Hub - Docker Compose Environment Configuration
# Copy this file to .env and customize values
# ===================
# Common Settings
# ===================
# Logging level (DEBUG, INFO, WARNING, ERROR, CRITICAL)
LOG_LEVEL=INFO
# MQTT Broker Settings (internal use)
MQTT_USERNAME=
MQTT_PASSWORD=
MQTT_PREFIX=meshcore
# External MQTT port mapping
MQTT_EXTERNAL_PORT=1883
MQTT_WS_PORT=9001
# ===================
# Interface Settings
# ===================
# Serial port for receiver device
SERIAL_PORT=/dev/ttyUSB0
# Serial port for sender device (if separate)
SERIAL_PORT_SENDER=/dev/ttyUSB1
# Baud rate for serial communication
SERIAL_BAUD=115200
# Optional node address override (64-char hex string)
NODE_ADDRESS=
NODE_ADDRESS_SENDER=
# ===================
# API Settings
# ===================
# External API port
API_PORT=8000
# API Keys for authentication (generate secure keys for production!)
# Example: openssl rand -hex 32
API_READ_KEY=
API_ADMIN_KEY=
# ===================
# Web Dashboard Settings
# ===================
# External web port
WEB_PORT=8080
# Network Information (displayed on web dashboard)
NETWORK_NAME=MeshCore Network
NETWORK_CITY=
NETWORK_COUNTRY=
NETWORK_LOCATION=
NETWORK_RADIO_CONFIG=
NETWORK_CONTACT_EMAIL=
NETWORK_CONTACT_DISCORD=
# Path to members JSON file (mounted into container)
MEMBERS_FILE_PATH=./members.json

View File

@@ -15,7 +15,7 @@ services:
ports:
- "11883:1883"
volumes:
- ../../docker/mosquitto.conf:/mosquitto/config/mosquitto.conf:ro
- ../../etc/mosquitto.conf:/mosquitto/config/mosquitto.conf:ro
healthcheck:
test: ["CMD", "mosquitto_sub", "-t", "$$SYS/#", "-C", "1", "-i", "healthcheck", "-W", "3"]
interval: 5s
@@ -27,7 +27,7 @@ services:
interface-mock:
build:
context: ../..
dockerfile: docker/Dockerfile
dockerfile: Dockerfile
container_name: meshcore-test-interface
depends_on:
mqtt:
@@ -51,7 +51,7 @@ services:
collector:
build:
context: ../..
dockerfile: docker/Dockerfile
dockerfile: Dockerfile
container_name: meshcore-test-collector
depends_on:
mqtt:
@@ -76,7 +76,7 @@ services:
api:
build:
context: ../..
dockerfile: docker/Dockerfile
dockerfile: Dockerfile
container_name: meshcore-test-api
depends_on:
mqtt:
@@ -109,7 +109,7 @@ services:
web:
build:
context: ../..
dockerfile: docker/Dockerfile
dockerfile: Dockerfile
container_name: meshcore-test-web
depends_on:
api: