docker部署区块链浏览器 explorer

下载explorer

# git clone https://github.com/ethereumclassic/explorer

docker-compose.yml

version: '3'
services:
  app:
    build: .
    command: ./app.js
    restart: always
    environment:
      MONGO_URI: 'mongodb://db/explorerDB'
    ports:
      - '13000:3000'
    depends_on:
      - db
  sync:
    build: .
    command: ./tools/sync.js
    restart: always
    environment:
      MONGO_URI: 'mongodb://db/explorerDB'
    depends_on:
      - db
  stats:
    build: .
    command: ./tools/stats.js
    restart: always
    environment:
      MONGO_URI: 'mongodb://db/explorerDB'
    depends_on:
      - db
  #price:
  #  build: .
  #  command: ./tools/price.js
  #  restart: always
  #  environment:
  #    MONGO_URI: 'mongodb://db/explorerDB'
  #  depends_on:
  #    - db
  richlist:
    build: .
    command: ./tools/richlist.js
    restart: always
    environment:
      MONGO_URI: 'mongodb://db/explorerDB'
    depends_on:
      - db
  db:
    image: mongo:4.0.28
    restart: always

修改配置文件

config.json

# cp config.example.json config.json

package-lock.json 

"web3-providers-ws": {
      "version": "1.0.0-beta.37",
      "resolved": "https://registry.npmjs.org/web3-providers-ws/-/web3-providers-ws-1.0.0-beta.37.tgz",
      "integrity": "sha512-8p6ZLv+1JYa5Vs8oBn33Nn3VGFBbF+wVfO+b78RJS1Qf1uIOzjFVDk3XwYDD7rlz9G5BKpxhaQw+6EGQ7L02aw==",
      "requires": {
        "underscore": "1.8.3",
        "web3-core-helpers": "1.0.0-beta.37",
        "websocket": "https://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2"     # git 修改为https
      },
      "dependencies": {
        "websocket": {
          "version": "https://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2",   # git 修改为https
          "from": "https://github.com/frozeman/WebSocket-Node.git#browserifyCompatible",                          # git 修改为https
          "requires": {
            "debug": "^2.2.0",
            "nan": "^2.3.3",
            "typedarray-to-buffer": "^3.1.2",
            "yaeti": "^0.0.6"
          }
        }
      }
    }

db.js

mongoose.connect(process.env.MONGO_URI || 'mongodb://db/explorerDB', {       # localhost 修改为db
  useMongoClient: true
  // poolSize: 5,
  // rs_name: 'myReplicaSetName',
  // user: 'explorer',
  // pass: 'yourdbpasscode'
});

运行explorer

# docker-compose up -d

访问浏览器

 

参考文档

https://github.com/ethereumclassic/explorer

posted @ 2023-03-08 17:17  小吉猫  阅读(136)  评论(0编辑  收藏  举报