7

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.

bguiz
  • 27,371
  • 47
  • 154
  • 243
  • What's with the close votes I see on this? I view it as rather clear + specific, and the OP has self-answered to boot! My only suggestion for improvement here would perhaps to edit answers to put the 2 alternative `docker-compose.yml` files into a single answer. – bguiz Sep 09 '21 at 02:10

1 Answers1

5

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.