antirez / lamernews

Lamer News -- an HN style social news site written in Ruby/Sinatra/Redis/JQuery
http://lamernews.com
Other
1.35k stars 200 forks source link

Ruby-1.9.2 compatible and ready for deploy on Heroku #111

Closed zh closed 11 years ago

zh commented 13 years ago

Made some changes to make your application compatible with ruby-1.9.2 (tested on ruby-1.9.2-p290) and also to make it deployable to Heroku [ http://heroku.com/ ]. The application successfully is running on URL: [ http://hotlinks.herokuapp.com/ ]

zh commented 13 years ago

Port number returned back to 10000. Now powered by unicorn (was thin) - better performance - see http://michaelvanrooijen.com/articles/2011/06/01-more-concurrency-on-a-single-heroku-dyno-with-the-new-celadon-cedar-stack/

mulderp commented 11 years ago

There are several things in this thread, but the Heroku URL would be solved by https://github.com/antirez/lamernews/pull/144 too

Regarding the Ruby version, I currently observe some problem when trying to run a Ruby 2.0 environment:

2013-08-09T08:56:14.166458+00:00 app[web.1]: 82.135.122.35 - - [09/Aug/2013 08:56:14] "GET /api/login?username=.....&password=..... HTTP/1.1" 200 79 0.0051
2013-08-09T08:56:18.663483+00:00 app[web.1]: TypeError - nil can't be coerced into Fixnum:
2013-08-09T08:56:18.663661+00:00 app[web.1]:    /app/pbkdf2.rb:145:in `each_with_index'
2013-08-09T08:56:18.663483+00:00 app[web.1]:    /app/pbkdf2.rb:146:in `^'
2013-08-09T08:56:18.663661+00:00 app[web.1]:    /app/pbkdf2.rb:146:in `block in xor_impl'
2013-08-09T08:56:18.663661+00:00 app[web.1]:    /app/pbkdf2.rb:145:in `each'
2013-08-09T08:56:18.663661+00:00 app[web.1]:    /app/pbkdf2.rb:119:in `block in calculate_block'
2013-08-09T08:56:18.663661+00:00 app[web.1]:    /app/pbkdf2.rb:190:in `^'
2013-08-09T08:56:18.663661+00:00 app[web.1]:    /app/pbkdf2.rb:115:in `upto'
2013-08-09T08:56:18.663661+00:00 app[web.1]:    /app/pbkdf2.rb:115:in `calculate_block'
2013-08-09T08:56:18.663661+00:00 app[web.1]:    /app/pbkdf2.rb:145:in `xor_impl'
2013-08-09T08:56:18.663836+00:00 app[web.1]:    /app/pbkdf2.rb:77:in `value'
2013-08-09T08:56:18.663836+00:00 app[web.1]:    /app/pbkdf2.rb:131:in `calculate!'
2013-08-09T08:56:18.663836+00:00 app[web.1]:    /app/app.rb:917:in `create_user'
2013-08-09T08:56:18.663836+00:00 app[web.1]:    /app/app.rb:460:in `block in '
2013-08-09T08:56:18.663661+00:00 app[web.1]:    /app/pbkdf2.rb:131:in `upto'
2013-08-09T08:56:18.663661+00:00 app[web.1]:    /app/pbkdf2.rb:132:in `block in calculate!'
2013-08-09T08:56:18.663836+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.2/lib/sinatra/base.rb:944:in `block (3 levels) in route!'
2013-08-09T08:56:18.663836+00:00 app[web.1]:    /app/pbkdf2.rb:84:in `hex_string'
2013-08-09T08:56:18.663979+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.0.0/gems/sinatra-1.4.2/lib/sinatra/base.rb:960:in `route_eval'
mulderp commented 11 years ago

Commit https://github.com/zh/lamernews/commit/9cf633e7a6141c19b85f8735af55789e0487664f looks nice as a short doc how to deploy to Heroku

fcambus commented 11 years ago

Haven't tried Ruby 2.0 yet, but this issue should be investigated indeed, thanks for reporting!

Regarding 9cf633e7a6141c19b85f8735af55789e0487664f, it could be nice to add these instructions to the Wiki. After #144 gets merged, would these instructions require modifications? (I'm not familiar with Heroku at all)

mulderp commented 11 years ago

Good idea! Ok, I updated the Wiki. It is indeed really easy to setuo Lamernews (for free) with Heroku (scaling might get costly quickly however). I am also not sure what's a good way to configure a DNS with Heroku, since the apps are loaded dynamically under different IPs. DNSSimple does a good job, but is also relatively expensive.

fcambus commented 11 years ago

Thanks for the Wiki update, just merged the Redis URL pull request :)

To configure a domain name to point to a Heroku app, you need to create a CNAME record pointing to your app URL.

mulderp commented 11 years ago

Thanks! Ah, now I remember again the problem I had, CNAME officially works only for subdomains (www. ...), and not all DNS services provide support for Apex domains. In fact, I found only DNSSimple and Unbit in Italy so far that could redirect without an A Record on the example.com.

On Sun, Aug 11, 2013 at 2:05 PM, Frederic Cambus notifications@github.comwrote:

Thanks for the Wiki update, just merged the Redis URL pull request :)

To configure a domain name to point to a Heroku app, you need to create a CNAME record pointing to your app URL.

— Reply to this email directly or view it on GitHubhttps://github.com/antirez/lamernews/pull/111#issuecomment-22456704 .

fcambus commented 11 years ago

Yeah you can't have a CNAME at the apex, in case you are using Heroku you can configure an HTTP 301 redirection for http://example.org to redirect to http://www.example.org

I think this pull request can now be closed? Could you open an issue about the Ruby 2.0 problem you reported? Thanks in advance.

mulderp commented 11 years ago

Agree, this looks solved, I have'nt the permissions though.

fcambus commented 11 years ago

Issue solved, closing.