TrueBlocks / trueblocks-docker

GNU General Public License v3.0
39 stars 16 forks source link

Suggest using network_mode: "host" for nodes not running in a container #381

Closed CyMule closed 1 year ago

CyMule commented 1 year ago

Users may want to use network_mode: "host" if they are running their node software directly on their host and not in a container.

docker-compose.yml would look like this:

name: TrueBlocksCore

services:
  core:
    image: trueblocks/core:v0.50.0-beta
    build: ./
    env_file: .env
    ports:
      - "8080:${SERVE_PORT-8080}"
    volumes:
      - unchained:/unchained
      - cache:/cache
     network_mode: "host"
volumes:
  unchained:
  cache:

This would be required in the case where the .env is using an RPC like: TB_CHAINS_MAINNET_RPCPROVIDER=http://localhost:8545 where localhost is intended to target the actual host machine and NOT internal to the container.

I will make a pull request after looking more into other potential options if there are any, and after I think about where this should be explained.

It could be within the docker-compose.yml and commented out with a comment like "Uncomment this if you want the container to share the same network as your host machine", explained in a FAQ, or maybe be an additional config option with an override.

tjayrush commented 1 year ago

My preference would be either explanatory text in the README or, as you suggest, a commented-out section in the .yml file with explanatory text there.

I'm not a huge fan of too many configurable options.

It gets too confusing (even for me), and someone who's knowledgable enough to even know what it means, can edit the .yml.

tjayrush commented 1 year ago

Fixed