美文网首页
使用docker运行status节点

使用docker运行status节点

作者: tyb_bot | 来源:发表于2019-02-15 21:09 被阅读146次
    配置要求
    • 内存>=1GB
    • CPU>=1核
    • 硬盘空间
      如果开启-mailserver选项,文档中描述的是一个月大约消耗600MB的空间;如果不开启-mailserver选项则无此消耗,节点将仅用作Whisper消息服务器
    • 操作系统
      只要可以运行docker理论上应该都可以,注:此文以linux系统为例

    关于如何安装docker,此处略过,具体步骤可参见docker官网

    运行节点
    1. 创建http-enabled.json文件
      echo '{ "HTTPEnabled": true, "HTTPHost": "0.0.0.0", "APIModules": "admin,debug" }' > http-enabled.json
    2. 拉取并启动status节点docker镜像
        docker run \
        -p 8545:8545 \
        -p 30303:30303 \
        -v $(pwd)/http-enabled.json:/config/config.json \
        statusteam/status-go \
        -register \
        -mailserver \
        -log DEBUG \
        -c /config/config.json 
    

    校验节点是否运行正常

    执行如下命令:

    curl -X POST \
        -H "Content-Type: application/json" \
        -d '{"jsonrpc":"2.0","method":"admin_peers","params":[],"id":1}' \
        localhost:8545
    

    ,正常的话你将看到类似如下响应:

    {"jsonrpc":"2.0","id":1,"result":[{"enode":"enode://a80eb084f6bf3f98bf6a492fd6ba3db636986b17643695f67f543115d93d69920fb72e349e0c617a01544764f09375bb85f452b9c750a892d01d0e627d9c251e@47.89.16.125:30305?discport=0","id":"36f613e54cb8412a1830fffd5c0b4099b1b9c107d6ab7104a27367b29fd5178b","name":"Statusd/vdeploy-staging/linux-amd64/go1.10.8","caps":["shh/6"],"network":{"localAddress":"172.17.0.2:56732","remoteAddress":"47.89.16.125:30305","inbound":false,"trusted":false,"static":true},"protocols":{"shh":"unknown"}},{"enode":"enode://960777f01b7dcda7c58319e3aded317a127f686631b1702a7168ad408b8f8b7616272d805ddfab7a5a6bc4bd07ae92c03e23b4b8cd4bf858d0f74d563ec76c9f@47.52.58.213:30305","id":"781b904d6468f2c996ed15d4a16a7b7d248e995b03e6b98bdd4fb62a444ec8a0","name":"Statusd/vdeploy-staging/linux-amd64/go1.10.8","caps":["shh/6"],"network":{"localAddress":"172.17.0.2:41148","remoteAddress":"47.52.58.213:30305","inbound":false,"trusted":false,"static":true},"protocols":{"shh":"unknown"}},{"enode":"enode://7c80e37f324bbc767d890e6381854ef9985d33940285413311e8b5927bf47702afa40cd5d34be9aa6183ac467009b9545e24b0d0bc54ef2b773547bb8c274192@47.91.155.62:30305?discport=0","id":"84d828cecc6d7fa6e4f831501e528f8593999d9972d4e5b46a22defb5fe554b2","name":"Statusd/vdeploy-staging/linux-amd64/go1.10.8","caps":["shh/6"],"network":{"localAddress":"172.17.0.2:39454","remoteAddress":"47.91.155.62:30305","inbound":false,"trusted":false,"static":true},"protocols":{"shh":"unknown"}}]}
    

    -mailserver选项

    打开-mailserver开关默认会加载如下配置:

    {
        "WhisperConfig": {
            "Enabled": true,
            "EnableNTPSync": true,
            "EnableMailServer": true,
            "MailServerPassword": "status-offline-inbox"
        }
    }
    

    其中的MailServerPassword正如其命名,是邮件服务器的密码,在后面会用到。


    status手机端app添加自定义邮件服务器

    以ios版本为例,邮件服务器的设置菜单路径:
    个人资料-->高级-->邮件服务器,点击右上角的加号+进行添加,名称自己随便定,其中邮件服务器地址格式模板为:enode://{enode-id}:{password}@{ip-address}:{port},这个地址在节点启动的时候会在日志中输出,例如其日志内容类似如下:

    INFO [02-15|09:20:35.006] UDP listener up                          net=enode://d848d1f3c12b07419860d7f9409c601c334ae6d9283f6395e050dc3a7a00e7e12d06d4fc54d1d47a407a92723cdab5d963959908a4922ff6e9f30118bc79b2a0@[::]:30303
    

    日志内容太多,可搜索关键字UDP listener up
    假设节点机器的ip为47.244.23.30,则对应的实际邮件地址我们应该填写为:enode://d848d1f3c12b07419860d7f9409c601c334ae6d9283f6395e050dc3a7a00e7e12d06d4fc54d1d47a407a92723cdab5d963959908a4922ff6e9f30118bc79b2a0:status-offline-inbox@47.244.23.30:30303
    注意:在选择使用自定义的邮件服务器后,app可能会要求你重新输入密码登录


    使用自建节点的好处
    • 连接更稳定;app默认提供的列表节点可能在国外,我这边的使用情况是经常提示Error connect to mail server...
    • 接收消息速度加快
    • 去中心化

    如果觉得这篇文章对你有用,欢迎使用snt打赏哦,本人的status联系地址:https://get.status.im/user/0x04fc558da36a9b88eb208a31f94729a9d0494e86deebde69503809084ef14eecc83bd2cab4cceaa93def8f6e9021ca7f1eb507ab3d47dd18661b8614d967b40e77


    参考资料:https://status.im/docs/run_status_node.html

    相关文章

      网友评论

          本文标题:使用docker运行status节点

          本文链接:https://www.haomeiwen.com/subject/rtfveqtx.html