TrueBlocks / trueblocks-docker

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

Add clarity to the build instructions #362

Closed CyMule closed 1 year ago

CyMule commented 2 years ago

I walked through the building of the container, and I had a few suggestions for changes that could make on-boarding easier for new users.

Potential Changes / Additions

Volume Flag

In order to use the, --mount flag, users need to run the following commands first. sudo mkdir -p /Volumes/IndexCache/trueblocks/unchained sudo mkdir -p /Volumes/IndexCache/trueblocks/cache This could be added to the directions before the build, or the -v volume flag could be used to automatically create the directory. This would make the run command look like this:

docker run \
  --name trueblocks-core \
  --env-file ./.env \
  --publish 8080:8080 \
  -v /Volumes/IndexCache/trueblocks/cache:/cache \
  -v /Volumes/IndexCache/trueblocks/unchained:/index \
  trueblocks-core:latest

Documentation on differences between flags:

If you use -v or --volume to bind-mount a file or directory that does not yet exist on the Docker host, -v will create the endpoint for you. It is always created as a directory. If you use --mount to bind-mount a file or directory that does not yet exist on the Docker host, Docker does not automatically create it for you, but generates an error.

.ENV

Another step could be added to suggest copying env.example. Right now if you clone, build, and try to run you will get an error saying:

docker: open ./.env: no such file or directory.

Adding a step suggesting cp env.example .env might reduce friction.

FAQ?

I'm not sure exactly where this could be added. Maybe a FAQ? A quick note suggesting the use of docker rm trueblocks-core to remove the container after stopping it if you need to restart it. Without removing the container you get a message like:

docker: Error response from daemon: Conflict. The container name "/trueblocks-core" is already in use by container "90db71ed2c0926b113f8a770380e260235ab769b39330d264d4b1bbe1a7cc295". You have to remove (or rename) that container to be able to reuse that name.
See 'docker run --help'.

This is obvious if you have used docker enough, but could be useful to add if there are other FAQs.

tjayrush commented 2 years ago

These are great. Can you please go ahead and make PRs (maybe one per suggestion above to make it easier for me to merge).

tjayrush commented 2 years ago

@dszlachta If you have any thoughts on these suggestions, please chime in. If not, no problem.

dszlachta commented 2 years ago

Looks great, thanks @CyMule. One thing that I'd add is to replace /Volumes/IndexCache/trueblocks/* paths with something more descriptive, like /path/to/your/index. These are example values so people will want to change them. Regarding .env - good catch. I think we can just copy section on it from develop