-
-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathentrypoint.sh
More file actions
executable file
·107 lines (91 loc) · 1.99 KB
/
entrypoint.sh
File metadata and controls
executable file
·107 lines (91 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/bin/sh
# ServerStatus Dashboard 入口脚本
# 兼容 scratch 镜像环境
# 健康检查模式
if [ "$1" = "--health-check" ]; then
# 检查进程是否存在
if [ -f "/proc/1/comm" ]; then
exit 0
else
exit 1
fi
fi
# 简单日志函数(不依赖 date 命令)
log() {
echo "[ENTRYPOINT] $1"
}
log "Starting ServerStatus Dashboard..."
# 检查数据目录
if [ ! -d "/dashboard/data" ]; then
log "Creating data directory..."
mkdir -p /dashboard/data
fi
# 检查配置文件
if [ ! -f "/dashboard/data/config.yaml" ]; then
log "Creating default configuration..."
cat > /dashboard/data/config.yaml << 'EOF'
# ServerStatus Dashboard 配置文件
debug: false
language: zh-CN
httpport: 80
grpcport: 2222
grpchost: ""
# 数据库配置
database:
type: sqlite
dsn: data/sqlite.db
# JWT 密钥 (请修改为随机字符串)
jwt_secret: "default-secret-please-change"
# 管理员账户 (首次启动后请立即修改)
admin:
username: admin
password: admin123
# 站点配置
site:
brand: "ServerStatus"
cookiename: "server-dash"
theme: "default"
customcode: ""
viewpassword: ""
# OAuth2 配置 (可选)
oauth2:
type: ""
admin: ""
clientid: ""
clientsecret: ""
endpoint: ""
# DDNS 配置 (可选)
ddns:
enable: false
provider: "webhook"
accessid: ""
accesssecret: ""
webhookmethod: ""
webhookurl: ""
webhookrequestbody: ""
webhookheaders: ""
maxretries: 3
# 其他配置
cover: 0
ignoredipnotification: ""
ignoredipnotificationserverids: []
tgbottoken: ""
tgchatid: ""
wxpushertoken: ""
wxpusheruids: []
EOF
log "Default configuration created"
log "Please modify admin password after first login"
fi
# 检查应用文件
if [ ! -f "/dashboard/app" ]; then
log "ERROR: Application binary not found at /dashboard/app"
exit 1
fi
if [ ! -x "/dashboard/app" ]; then
log "Setting executable permissions for app..."
chmod +x /dashboard/app
fi
# 启动应用
log "Starting application..."
exec /dashboard/app "$@"