benbalter / jekyll-auth

A simple way to use GitHub OAuth to serve a protected Jekyll site to your GitHub organization
https://ben.balter.com/jekyll-auth
843 stars 114 forks source link

Heroku web process dies every time #10

Closed daaain closed 11 years ago

daaain commented 11 years ago

This might be very well something badly set up on my side, but can't for my life figure out why Heroku refuses to run the process :( It runs beautifully locally, redirects to the Github OAuth page straight away.

The deployment looks all right, but in the end I get application error from Heroku. I've tried both with Ruby 1.9.3 and 2.0.0 just in case.

This is from the application instance:

2013-10-11T17:29:59.714626+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path=/ host=xxx.herokuapp.com fwd="xx.xx.xx.xx" dyno= connect= service= status=503 bytes=

And this is from the github-heroku-pusher instance:

2013-10-11T17:27:21.074475+00:00 app[web.1]: -----> Ruby/Rack app detected
2013-10-11T17:27:24.609184+00:00 app[web.1]: -----> Using Ruby version: ruby-2.0.0
2013-10-11T17:27:25.698599+00:00 app[web.1]: -----> Installing dependencies using Bundler version 1.3.2
2013-10-11T17:27:26.199562+00:00 app[web.1]:        Ruby version change detected. Clearing bundler cache.
2013-10-11T17:27:26.199562+00:00 app[web.1]:        Old: ruby 1.9.3p448 (2013-06-27 revision 41675) [x86_64-linux]
2013-10-11T17:27:26.199562+00:00 app[web.1]:        New: ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-linux]
2013-10-11T17:27:27.484403+00:00 app[web.1]:        Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment
2013-10-11T17:27:33.814976+00:00 app[web.1]:        Fetching gem metadata from https://rubygems.org/.......
2013-10-11T17:27:37.856424+00:00 app[web.1]:        Fetching gem metadata from https://rubygems.org/..
2013-10-11T17:27:41.488273+00:00 app[web.1]:        Installing rake (10.1.0)
2013-10-11T17:27:48.908292+00:00 app[web.1]:        Installing RedCloth (4.2.9)
2013-10-11T17:27:49.866237+00:00 app[web.1]:        Installing addressable (2.3.5)
2013-10-11T17:27:51.208200+00:00 app[web.1]:        Installing fast-stemmer (1.0.2)
2013-10-11T17:27:51.741929+00:00 app[web.1]:        Installing classifier (1.3.3)
2013-10-11T17:27:52.060297+00:00 app[web.1]:        Installing colorator (0.1)
2013-10-11T17:27:52.968501+00:00 app[web.1]:        Installing highline (1.6.19)
2013-10-11T17:27:53.725524+00:00 app[web.1]:        Installing commander (4.1.5)
2013-10-11T17:27:54.427446+00:00 app[web.1]:        Installing directory_watcher (1.4.1)
2013-10-11T17:27:55.075665+00:00 app[web.1]:        Installing dotenv (0.9.0)
2013-10-11T17:27:57.402998+00:00 app[web.1]:        Installing excon (0.25.3)
2013-10-11T17:27:59.119104+00:00 app[web.1]:        Installing multipart-post (1.2.0)
2013-10-11T17:28:00.275510+00:00 app[web.1]:        Installing faraday (0.8.8)
2013-10-11T17:28:01.259089+00:00 app[web.1]:        Installing git (1.2.6)
2013-10-11T17:28:03.569517+00:00 app[web.1]:        Installing liquid (2.5.1)
2013-10-11T17:28:04.110170+00:00 app[web.1]:        Installing syntax (1.0.0)
2013-10-11T17:28:06.151816+00:00 app[web.1]:        Installing maruku (0.6.1)
2013-10-11T17:28:07.463571+00:00 app[web.1]:        Installing posix-spawn (0.3.6)
2013-10-11T17:28:19.732379+00:00 app[web.1]:        Installing yajl-ruby (1.1.0)
2013-10-11T17:28:22.216288+00:00 app[web.1]:        Installing pygments.rb (0.5.2)
2013-10-11T17:28:29.612997+00:00 app[web.1]:        Installing redcarpet (2.2.2)
2013-10-11T17:28:30.661852+00:00 app[web.1]:        Installing safe_yaml (0.7.1)
2013-10-11T17:28:31.854036+00:00 app[web.1]:        Installing jekyll (1.2.0)
2013-10-11T17:28:33.006949+00:00 app[web.1]:        Installing kramdown (1.0.2)
2013-10-11T17:28:38.461375+00:00 app[web.1]:        Installing rdiscount (1.6.8)
2013-10-11T17:28:39.126261+00:00 app[web.1]:        Installing github-pages (8)
2013-10-11T17:28:39.599162+00:00 app[web.1]:        Installing heroku-api (0.3.15)
2013-10-11T17:28:39.787858+00:00 app[web.1]:        Installing launchy (2.3.0)
2013-10-11T17:28:40.016879+00:00 app[web.1]:        Installing netrc (0.7.7)
2013-10-11T17:28:40.360276+00:00 app[web.1]:        Installing mime-types (1.25)
2013-10-11T17:28:40.624812+00:00 app[web.1]:        Installing rest-client (1.6.7)
2013-10-11T17:28:40.915817+00:00 app[web.1]:        Installing rubyzip (1.0.0)
2013-10-11T17:28:41.744431+00:00 app[web.1]:        Installing heroku (3.0.0)
2013-10-11T17:28:43.157364+00:00 app[web.1]:        Installing rack (1.5.2)
2013-10-11T17:28:43.426167+00:00 app[web.1]:        Installing rack-protection (1.5.0)
2013-10-11T17:28:44.023455+00:00 app[web.1]:        Installing tilt (1.4.1)
2013-10-11T17:28:44.717278+00:00 app[web.1]:        Installing sinatra (1.4.3)
2013-10-11T17:28:45.474663+00:00 app[web.1]:        Installing sinatra-index (0.0.2)
2013-10-11T17:28:45.931565+00:00 app[web.1]:        Installing sawyer (0.5.1)
2013-10-11T17:28:46.368319+00:00 app[web.1]:        Installing octokit (2.4.0)
2013-10-11T17:28:48.305966+00:00 app[web.1]:        Installing warden (1.2.3)
2013-10-11T17:28:48.669571+00:00 app[web.1]:        Installing warden-github (1.0.0)
2013-10-11T17:28:48.968176+00:00 app[web.1]:        Installing sinatra_auth_github (1.0.0)
2013-10-11T17:28:49.401890+00:00 app[web.1]:        Installing jekyll-auth (0.1.2)
2013-10-11T17:28:49.411907+00:00 app[web.1]:        Using bundler (1.3.2)
2013-10-11T17:28:49.412920+00:00 app[web.1]:        !    The `heroku` gem has been deprecated and replaced with the Heroku Toolbelt.
2013-10-11T17:28:49.412920+00:00 app[web.1]:        !    Download and install from: https://toolbelt.heroku.com
2013-10-11T17:28:49.412833+00:00 app[web.1]:        Your bundle is complete! It was installed into ./vendor/bundle
2013-10-11T17:28:49.412920+00:00 app[web.1]:        Post-install message from heroku:
2013-10-11T17:28:49.412920+00:00 app[web.1]:        !    For API access, see: https://github.com/heroku/heroku.rb
2013-10-11T17:28:49.564590+00:00 app[web.1]:        Cleaning up the bundler cache.
2013-10-11T17:28:53.131809+00:00 app[web.1]: -----> Running: rake assets:precompile
2013-10-11T17:28:53.950817+00:00 app[web.1]:        bundle exec jekyll-auth build
2013-10-11T17:28:55.754054+00:00 app[web.1]:        building the site...
2013-10-11T17:28:55.754054+00:00 app[web.1]:        bundle exec jekyll build
2013-10-11T17:28:57.589405+00:00 app[web.1]:        Configuration file: /tmp/build_51c2626d-2e7f-40c2-9c85-7242e96982ea/_config.yml
2013-10-11T17:28:57.589405+00:00 app[web.1]:        Destination: /tmp/build_51c2626d-2e7f-40c2-9c85-7242e96982ea/_site
2013-10-11T17:28:57.589405+00:00 app[web.1]:        Source: /tmp/build_51c2626d-2e7f-40c2-9c85-7242e96982ea
2013-10-11T17:28:57.753200+00:00 app[web.1]:        Generating... done.
2013-10-11T17:28:57.818041+00:00 app[web.1]:        site built.
2013-10-11T17:28:57.874046+00:00 app[web.1]:        Asset precompilation completed (4.74s)
2013-10-11T17:28:58.046331+00:00 app[web.1]: -----> Discovering process types
2013-10-11T17:29:01.225053+00:00 app[web.1]:        Procfile declares types     -> (none)
2013-10-11T17:29:01.225053+00:00 app[web.1]:        Default types for Ruby/Rack -> console, rake, web
2013-10-11T17:29:01.278298+00:00 app[web.1]:
2013-10-11T17:29:11.269930+00:00 app[web.1]: -----> Compiled slug size: 42.5MB
2013-10-11T17:29:15.767270+00:00 app[web.1]:
2013-10-11T17:29:15.767270+00:00 app[web.1]: -----> Launching... done, v15
2013-10-11T17:29:15.767270+00:00 app[web.1]:        http://rogo-docs.herokuapp.com deployed to Heroku
2013-10-11T17:29:16.010729+00:00 app[web.1]: To git@heroku.com:rogo-docs.git
2013-10-11T17:29:16.011032+00:00 app[web.1]:    127fb60..d348f93  master -> master
2013-10-11T17:29:16.018154+00:00 app[web.1]: 192.30.252.49 - - [11/Oct/2013 17:29:16] "POST /post-receive HTTP/1.1" 200 8 124.1439
parkr commented 11 years ago

This is probably a problem with your Procfile. What happens when you run foreman start on a local clone of your app?

daaain commented 11 years ago

I don't have a Procfile, I think it should work with the default bundle exec rackup config.ru -p $PORT?

When I run bundle exec rackup config.ru locally it does work nicely.

parkr commented 11 years ago

That may be the problem -- heroku uses the Procfile to boot up all your apps.

daaain commented 11 years ago

I tried creating one with web: bundle exec rackup config.ru -p $PORT, but the same thing happens :(

benbalter commented 11 years ago

Sounds like the right diagnosis, just have to find the solution.

Are you using the Gemified version? If so, there should be no Procfile. bundle exec rackup config.ru -p $PORT is run by default.

daaain commented 11 years ago

I am, the latest (0.1.2) version. Not sure if it's relevant, but I'm using GITHUB_ORG_ID not the team one.

It's all very strange, even if I try to relaunch the process from Heroku's dashboard by clicking on the checkbox, it dies off and the box is unchecked when I refresh the page.

Couldn't get any useful info from the log, there are no Ruby stack traces or anything. I'm new to Heroku, so might be missing something though. Is there a way to trigger verbose / debug output with the Gem itself?

benbalter commented 11 years ago

This is from the application instance... And this is from the github-heroku-pusher instance

Re-read your original comment and I think I see what's going on. Did a deploy, and my log is virtually identical to yours... it looks like jekyll-auth is working as expected... just in the wrong place. Jekyll-auth should be on the web instance, not the deploy instance. Never used github-heroku-pusher, but you'll want to ensure after each push rake assets::precompile (or some other way to build the site) is fired, and that the jekyll-auth server starts.

In short, you should be adding jekyll-auth to your site itself right along side the content, not to the thing pushing it to Heroku as based on the above log, it looks like you're doing.

daaain commented 11 years ago

Wait, jekyll-auth IS on the app instance, that log from the pusher instance is what is piped back from the app instance via the Git push to Heroku's repo. And you can see that it does run the Rake task (Asset precompilation completed (4.74s)), it's just the webserver which doesn't want to run for some reason.

Not sure if that helps, but I'm trying to use jekyll-auth with Prose Starter: https://github.com/prose/starter, could it be that there is some setting in there which breaks it? In _config.yml I changed the baseurl as that's specific to their Github Pages setup and added exclude: ['vendor'] as trying to compile the content of all installed Gems were totally throwing the wheels off Jekyll.

benbalter commented 11 years ago

If you push directly to the app instance do you have the same problem?

Also, to confirm, you ran jekyll-auth new from the repo to set up Config.ru?

Perhaps you could remove any content from the repo and post it to an open source repository? At the very least, a screenshot of the root directory may be helpful.

daaain commented 11 years ago

Pushing directly is the same, first this pusher instance didn't even work so I was doing it directly for a while.

You mean jekyll-auth new right? Yes, I did that, though I had to edit the settings manually afterwards as it created an empty GITHUB_TEAM_ID so I removed that and added GITHUB_ORG_ID instead.

At the moment there's nothing specific in there yet so I put everything into a public repo: https://github.com/daaain/jekyll-auth-test

Thanks a lot for helping out by the way, really appreciated!

benbalter commented 11 years ago

Cloned your site, ran jekyll-auth new and opened the resulting site to get the bouncercat as expected. If you run heroku logs on the app instance is there anything useful there? Perhaps your oauth application and callback are not properly configured?

Yes, I did that, though I had to edit the settings manually afterwards as it created an empty GITHUB_TEAM_ID so I removed that and added GITHUB_ORG_ID instead.

That should now be fixed in https://github.com/benbalter/jekyll-auth/commit/7bb545a15d5e3b17c195ecad1301c65da9f80d48.

daaain commented 11 years ago

Thanks a lot for trying it, as a last resort I deleted and recreated the Heroku app, ran jekyll-auth new and it works perfectly now, yay! :)

Not sure what could have been going wrong, I'll just chalk it up as my Heroku noobness...