Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: issue with docker config and volume setup #159

Merged
merged 4 commits into from
Jan 26, 2024

Conversation

Extheoisah
Copy link
Contributor

  • modifies the volume setup script for sim.json config
  • adds --data-dir to CMD args (default is /data in volume)
  • fix entrypoint.sh script

@okjodom okjodom requested a review from sr-gi November 16, 2023 18:05
Copy link
Contributor

@carlaKC carlaKC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just some structural comments which I'd like to fix up since we need to wait for #132 anyway.

docker/setup-volume.sh Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
Copy link
Contributor

@carlaKC carlaKC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

verynice!

I'll test this out locally once #132 is done, then merge 🚀

Copy link
Member

@sr-gi sr-gi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me overall.

Some comments and nits inline.

@@ -15,14 +16,15 @@ help:
@echo "stop Stops the Docker container."
@echo ""
@echo "Variables:"
@echo "SIMFILE_PATH Path to the sim.json file."
@echo "SIMFILE_PATH Path to the sim.json file."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this line and the one for stop three lines above end with a ., while the rest do not.


run-docker:
docker run -d --rm --name sim-ln --init -v simln-data:/data -e SIMFILE_PATH=/data/sim.json -e LOG_LEVEL=$(LOG_LEVEL) -e HELP=${HELP} -e PRINT_BATCH_SIZE=${PRINT_BATCH_SIZE} -e TOTAL_TIME=${TOTAL_TIME} sim-ln
docker run -d --rm --name sim-ln --init -v simln-data:/data -e SIMFILE_PATH=/data/sim.json -e DATA_DIR=${DATA_DIR} -e LOG_LEVEL=$(LOG_LEVEL) -e HELP=${HELP} -e PRINT_BATCH_SIZE=${PRINT_BATCH_SIZE} -e TOTAL_TIME=${TOTAL_TIME} sim-ln

run-interactive:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't catch this when it was added, but I'm wondering now:

Don't we want to also pass the env variables when running interactively?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm... we should. I'll fix that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed here -> 85082b3

docker/README.md Outdated Show resolved Hide resolved
@@ -1,7 +1,12 @@
#!/bin/sh

# Define the start command
START_COMMAND="/usr/local/bin/sim-cli $SIMFILE_PATH"
START_COMMAND="/usr/local/bin/sim-cli --sim-file $SIMFILE_PATH"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this only be passed now if $SIMFILE_PATH is defined? If not passed, this will default to pick it from data_dir/sim.json

Copy link
Contributor Author

@Extheoisah Extheoisah Nov 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still need it because the cli looks for the config JSON in the root by default. whereas in docker, we're mounting a volume that hosts the JSON. So we need to point it to the docker volume where the sim.json is hosted and use that as a default if no SIMFILE_PATH is specified

Makefile Outdated

run-docker:
docker run -d --rm --name sim-ln --init -v simln-data:/data -e SIMFILE_PATH=/data/sim.json -e LOG_LEVEL=$(LOG_LEVEL) -e HELP=${HELP} -e PRINT_BATCH_SIZE=${PRINT_BATCH_SIZE} -e TOTAL_TIME=${TOTAL_TIME} sim-ln
docker run -d --rm --name sim-ln --init -v simln-data:/data -e SIMFILE_PATH=/data/sim.json -e DATA_DIR=${DATA_DIR} -e LOG_LEVEL=$(LOG_LEVEL) -e HELP=${HELP} -e PRINT_BATCH_SIZE=${PRINT_BATCH_SIZE} -e TOTAL_TIME=${TOTAL_TIME} sim-ln
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-e SIMFILE_PATH=/data/sim.json should be -e SIMFILE_PATH=${SIMFILE_PATH} now right? Given the parameter is not required anymore plus we want the user to be able to re-define the location if desired

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha. fixed.

@m3dwards
Copy link
Contributor

Looks straightforward enough.

utACK 85082b3

Copy link
Contributor

@carlaKC carlaKC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Came back to test and ran into issues with make docker build and make run-interactive, I think we've made some breaking changes since you last updated :')

docker run -it --rm --name sim-ln --init -v simln-data:/data_dir -e SIMFILE_PATH=/data_dir/sim.json -e DATA_DIR= -e LOG_LEVEL=info -e HELP= -e PRINT_BATCH_SIZE= -e TOTAL_TIME= sim-ln
error: unexpected argument '--sim-file' found

  tip: to pass '--sim-file' as a value, use '-- --sim-file'

Makefile Show resolved Hide resolved
@Extheoisah
Copy link
Contributor Author

Came back to test and ran into issues with make docker build and make run-interactive, I think we've made some breaking changes since you last updated :')

docker run -it --rm --name sim-ln --init -v simln-data:/data_dir -e SIMFILE_PATH=/data_dir/sim.json -e DATA_DIR= -e LOG_LEVEL=info -e HELP= -e PRINT_BATCH_SIZE= -e TOTAL_TIME= sim-ln
error: unexpected argument '--sim-file' found

  tip: to pass '--sim-file' as a value, use '-- --sim-file'

Hmm...maybe. I haven't run it since. I'll look into it

@Extheoisah
Copy link
Contributor Author

Came back to test and ran into issues with make docker build and make run-interactive, I think we've made some breaking changes since you last updated :')

docker run -it --rm --name sim-ln --init -v simln-data:/data_dir -e SIMFILE_PATH=/data_dir/sim.json -e DATA_DIR= -e LOG_LEVEL=info -e HELP= -e PRINT_BATCH_SIZE= -e TOTAL_TIME= sim-ln
error: unexpected argument '--sim-file' found

  tip: to pass '--sim-file' as a value, use '-- --sim-file'

@carlaKC So I tried running locally with the new changes and the only error I had was due to limitations in my docker disk size (not related to sim-ln) for which I added a small clean-up here -> bbda19f
I cleaned up previous sim-ln build images and volumes and created new ones and successfully ran make build docker and make run-interactive. Please clean up your docker setup and try again. If the issue continues, could you send a screenshot of the error?

Copy link
Contributor

@carlaKC carlaKC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK, I think I had some caching issues on my end. Thanks for the update!

@carlaKC carlaKC merged commit 71d3aa3 into bitcoin-dev-project:main Jan 26, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants