Tomás E. Losada
Tomás E. Losada

Reputation: 135

Is there a docker-compose for dockerized RSK node?

I need a docker-compose YAML file for the dockerized version of RSK node (see here).

It needs to have a volume for the config file and another for the DB.

Upvotes: 7

Views: 106

Answers (1)

Tomás E. Losada
Tomás E. Losada

Reputation: 135

Here it is (example for RSK Testnet Docker):

version: "3"
services:
  rsk-testnet:
    image: testnet:latest
    build:
        context: .
        dockerfile: Dockerfile.Testnet
    restart: always
    volumes:
      - rsk_db:/var/lib/rsk/database
      - rsk_cfg:/etc/rsk
    ports:
      - 4444:4444
      - 50505:50505

volumes:
    rsk_db:
        driver: local
        driver_opts:
            o: bind
            type: none
            device: /rsk/database
    rsk_cfg:
        driver: local
        driver_opts:
            o: bind
            type: none
            device: /rsk/conf

A second aproach will be the following: Maybe, it is better to create a separate volume for the data and not share it with the host. Because of speed.

version: "3.8"
services:

  mainnet:
    build: ./docker/rsk
    container_name: rsk-node-mainnet
    entrypoint: "/usr/bin/java -Dlogback.configurationFile='/etc/rsk/logback.xml' -Drsk.conf.file=/etc/rsk/node.conf -cp /usr/share/rsk/rsk.jar co.rsk.Start > /dev/null 2>&1 &"
    volumes:
      - rsk-node-storage:/data
    #  - ./import:/import
    restart: unless-stopped
    networks:
      - rsk-node-mainnet-network
    ports:
      - '4444:4444'
      - '4445:4445'
      
volumes:
  rsk-node-storage:
    external: true

networks:
  rsk-node-mainnet-network:
    external: true
    name: rsk-node-mainnet-network

And to node.conf:

database.dir = /data/database/mainnet

Probably to be correct, you should copy your own node.conf in dockerfile. Or change the entrypoint parameters and insert node.conf from the host.

Upvotes: 5

Related Questions