-
Notifications
You must be signed in to change notification settings - Fork 30
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
Changes from all commits
4bb1f4c
a495e9d
bbb168d
bbda19f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
LOG_LEVEL ?= info | ||
DEFAULT_DATA_DIR ?= /data_dir | ||
DEFAULT_SIMFILE_PATH ?= /data_dir/sim.json | ||
|
||
build-docker: | ||
docker build -f docker/Dockerfile -t sim-ln . | ||
|
@@ -15,17 +17,18 @@ help: | |
@echo "stop Stops the Docker container." | ||
@echo "" | ||
@echo "Variables:" | ||
@echo "SIMFILE_PATH Path to the sim.json file." | ||
@echo "LOG_LEVEL Set the logging level (default: info) e.g. <make run LOG_LEVEL=debug>" | ||
@echo "HELP Set to true to print the help message (default: false) e.g. <make run HELP=true>" | ||
@echo "PRINT_BATCH_SIZE Set the batch size for printing the results e.g. <make run PRINT_BATCH_SIZE=100>" | ||
@echo "TOTAL_TIME Set the total time for the simulation e.g. <make run TOTAL_TIME=1000>" | ||
@echo "SIMFILE_PATH Path to the sim.json file." | ||
@echo "LOG_LEVEL Set the logging level (default: info) e.g. <make run LOG_LEVEL=debug>." | ||
@echo "HELP Set to true to print the help message (default: false) e.g. <make run HELP=true>." | ||
@echo "PRINT_BATCH_SIZE Set the batch size for printing the results e.g. <make run PRINT_BATCH_SIZE=100>." | ||
@echo "TOTAL_TIME Set the total time for the simulation e.g. <make run TOTAL_TIME=1000>." | ||
@echo "DATA_DIR Set the data directory for the simulation containing simulation files and results e.g. <make run-docker DATA_DIR="/Users/anon/data_dir>"." | ||
|
||
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 | ||
carlaKC marked this conversation as resolved.
Show resolved
Hide resolved
|
||
docker run -d --rm --name sim-ln --init -v simln-data:${DEFAULT_DATA_DIR} -e SIMFILE_PATH=${DEFAULT_SIMFILE_PATH} -e LOG_LEVEL=$(LOG_LEVEL) -e HELP=${HELP} -e PRINT_BATCH_SIZE=${PRINT_BATCH_SIZE} -e TOTAL_TIME=${TOTAL_TIME} sim-ln | ||
|
||
run-interactive: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmm... we should. I'll fix that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed here -> 85082b3 |
||
docker run --rm --name sim-ln --init -v simln-data:/data -e SIMFILE_PATH=/data/sim.json -it sim-ln | ||
docker run -it --rm --name sim-ln --init -v simln-data:${DEFAULT_DATA_DIR} -e SIMFILE_PATH=${DEFAULT_SIMFILE_PATH} -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 | ||
|
||
stop-docker: | ||
docker stop sim-ln |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't this only be passed now if There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
|
||
# Check if a custom data directory was provided | ||
if [[ ! -z ${DATA_DIR} ]]; then | ||
START_COMMAND="$START_COMMAND --data-dir $DATA_DIR" | ||
fi | ||
|
||
# Check for version arg | ||
if [[ ! -z ${VERSION} ]]; then | ||
|
There was a problem hiding this comment.
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.