-
Notifications
You must be signed in to change notification settings - Fork 191
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
Add docker image, devcontainer, and editorconfig support #151
Conversation
For more easily portable development, including Github CodeSpaces support
@bpkroth Is it common practice to put the Dockerfile in the root dir? I just don't know what people normally do. |
It depends. It is possible to hide it inside the Maintainers choice I would say. This is just a convenience feature that I added locally for myself while I was working on #147. Figured it might be nice for others as well. |
One other comment: since this was just meant for local dev purposes, it doesn't copy the source files into the container image (instead relies on the UPDATE: added this too now. May help for distributing basebench as a docker image for automated testing. |
to also support deploying and running a built copy, not just for local devcontainer purposes most things are controllable via environment variables - BENCHBASE_PROFILES (full image build) - BENCHBASE_PROFILE (which profile to run)
Very interested in this PR (especially with the deployable image, which will simplify using benchbase to run experiments on the cloud), thanks! It might be outside the scope of this PR but would be good to take in options to override the config file URLs, port, and passwords. I suspect if the image is used in deployment these need to be configurable too. |
I agree CLI options to adjust the configs seems somewhat nice, but wasn't something I wanted to tackle here. As a workaround for now, you can do something like this to map the configfile from the host into the container: docker run -v $PWD/configs/myconfig.xml:/benchbase/configs/myconfig.xml benchbase -c /benchbase/configs/myconfig.xml ... Alternatively, what you suggest about using environment variables to pass in basic connection info and then rewrite a config template before executing the jar could work, but I suspect becomes complex as well. For instance: docker run --env BENCHBASE_PROFILE=postgres --env CONNECT_URL=jdbc:postgres://.... benchbase -b tpcc # -c omitted intentionally Could then use the Anyways, happy to hear actual maintainer thoughts about this, but I do agree that having deployable docker support would be very useful for scaling automated benchmarks on various platforms (e.g. k8s, Azure Batch, etc.). |
Adds addition targets for the Dockerfile to allow reusing the compiled sources for running the tests vs. cleaning it for fullimage usage.
…thub actions runner uid/gid
this avoids having to publish the docker image somewhere for a downstream job to use however, it requires use to manually lookup the docker network that the test database service was setup with to connect the container to we also have to dynamically rewrite the sample config to connect with a name instead of localhost since the benchmark is running inside a separate container
Spent some time to get the docker image testing into the CI pipelines. |
@timveil Can you review this? |
Yes will do! |
Any updates on this? |
Let me review this asap! Thank you for the reminder. |
@bpkroth Can you resolve the conflicts? And then I will try to review this so we can merge. |
Just did. Will see if it needs any CI adjustments after the other recent changes shortly. Thanks! |
&& rm -rf /benchbase/.git /benchbase/target /benchbase/pom.xml | ||
|
||
# Add an additional layer that also includes a built copy of the source. | ||
FROM devcontainer AS fullimage |
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.
FWIW, this is useful for deploying the image as benchmarking agent in k8s, Azure Batch, etc.
However, it probably doesn't need a full JDK at that point.
One can save a little bit of space by removing the /benchbase/src
tree and the openssh-client
(and apt autoremove
ing to get rid of the dependencies), but the real wins are in having the fullimage use the JRE instead of the JDK.
I'm gonna call that future improvements for now though.
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.
LGTM
Here's a simple PR to add support for developing inside a container either with VSCode or Github Codespaces.
This makes it a little quicker/easier to get all the necessary dependencies for building the project without bloating the rest of the dev environment.
It also adds very basic EditorConfig support for setting very basic editor tweaks for the repo's coding style (I tried to make them match the existing styles).
Update: also adds support for building a benchbase docker image that can be used for easy deployment for distributed benchmarking and some pipeline test cases for building it.
This does not yet handle publishing the image to a known container image repository for
docker pull
support yet though.