Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it easy to run Citizenry on Heroku #45

Open
igal opened this issue Oct 29, 2011 · 7 comments
Open

Make it easy to run Citizenry on Heroku #45

igal opened this issue Oct 29, 2011 · 7 comments
Labels

Comments

@igal
Copy link
Collaborator

igal commented Oct 29, 2011

Hosting Rails applications can be a real pain for people and hinders adoption. Heroku offers free/cheap hosting, but offers a very odd and limited environment, and we have to port to it so they can run the app. I've already done much of the work needed, but some more is needed:

  • Gemfile: Lock down versions, add logic to dynamically load appropriate database driver, and stop putting the Gemfile.lock into the public version control. Update instructions to reflect these changes. See https://github.com/calagator/calagator/blob/master/Gemfile for an example of a dynamic Gemfile that loads the database driver.
  • PostgreSQL: Ensure all queries run on Sqlite3, MySQL and also PostgreSQL, which is what Heroku uses. In theory, this should work because there are some folks already using this on PostgreSQL, although it's unclear if they've submitted all their patches.
  • Ruby 1.9.2: Ensure that all code runs on Ruby 1.8.7 and also 1.9.2, which is what Heroku uses. I think I've fixed all the compatibility problems.
  • Coverage: We need to boost code coverage so that we have a higher level of certainty that the port really works. I've added "simplecov" to perform Ruby 1.9.2 code coverage, and been slowly adding tests.
  • Instructions: We need to provide instructions on how to deploy to Heroku. We can borrow my similar work from. https://github.com/calagator/calagator/blob/with_heroku/HEROKU.md
@mchung
Copy link
Contributor

mchung commented May 2, 2012

I'm doing this now and wanted to share my notes as I progressed.

  • MySQL w/ ClearDB is an option.
heroku addons:add cleardb:ignite
heroku config | grep CLEARDB_DATABASE_URL
heroku config:add DATABASE_URL='mysql2:/.....'
  • Add settings.yml by removing the restriction from .gitignore
  • Configure compass to play nicely by updating the css_dir variable in config/compass.rb
css_dir = "tmp/stylesheets/compiled"
  • Configure config.ru. In config.ru (just before run...) add in:
use Rack::Static, :urls => ["/stylesheets/compiled"], :root => "tmp"

There are likely many more changes (sphinx, various settings); I'll report back with my progress.

@mchung
Copy link
Contributor

mchung commented May 11, 2012

Done. I combined my notes along with the other two wiki entries.

I haven't looked at S3 for paperclip uploads yet. Anyone want to take a stab at that?

@webmaven
Copy link

webmaven commented Dec 9, 2012

I'm having trouble deploying to Heroku:

I started from the procedure documented at https://github.com/reidab/citizenry/wiki/Deploying-to-Heroku , except that I deployed to a cedar stack (bamboo is no longer available).

I've got Twitter authentication working, but adding the LinkedIn key and secret fails with a redirect to /auth/failure?message=invalid_response, Google fails with 'Request-URI Too Large', and Github fails with 'The page you were looking for doesn't exist.'.

Oh, and what do I need to do to to disable various authentication providers?

Anyway, as soon as I added one person (myself) the home page broke with 'We're sorry, but something went wrong.' Other pages such as /people are working, so the site is being populated, but I need to fix the homepage.

You can see the changes (yes, including the keys and secrets) I made to configuration and gems here: https://github.com/NM-Tech-Directory/citizenry/

Can anyone help me get this deployment working?

@webmaven
Copy link

webmaven commented Dec 9, 2012

Another problem: As we've been adding people, profile photos for the people we added earlier are getting broken: http://nmtechdir.herokuapp.com/people

@elliottw
Copy link

I'm having the same "dropped photo" problem.

@pauldowman
Copy link

@webmaven @elliottw Did you include the change to store photos on S3? If not then you're using local filesystem storage which is not shared between dynos and is destroyed when the dyno is.

https://devcenter.heroku.com/articles/dynos#ephemeral-filesystem

@webmaven
Copy link

Ah. Thanks @pauldowman, no I hadn't. Once I make the change to S3, what do I do about existing profiles etc. that have already had their photos destroyed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants