serverdeck 1.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,9 @@
1
+ .venv/
2
+ dist/
3
+ build/
4
+ *.egg-info/
5
+ __pycache__/
6
+ *.py[cod]
7
+ .pytest_cache/
8
+ .ruff_cache/
9
+ serverdeck.json
@@ -0,0 +1,124 @@
1
+ Metadata-Version: 2.5
2
+ Name: serverdeck
3
+ Version: 1.1.0
4
+ Summary: A lightweight, read-only server status dashboard: systemd timers, restic, containers, disks, CPU, memory and network.
5
+ Keywords: dashboard,docker,monitoring,podman,restic,server,sysadmin,systemd
6
+ Classifier: Environment :: Web Environment
7
+ Classifier: Operating System :: POSIX :: Linux
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3 :: Only
10
+ Classifier: Topic :: System :: Monitoring
11
+ Classifier: Topic :: System :: Systems Administration
12
+ Classifier: Topic :: Utilities
13
+ Requires-Python: >=3.9
14
+ Description-Content-Type: text/markdown
15
+
16
+ # serverdeck
17
+
18
+ 一个轻量的服务器状态面板:systemd 定时任务、restic 备份、容器、磁盘、内存、
19
+ CPU 与网络信息集中在一个只读页面里。后端仅使用 Python 标准库,前端不依赖任何
20
+ CDN 或前端框架。
21
+
22
+ ## 功能
23
+
24
+ - **systemd 定时任务**:下次 / 上次触发时间、timer 状态、上次 service 执行结果。
25
+ - **restic 备份**:仓库可访问性、快照数量、最新快照时间、最近快照列表与错误原因。
26
+ - **容器**:自动识别 docker / podman;优先使用 docker,两者都不存在时不显示容器 tab。
27
+ - **资源**:CPU 总体与逐核占用、内存 / 缓存 / 交换、各挂载点磁盘用量。
28
+ - **网络**:接口地址、实时收发速率、累计流量、TCP 状态统计、监听端口及进程。
29
+ - **页面**:按功能拆分为 tab(系统、网络、定时任务、容器、Restic),系统页内含
30
+ CPU、内存与磁盘详情;自动刷新,可选访问令牌;默认只监听回环地址。
31
+
32
+ ## 安装
33
+
34
+ 需要 Python 3.9+。
35
+
36
+ 从源码使用 uv:
37
+
38
+ ```bash
39
+ uv sync
40
+ uv run serverdeck
41
+ ```
42
+
43
+ 构建并安装本地 wheel:
44
+
45
+ ```bash
46
+ uv build
47
+ uv pip install dist/*.whl
48
+ serverdeck
49
+ ```
50
+
51
+ 发布到 PyPI 后也可以用:
52
+
53
+ ```bash
54
+ uv tool install serverdeck
55
+ ```
56
+
57
+ ## 使用
58
+
59
+ ```bash
60
+ serverdeck
61
+ # 打开 http://127.0.0.1:8787
62
+ ```
63
+
64
+ 对外监听时建议设置访问令牌:
65
+
66
+ ```bash
67
+ serverdeck --host 0.0.0.0 --port 8787 --token 'your-token'
68
+ ```
69
+
70
+ ### restic
71
+
72
+ 通过命令行指定仓库:
73
+
74
+ ```bash
75
+ serverdeck \
76
+ --restic-repo /mnt/backup/restic \
77
+ --restic-password-file /etc/restic/pass
78
+ ```
79
+
80
+ `--restic-repo` 可以重复指定。脚本也会自动扫描 systemd 单元和 cron 中出现的
81
+ restic 命令(仅限当前用户可读的文件),并读取 `RESTIC_REPOSITORY` 环境变量。
82
+
83
+ ### 配置文件
84
+
85
+ 默认查找当前目录的 `serverdeck.json` 或
86
+ `~/.config/serverdeck/config.json`,也可以用 `--config` 指定:
87
+
88
+ ```json
89
+ {
90
+ "host": "127.0.0.1",
91
+ "port": 8787,
92
+ "refresh_seconds": 5,
93
+ "token": "",
94
+ "containers": {"runtime": "auto"},
95
+ "restic": {
96
+ "enabled": true,
97
+ "interval": 300,
98
+ "repos": [
99
+ {
100
+ "name": "本机备份",
101
+ "repository": "/mnt/backup/restic",
102
+ "password_file": "/etc/restic/pass",
103
+ "env": {}
104
+ }
105
+ ]
106
+ }
107
+ }
108
+ ```
109
+
110
+ ## 开发
111
+
112
+ ```bash
113
+ uv sync
114
+ uv run pytest
115
+ uv run ruff check .
116
+ uv build
117
+ ```
118
+
119
+ ## 说明
120
+
121
+ - 默认监听 `127.0.0.1`。对外暴露时请配合 `--token` 使用。
122
+ - 监听端口表中的进程列通常需要相应权限才能看到其他用户的进程。
123
+ - restic 采集默认每 300 秒执行一次;页面上的“刷新”按钮会立即触发全量采集。
124
+ - 面板是只读的,不会修改 systemd、容器、restic 或系统配置。
@@ -0,0 +1,109 @@
1
+ # serverdeck
2
+
3
+ 一个轻量的服务器状态面板:systemd 定时任务、restic 备份、容器、磁盘、内存、
4
+ CPU 与网络信息集中在一个只读页面里。后端仅使用 Python 标准库,前端不依赖任何
5
+ CDN 或前端框架。
6
+
7
+ ## 功能
8
+
9
+ - **systemd 定时任务**:下次 / 上次触发时间、timer 状态、上次 service 执行结果。
10
+ - **restic 备份**:仓库可访问性、快照数量、最新快照时间、最近快照列表与错误原因。
11
+ - **容器**:自动识别 docker / podman;优先使用 docker,两者都不存在时不显示容器 tab。
12
+ - **资源**:CPU 总体与逐核占用、内存 / 缓存 / 交换、各挂载点磁盘用量。
13
+ - **网络**:接口地址、实时收发速率、累计流量、TCP 状态统计、监听端口及进程。
14
+ - **页面**:按功能拆分为 tab(系统、网络、定时任务、容器、Restic),系统页内含
15
+ CPU、内存与磁盘详情;自动刷新,可选访问令牌;默认只监听回环地址。
16
+
17
+ ## 安装
18
+
19
+ 需要 Python 3.9+。
20
+
21
+ 从源码使用 uv:
22
+
23
+ ```bash
24
+ uv sync
25
+ uv run serverdeck
26
+ ```
27
+
28
+ 构建并安装本地 wheel:
29
+
30
+ ```bash
31
+ uv build
32
+ uv pip install dist/*.whl
33
+ serverdeck
34
+ ```
35
+
36
+ 发布到 PyPI 后也可以用:
37
+
38
+ ```bash
39
+ uv tool install serverdeck
40
+ ```
41
+
42
+ ## 使用
43
+
44
+ ```bash
45
+ serverdeck
46
+ # 打开 http://127.0.0.1:8787
47
+ ```
48
+
49
+ 对外监听时建议设置访问令牌:
50
+
51
+ ```bash
52
+ serverdeck --host 0.0.0.0 --port 8787 --token 'your-token'
53
+ ```
54
+
55
+ ### restic
56
+
57
+ 通过命令行指定仓库:
58
+
59
+ ```bash
60
+ serverdeck \
61
+ --restic-repo /mnt/backup/restic \
62
+ --restic-password-file /etc/restic/pass
63
+ ```
64
+
65
+ `--restic-repo` 可以重复指定。脚本也会自动扫描 systemd 单元和 cron 中出现的
66
+ restic 命令(仅限当前用户可读的文件),并读取 `RESTIC_REPOSITORY` 环境变量。
67
+
68
+ ### 配置文件
69
+
70
+ 默认查找当前目录的 `serverdeck.json` 或
71
+ `~/.config/serverdeck/config.json`,也可以用 `--config` 指定:
72
+
73
+ ```json
74
+ {
75
+ "host": "127.0.0.1",
76
+ "port": 8787,
77
+ "refresh_seconds": 5,
78
+ "token": "",
79
+ "containers": {"runtime": "auto"},
80
+ "restic": {
81
+ "enabled": true,
82
+ "interval": 300,
83
+ "repos": [
84
+ {
85
+ "name": "本机备份",
86
+ "repository": "/mnt/backup/restic",
87
+ "password_file": "/etc/restic/pass",
88
+ "env": {}
89
+ }
90
+ ]
91
+ }
92
+ }
93
+ ```
94
+
95
+ ## 开发
96
+
97
+ ```bash
98
+ uv sync
99
+ uv run pytest
100
+ uv run ruff check .
101
+ uv build
102
+ ```
103
+
104
+ ## 说明
105
+
106
+ - 默认监听 `127.0.0.1`。对外暴露时请配合 `--token` 使用。
107
+ - 监听端口表中的进程列通常需要相应权限才能看到其他用户的进程。
108
+ - restic 采集默认每 300 秒执行一次;页面上的“刷新”按钮会立即触发全量采集。
109
+ - 面板是只读的,不会修改 systemd、容器、restic 或系统配置。
@@ -0,0 +1,70 @@
1
+ [project]
2
+ name = "serverdeck"
3
+ version = "1.1.0"
4
+ description = "A lightweight, read-only server status dashboard: systemd timers, restic, containers, disks, CPU, memory and network."
5
+ readme = "README.md"
6
+ requires-python = ">=3.9"
7
+ keywords = [
8
+ "server",
9
+ "dashboard",
10
+ "monitoring",
11
+ "systemd",
12
+ "restic",
13
+ "podman",
14
+ "docker",
15
+ "sysadmin",
16
+ ]
17
+ classifiers = [
18
+ "Environment :: Web Environment",
19
+ "Operating System :: POSIX :: Linux",
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3 :: Only",
22
+ "Topic :: System :: Monitoring",
23
+ "Topic :: System :: Systems Administration",
24
+ "Topic :: Utilities",
25
+ ]
26
+ dependencies = []
27
+
28
+ [project.scripts]
29
+ serverdeck = "serverdeck.cli:main"
30
+
31
+ [dependency-groups]
32
+ dev = [
33
+ "pytest>=8.0",
34
+ "ruff>=0.8",
35
+ ]
36
+
37
+ [build-system]
38
+ requires = ["hatchling"]
39
+ build-backend = "hatchling.build"
40
+
41
+ [tool.hatch.build.targets.wheel]
42
+ packages = ["src/serverdeck"]
43
+
44
+ [tool.hatch.build.targets.sdist]
45
+ include = [
46
+ "src",
47
+ "tests",
48
+ "README.md",
49
+ "pyproject.toml",
50
+ "uv.lock",
51
+ ]
52
+
53
+ [tool.pytest.ini_options]
54
+ testpaths = ["tests"]
55
+ addopts = "-q"
56
+
57
+ [tool.ruff]
58
+ line-length = 100
59
+ target-version = "py39"
60
+
61
+ [tool.ruff.lint]
62
+ select = ["E", "F", "I", "B"]
63
+ ignore = ["E501"]
64
+
65
+ [tool.pyright]
66
+ include = ["src", "tests"]
67
+ extraPaths = ["src"]
68
+ pythonVersion = "3.9"
69
+ venvPath = "."
70
+ venv = ".venv"
@@ -0,0 +1,13 @@
1
+ """serverdeck: a lightweight, read-only server status dashboard."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from importlib.metadata import PackageNotFoundError
6
+ from importlib.metadata import version as _package_version
7
+
8
+ try:
9
+ __version__ = _package_version("serverdeck")
10
+ except PackageNotFoundError: # 源码树中直接运行时
11
+ __version__ = "1.1.0"
12
+
13
+ __all__ = ["__version__"]
@@ -0,0 +1,8 @@
1
+ """支持 python -m serverdeck。"""
2
+
3
+ import sys
4
+
5
+ from .cli import main
6
+
7
+ if __name__ == "__main__":
8
+ sys.exit(main())