[PR #2165] [MERGED] feat: add vikunja doctor command for diagnostic checks #9816

Closed
opened 2026-04-23 09:13:51 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/go-vikunja/vikunja/pull/2165
Author: @kolaente
Created: 1/27/2026
Status: Merged
Merged: 1/27/2026
Merged by: @kolaente

Base: mainHead: feat-doctor


📝 Commits (10+)

  • d33efa7 feat(doctor): add diagnostic check package
  • 58ac453 feat: add vikunja doctor command for diagnostic checks
  • 966b02c fix(doctor): address lint issues
  • d6a35f1 feat(doctor): add Windows compatibility for file checks
  • 7990125 fix(doctor): use custom init to avoid fatal errors on service failures
  • f452e06 refactor(doctor): use minimal init, check each service independently
  • 70c353e fix(doctor): use actual LDAP bind test instead of TCP connection
  • 321c118 fix(doctor): split user check into platform-specific files
  • 83d9c57 fix(doctor): handle empty OpenID authurl to prevent panic
  • c206491 refactor(doctor): reduce duplication in files check

📊 Changes

15 files changed (+1223 additions, -3 deletions)

View changed files

📝 go.mod (+1 -1)
📝 go.sum (+0 -2)
pkg/cmd/doctor.go (+68 -0)
pkg/doctor/config.go (+120 -0)
pkg/doctor/database.go (+124 -0)
pkg/doctor/doctor.go (+33 -0)
pkg/doctor/files.go (+132 -0)
pkg/doctor/files_unix.go (+46 -0)
pkg/doctor/files_windows.go (+27 -0)
pkg/doctor/output.go (+75 -0)
pkg/doctor/services.go (+406 -0)
pkg/doctor/system.go (+82 -0)
pkg/doctor/system_unix.go (+40 -0)
pkg/doctor/system_windows.go (+37 -0)
pkg/doctor/types.go (+32 -0)

📄 Description

Summary

  • Add a new vikunja doctor CLI command that performs self-service diagnostic checks
  • Displays system health information with colored status indicators (✓/✗)
  • Returns exit code 0 if all checks pass, 1 if any fail

Checks performed

  • System: Version, Go version, OS/arch, running user, working directory
  • Configuration: Config file path, public URL, JWT secret, CORS origins
  • Database: Connection test, server version (SQLite/MySQL/PostgreSQL)
  • Files: Storage path, writability, disk space (Unix only)
  • Optional services (when enabled):
    • Redis: Connection ping
    • Typesense: Health endpoint
    • Mailer: SMTP connection
    • LDAP: Bind authentication test
    • OpenID Connect: Discovery endpoint for each configured provider

Example output

Vikunja Doctor
==============

System
  ✓ Version: v1.0.0
  ✓ Go: go1.22.0
  ✓ OS: linux/amd64
  ✓ User: vikunja (uid=1000)
  ✓ Working directory: /app

Configuration
  ✓ Config file: /etc/vikunja/config.yml
  ✓ Public URL: https://vikunja.example.com
  ✓ JWT secret: configured

Database (sqlite)
  ✓ Connection: OK
  ✓ Server version: 3.45.0

Files (local)
  ✓ Path: /app/files
  ✓ Writable: yes
  ✓ Disk space: 45.2 GB available

OpenID Connect
  ✓ Provider: Authentik: OK
  ✗ Provider: Broken Provider: discovery endpoint returned status 404

1 check(s) failed

Test plan

  • Build succeeds (mage build)
  • Lint passes (mage lint)
  • vikunja doctor runs and shows all check categories
  • Failed services show with ✗ and error message
  • Exit code is 1 when checks fail, 0 when all pass
  • Windows build compatibility (files_windows.go stub)

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/go-vikunja/vikunja/pull/2165 **Author:** [@kolaente](https://github.com/kolaente) **Created:** 1/27/2026 **Status:** ✅ Merged **Merged:** 1/27/2026 **Merged by:** [@kolaente](https://github.com/kolaente) **Base:** `main` ← **Head:** `feat-doctor` --- ### 📝 Commits (10+) - [`d33efa7`](https://github.com/go-vikunja/vikunja/commit/d33efa7b8134828b8775331f90642a18ef117f60) feat(doctor): add diagnostic check package - [`58ac453`](https://github.com/go-vikunja/vikunja/commit/58ac453da7fdf23c819cfa666a23a7af1ea61cec) feat: add vikunja doctor command for diagnostic checks - [`966b02c`](https://github.com/go-vikunja/vikunja/commit/966b02ccf6d0dd6d4dd0cf8f479a0ad59e0ba890) fix(doctor): address lint issues - [`d6a35f1`](https://github.com/go-vikunja/vikunja/commit/d6a35f1a0b8873faac1ef336cf668ab0e6264b5e) feat(doctor): add Windows compatibility for file checks - [`7990125`](https://github.com/go-vikunja/vikunja/commit/7990125acf25a439f9dd5717589babac9e1a1c59) fix(doctor): use custom init to avoid fatal errors on service failures - [`f452e06`](https://github.com/go-vikunja/vikunja/commit/f452e06348aad39c09e56422e683a26ca43bb3e5) refactor(doctor): use minimal init, check each service independently - [`70c353e`](https://github.com/go-vikunja/vikunja/commit/70c353eb2270952dcb03e881ceda3220d8ec7ad8) fix(doctor): use actual LDAP bind test instead of TCP connection - [`321c118`](https://github.com/go-vikunja/vikunja/commit/321c118361da15a8f8338cd1f54ef7ded8d05105) fix(doctor): split user check into platform-specific files - [`83d9c57`](https://github.com/go-vikunja/vikunja/commit/83d9c57d378fbcdf38f8372b8b786ddb2fae5e71) fix(doctor): handle empty OpenID authurl to prevent panic - [`c206491`](https://github.com/go-vikunja/vikunja/commit/c206491338792ad9ef174de9b27a35befe65d838) refactor(doctor): reduce duplication in files check ### 📊 Changes **15 files changed** (+1223 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `go.mod` (+1 -1) 📝 `go.sum` (+0 -2) ➕ `pkg/cmd/doctor.go` (+68 -0) ➕ `pkg/doctor/config.go` (+120 -0) ➕ `pkg/doctor/database.go` (+124 -0) ➕ `pkg/doctor/doctor.go` (+33 -0) ➕ `pkg/doctor/files.go` (+132 -0) ➕ `pkg/doctor/files_unix.go` (+46 -0) ➕ `pkg/doctor/files_windows.go` (+27 -0) ➕ `pkg/doctor/output.go` (+75 -0) ➕ `pkg/doctor/services.go` (+406 -0) ➕ `pkg/doctor/system.go` (+82 -0) ➕ `pkg/doctor/system_unix.go` (+40 -0) ➕ `pkg/doctor/system_windows.go` (+37 -0) ➕ `pkg/doctor/types.go` (+32 -0) </details> ### 📄 Description ## Summary - Add a new `vikunja doctor` CLI command that performs self-service diagnostic checks - Displays system health information with colored status indicators (✓/✗) - Returns exit code 0 if all checks pass, 1 if any fail ## Checks performed - **System**: Version, Go version, OS/arch, running user, working directory - **Configuration**: Config file path, public URL, JWT secret, CORS origins - **Database**: Connection test, server version (SQLite/MySQL/PostgreSQL) - **Files**: Storage path, writability, disk space (Unix only) - **Optional services** (when enabled): - Redis: Connection ping - Typesense: Health endpoint - Mailer: SMTP connection - LDAP: Bind authentication test - OpenID Connect: Discovery endpoint for each configured provider ## Example output ``` Vikunja Doctor ============== System ✓ Version: v1.0.0 ✓ Go: go1.22.0 ✓ OS: linux/amd64 ✓ User: vikunja (uid=1000) ✓ Working directory: /app Configuration ✓ Config file: /etc/vikunja/config.yml ✓ Public URL: https://vikunja.example.com ✓ JWT secret: configured Database (sqlite) ✓ Connection: OK ✓ Server version: 3.45.0 Files (local) ✓ Path: /app/files ✓ Writable: yes ✓ Disk space: 45.2 GB available OpenID Connect ✓ Provider: Authentik: OK ✗ Provider: Broken Provider: discovery endpoint returned status 404 1 check(s) failed ``` ## Test plan - [x] Build succeeds (`mage build`) - [x] Lint passes (`mage lint`) - [x] `vikunja doctor` runs and shows all check categories - [x] Failed services show with ✗ and error message - [x] Exit code is 1 when checks fail, 0 when all pass - [x] Windows build compatibility (files_windows.go stub) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-23 09:13:51 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/vikunja#9816