Skip to content

Commit

Permalink
Publish hotrod image to docker hub (#702)
Browse files Browse the repository at this point in the history
* Publish hotrod to dockerub

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

* Fix review comments

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

* Add env to dockerfile to handle collector hostport

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

* Use alpine

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

* Use scratch and entrypoint hotrod all

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

* Remove cd -

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

* Fix cd

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

* Add ls

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

* Remove bindata.go

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

* Add wait until 200

Signed-off-by: Pavol Loffay <ploffay@redhat.com>
  • Loading branch information
pavolloffay authored Mar 21, 2018
1 parent ff666cd commit 30d3e18
Show file tree
Hide file tree
Showing 11 changed files with 320 additions and 18 deletions.
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

.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/
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

0 comments on commit 30d3e18

Please # to comment.