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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ matrix:
- go: 1.9
env:
- ES_INTEGRATION_TEST=true
- go: 1.9
env:
- HOTROD=true

services:
- docker
Expand Down Expand Up @@ -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/hotrod-integration-test.sh ; else echo 'skipping hotrod example'; fi

after_success:
- if [ "$COVERAGE" == true ]; then travis_retry goveralls -coverprofile=cover.out -service=travis-ci || true ; else echo 'skipping coverage'; fi
Expand Down
17 changes: 14 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,20 @@ install-glide:
install: install-glide
glide install

.PHONY: install-go-bindata
install-go-bindata:
go get github.com/jteeuwen/go-bindata/...
go get github.com/elazarl/go-bindata-assetfs/...

.PHONY: build-examples
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/...)
rm ./examples/hotrod/services/frontend/bindata.go
CGO_ENABLED=0 GOOS=linux installsuffix=cgo go build -o ./examples/hotrod/hotrod-linux ./examples/hotrod/main.go

.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


.PHONY: build_ui
build_ui:
Expand Down Expand Up @@ -177,7 +188,7 @@ docker-push:
if [ $$CONFIRM != "y" ] && [ $$CONFIRM != "Y" ]; then \
echo "Exiting." ; exit 1 ; \
fi
for component in agent cassandra-schema collector query ; do \
for component in agent cassandra-schema collector query example-hotrod; do \
docker push $(DOCKER_NAMESPACE)/jaeger-$$component ; \
done

Expand Down
2 changes: 1 addition & 1 deletion examples/hotrod/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
hotrod-demo
hotrod-linux
4 changes: 2 additions & 2 deletions examples/hotrod/Dockerfile
Original file line number Diff line number Diff line change
@@ -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

ENTRYPOINT ["/go/bin/hotrod-linux", "all"]
13 changes: 9 additions & 4 deletions examples/hotrod/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,27 @@ to view the traces. A tutorial / walkthough is available:

An all-in-one Jaeger backend is packaged as a Docker container with in-memory storage.

```
docker run -d -p6831:6831/udp -p16686:16686 jaegertracing/all-in-one:latest
```bash
docker run -d --name jaeger -p6831:6831/udp -p16686:16686 jaegertracing/all-in-one:latest
```

Jaeger UI can be accessed at http://localhost:16686.

### Run HotROD Application
### Run HotROD from source

```
```bash
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 --jaeger-agent.host-port=jaeger:6831
```

Then open http://127.0.0.1:8080


Expand Down
5 changes: 0 additions & 5 deletions examples/hotrod/create-image.sh

This file was deleted.

248 changes: 248 additions & 0 deletions examples/hotrod/services/frontend/bindata_assetfs.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion examples/hotrod/services/frontend/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (

"github.com/opentracing/opentracing-go"
"go.uber.org/zap"
"github.com/elazarl/go-bindata-assetfs"

"github.com/jaegertracing/jaeger/examples/hotrod/pkg/httperr"
"github.com/jaegertracing/jaeger/examples/hotrod/pkg/log"
Expand All @@ -32,6 +33,7 @@ type Server struct {
tracer opentracing.Tracer
logger log.Factory
bestETA *bestETA
assetFs *assetfs.AssetFS
}

// NewServer creates a new frontend.Server
Expand All @@ -41,6 +43,7 @@ func NewServer(hostPort string, tracer opentracing.Tracer, logger log.Factory) *
tracer: tracer,
logger: logger,
bestETA: newBestETA(tracer, logger),
assetFs: assetFS(),
}
}

Expand All @@ -60,7 +63,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 := s.assetFs.Asset("web_assets/index.html")
if err != nil {
http.Error(w, "Could not load index page", http.StatusInternalServerError)
s.logger.Bg().Error("Could lot load static assets", zap.Error(err))
}
w.Write(b)
}

func (s *Server) dispatch(w http.ResponseWriter, r *http.Request) {
Expand Down
2 changes: 1 addition & 1 deletion scripts/import-order-cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

set -e

python scripts/import-order-cleanup.py -o $1 -t $(git ls-files "*\.go" | grep -v -e thrift-gen -e swagger-gen -e thrift-0.9.2)
python scripts/import-order-cleanup.py -o $1 -t $(git ls-files "*\.go" | grep -v -e thrift-gen -e swagger-gen -e thrift-0.9.2 -e bindata_assetfs.go)
Loading