How donknap/dpanel works
Project type and purpose
• This is a full-stack Docker management panel (“DPanel”)
• Purpose: provide a web UI and CLI scripts to manage Docker containers, images, networks, volumes, backups, crons, SSL certificates, registry sync, etc.
Main architectural layers (based on file structure)
• Frontend: static assets in asset/index.html + asset/static (React, UmiJS, Ant Design)
• HTTP/API layer: Go controllers under app/application/http and common/http
• Application logic: app/application/logic and common/logic modules
• CLI commands: app/ctrl/command (compose, container, store, user), invoked by docker/script/*.yaml
• Service layer: common/service (docker SDK, crontab, ACME, storage, SSH, WebSocket, plugin, registry, notice)
• Data access layer: common/dao + common/accessor + common/entity (ORM-generated DAOs and option builders)
• Infrastructure/config: config.yaml, migrations under common/migrate, Dockerfiles, Makefile
External systems and dependencies
• Docker Engine via unix socket (/var/run/docker.sock)
• SQL database (models generated by gen-model.yaml)
• Nginx reverse proxy (docker/nginx)
• ACME service for certificates (common/service/acme)
• Optional remote storage via rclone (through plugin or storage service)
• Web browser (classic web UI)
• CLI scripts scheduled by host crontab or run manually
a. Frontend (Browser)
• Sends HTTP/HTTPS → Nginx
b. Nginx (Docker container)
• Serves static files
• Proxies API calls → Go HTTP server
c. Go HTTP Server (main.go)
• HTTP controllers → application logic → service layer → Docker Engine / DB / ACME / storage / plugin
• WebSocket endpoints → push events to front end
d. CLI Module (app/ctrl)
• Invoked by shell scripts under docker/script
• Shares the same service & data layers as the HTTP server
e. Service Layer
• Docker SDK calls to Docker Engine
• Cron job scheduling (wrapper around host crontab or internal scheduler)
• ACME for SSL
• Plugin loader & executor
• SSH and remote storage interactions
f. Data Layer
• ORM DAOs → SQL database
• Migrations manage schema versions
g. External Services
• Docker Engine
• Database (MySQL/PostgreSQL)
• Certificate Authority (Let’s Encrypt via ACME)
• Remote object storage (via rclone or other plugin)
Architectural patterns and design principles
• Layered architecture (Presentation → Application → Service → Data)
• MVC-like controllers for HTTP and CLI adapters
• Hexagonal/Ports & Adapters: services encapsulate external dependencies (Docker, DB, SSH, WebSocket)
• Reuse of core logic across HTTP and CLI interfaces
Essential details to capture
• Dual interfaces (HTTP + CLI) sharing the same core
• Docker Engine integration via unix socket
• Database persistence (common/dao) and migrations
• Plugin system and built-in scripts (docker/script)
• Certificate management (ACME)
• WebSocket events channel (common/service/ws)