-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathnodeget.conf
More file actions
101 lines (88 loc) · 2.94 KB
/
Copy pathnodeget.conf
File metadata and controls
101 lines (88 loc) · 2.94 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
# NodeGet Configuration for kejilion/apps
# Official: https://nodeget.com
# Docker install: https://nodeget.com/guide/install/docker
local app_id="nodeget"
local app_name="NodeGet"
local app_text="NodeGet 服务器节点监控、API 扩展与自动化运维平台"
local app_url="https://nodeget.com"
local docker_name="nodeget"
local docker_port="2211"
local app_size="1"
# --- 核心逻辑 / Core Logic ---
docker_app_install() {
local app_dir="/home/docker/nodeget"
local postgres_password
postgres_password=$(openssl rand -hex 24 2>/dev/null || head /dev/urandom | tr -dc A-Za-z0-9 | head -c 32)
mkdir -p "${app_dir}/data/config" "${app_dir}/data/postgres"
cd "${app_dir}" || return 1
if [ ! -f .env ]; then
cat <<ENV > .env
POSTGRES_DB=nodeget
POSTGRES_USER=nodeget
POSTGRES_PASSWORD=${postgres_password}
TZ=Asia/Shanghai
ENV
fi
cat <<'EOF' > docker-compose.yml
name: nodeget-postgres
services:
postgres:
image: postgres:17-alpine
container_name: nodeget-postgres
restart: unless-stopped
environment:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
TZ: ${TZ}
volumes:
- ./data/postgres:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 5s
timeout: 5s
retries: 20
nodeget:
image: genshinmc/nodeget:latest
container_name: nodeget
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
environment:
NODEGET_PORT: "2211"
NODEGET_LOG_FILTER: info
NODEGET_DATABASE_URL: postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}
TZ: ${TZ}
ports:
- "2211:2211"
volumes:
- ./data/config:/etc/nodeget
EOF
sed -i "s/\"2211:2211\"/\"${docker_port}:2211\"/g" docker-compose.yml
docker compose up -d
echo "NodeGet 已部署完成!"
check_docker_app_ip
echo "配置目录:${app_dir}/data/config"
echo "PostgreSQL 数据目录:${app_dir}/data/postgres"
echo "数据库密码已保存:${app_dir}/.env"
echo "查看登录/接入凭证:cd ${app_dir} && docker compose logs nodeget | grep -E 'Super Token|Root Password'"
echo "Dashboard 地址:https://dash.nodeget.com/#/dashboard/node-manage?tab=servers"
echo "添加 Server 时填写当前服务地址和 Super Token;Root Password 请一并妥善保存。"
}
docker_app_update() {
local app_dir="/home/docker/nodeget"
cd "${app_dir}" || return 1
docker compose pull
docker compose up -d
echo "NodeGet 已更新完成。"
}
docker_app_uninstall() {
local app_dir="/home/docker/nodeget"
cd "${app_dir}" || return 1
docker compose down --rmi all
rm -rf "${app_dir}"
echo "NodeGet 已彻底卸载,包括配置与 PostgreSQL 数据。"
}
# --- 注册 (必须包含) / Registration (Mandatory) ---
docker_app_plus