mvrun work

This commit is contained in:
Joel Krauska
2025-11-03 20:13:36 -08:00
parent 4de92da1ae
commit e343d6aa15
2 changed files with 48 additions and 7 deletions
+40 -1
View File
@@ -221,6 +221,8 @@ vacuum = False
# Application logs (errors, startup messages, etc.) are unaffected
# Set to True to enable, False to disable (default: False)
access_log = False
# Database cleanup logfile location
db_cleanup_logfile = dbcleanup.log
```
---
@@ -254,12 +256,29 @@ Open in your browser: http://localhost:8081/
## Running Meshview with `mvrun.py`
- `mvrun.py` starts both `startdb.py` and `main.py` in separate threads and merges the output.
- It accepts the `--config` argument like the others.
- It accepts several command-line arguments for flexible deployment.
```bash
./env/bin/python mvrun.py
```
**Command-line options:**
- `--config CONFIG` - Path to the configuration file (default: `config.ini`)
- `--pid_dir PID_DIR` - Directory for PID files (default: `.`)
- `--py_exec PY_EXEC` - Path to the Python executable (default: `./env/bin/python`)
**Examples:**
```bash
# Use a specific config file
./env/bin/python mvrun.py --config /etc/meshview/config.ini
# Store PID files in a specific directory
./env/bin/python mvrun.py --pid_dir /var/run/meshview
# Use a different Python executable
./env/bin/python mvrun.py --py_exec /usr/bin/python3
```
---
## Setting Up Systemd Services (Ubuntu)
@@ -365,6 +384,15 @@ hour = 2
minute = 00
# Run VACUUM after cleanup
vacuum = False
# -------------------------
# Logging Configuration
# -------------------------
[logging]
# Enable or disable HTTP access logs from the web server
access_log = False
# Database cleanup logfile location
db_cleanup_logfile = dbcleanup.log
```
Once changes are done you need to restart the script for changes to load.
@@ -416,6 +444,17 @@ Check the log file to see it the script run at the specific time.
---
## Testing
MeshView includes a test suite using pytest. For detailed testing documentation, see [README-testing.md](README-testing.md).
Quick start:
```bash
./env/bin/pytest tests/test_api_simple.py -v
```
---
## Technical Documentation
For more detailed technical documentation including database migrations, architecture details, and advanced topics, see the [docs/](docs/) directory.
+8 -6
View File
@@ -98,13 +98,15 @@ def main():
# Add --config runtime argument
parser.add_argument('--config', help="Path to the configuration file.", default='config.ini')
parser.add_argument('--piddir', help="PID files path.", default='.')
parser.add_argument('--pyexec', help="Path to the Python executable.", default='./env/bin/python')
parser.add_argument('--pid_dir', help="PID files path.", default='.')
parser.add_argument(
'--py_exec', help="Path to the Python executable.", default='./env/bin/python'
)
args = parser.parse_args()
# PID file paths
db_pid_file = os.path.join(args.piddir, 'meshview-db.pid')
web_pid_file = os.path.join(args.piddir, 'meshview-web.pid')
db_pid_file = os.path.join(args.pid_dir, 'meshview-db.pid')
web_pid_file = os.path.join(args.pid_dir, 'meshview-web.pid')
# Track PID files globally for cleanup
pid_files.append(db_pid_file)
@@ -112,12 +114,12 @@ def main():
# Database Thread
dbthrd = threading.Thread(
target=run_script, args=(args.pyexec, 'startdb.py', db_pid_file, '--config', args.config)
target=run_script, args=(args.py_exec, 'startdb.py', db_pid_file, '--config', args.config)
)
# Web server thread
webthrd = threading.Thread(
target=run_script, args=(args.pyexec, 'main.py', web_pid_file, '--config', args.config)
target=run_script, args=(args.py_exec, 'main.py', web_pid_file, '--config', args.config)
)
# Start Meshview subprocess threads