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
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,17 @@ Access example:
http://your-server-ip:8380
```

### Admin login

On first start the backend creates a default administrator account:

- Username: `NodeProbe`
- Password: `nodeprobe` followed by the last segment of your server's **public** IP address
(e.g. public IP `203.0.113.5` -> password `nodeprobe5`)

If the server cannot determine its public IP, you can provide it via the `SERVER_IP`
environment variable.

### Using the deploy script

The repository provides a `deploy.sh` script for one‑click deployment or updates. The script automatically switches to its directory and can be executed from anywhere:
Expand Down
10 changes: 10 additions & 0 deletions README.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@ docker compose up -d
http://your-server-ip:8380
```

### 管理员登录

首次启动时后台会自动创建一个管理员账户:

- 用户名:`NodeProbe`
- 密码:`nodeprobe` 加上服务器**公网**IP 的最后一段
(例如公网 IP `203.0.113.5` 对应密码 `nodeprobe5`)

若服务无法自动获取公网 IP,可通过 `SERVER_IP` 环境变量手动指定。

### 使用部署脚本

仓库自带 `deploy.sh`,可一键部署或更新。脚本会自动切换到自身目录,可在任意位置通过绝对路径执行:
Expand Down
7 changes: 6 additions & 1 deletion backend/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,12 @@ def short_ts(ts):
@app.on_event("startup")
def create_default_user():
db = database.SessionLocal()
host_ip = os.environ.get("SERVER_IP") or socket.gethostbyname(socket.gethostname())
host_ip = os.environ.get("SERVER_IP")
if not host_ip:
try:
host_ip = requests.get("https://api.ipify.org", timeout=5).text.strip()
except Exception:
host_ip = socket.gethostbyname(socket.gethostname())
try:
user = db.query(models.User).first()
if not user:
Expand Down