Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 372
Tomás E. Losada Avatar asked Sep 08 '21 18:09

Tomás E. Losada


People also ask

Do you need Dockerfile and Docker compose?

Both the Dockerfile and docker-compose are important resources in the development and deployment of cloud-native applications. But knowing the difference between docker-compose and the Dockerfile is important. The Dockerfile is used to build images, while docker-compose helps you run them as containers.

What is a Docker compose?

Docker Compose is a tool that was developed to help define and share multi-container applications. With Compose, we can create a YAML file to define the services and with a single command, can spin everything up or tear it all down.

What is Docker used for?

Docker is an open platform for developing, shipping, and running applications. Docker enables you to separate your applications from your infrastructure so you can deliver software quickly. With Docker, you can manage your infrastructure in the same ways you manage your applications.


Video Answer


1 Answers

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.

like image 143
Tomás E. Losada Avatar answered Oct 22 '22 12:10

Tomás E. Losada