Do not make Doctor start the full RustChan server by default. It should be a preflight check, not a live production test.
rustchan-cli doctor
It should accept further args such as:
rustchan-cli doctor --data-dir ...
rustchan-cli doctor --data-dir ./rustchan-data
rustchan-cli --headless --data-dir ./rustchan-data
Doctor should also write the report to doctor.log in the logs folder.
Doctor checks:
-
Load settings.toml, or report that it does not exist.
-
Validate config syntax and values.
-
Validate paths.
-
Validate file permissions.
-
Validate rustchan-data/ layout.
-
Validate static asset availability.
-
Validate favicon path.
-
Validate upload/media directory safety.
-
Validate database path and basic accessibility.
-
Validate backup directory path if backups are enabled/configured.
-
Validate TLS cert/key paths if TLS is enabled.
-
Validate HTTP/HTTPS/redirect port availability.
-
Validate Tor state/cache directory safety if Tor is enabled.
-
Validate optional dependency availability where relevant:
-
ffmpeg
-
ffprobe
-
WebP support
-
VP9 support
-
Opus support
-
Print a clear pass/warn/fail report.
-
Exit 0 only if production startup is expected to work.
Example output:
RustChan Doctor
Config
PASS settings.toml found
PASS settings.toml parsed successfully
PASS required values are valid
Paths
PASS data directory exists
PASS uploads directory exists
PASS runtime directory exists
PASS logs directory is writable
PASS backup directory path is suitable
PASS media paths are contained safely
Database
PASS database path is valid
PASS database is readable
PASS database is writable
WARN integrity check was not run by default
Network
PASS HTTP bind 127.0.0.1:8080 is available
PASS HTTPS bind 127.0.0.1:8443 is available
WARN public_hosts is empty; reverse proxy deployments should configure it
WARN HTTP->HTTPS redirect is disabled
TLS
PASS TLS enabled
PASS certificate file exists and is readable
PASS private key file exists and is readable
Tor
PASS Tor enabled
PASS Tor state directory path is suitable
WARN Tor bootstrap not tested by doctor
Media
PASS ffmpeg found
PASS ffprobe found
PASS VP9 support detected
PASS Opus support detected
WARN WebP support not detected
Favicon
PASS /favicon.ico source exists
PASS favicon path is contained safely
Logs
PASS logs directory exists
PASS doctor.log is writable
Result
PASS RustChan appears ready to start.
Failure example:
RustChan Doctor
Config
FAIL settings.toml parsed with 1 error
[tls] redirect_http requires [tls] enabled = true
Network
FAIL HTTP bind 127.0.0.1:8080 failed: address already in use
Result
FAIL RustChan is not ready to start.
Avoid checking things that are slow, flaky, destructive, or network-dependent by default:
-
Tor bootstrap to completion
-
Public internet reachability
-
Serveo/cloudflared tunnel availability
-
Real TLS handshake from a browser
-
Load testing
-
Full database repair
-
Full backup/restore simulation
-
Media transcode stress tests
Make Doctor a first-class TUI page.
The Doctor page should show a compact summary first:
PASS in green
WARN in orange
FAIL in red
Doctor
Config PASS
Paths PASS
Database PASS
Network PASS
TLS WARN
Tor PASS
Media WARN
Favicon PASS
Logs PASS
Result
PASS RustChan appears ready to start.
Pressing Enter on a selected section should expand/collapse details:
Network
PASS HTTP bind 127.0.0.1:8080 available
PASS HTTPS bind 127.0.0.1:8443 available
WARN public_hosts is empty; reverse proxy deployments should configure it
Controls:
[↑↓] Select section
[j/k] Select section quietly as Vim-style aliases
[Enter] Expand/collapse section
[R] Re-run doctor
[Esc] Back
[Q] Quit
Implementation notes:
-
Reuse existing RustChan config loading and validation logic where possible instead of duplicating a second parser.
-
Do not start the full server as part of the default doctor command.
-
Keep checks deterministic and fast.
-
Structure doctor results internally as sections with individual checks, severity, message, and optional detail text so the CLI report and TUI page can render from the same source of truth.
-
Prefer implementing this in existing files/modules if practical; avoid creating new Rust files unless the existing structure would become messy.
-
Make sure doctor.log receives the same report that is printed to the terminal.
Do not make Doctor start the full RustChan server by default. It should be a preflight check, not a live production test.
rustchan-cli doctor
It should accept further args such as:
rustchan-cli doctor --data-dir ...
rustchan-cli doctor --data-dir ./rustchan-data
rustchan-cli --headless --data-dir ./rustchan-data
Doctor should also write the report to doctor.log in the logs folder.
Doctor checks:
Load settings.toml, or report that it does not exist.
Validate config syntax and values.
Validate paths.
Validate file permissions.
Validate rustchan-data/ layout.
Validate static asset availability.
Validate favicon path.
Validate upload/media directory safety.
Validate database path and basic accessibility.
Validate backup directory path if backups are enabled/configured.
Validate TLS cert/key paths if TLS is enabled.
Validate HTTP/HTTPS/redirect port availability.
Validate Tor state/cache directory safety if Tor is enabled.
Validate optional dependency availability where relevant:
ffmpeg
ffprobe
WebP support
VP9 support
Opus support
Print a clear pass/warn/fail report.
Exit 0 only if production startup is expected to work.
Example output:
RustChan Doctor
Config
PASS settings.toml found
PASS settings.toml parsed successfully
PASS required values are valid
Paths
PASS data directory exists
PASS uploads directory exists
PASS runtime directory exists
PASS logs directory is writable
PASS backup directory path is suitable
PASS media paths are contained safely
Database
PASS database path is valid
PASS database is readable
PASS database is writable
WARN integrity check was not run by default
Network
PASS HTTP bind 127.0.0.1:8080 is available
PASS HTTPS bind 127.0.0.1:8443 is available
WARN public_hosts is empty; reverse proxy deployments should configure it
WARN HTTP->HTTPS redirect is disabled
TLS
PASS TLS enabled
PASS certificate file exists and is readable
PASS private key file exists and is readable
Tor
PASS Tor enabled
PASS Tor state directory path is suitable
WARN Tor bootstrap not tested by doctor
Media
PASS ffmpeg found
PASS ffprobe found
PASS VP9 support detected
PASS Opus support detected
WARN WebP support not detected
Favicon
PASS /favicon.ico source exists
PASS favicon path is contained safely
Logs
PASS logs directory exists
PASS doctor.log is writable
Result
PASS RustChan appears ready to start.
Failure example:
RustChan Doctor
Config
FAIL settings.toml parsed with 1 error
[tls] redirect_http requires [tls] enabled = true
Network
FAIL HTTP bind 127.0.0.1:8080 failed: address already in use
Result
FAIL RustChan is not ready to start.
Avoid checking things that are slow, flaky, destructive, or network-dependent by default:
Tor bootstrap to completion
Public internet reachability
Serveo/cloudflared tunnel availability
Real TLS handshake from a browser
Load testing
Full database repair
Full backup/restore simulation
Media transcode stress tests
Make Doctor a first-class TUI page.
The Doctor page should show a compact summary first:
PASS in green
WARN in orange
FAIL in red
Doctor
Config PASS
Paths PASS
Database PASS
Network PASS
TLS WARN
Tor PASS
Media WARN
Favicon PASS
Logs PASS
Result
PASS RustChan appears ready to start.
Pressing Enter on a selected section should expand/collapse details:
Network
PASS HTTP bind 127.0.0.1:8080 available
PASS HTTPS bind 127.0.0.1:8443 available
WARN public_hosts is empty; reverse proxy deployments should configure it
Controls:
[↑↓] Select section
[j/k] Select section quietly as Vim-style aliases
[Enter] Expand/collapse section
[R] Re-run doctor
[Esc] Back
[Q] Quit
Implementation notes:
Reuse existing RustChan config loading and validation logic where possible instead of duplicating a second parser.
Do not start the full server as part of the default doctor command.
Keep checks deterministic and fast.
Structure doctor results internally as sections with individual checks, severity, message, and optional detail text so the CLI report and TUI page can render from the same source of truth.
Prefer implementing this in existing files/modules if practical; avoid creating new Rust files unless the existing structure would become messy.
Make sure doctor.log receives the same report that is printed to the terminal.