Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,7 @@ All notable changes to this project will be documented in this file.
- Log default admin password and require change on first login
- Ensure database directory exists and `/tests` endpoint is accessible
- Resolve missing ping command and other display issues
- Preserve Docker volume by parameterising `DATA_DIR` in deploy script
- Show default admin password and login URL in Docker startup logs


2 changes: 2 additions & 0 deletions CHANGELOG.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,7 @@
- 记录默认管理员密码并要求首次登录后修改
- 确保数据库目录存在且 `/tests` 接口可访问
- 解决缺少 ping 命令等显示问题
- 部署脚本参数化 `DATA_DIR` 以避免重建时丢失数据卷
- 在启动日志中显示默认管理员密码和登录地址


2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ docker compose up -d
```

Default data will be stored under `/opt/NodeProbe/data/`.
The directory can be customised by setting the `DATA_DIR` environment variable
before running Docker Compose or `deploy.sh`.

Access example:

Expand Down
3 changes: 3 additions & 0 deletions README.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ docker compose up -d
```

默认数据存储于 `/opt/NodeProbe/data/`。
可通过设置 `DATA_DIR` 环境变量自定义该目录,运行 Docker Compose 或
`deploy.sh` 时会自动使用此路径。

访问示例:

Expand Down Expand Up @@ -75,6 +77,7 @@ docker run -d --name nodeprobe -p 8380:8380 \
```

默认数据会保存到 `/opt/NodeProbe/data/`。
同样可通过 `DATA_DIR` 环境变量进行更改。

## 更新日志

Expand Down
12 changes: 10 additions & 2 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,18 @@ set -e

# Absolute path of script
BASE_DIR="$(cd "$(dirname "$0")" && pwd)"
# Use a persistent data directory that matches the project name
DATA_DIR="/opt/NodeProbe/data"

# Use a persistent data directory that matches the project name. This avoids
# wiping existing volumes when the repository is redeployed from a different
# location or under a different name.
PROJECT_NAME="$(basename "$BASE_DIR")"
DATA_DIR="/opt/${PROJECT_NAME}/data"

# Ensure the directory exists and expose it for docker-compose variable
# substitution.
mkdir -p "$DATA_DIR"
export DATA_DIR

cd "$BASE_DIR"

git pull
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ services:
ports:
- "8380:8380"
volumes:
- /opt/NodeProbe/data:/app/data
- ${DATA_DIR:-/opt/NodeProbe/data}:/app/data
restart: unless-stopped