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

Publish hotrod image to docker hub #702

Merged
merged 10 commits into from
Mar 21, 2018

Conversation

pavolloffay
Copy link
Member

Resolves #204

Signed-off-by: Pavol Loffay ploffay@redhat.com

.travis.yml Outdated
@@ -50,6 +53,7 @@ script:
- if [ "$CROSSDOCK" == true ]; then bash ./scripts/travis/build-crossdock.sh ; else echo 'skipping crossdock'; fi
- if [ "$DOCKER" == true ]; then bash ./scripts/travis/build-docker-images.sh ; else echo 'skipping docker images'; fi
- if [ "$ES_INTEGRATION_TEST" == true ]; then bash ./scripts/travis/es-integration-test.sh ; else echo 'skipping elastic search integration test'; fi
- if [ "$HOTROD" == true ]; then bash ./scripts/travis/es-integration-test.sh ; else echo 'skipping hotrod example'; fi
Copy link
Member

Choose a reason for hiding this comment

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

this is calling es-integration-test


.PHONE: docker-hotrod
docker-hotrod: build-examples
docker build -t $(DOCKER_NAMESPACE)/example-hotrod:${DOCKER_TAG} ./examples/hotrod
Copy link
Member Author

Choose a reason for hiding this comment

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

  • example-hotrod
  • hotrod-example
  • hotrod

Copy link
Member

Choose a reason for hiding this comment

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

I created example-hotrod repo on Hub

@@ -1,4 +1,4 @@
FROM scratch
EXPOSE 8080 8081 8082 8083
COPY hotrod-linux /
CMD ["./hotrod-linux", "all"]
COPY hotrod-linux /go/bin/
Copy link
Member Author

Choose a reason for hiding this comment

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

changing this to align with other images

go get github.com/jaegertracing/jaeger
cd $GOPATH/src/github.com/jaegertracing/jaeger
make install
cd examples/hotrod
go run ./main.go all
```

### Run HotROD from docker
```bash
docker run --rm -it --link jaeger -p8080:8080 jaegertracing/example-hotrod:latest /go/bin/hotrod-linux all --jaeger-agent.host-port=jaeger:6831
Copy link
Member Author

Choose a reason for hiding this comment

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

if we use entrypoint then this would look like docker run --rm -it --link jaeger -p8080:8080 jaegertracing/example-hotrod:latest --jaeger-agent.host-port=jaeger:6831

@yurishkuro
Copy link
Member

unit tests failed twice in the same spot

go test -coverprofile .cover/cover.72.out -v -race github.com/jaegertracing/jaeger/plugin/storage
=== RUN   TestFactoryConfigFromEnv
--- PASS: TestFactoryConfigFromEnv (0.00s)
=== RUN   TestFactoryConfigFromEnvDeprecated
--- PASS: TestFactoryConfigFromEnvDeprecated (0.00s)
=== RUN   TestNewFactory
--- FAIL: TestNewFactory (0.00s)
	<autogenerated>:1: 
			Error Trace:	factory_test.go:59
			Error:      	Should NOT be empty, but was &{<nil> <nil> <nil>}
			Test:       	TestNewFactory

@pavolloffay
Copy link
Member Author

pavolloffay commented Feb 21, 2018

This failure is not related to this PR, I get it on master locally.

EDIT: there has been a change in testify and NotEmpty fails if struct contains only nil references.

@coveralls
Copy link

coveralls commented Feb 21, 2018

Coverage Status

Coverage remained the same at 100.0% when pulling 83b7c23 on pavolloffay:publish-hotrod into ff666cd on jaegertracing:master.

go get github.com/jaegertracing/jaeger
cd $GOPATH/src/github.com/jaegertracing/jaeger
make install
cd examples/hotrod
go run ./main.go all
```

### Run HotROD from docker
```bash
docker run --rm -it --link jaeger -p8080-8083:8080-8083 jaegertracing/example-hotrod:latest /go/bin/hotrod-linux all --jaeger-agent.host-port=jaeger:6831
Copy link
Member

Choose a reason for hiding this comment

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

can we use syntax with ENV var? I think it will make the command less intimidating.

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, I think there are two variants:

  • use viper to configure this
  • define env var in dockerfile and pass it to this flag (defaults to localhost) - only for agent host port as it will be used the most

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think we need viper in hotrod it will complicate code. I will add env var

@@ -60,7 +60,12 @@ func (s *Server) createServeMux() http.Handler {

func (s *Server) home(w http.ResponseWriter, r *http.Request) {
s.logger.For(r.Context()).Info("HTTP", zap.String("method", r.Method), zap.Stringer("url", r.URL))
http.ServeFile(w, r, "services/frontend/web_assets/index.html")
b, err := assetFS().Asset("web_assets/index.html")
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 be loaded once in the constructor?

export CID=$(docker run -d -p 8080:8080 $REPO:latest)
body=$(curl localhost:8080)
if [[ $body != *"Rides On Demand"* ]]; then
exit 1
Copy link
Member

Choose a reason for hiding this comment

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

should log something to explain why it's failing

@yurishkuro
Copy link
Member

EDIT: there has been a change in testify and NotEmpty fails if struct contains only nil references.

We should upgrade testify (and also use a semver instead of head) in a separate PR and fix the test, so that this PR is clean.

Signed-off-by: Pavol Loffay <ploffay@redhat.com>
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
@pavolloffay
Copy link
Member Author

@yurishkuro regarding #702 (comment)

can we use syntax with ENV var? I think it will make the command less intimidating.

We have two options: use viper which will complicate code or use env var in dockerfile like:

FROM alpine
ENV JAEGER_AGENT_HOST_PORT localhost:6831
EXPOSE 8080 8081 8082 8083
COPY hotrod-linux /go/bin/
CMD /go/bin/hotrod-linux all --jaeger-agent.host-port ${JAEGER_AGENT_HOST_PORT}

It will use shell cmd command, instead of exec. Or other solution is to use

FROM scratch
EXPOSE 8080 8081 8082 8083
COPY hotrod-linux /go/bin/
ENTRYPOINT ["/go/bin/hotrod-linux", "all"]

and it will be used as docker run jaegertracing/hotrod --jaeger-agent.host-port host:port

Signed-off-by: Pavol Loffay <ploffay@redhat.com>
Makefile Outdated
build-examples:
go build -o ./examples/hotrod/hotrod-demo ./examples/hotrod/main.go
build-examples: install-go-bindata
cd ./examples/hotrod/services/frontend/ && go-bindata-assetfs -pkg frontend web_assets/... && cd -
Copy link
Member

Choose a reason for hiding this comment

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

not sure if it works in make, but using parens (cd x && cmd) automatically scopes the execution making cd - unnecessary

@pavolloffay
Copy link
Member Author

@yurishkuro what about my comment regarding env #702 (comment).

I like more the second approach with entrypoint. I think nobody will use hotrod with other than all command

@yurishkuro
Copy link
Member

yes I like the second option better

Signed-off-by: Pavol Loffay <ploffay@redhat.com>
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
@pavolloffay
Copy link
Member Author

All passing ready for the final review/merge

Copy link
Member

@yurishkuro yurishkuro left a comment

Choose a reason for hiding this comment

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

just one question before we merge - what's the reason for having a separate matrix entry for hotrod (and all-in-one, for that matter) instead of uploading all docker images from the DOCKER=true entry? Each entry makes the build longer since we have limited number of workers and travis initialization takes a few minutes.

@pavolloffay
Copy link
Member Author

To test it if it works. We could refactor it in #707.

I will merge it now. We can always remove it.

@pavolloffay pavolloffay merged commit 30d3e18 into jaegertracing:master Mar 21, 2018
@ghost ghost removed the review label Mar 21, 2018
@pavelnikolov
Copy link

Thank you for fixing this! I'll update the Kubernetes Chart to use the official hotrod Docker image.

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.

4 participants