Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update config description / 更新config的解释 #209

Merged
merged 1 commit into from
Jul 17, 2023
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
129 changes: 61 additions & 68 deletions docs/zh/config-desc.md
Original file line number Diff line number Diff line change
@@ -1,53 +1,6 @@
# 配置文件解析

   `sophon-miner` 的配置文件默认位于 `~/.sophon-miner/config.toml`,执行命令 `sophon-miner init` 时生成。文件中以 `#` 开头的行为注释。


## 旧版本

旧版本指的是版本号 `< v1.7.0` 的版本

```toml
# 链服务监听地址
ListenAPI = "/ip4/127.0.0.1/tcp/3453"
Token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiYWRtaW4iLCJwZXJtIjoiYWRtaW4iLCJleHQiOiIifQ.RRSdeQ-c1Ei-8roAj-L-wpOr-y6PssDorbGijMPxjoc"
# 生产的区块记录方式,已废弃,由 `slash filter` 取代
BlockRecord = "cache"

# `sophon-miner` 服务监听地址
[API]
ListenAddress = "/ip4/0.0.0.0/tcp/12308/http"
RemoteListenAddress = ""
Timeout = "30s"

# 事件网关服务监听地址
[Gateway]
ListenAPI = ["/ip4/127.0.0.1/tcp/45132"]
Token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiYWRtaW4iLCJwZXJtIjoiYWRtaW4iLCJleHQiOiIifQ.RRSdeQ-c1Ei-8roAj-L-wpOr-y6PssDorbGijMPxjoc"

# 数据库信息
[Db]
# 矿工管理方式,已废弃,从 `sophon-auth` 获取
Type = "auth"
# `slash filter` 模块区块存取方式
SFType = "mysql"
[Db.MySQL]
Conn = "root:kuangfengjuexizhan@tcp(192.168.200.2:3308)/sophon-miner-butterfly-200-19?charset=utf8mb4&parseTime=True&loc=Local&timeout=10s"
MaxOpenConn = 100
MaxIdleConn = 10
ConnMaxLifeTime = 60
Debug = false
[Db.Auth]
ListenAPI = "http://127.0.0.1:8989"
Token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiYWRtaW4iLCJwZXJtIjoiYWRtaW4iLCJleHQiOiIifQ.RRSdeQ-c1Ei-8roAj-L-wpOr-y6PssDorbGijMPxjoc"

# Jaeger Tracing 服务信息,默认不启用
[Tracing]
JaegerTracingEnabled = false
JaegerEndpoint = "localhost:6831"
ProbabilitySampler = 1.0
ServerName = "sophon-miner"
```
`sophon-miner` 的配置文件默认位于 `~/.sophon-miner/config.toml`,执行命令 `sophon-miner init` 时生成。文件中以 `#` 开头的行为注释。

## 新版本

Expand All @@ -63,45 +16,38 @@ MpoolSelectDelaySecs = 0

# `sophon-miner` 服务监听地址
[API]
ListenAddress = "/ip4/0.0.0.0/tcp/12308“

# 链服务监听地址
ListenAddress = "/ip4/127.0.0.1/tcp/12308"

[FullNode]
Addr = "/ip4/127.0.0.1/tcp/3453"
Token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiY2hhaW4tc2VydmljZSIsInBlcm0iOiJhZG1pbiIsImV4dCI6IiJ9.DxlsJO-XrrdQLvJdA6wdWJxeYOhZt_kMYMHc7NdfQNw"
# [Gateway],[Auth],[FullNode] 是同一个token
Token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiZWx2aW4iLCJwZXJtIjoiYWRtaW4iLCJleHQiOiIifQ.y2vEhxUd2Q9N6kYKe1nsKA4Xelam_ZIVRw7Ul_LgNkk"

# 事件网关服务监听地址
[Gateway]
ListenAPI = ["/ip4/127.0.0.1/tcp/45132"]
Token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiY2hhaW4tc2VydmljZSIsInBlcm0iOiJhZG1pbiIsImV4dCI6IiJ9.DxlsJO-XrrdQLvJdA6wdWJxeYOhZt_kMYMHc7NdfQNw"
ListenAPI = ["/ip4/0.0.0.0/tcp/4569"]
# [Gateway],[Auth],[FullNode] 是同一个token
Token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiZWx2aW4iLCJwZXJtIjoiYWRtaW4iLCJleHQiOiIifQ.y2vEhxUd2Q9N6kYKe1nsKA4Xelam_ZIVRw7Ul_LgNkk"

# 矿工管理服务监听地址
[Auth]
Addr = "http://127.0.0.1:8989"
Token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiY2hhaW4tc2VydmljZSIsInBlcm0iOiJhZG1pbiIsImV4dCI6IiJ9.DxlsJO-XrrdQLvJdA6wdWJxeYOhZt_kMYMHc7NdfQNw"
Addr = "127.0.0.1:8989"
# [Gateway],[Auth],[FullNode] 是同一个token
Token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiZWx2aW4iLCJwZXJtIjoiYWRtaW4iLCJleHQiOiIifQ.y2vEhxUd2Q9N6kYKe1nsKA4Xelam_ZIVRw7Ul_LgNkk"

# `slash filter` 模块区块存取方式
[SlashFilter]
Type = "local"
[SlashFilter.MySQL]
Conn = ""
MaxOpenConn = 100
MaxIdleConn = 10
ConnMaxLifeTime = 60
ConnMaxLifeTime = "1m0s"
Debug = false

# Jaeger Tracing 服务信息,默认不启用
[Tracing]
JaegerTracingEnabled = false
JaegerEndpoint = "localhost:6831"
ProbabilitySampler = 1.0
ServerName = "sophon-miner"
```

### `Metrics` 配置项解析
JaegerEndpoint = "localhost:6831"
ServerName = ""

`Metrics` 一份基本的配置样例如下:
```toml
[Metrics]
# 是否开启metrics指标统计,默认为false
Enabled = false
Expand Down Expand Up @@ -176,3 +122,50 @@ SubmitNodes = []
Addr = "/ip4/192.168.200.107/tcp/3453"
Token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiY2hhaW4tc2VydmljZSIsInBlcm0iOiJhZG1pbiIsImV4dCI6IiJ9.DxlsJO-XrrdQLvJdA6wdWJxeYOhZt_kMYMHc7NdfQNw"
```

## 旧版本

旧版本指的是版本号 `< v1.7.0` 的版本

```toml
# 链服务监听地址
ListenAPI = "/ip4/127.0.0.1/tcp/3453"
Token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiYWRtaW4iLCJwZXJtIjoiYWRtaW4iLCJleHQiOiIifQ.RRSdeQ-c1Ei-8roAj-L-wpOr-y6PssDorbGijMPxjoc"
# 生产的区块记录方式,已废弃,由 `slash filter` 取代
BlockRecord = "cache"

# `sophon-miner` 服务监听地址
[API]
ListenAddress = "/ip4/0.0.0.0/tcp/12308/http"
RemoteListenAddress = ""
Timeout = "30s"

# 事件网关服务监听地址
[Gateway]
ListenAPI = ["/ip4/127.0.0.1/tcp/45132"]
Token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiYWRtaW4iLCJwZXJtIjoiYWRtaW4iLCJleHQiOiIifQ.RRSdeQ-c1Ei-8roAj-L-wpOr-y6PssDorbGijMPxjoc"

# 数据库信息
[Db]
# 矿工管理方式,已废弃,从 `sophon-auth` 获取
Type = "auth"
# `slash filter` 模块区块存取方式
SFType = "mysql"
[Db.MySQL]
Conn = "root:kuangfengjuexizhan@tcp(192.168.200.2:3308)/sophon-miner-butterfly-200-19?charset=utf8mb4&parseTime=True&loc=Local&timeout=10s"
MaxOpenConn = 100
MaxIdleConn = 10
ConnMaxLifeTime = 60
Debug = false
[Db.Auth]
ListenAPI = "http://127.0.0.1:8989"
Token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiYWRtaW4iLCJwZXJtIjoiYWRtaW4iLCJleHQiOiIifQ.RRSdeQ-c1Ei-8roAj-L-wpOr-y6PssDorbGijMPxjoc"

# Jaeger Tracing 服务信息,默认不启用
[Tracing]
JaegerTracingEnabled = false
JaegerEndpoint = "localhost:6831"
ProbabilitySampler = 1.0
ServerName = "sophon-miner"
```

7 changes: 5 additions & 2 deletions docs/zh/getting-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

## 实例初始化

初始化 `Repo`
### 初始化 `Repo`

**注意⚠️**
1. `init` 命令会连接 `--api`flag 指定的链节点,所以必须先启动链节点,才能初始化成功。

`< v1.7.0` 版本:
```shell script
Expand All @@ -26,7 +29,7 @@ $ ./sophon-miner init
--slash-filter local
```

启动 `sophon-miner`
### 启动 `sophon-miner`

```shell script
$ nohup ./sophon-miner run > miner.log 2>&1 &
Expand Down