Files
peardock/config.js
T
Raven Scott c5015a66e8
Release rolling / release (push) Successful in 8m4s
Alert System Changes: Fixes applied (feature kept, load bounded)
1. Removed docker.df() entirely
2. Poll only what rules need
   • docker_daemon → cheap ping
   • container_health / stack_health → listContainers
   • resource → host statfs only (no Docker)
   • Event-only rules → no poll timer
3. Poll floor 60s, default 120s (was 15s min / 60s default)
4. No overlapping polls (pollInFlight)
5. Event path: drop noisy actions (exec_*, attach, …), match only relevant rules, serialize work (bounded queue)
6. UI status shows whether poll is active
2026-08-04 22:13:20 -04:00

118 lines
4.2 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* Centralized configuration constants
*/
export const CONFIG = {
// Stats collection (server/services/stats.js)
// Round-robin one-shot samples — not full-fleet stream:true (Dozzle-style streams
// keep dockerd busy ~1Hz × N containers). See Settings → Performance.
STATS: {
INTERVAL_MS: 5000, // Min gap between allStats broadcasts
ACTIVE_INTERVAL_MS: 5000, // Idle gap after each sample batch completes
IDLE_INTERVAL_MS: 5000, // Reserved (peer-idle uses full pause)
CACHE_TTL_MS: 2000, // Per-container broadcast cache TTL
CONCURRENCY: 2, // Max parallel one-shot stats to dockerd
SAMPLES_PER_TICK: 4, // Max containers sampled per tick (round-robin)
LIST_INTERVAL_MS: 15000, // How often to re-list containers
SMOOTHING_FACTOR: 0.2, // Client-side smoothing (if used)
},
// UI updates
UI: {
DEBOUNCE_MS: 300, // Debounce time for UI updates
SKELETON_LOADER_DELAY: 200, // Delay before showing skeleton
ALERT_DURATION_MS: 5000, // Alert display duration
},
// Connection
CONNECTION: {
TIMEOUT_MS: 30000, // Connection timeout
/** Fixed delay between automatic peer reconnect attempts */
RECONNECT_DELAY_MS: 5000,
/**
* Default max automatic reconnect attempts when Settings has no override.
* 0 = unlimited. Runtime/UI caps at 8 (see Settings → Behavior).
* Client default preference is 8 tries via settings cache.
*/
RECONNECT_MAX_ATTEMPTS: 0,
HEALTH_CHECK_INTERVAL_MS: 10000, // Health check interval
},
// Container operations
CONTAINER: {
MAX_NAME_LENGTH: 63,
MIN_NAME_LENGTH: 1,
MAX_IMAGE_LENGTH: 255,
/** RPC timeout for lifecycle ops (remove/stop/restart/…) — longer than dial timeout */
OPERATION_TIMEOUT_MS: 120000,
},
// Terminal
TERMINAL: {
MIN_HEIGHT: 150,
MAX_HEIGHT_RATIO: 0.9, // Max height as ratio of window
SCROLLBACK_LINES: 10000,
HISTORY_SIZE: 1000,
},
// Storage
STORAGE: {
COOKIE_SIZE_LIMIT: 4000, // 4KB cookie limit (legacy)
CONNECTIONS_KEY: 'peardock_connections', // localStorage mirror key
USE_LOCALSTORAGE_KEY: 'peardock_use_localstorage',
TEMPLATES_KEY: 'peardock_templates', // legacy LS; primary is cache/templates.json
/** Desktop peer roster: ~/.config/peardock/cache/peers.json */
PEERS_CACHE_REL: '.config/peardock/cache/peers.json',
/** Client prefs (theme, density, filters, table cols, …): ~/.config/peardock/cache/settings.json */
SETTINGS_CACHE_REL: '.config/peardock/cache/settings.json',
/** Saved deploy templates: ~/.config/peardock/cache/templates.json */
TEMPLATES_CACHE_REL: '.config/peardock/cache/templates.json',
/** Notification center history: ~/.config/peardock/cache/notifications.json */
NOTIFICATIONS_CACHE_REL: '.config/peardock/cache/notifications.json',
/** Local backup history: ~/.config/peardock/cache/backups.json */
BACKUPS_CACHE_REL: '.config/peardock/cache/backups.json',
/** Server alerts snapshot (synced from admin export): ~/.config/peardock/cache/alerts.json */
ALERTS_CACHE_REL: '.config/peardock/cache/alerts.json',
/** localStorage key mirrored from settings cache */
SETTINGS_KEY: 'peardock.settings.v1',
},
// Docker command validation
DOCKER: {
MAX_COMMAND_LENGTH: 500,
ALLOWED_COMMANDS: [
'ps', 'images', 'volumes', 'networks', 'info', 'version',
'logs', 'inspect', 'stats', 'top', 'diff', 'port',
'history', 'search', 'events', 'system', 'help'
],
BLOCKED_COMMANDS: [
'exec', 'run', 'create', 'start', 'stop', 'restart', 'kill',
'rm', 'rmi', 'prune', 'build', 'commit', 'push', 'pull',
'tag', 'load', 'save', 'import', 'export', 'cp', 'update'
],
},
// Status codes
STATUS: {
CONNECTED: 'connected',
DISCONNECTED: 'disconnected',
CONNECTING: 'connecting',
ERROR: 'error',
},
// Error codes
ERROR_CODES: {
RATE_LIMIT_EXCEEDED: 'RATE_LIMIT_EXCEEDED',
INVALID_INPUT: 'INVALID_INPUT',
CONNECTION_FAILED: 'CONNECTION_FAILED',
OPERATION_TIMEOUT: 'OPERATION_TIMEOUT',
PERMISSION_DENIED: 'PERMISSION_DENIED',
UNKNOWN_ERROR: 'UNKNOWN_ERROR',
},
};