超级账本锯齿+ Docker

时间:2020-04-30 14:57:23

标签: python docker docker-compose hyperledger-sawtooth

我对Docker相对较新 我使用Hyperledger Sawtooth和Docker Compose制作了原型 我已经预定义了container_name并将其添加到docker-compose.yml文件中 但是,某些容器可以像PostgreSQL工作实例,外壳程序和自定义验证器那样平稳运行,但是API,TP(事务处理器)和订户正在返回从Bash找不到的命令,或者没有返回这样的文件或目录。 我尝试修剪图像,然后在另一个图像中运行它,这不是防火墙或代理问题。 然后我三重检查了文件的结尾和路径。 我正在以PoET共识运行Sawtooth Python SDK。 我正在运行Windows 10 Pro和最新的Docker版本。后端使用Python,前端使用webpack和mithril.js,尽管它们已成功构建。 在此先感谢您,如果问题有点奇怪,对不起,我仍然是Docker的新手。


version: '2.1'

services:

  wen-rayih-shell:
    build:
      context: .
      dockerfile: ./shell/Dockerfile
    image: sawtooth-wen-rayih-shell
    container_name: wen-rayih-shell
    volumes:
      - .:/project/sawtooth-wen-rayih
      - /project/sawtooth-wen-rayih/tracker_app/node_modules
    command: |
      bash -c "
        wen-rayih-protogen
        cd tracker_app/
        npm run build
        cd ../
        tail -f /dev/null
      "

  wen-rayih-tp:
    build:
        context: .
        dockerfile: ./processor/Dockerfile
    image: sawtooth-wen-rayih-tp
    container_name: wen-rayih-tp
    volumes:
      - '.:/project/sawtooth-wen-rayih'
    depends_on:
      - wen-rayih-shell
    command: |
      bash -c "
        sleep 1
        wen-rayih-tp -v -C tcp://validator:4004
      "

  wen-rayih-rest-api:
    build:
      context: .
      dockerfile: ./rest_api/Dockerfile
    image: wen-rayih-rest-api
    container_name: wen-rayih-rest-api
    volumes:
      - .:/project/sawtooth-wen-rayih
    ports:
      - '8000:8000'
    depends_on:
      - wen-rayih-shell
    command: |
      bash -c "
        wen-rayih-rest-api \
          -B wen-rayih-rest-api:8000 \
          -C validator:4004 \
          --db-host postgres \
          -vv
      "

  wen-rayih-subscriber:
    build:
      context: .
      dockerfile: ./subscriber/Dockerfile
    image: sawtooth-wen-rayih-subscriber
    container_name: wen-rayih-subscriber
    volumes:
      - '.:/project/sawtooth-wen-rayih'
    depends_on:
      - wen-rayih-shell
      - postgres
    command: |
      bash -c "
        wen-rayih-subscriber init \
          --db-host postgres \
          -vv
        sleep 3
        wen-rayih-subscriber subscribe \
          --db-host postgres \
          -C tcp://validator:4004 \
          -vv
      "

  settings-tp:
    image: hyperledger/sawtooth-settings-tp:1.2
    container_name: sawtooth-settings-tp
    depends_on:
      - validator
    entrypoint: settings-tp -vv -C tcp://validator:4004

  rest-api:
    image: hyperledger/sawtooth-rest-api:1.2
    container_name: sawtooth-rest-api
    expose:
      - 8008
    ports:
      - '8008:8008'
    depends_on:
      - validator
    entrypoint: sawtooth-rest-api -vv -C tcp://validator:4004 --bind rest-api:8008

  validator:
    image: hyperledger/sawtooth-validator:1.2
    container_name: sawtooth-validator
    expose:
      - 4004
    ports:
      - '4004:4004'
    command: |
      bash -c "
        if [ ! -f /etc/sawtooth/keys/validator.priv ]; then
          sawadm keygen
          sawtooth keygen my_key
          sawset genesis -k /root/.sawtooth/keys/my_key.priv
          sawset proposal create -k /root/.sawtooth/keys/my_key.priv \
            sawtooth.consensus.algorithm.name=Devmode \
            sawtooth.consensus.algorithm.version=0.1 \
            -o config.batch
          sawadm genesis config-genesis.batch config.batch
        fi;
        sawtooth-validator -vv \
          --endpoint tcp://validator:8800 \
          --bind component:tcp://eth0:4004 \
          --bind network:tcp://eth0:8800 \
          --bind consensus:tcp://eth0:5050
      "

  devmode-engine:
    image: hyperledger/sawtooth-devmode-engine-rust:1.2
    expose:
      - 5050
    ports:
      - '5050:5050'
    container_name: sawtooth-devmode-engine-rust-default
    depends_on:
      - validator
    entrypoint: devmode-engine-rust --connect tcp://validator:5050

  postgres:
    image: postgres:alpine
    container_name: wen-rayih-postgres
    restart: always
    environment:
      POSTGRES_USER: sawtooth
      POSTGRES_PASSWORD: sawtooth
      POSTGRES_DB: wen-rayih
    ports:
      - '5432:5432'

  adminer:
    image: adminer
    container_name: wen-rayih-adminer
    restart: always
    ports:
      - '8080:8080'

  tracker-app:
    build: ./tracker_app
    image: wen-rayih-tracker-app
    container_name: tracker-app
    volumes:
      - ./tracker_app/public/:/usr/local/apache2/htdocs/
    expose:
      - 80
    ports:
      - '8040:80'
    depends_on:
      - wen-rayih-shell
      - wen-rayih-rest-api

0 个答案:

没有答案