feat: Add container restart functionality from web UI

- Added restart button to settings page
- Created /api/restart endpoint (file-flag based)
- Implemented watch-restart.sh daemon
- Added systemd service for restart watcher
- Updated README with restart setup instructions
- Container automatically restarts when settings changed

Settings flow:
1. User edits settings in web UI
2. Click 'Save Settings' to persist to .env
3. Click 'Restart Bot' to apply changes
4. Watcher detects flag and restarts container
5. New settings loaded automatically
This commit is contained in:
mindesbunister
2025-10-24 15:06:26 +02:00
parent 9e0d9b88f9
commit 26864c10f2
7 changed files with 174 additions and 10 deletions

View File

@@ -20,10 +20,10 @@ services:
# Load from .env file (create from .env.example)
DRIFT_WALLET_PRIVATE_KEY: ${DRIFT_WALLET_PRIVATE_KEY}
DRIFT_ENV: ${DRIFT_ENV:-mainnet-beta}
DRIFT_ENV: "${DRIFT_ENV:-mainnet-beta}"
API_SECRET_KEY: ${API_SECRET_KEY}
SOLANA_RPC_URL: ${SOLANA_RPC_URL}
PYTH_HERMES_URL: ${PYTH_HERMES_URL:-https://hermes.pyth.network}
PYTH_HERMES_URL: "${PYTH_HERMES_URL:-https://hermes.pyth.network}"
# Trading configuration
MAX_POSITION_SIZE_USD: ${MAX_POSITION_SIZE_USD:-50}
@@ -52,6 +52,9 @@ services:
# Mount logs directory
- ./logs:/app/logs
# Mount Docker socket for container restart capability
- /var/run/docker.sock:/var/run/docker.sock
# Mount for hot reload in development (comment out in production)
# - ./v4:/app/v4:ro