TrueBlocks / trueblocks-docker

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

Describe BOTH methods of starting the container in the README #379

Closed CyMule closed 1 year ago

CyMule commented 1 year ago

Suggestion

Describe BOTH methods of starting the container in the README.

Reasoning

Its nice to have options, and I wasn't initially familiar with the docker compose -f docker-compose.yml -f docker-compose.local.yml up syntax. I've used docker compose up many times, but I had to do a quick google to understand the override syntax.

Method 1

docker compose up

In the current configuration, docker compose up works and it uses named volumes: docker-compose.yml

...
    volumes:
      - unchained:/unchained
      - cache:/cache
volumes:
  unchained:
  cache:

Method 2

The second method is docker compose -f docker-compose.yml -f docker-compose.local.yml up which is what is currently described in the README.

This mounts folders from the host machine into the container.

Questions

Is method 2 the preferred method for starting the container? As in do you prefer having the ability to access the folders on the host machine?

If so we could reverse the configuration so that the default start command would be docker compose up and then if you wanted named volumes INSTEAD of the mounted folders you would use the longer command docker compose -f docker-compose.yml -f docker-compose.local.yml up .

This would then require swapping the volume parts of the two file so docker-compose.yml would be:

name: TrueBlocksCore

services:
  core:
    image: trueblocks/core:v0.50.0-beta
    build: ./
    env_file: .env
    ports:
      - "8080:${SERVE_PORT-8080}"
    volumes:
      - type: bind
        source: /Users/user/Data/cache
        target: /cache
      - type: bind
        source: /Users/user/Data/unchained
        target: /unchained

and docker-compose.local.yml would be:

services:
  core:
    volumes:
      - unchained:/unchained
      - cache:/cache
volumes:
  unchained:
  cache:

Keeping the docker-compose.yml as is means that docker compose up works with no additional work. Using the mounted folders requires the user to create the folders prior as instructed which obviously isn't a huge step.

tjayrush commented 1 year ago

Is method 2 the preferred method for starting the container?

I think so (but I'm open to discussion). Reasons why:

On the upside of having it entirely inside the docker container:

tjayrush commented 1 year ago

If we do decide to suggest an alternative way to run the docker version, I would suggest we have a section in the README called something like "An Alternative Way to Start the Docker" This as opposed to trying to intertwine the instructions of the two methods in the same section, which I think will confuse both methods.

Plus having these two different modes in separate sections implicitly shows the user that one method is preferred.

CyMule commented 1 year ago

I also prefer method 2 (making the folders first) instead of using the docker volumes. This is partially based on the assumption that new users will start might start with the docker version and then transition to using chifra directly rather than through docker. The transition is easier with method 2.