-
Notifications
You must be signed in to change notification settings - Fork 5
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: introduce dockerfile to containerize VU #77
Conversation
d82c9f0
to
ee450f0
Compare
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.
Given that this is an open source project, one should be able to build it without private dependencies.
ee450f0
to
64a024b
Compare
Changes that's been made:
|
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 with a few thoughts
vervet-underground/lib/config.go
Outdated
@@ -0,0 +1,20 @@ | |||
package lib |
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.
Package names in Go should be more descriptive. I'd recommend putting this in a package config
instead that deals with all matters of VU config.
https://go.dev/blog/package-names for context.
Requires a correct SSH config set up that allows access to our private Github repositories: > docker build . -t vu Run: > docker run -p 8080:8080 vu
4504077
to
796540e
Compare
"vervet-underground/lib" | ||
) | ||
|
||
func Load(configPath string) (*lib.ServerConfig, error) { |
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.
godoc please, maybe something like
// Load reads the config file from configPath and returns it as a new ServerConfig instance.
ServerConfig
should also come over to config
. Ideally we should drop the lib
package in favor of meaningful package names. (If there is other stuff in lib
that isn't config-related, let's relocate those bits in followups.)
A comma-separated string in an env var for the list of services to scrape would probably suffice for the initial version of this. Later versions will do service discovery from k8s direct. So, we could get rid of the config file... I don't think we need to configure the bind host in a container either. Secrets I'd agree are best provided as env vars, unless they're large (like PEM-encoded private keys) in which case it makes more sense to mount them. Blending secrets with actual config in a monolithic JSON is an antipattern I think we can avoid here. We might need a config file for expressing more complex configuration if there's lots of nesting (like a |
Introduces a local dockerfile (multi-stage) that can be used to build and run a containerized version of VU (still simple).
Due to the container being built by docker, you'll have to share your private
ssh_key
in the image, or you won't have access to private/internal Snyk repositories.To try this out:
docker build . -t vu --build-arg github_user=Todai88 --build-arg ssh_key="$(cat ~/.ssh/id_rsa)"
docker run -p 8080:8080 -e host="0.0.0.0"
-p 8080:8080is used to bind port
8080on the host's network adapter to
8080on the running container.
e host="0.0.0.0is used to share the container's address with the network context that Docker runs on. If not provided, you will receive
empty response from server`. 馃憥