palantir / bulldozer

GitHub Pull Request Auto-Merge Bot
Apache License 2.0
745 stars 100 forks source link

Getting 404 #117

Closed shammishailaj closed 5 years ago

shammishailaj commented 5 years ago

I have set-up bulldozed using docker. The command being used to run the docker container is:

docker run -it -d --restart unless-stopped -v /path/to/bulldozer.yml:/secrets/bulldozer.yml -p 8400:8400 --name bulldozer palantirtechnologies/bulldozer:latest

Nginx reverse proxy has been set-up on xyz.example.com which routes traffic to the docker container running on http://localhost:8400

When I try to access the http://xyz.example.com , I am getting a 404 from the container. When I am trying to hit http://xyz.example.com/api/github/hook , I am getting a 404 again.

Can someone explain what I am doing wrong here?

jamestoyer commented 5 years ago

Hi @shammishailaj 👋 ,

Looking at the information you've given it's a bit hard to say what might be going wrong. Although, here are some thoughts on what could be wrong.

Hopefully these can help you get pointed in the right direction 🙂

shammishailaj commented 5 years ago

Hi @jamestoyer

Thanks for your insights. :)

Points 1 and 2 make total sense. Will try to set-up a webhook and see if that works.

Also, will it be possible for you to share a sample POST request, if that is not too much to ask for. The Nginx proxy is configured properly as hits were reaching the container and the container logs were showing 404 as well.

shammishailaj commented 5 years ago

Hi @jamestoyer

Should I use JSON as the content-type in Github Webhook setting or application/x-www-form-urlencoded ?

shammishailaj commented 5 years ago

I have tried with both application/x-www-form-urlencoded and application/json

In both cases the server is returning 500 to Github. Please see the docker logs below

{"level":"error","rid":"bjqiti7hkhl29uhkaojg","github_event_type":"ping","github_delivery_id":"fdf67320-860b-11e9-972d-93ca900303d6","error":"failed to validate webhook payload: missing signature\ngithub.com/palantir/bulldozer/vendor/github.com/palantir/go-githubapp/githubapp.(*eventDispatcher).ServeHTTP\n\t/go/src/github.com/palantir/bulldozer/vendor/github.com/palantir/go-githubapp/githubapp/dispatcher.go:109\ngithub.com/palantir/bulldozer/vendor/goji%2eio.dispatch.ServeHTTP\n\t/go/src/github.com/palantir/bulldozer/vendor/goji.io/dispatch.go:17\ngithub.com/palantir/bulldozer/vendor/goji%2eio.(*dispatch).ServeHTTP\n\t<autogenerated>:1\ngithub.com/palantir/bulldozer/vendor/github.com/bluekeyes/hatpear.Recover.func1.1\n\t/go/src/github.com/palantir/bulldozer/vendor/github.com/bluekeyes/hatpear/hatpear.go:107\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:1964\ngithub.com/palantir/bulldozer/vendor/github.com/bluekeyes/hatpear.Catch.func1.1\n\t/go/src/github.com/palantir/bulldozer/vendor/github.com/bluekeyes/hatpear/hatpear.go:60\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:1964\ngithub.com/palantir/bulldozer/vendor/github.com/rs/zerolog/hlog.AccessHandler.func1.1\n\t/go/src/github.com/palantir/bulldozer/vendor/github.com/rs/zerolog/hlog/hlog.go:180\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:1964\ngithub.com/palantir/bulldozer/vendor/github.com/rs/zerolog/hlog.RequestIDHandler.func1.1\n\t/go/src/github.com/palantir/bulldozer/vendor/github.com/rs/zerolog/hlog/hlog.go:169\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:1964\ngithub.com/palantir/bulldozer/vendor/github.com/palantir/go-baseapp/baseapp.NewMetricsHandler.func1.1\n\t/go/src/github.com/palantir/bulldozer/vendor/github.com/palantir/go-baseapp/baseapp/middleware.go:55\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:1964\ngithub.com/palantir/bulldozer/vendor/github.com/rs/zerolog/hlog.NewHandler.func1.1\n\t/go/src/github.com/palantir/bulldozer/vendor/github.com/rs/zerolog/hlog/hlog.go:30\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:1964\ngithub.com/palantir/bulldozer/vendor/goji%2eio.(*Mux).ServeHTTP\n\t/go/src/github.com/palantir/bulldozer/vendor/goji.io/mux.go:74\nnet/http.serverHandler.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2741\nnet/http.(*conn).serve\n\t/usr/local/go/src/net/http/server.go:1847\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1333","time":"2019-06-03T14:29:28.099541145Z","message":"Unexpected error handling webhook request"}

{"level":"info","rid":"bjqiti7hkhl29uhkaojg","method":"POST","path":"/api/github/hook","status":500,"size":22,"elapsed":0.20812,"time":"2019-06-03T14:29:28.099582223Z","message":"http_request"}

Please help

asvoboda commented 5 years ago

I think you've almost got it working. The error seems to be the same as the one in #85

as @bluekeyes said:

This latest error can happen if the webhook_secret value in the Bulldozer configuration file does not match the value configured in the GitHub App. You can set the value used by GitHub on the settings page for your app. The actual value is arbitrary, so I recommend generating a random 32 character string.

Let us know if that solves your problem.

shammishailaj commented 5 years ago

Yes that did solve it. I had configured the Webhook Secret in bulldozer.yml but had not mentioned it in the repository's webhook settings.

Thanks to both @asvoboda and @jamestoyer