docs: Move data storage to project directory and cleanup configuration

Major documentation update with new data structure:

Breaking Changes:
- Data storage moved from host directories to ./data/ inside project
- MC_CONFIG_DIR default changed: /root/.config/meshcore → ./data/meshcore
- MC_ARCHIVE_DIR default changed: /mnt/archive/meshcore → ./data/archive
- Requires migration for existing installations (see MIGRATION.md)

Documentation:
- Add MIGRATION.md - step-by-step guide for existing users
- Add FRESH_INSTALL.md - complete installation guide for new users
- Update README.md - new Configuration section with ./data/ structure
- Update .env.example - placeholders instead of real values, new defaults
- Update .claude/CLAUDE.md - updated environment variables documentation
- Change serial device detection from 'ls -l' to 'ls' (cleaner output)

Code Cleanup:
- Remove deprecated MC_REFRESH_INTERVAL variable (unused since intelligent refresh)
- Remove MC_REFRESH_INTERVAL from app/config.py
- Remove refresh_interval from app/routes/views.py (5 functions)
- Remove refresh_interval from app/routes/api.py
- Remove refreshInterval from app/templates/index.html
- Remove refreshInterval from app/templates/dm.html
- Remove MC_REFRESH_INTERVAL from docker-compose.yml

Configuration:
- Update .gitignore - exclude data/ and docs/github-discussion-*.md
- Serial port: use /dev/serial/by-id/[YOUR_DEVICE_ID] placeholder
- Device name: use [YOUR_DEVICE_NAME] placeholder

Benefits:
- All project data in one location (easier backups)
- Better portability (no host dependencies)
- Cleaner codebase (removed unused variables)
- Comprehensive documentation for migration and fresh install

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
MarekWo
2025-12-30 15:31:26 +01:00
parent dec264bdc2
commit f8ef1ac297
11 changed files with 929 additions and 39 deletions

View File

@@ -42,18 +42,19 @@ A lightweight web interface for meshcore-cli, providing browser-based access to
### Prerequisites
- Docker and Docker Compose installed
- Heltec V4 device connected via USB
- **Docker** and **Docker Compose** installed ([installation guide](https://wiki.wojtaszek.it/pl/home/apps/docker/installation))
- **Meshcore device** connected via USB (tested on Heltec V4)
**Note:** meshcore-cli is automatically installed inside the Docker container - no host installation required!
**Important:** This application requires meshcore-cli version **1.3.12 or newer** for proper Direct Messages (DM) functionality. The Docker container automatically installs the latest version.
**Important Notes:**
-**No meshcore-cli installation required on host** - meshcore-cli is automatically installed inside the Docker container
-**No manual directory setup needed** - all data is stored in `./data/` inside the project directory
-**meshcore-cli version 1.3.12+** is automatically installed for proper Direct Messages (DM) functionality
### Installation
1. **Clone the repository**
```bash
git clone <repository-url>
git clone https://github.com/MarekWo/mc-webui
cd mc-webui
```
@@ -66,15 +67,24 @@ A lightweight web interface for meshcore-cli, providing browser-based access to
3. **Find your serial device**
```bash
ls -l /dev/serial/by-id/
ls /dev/serial/by-id/
```
You should see a device name starting with `usb-Espressif_Systems_...`. For Heltec V4 it looks like:
```
usb-Espressif_Systems_heltec_wifi_lora_32_v4__16_MB_FLASH__2_MB_PSRAM__90706984A000-if00
```
Copy the **full device ID** and update `MC_SERIAL_PORT` in `.env`:
```bash
MC_SERIAL_PORT=/dev/serial/by-id/usb-Espressif_Systems_heltec_wifi_lora_32_v4__16_MB_FLASH__2_MB_PSRAM__90706984A000-if00
```
Update `MC_SERIAL_PORT` in `.env` with your device path.
4. **Build and run**
```bash
docker compose up -d --build
```
**Note:** Docker will automatically create the `./data/` directory with necessary subdirectories (`meshcore/` and `archive/`) on first run. All runtime data (messages, contacts, settings, archives) will be stored there.
5. **Access the web interface**
Open your browser and navigate to:
```
@@ -82,21 +92,24 @@ A lightweight web interface for meshcore-cli, providing browser-based access to
```
Or from another device on your network:
```
http://<server-ip>:5000
http://<your-server-ip>:5000
```
## Configuration
All configuration is done via environment variables in the `.env` file:
All configuration is done via environment variables in the `.env` file.
**Important:** All data files (messages, contacts, settings, archives) are stored in the `./data/` directory inside your project folder. This directory is automatically created by Docker and should be included in your backups.
### Environment Variables
| Variable | Description | Default |
|----------|-------------|---------|
| `MC_SERIAL_PORT` | Path to serial device | `/dev/ttyUSB0` |
| `MC_SERIAL_PORT` | Serial device path (use /dev/serial/by-id/ for stability) | `/dev/ttyUSB0` |
| `MC_DEVICE_NAME` | Device name (for .msgs and .adverts.jsonl files) | `MeshCore` |
| `MC_CONFIG_DIR` | meshcore configuration directory | `/root/.config/meshcore` |
| `MC_REFRESH_INTERVAL` | Auto-refresh interval (seconds) | `60` |
| `MC_INACTIVE_HOURS` | Inactivity threshold for cleanup | `48` |
| `MC_ARCHIVE_DIR` | Archive directory path | `/mnt/archive/meshcore` |
| `MC_CONFIG_DIR` | Configuration directory (shared between containers) | `./data/meshcore` |
| `MC_INACTIVE_HOURS` | Inactivity threshold for contact cleanup (hours) | `48` |
| `MC_ARCHIVE_DIR` | Archive directory path | `./data/archive` |
| `MC_ARCHIVE_ENABLED` | Enable automatic archiving | `true` |
| `MC_ARCHIVE_RETENTION_DAYS` | Days to show in live view | `7` |
| `FLASK_HOST` | Listen address | `0.0.0.0` |
@@ -104,6 +117,12 @@ All configuration is done via environment variables in the `.env` file:
| `FLASK_DEBUG` | Debug mode | `false` |
| `TZ` | Timezone for container logs | `UTC` |
**Notes:**
- `MC_CONFIG_DIR` is mounted as a shared volume for both containers (meshcore-bridge and mc-webui)
- All paths starting with `./` are relative to the project root directory
- The `data/` directory is excluded from git via `.gitignore`
- Auto-refresh is intelligent: checks for new messages every 10 seconds, updates UI only when needed (no configuration required)
See [.env.example](.env.example) for a complete example.
## Architecture