Skip to content

Commit

Permalink
Fix empty static files
Browse files Browse the repository at this point in the history
Signed-off-by: Pavol Loffay <[email protected]>
  • Loading branch information
pavolloffay committed Oct 28, 2017
1 parent 77ce3cd commit 5685162
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 11 deletions.
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,13 @@ build-query-linux:
build-collector-linux:
CGO_ENABLED=0 GOOS=linux installsuffix=cgo go build -o ./cmd/collector/collector-linux ./cmd/collector/main.go

.PHONY: docker-no-ui
docker-no-ui: build-agent-linux build-collector-linux build-query-linux build-crossdock-linux
mkdir -p jaeger-ui-build/build/
make docker-images-only

.PHONY: docker
docker: build_ui build-agent-linux build-collector-linux build-query-linux build-crossdock-linux docker-images-only
docker: build_ui docker-no-ui

.PHONY: docker-images-only
docker-images-only:
Expand Down Expand Up @@ -151,7 +156,7 @@ build-crossdock-linux:
include crossdock/rules.mk

.PHONY: build-crossdock
build-crossdock: docker
build-crossdock: docker-no-ui
make crossdock

.PHONY: build-crossdock-fresh
Expand Down
6 changes: 1 addition & 5 deletions cmd/query/app/static_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ import (
"github.com/pkg/errors"
)

const (
defaultStaticAssetsRoot = "jaeger-ui-build/build/"
)

var (
staticRootFiles = []string{"favicon.ico"}
configPattern = regexp.MustCompile("JAEGER_CONFIG *= *DEFAULT_CONFIG;")
Expand All @@ -45,7 +41,7 @@ type StaticAssetsHandler struct {
// NewStaticAssetsHandler returns a StaticAssetsHandler
func NewStaticAssetsHandler(staticAssetsRoot string, uiConfig string) (*StaticAssetsHandler, error) {
if staticAssetsRoot == "" {
staticAssetsRoot = defaultStaticAssetsRoot
return nil, nil
}
if !strings.HasSuffix(staticAssetsRoot, "/") {
staticAssetsRoot = staticAssetsRoot + "/"
Expand Down
8 changes: 6 additions & 2 deletions cmd/query/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,17 @@ func main() {
app.HandlerOptions.Prefix(queryOpts.Prefix),
app.HandlerOptions.Logger(logger),
app.HandlerOptions.Tracer(tracer))
r := mux.NewRouter()
staticHandler, err := app.NewStaticAssetsHandler(queryOpts.StaticAssets, queryOpts.UIConfig)
if err != nil {
logger.Fatal("Could not create static assets handler", zap.Error(err))
}
r := mux.NewRouter()
if staticHandler != nil {
staticHandler.RegisterRoutes(r)
} else {
logger.Info("Static handler is not registered")
}
apiHandler.RegisterRoutes(r)
staticHandler.RegisterRoutes(r)
portStr := ":" + strconv.Itoa(queryOpts.Port)
recoveryHandler := recoveryhandler.NewRecoveryHandler(logger, true)

Expand Down
8 changes: 6 additions & 2 deletions cmd/standalone/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,12 +221,16 @@ func startQuery(
queryApp.HandlerOptions.Prefix(qOpts.Prefix),
queryApp.HandlerOptions.Logger(logger),
queryApp.HandlerOptions.Tracer(tracer))
r := mux.NewRouter()
staticHandler, err := queryApp.NewStaticAssetsHandler(qOpts.StaticAssets, qOpts.UIConfig)
if err != nil {
logger.Fatal("Could not create static assets handler", zap.Error(err))
}
r := mux.NewRouter()
apiHandler.RegisterRoutes(r)
if staticHandler != nil {
apiHandler.RegisterRoutes(r)
} else {
logger.Info("Static handler is not registered")
}
staticHandler.RegisterRoutes(r)
portStr := ":" + strconv.Itoa(qOpts.Port)
recoveryHandler := recoveryhandler.NewRecoveryHandler(logger, true)
Expand Down
5 changes: 5 additions & 0 deletions crossdock/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,8 @@ services:
image: jaegertracing/test-driver
ports:
- "8080"

jaeger-query:
# override to disable static files
command: ["/go/bin/query-linux", "--query.static-files=", "--cassandra.keyspace=jaeger_v1_dc1", "--cassandra.servers=cassandra"]

0 comments on commit 5685162

Please sign in to comment.