Skip to content

Commit

Permalink
chore: 适配安装过程
Browse files Browse the repository at this point in the history
  • Loading branch information
rehiy committed Feb 24, 2023
1 parent 559488d commit d1a412e
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 15 deletions.
9 changes: 7 additions & 2 deletions docker/tdp-server
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@ mkdir -p /etc/tdp-cloud
mkdir -p /var/lib/tdp-cloud
mkdir -p /var/log/tdp-cloud

yml=/etc/tdp-cloud/config.yml
yml=/etc/tdp-cloud/server.yml

[ -f $yml ] || cat <<EOF >$yml
dataset:
dir: /var/lib/tdp-cloud
logger:
dir: /var/log/tdp-cloud
level: info
server:
dsn: /var/lib/tdp-cloud/server.db
dsn: server.db
listen: :7800
EOF

Expand Down
15 changes: 10 additions & 5 deletions docs/server-linux
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,16 @@ install() {

config=/etc/tdp-cloud/server.yml

echo "server:" >$config
echo " dsn: /var/lib/tdp-cloud/server.db" >>$config
echo " listen: :7800" >>$config
echo "logger:" >>$config
echo " directory: /var/log/tdp-cloud" >>$config
cat <<EOF >$config
dataset:
dir: /var/lib/tdp-cloud
logger:
dir: /var/log/tdp-cloud
level: info
server:
dsn: server.db
listen: :7800
EOF

$TDP_EXEC server -s install -c $config
if [ $? -ne 0 ]; then
Expand Down
13 changes: 9 additions & 4 deletions docs/worker-linux
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,15 @@ install() {

config=/etc/tdp-cloud/worker.yml

echo "worker:" >$config
echo " remote: $TDP_REMOTE_URL" >>$config
echo "logger:" >>$config
echo " directory: /var/log/tdp-cloud" >>$config
cat <<EOF >$config
dataset:
dir: /var/lib/tdp-cloud
logger:
dir: /var/log/tdp-cloud
level: info
worker:
remote: $TDP_REMOTE_URL
EOF

$TDP_EXEC worker -s install -c $config
if [ $? -ne 0 ]; then
Expand Down
18 changes: 14 additions & 4 deletions docs/部署服务端.md → docs/安装服务端.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 部署服务端
# 安装服务端

## 快速部署

Expand All @@ -10,21 +10,31 @@ wget -qO- https://apps.rehiy.com/tdp-cloud/server-linux | sh -

- 如需更改配置,请编辑文件 `/etc/tdp-cloud/config.yml`,然后重启服务 `service tdp-server restart`

## 容器部署

```shell
docker run -d --name tdp-server \
-p 7800 \
-v ./conf:/etc/tdp-cloud \
-v ./data:/var/lib/tdp-cloud \
rehiy/tdp-cloud
```

## 手动部署

- 根据系统类型下载编译好的[二进制程序](https://github.com/open-tdp/tdp-cloud/releases),重命名为 `tdp-cloud`

- 运行 `tdp-cloud server`,此时会生成 `server.db` 数据库文件,请注意权限
- 运行 `tdp-cloud server`,此时会生成 `var/data/server.db` 数据库文件,请注意目录权限

## 访问控制面板

- 浏览器打开 `http://your-server:7800`,初始账号 `admin`,密码 `123456`

- 登录账号,添加一组或多组云厂账号,即可管理云资源

## 数据库配置参数 `--dsn`
## 数据库配置参数 `dsn`

- 使用 **SQLite** 数据源 `data/server.db`。默认会追加参数 `?_pragma=busy_timeout=5000&_pragma=journa_mode(WAL)`
- 使用 **SQLite** 数据源 `server.db`。默认会追加参数 `?_pragma=busy_timeout=5000&_pragma=journa_mode(WAL)`

- 使用 **MySQL** 数据源 `user:password@tcp(localhost:3306)/dbname`。默认会追加参数 `?charset=utf8mb4&parseTime=True&loc=Local`

Expand Down

0 comments on commit d1a412e

Please sign in to comment.