How can I run 2 nodes in 1 Server?

Currently I am digging well with 1 node.

However, my server has a high specification, so I want to operate two nodes.

Here is my second Serverโ€™s docker-compose.yml.

#	Copyright(c) 2018 Gluwa, Inc.
#
#	This file is part of Creditcoin.
#
#	Creditcoin is free software: you can redistribute it and/or modify
#	it under the terms of the GNU Lesser General Public License as published by
#	the Free Software Foundation, either version 3 of the License, or
#	(at your option) any later version.
#	
#	This program is distributed in the hope that it will be useful,
#	but WITHOUT ANY WARRANTY; without even the implied warranty of
#	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#	GNU Lesser General Public License for more details.
#	
#	You should have received a copy of the GNU Lesser General Public License
#	along with Creditcoin. If not, see <https://www.gnu.org/licenses/>.

version: "3.7"

services:

  settings-tp2:
    image: hyperledger/sawtooth-settings-tp:1.2
    container_name: sawtooth-settings-tp-default2
    depends_on:
      - validator2
    entrypoint: settings-tp -C tcp://validator2:4005
    stop_signal: SIGKILL
    logging:
        driver: "json-file"
        options:
            max-file: "5"
            max-size: "10m"
    networks:
      - default2

  validator2:
    image: gluwa/creditcoin-validator:latest
    container_name: sawtooth-validator-default2
    volumes:
      - type: volume
        source: validator-block-volume2
        target: /var/lib/sawtooth/
      - type: volume
        source: validator-key-volume2
        target: /etc/sawtooth/keys/
    expose:
      - 4005
      - 8801
    ports:
      - 4005:4005
      - 8801:8801
    secrets:
     - source: validator_logging2
       target: /etc/sawtooth/log_config.toml
    entrypoint: |
        bash -c 'if [[ ! -f /etc/sawtooth/keys/validator.pub ]]
            then 
                echo "First run"
                sawadm keygen
            fi
            sawtooth-validator \
                --endpoint tcp://my-ip:8801 \
                --bind component:tcp://eth0:4005 \
                --bind network:tcp://eth0:8801 \
                --peering dynamic \
                --seeds tcp://node-000.creditcoin.org:8800 \
                --seeds tcp://node-001.creditcoin.org:8800 \
                --seeds tcp://node-002.creditcoin.org:8800 \
                --seeds tcp://node-003.creditcoin.org:8800 \
                --seeds tcp://creditcoin-node.gluwa.com:8800 \
                --seeds tcp://creditcoin-gateway.gluwa.com:8800 \
                --seeds tcp://118.27.14.197:8800 \
                --seeds tcp://118.27.20.120:8800 \
                --seeds tcp://160.251.9.11:8800 \
                --seeds tcp://160.251.9.75:8800 \
                --seeds tcp://160.251.10.137:8800 \
                --seeds tcp://160.251.13.5:8800 \
                --maximum-peer-connectivity 5 \
                --scheduler parallel'
    stop_signal: SIGKILL
    logging:
        driver: "json-file"
        options:
            max-file: "5"
            max-size: "100m"
    networks:
      - default2

  rest-api2:
    image: hyperledger/sawtooth-rest-api:1.2
    container_name: sawtooth-rest-api-default2
    ports:
      - 8809:8809
    secrets:
     - source: rest_api_logging2
       target: /etc/sawtooth/log_config.toml
    depends_on:
      - validator2
    entrypoint: sawtooth-rest-api -C tcp://validator2:4005 --bind rest-api2:8809
    stop_signal: SIGKILL
    logging:
        driver: "json-file"
        options:
            max-file: "5"
            max-size: "10m"
    networks:
      - default2

  processor2:
    image: gluwa/creditcoin-processor:latest
    container_name: creditcoin-processor2
    depends_on:
      - validator2
      - settings-tp2
      - rest-api2
    entrypoint: |
        bash -c 'rest_status=$$(curl -s --head -w %{http_code} http://rest-api2:8809/state?address=000000 -o /dev/null)
            while [ "$$rest_status" != "200" ]
            do
                echo $$rest_status
                sleep 2
                rest_status=$$(curl -s --head -w %{http_code} http://rest-api2:8809/state?address=000000 -o /dev/null)
            done
            ./ccprocessorLinux.out tcp://validator2:4005 tcp://gateway2:55556 http://rest-api2:8809'
    stop_signal: SIGKILL
    logging:
        driver: "json-file"
        options:
            max-file: "5"
            max-size: "10m"
    networks:
      - default2

  gateway2:
    image: gluwa/creditcoin-gateway:latest
    container_name: creditcoin-gateway2
    expose:
      - 55556
    ports:
      - 55556:55556
    secrets:
      - source: gateway_config2
        target: /home/Creditcoin/Gateway/appsettings.json
    entrypoint: ./ccgateway
    stop_signal: SIGKILL
    logging:
        driver: "json-file"
        options:
            max-file: "5"
            max-size: "10m"
    networks:
      - default2

secrets:
  gateway_config2:
    file: ./gatewayConfig.json
  rest_api_logging2:
    file: ./rest_api-log_config.toml
  validator_logging2:
    file: ./validator-log_config.toml

volumes:
  validator-block-volume2:
  validator-key-volume2:

networks:
  default2:
    driver: bridge

But, when I enter docker-compose up, there is something error about 503.

~/CreditcoinDocs-Mainnet2/Server# docker-compose up
WARNING: Found orphan containers (sawtooth-settings-tp-default, sawtooth-validator-default, creditcoin-processor, sawtooth-rest-api-default, creditcoin-gateway) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up.
Starting creditcoin-gateway2           ... done
Recreating sawtooth-validator-default2 ... done
Recreating sawtooth-settings-tp-default2 ... done
Recreating sawtooth-rest-api-default2    ... done
Recreating creditcoin-processor2         ... done
Attaching to creditcoin-gateway2, sawtooth-validator-default2, sawtooth-settings-tp-default2, sawtooth-rest-api-default2, creditcoin-processor2
sawtooth-validator-default2 | [2021-03-15 15:54:07.650 WARNING  cli] Network key pair is not configured, Network communications between validators will not be authenticated or encrypted.
sawtooth-validator-default2 | [2021-03-15 15:54:07.650 WARNING  cli] Network key pair is not configured, Network communications between validators will not be authenticated or encrypted.
creditcoin-processor2 | 503
creditcoin-processor2 | 503
creditcoin-processor2 | 503
creditcoin-processor2 | 503

503 means, there is no snapshot files. But I copied.

cp /var/lib/docker/volumes/server_validator-block-volume/_data/* /var/lib/docker/volumes/server_validator-block-volume2/_data

How can I solve this problem?

Hi, woosungchoi.

It seems that you are not using multi-core to mining.
How about multi-core mining using following script?
It will be better than multiple virtual nodes in my thought.

I donโ€™t know the reason of 503, but multiple virtual machines on single server is not described on manual. So I think that it is not recommended.

1 Like

Okay. I will try it. Thx.