Permalink
Browse files

Add standalone Dockerfile that runs agent, collector, and query (#69)

  • Loading branch information...
badiib authored and black-adder committed Apr 8, 2017
1 parent 527cde4 commit 0ab671ee2ea8ebdb18c946d4a443c86ed0bc94e1
View
@@ -12,5 +12,6 @@ _site/
env/
Gemfile.lock
vendor/
examples/hotrod/hotrod
jaeger-ui-build/
examples/hotrod/hotrod*
cmd/standalone/standalone*
View
@@ -1,3 +1,6 @@
[submodule "idl"]
path = idl
url = https://github.com/uber/jaeger-idl.git
[submodule "jaeger-ui"]
path = jaeger-ui
url = https://github.com/uber/jaeger-ui
View
@@ -8,10 +8,32 @@ go:
services:
- docker
env:
global:
- COMMIT=${TRAVIS_COMMIT::8}
# DOCKER_USER
- secure: TNvbr5/d7raSovEtttxdrZl8tP7vCCzL56gKKhr2wF4ET5/iRbcfSP9zoFPEOlIdgmCHZhGTh+fED1Eqgyswv6HPOAfEuov5vtzNB9fkcI46/nRk7KbiDlcEuE2IFtwkijFDz6YdJlbPCozHa81/Ih6G20H61tgv6f0AsGGT9MR7DQ71cCu8xZykNDjEKTo7RF6GiqG2VYa+S1P3vCOKRv31ouo/a5SPP+1AIvAg8u++qWVC8WJixmkXnw2OplvCFgHS0dlT3FvUPjYtUtLens5gpBDo7kn7+Ba27m2D0IzkzDPW5sK0YMMZW61LLn8GLPiJtLqzUHovaJ2NcFfi07RQ4GSMnwnjP0nLQbgd0CzM2zJGJRcOTkYe7IEDrdcTBcljZdZAJdoJEzrGYYWRQcX0Kyjc83ghX3A5s+CQWlPElQrkBB7KhNZ+w2Cn4+Mr6zOiRnBYg1NIUV2eGHMNnC4HI9RqgvA1QqcT5YHWqpz20sddHx1kgzgh8vOW8csiFon/Wrvyb2TaemzsKxIlT/UZZfDuyWG/Lvm4oxmTp1GrgQsC2iJjox4z6VIxbhykZEqNU1dhY6KuvgjEGetxk2j/NVfI8Qb4tvWqKoXq5Buap/J0AWjxWjGbrIGZbz5FgzfEP33WR8X2Oh5Cy+TMl1v0+YBAB3OaMpe/Qe2rGlk= # DOCKER_PASS
# DOCKER_PASS
- secure: mX3/Gwv5esCjU9GfqDaXbTslA0UOY9q45+rnW58X6z1tY2pFOts5uhtLve3YneGn3IN0n+m5mcljim72vKNQaPJCSodYfcfrqth2YqkYTXNWykOIdlLs1u58pYYGRXJaAlD4EgQysB/nAaQYO00/n2tBq4vEmu0dikbJer97smStkokLBiz42tJbvY6mikqnHHbRAA4dw5MHwYikDkI82oKxUsB8horetMmXgwTkT3AiE5UufXm3iYxpZ48KTYBW8WbQSQV1T1nriisZVErbYh69QLaLrEK3/WYiN3r4fOag4JvMA5GuPpuVGQfKzXUuFptG54VBbPKCgmcXA/DlaEQ6HILsfHdl29/AXHa59dVjWGfQ5f/N4VWaIVXhE0qWo+/WIoyr7SaLybyGVe3gf1vDaDFlfVlrE7j13H+XKiwzfOeaqnTrcNc/MSCFCtnUbjvX4UlXCbE4gVbCuEsjAPQ8mI/MMaCWLxhaYTW/cSyGRTGMLwe4Q8uAPd3BQat63byLo3BfK+icyw24RbSGBDRu5FZORK164MMjr0+UKVT3gh5/JdFxLkdOGjJL/9QuppNShI5GBIctIg15AQJNkhSLm8DxUTNHhjjBgXzqNhDVmUQLQVgqCWlHh1HVF5eiIQXBNGBE1Lw9v9dGTUHlPUUqeJKsxEyYWfZuY4tNhzU=
install:
- nvm version
- node -v
- make install_ci
script:
- make test_ci
- travis_retry goveralls -coverprofile=cover.out -service=travis-ci || true
after_success:
- nvm use 4
- make build-all-in-one-linux || { echo 'failed build-all-in-one-linux' ; exit 0; }
- export REPO=jaegertracing/all-in-one
- export BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo $TRAVIS_PULL_REQUEST_BRANCH; fi)
- export TAG=`if [ "$BRANCH" == "master" ]; then echo "latest"; else echo "${BRANCH///}"; fi`
- echo "TRAVIS_BRANCH=$TRAVIS_BRANCH, REPO=$REPO, PR=$PR, BRANCH=$BRANCH, TAG=$TAG"
- docker login -u $DOCKER_USER -p $DOCKER_PASS
- docker build -f cmd/standalone/Dockerfile -t $REPO:$COMMIT .
- docker tag $REPO:$COMMIT $REPO:$TAG
- docker tag $REPO:$COMMIT $REPO:travis-$TRAVIS_BUILD_NUMBER
- docker push $REPO
View
@@ -82,6 +82,14 @@ install_examples: install
build_examples:
go build -o ./examples/hotrod/hotrod-demo ./examples/hotrod/main.go
build_ui:
cd jaeger-ui && npm install && npm run build
rm -rf jaeger-ui-build && mkdir jaeger-ui-build
cp -r jaeger-ui/build jaeger-ui-build/
build-all-in-one-linux: build_ui
CGO_ENABLED=0 GOOS=linux installsuffix=cgo go build -o ./cmd/standalone/standalone-linux ./cmd/standalone/main.go
.PHONY: cover
cover:
./scripts/cover.sh $(shell go list $(PACKAGES))
@@ -27,4 +27,6 @@ var (
QueryPort = flag.Int("query.port", 16686, "The port for the query service")
// QueryPrefix is the prefix of the query service api
QueryPrefix = flag.String("query.prefix", "api", "The prefix for the url of the query service")
// QueryStaticAssets is the path for the static assets for the UI (https://github.com/uber/jaeger-ui)
QueryStaticAssets = flag.String("query.static-files", "jaeger-ui-build/build/", "The path for the static assets for the UI")
)
@@ -0,0 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<title>Test Page</title>
</html>
@@ -27,35 +27,40 @@ import (
)
const (
staticAssetsRoot = "jaeger-ui-build/build/"
defaultStaticAssetsRoot = "jaeger-ui-build/build/"
)
var (
staticRootFiles = []string{"favicon.ico"}
)
// StaticAssetsHandler handles static assets
type StaticAssetsHandler struct{}
type StaticAssetsHandler struct {
staticAssetsRoot string
}
// NewStaticAssetsHandler returns a StaticAssetsHandler
func NewStaticAssetsHandler() *StaticAssetsHandler {
return &StaticAssetsHandler{}
func NewStaticAssetsHandler(staticAssetsRoot string) *StaticAssetsHandler {
if staticAssetsRoot == "" {
staticAssetsRoot = defaultStaticAssetsRoot
}
return &StaticAssetsHandler{staticAssetsRoot: staticAssetsRoot}
}
// RegisterRoutes registers routes for this handler on the given router
func (sH *StaticAssetsHandler) RegisterRoutes(router *mux.Router) {
router.PathPrefix("/static").Handler(http.FileServer(http.Dir(staticAssetsRoot)))
router.PathPrefix("/static").Handler(http.FileServer(http.Dir(sH.staticAssetsRoot)))
for _, file := range staticRootFiles {
router.Path("/" + file).HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, staticAssetsRoot+file)
http.ServeFile(w, r, sH.staticAssetsRoot+file)
})
}
router.NotFoundHandler = http.HandlerFunc(notFound)
router.NotFoundHandler = http.HandlerFunc(sH.notFound)
}
func notFound(w http.ResponseWriter, r *http.Request) {
func (sH *StaticAssetsHandler) notFound(w http.ResponseWriter, r *http.Request) {
// don't allow returning "304 Not Modified" for index.html because
// the cached versions might have the wrong filenames for javascript assets
delete(r.Header, "If-Modified-Since")
http.ServeFile(w, r, staticAssetsRoot+"index.html")
http.ServeFile(w, r, sH.staticAssetsRoot+"index.html")
}
@@ -32,7 +32,7 @@ import (
func TestStaticAssetsHandler(t *testing.T) {
r := mux.NewRouter()
handler := NewStaticAssetsHandler()
handler := NewStaticAssetsHandler("fixture/")
handler.RegisterRoutes(r)
server := httptest.NewServer(r)
defer server.Close()
@@ -44,5 +44,10 @@ func TestStaticAssetsHandler(t *testing.T) {
resp, err := httpClient.Get(server.URL)
assert.NoError(t, err)
defer resp.Body.Close()
assert.Equal(t, http.StatusNotFound, resp.StatusCode)
assert.Equal(t, http.StatusOK, resp.StatusCode)
}
func TestDefaultStaticAssetsRoot(t *testing.T) {
handler := NewStaticAssetsHandler("")
assert.Equal(t, "jaeger-ui-build/build/", handler.staticAssetsRoot)
}
View
@@ -68,7 +68,7 @@ func main() {
app.HandlerOptions.Adjusters(app.StandardAdjusters),
app.HandlerOptions.Prefix(*builder.QueryPrefix),
app.HandlerOptions.Logger(logger))
sHandler := app.NewStaticAssetsHandler()
sHandler := app.NewStaticAssetsHandler(*builder.QueryStaticAssets)
r := mux.NewRouter()
rHandler.RegisterRoutes(r)
sHandler.RegisterRoutes(r)
@@ -0,0 +1,7 @@
FROM golang:1.7
EXPOSE 5775 6831 6832 14267 16686
COPY ./jaeger-ui-build /go/src/jaeger-ui-build
COPY ./cmd/standalone/standalone-linux /go/bin/
ENTRYPOINT /go/bin/standalone-linux --span-storage.type=memory --query.static-files=/go/src/jaeger-ui-build/build/
View
@@ -139,7 +139,7 @@ func startQuery(logger *zap.Logger, baseFactory metrics.Factory, memoryStore *me
dependencyReader,
queryApp.HandlerOptions.Prefix(*query.QueryPrefix),
queryApp.HandlerOptions.Logger(logger))
sHandler := queryApp.NewStaticAssetsHandler()
sHandler := queryApp.NewStaticAssetsHandler(*query.QueryStaticAssets)
r := mux.NewRouter()
rHandler.RegisterRoutes(r)
sHandler.RegisterRoutes(r)
Submodule jaeger-ui added at 5f05a8

0 comments on commit 0ab671e

Please sign in to comment.