Tagged: heroku

Heroku

I've watched Heroku for a while. I've even tried to deploy an app there a few times, but never got into it that much. I needed a cheap (free) place to put My Amazon Feeds.com. It's just a utility site. It's not meant to scale or be production worthy. Instead it's meant to show off some code and I didn't want to spend a long time messing with deployment.

Turns out deployment on Heroku is pretty simple if you don't need a lot of custom setup. Their instructions are pretty clear so I won't repeat them. There are a few things you will want to keep in mind:

  1. You will need to create a file in the root called .gems. Mine looks like this:
    
    mislav-will_paginate --source http://gems.github.com
    httparty
    river
    
  2. Heroku uses PostgreSQL. If you have MySQL specific code or even some sloppy migrations you might have a few problems.
  3. The Heroku file system is read-only. This has some interesting side effects include the fact that your caching will ...

Continue Reading →
of sys ops is taken care of for you, you will occasionally run into strange database issues that are hard to explain. For me it the database issues showed up as some ugly entries when I tried to run a rake db:migrate on a deployed database:

2013-12-13T16:57:28.079781+00:00 app[web.1]: PG::IndexCorrupted: ERROR:  index "pg_constraint_conname_nsp_index" contains unexpected zero page at block 0
2013-12-13T16:57:28.079781+00:00 app[web.1]: HINT:  Please REINDEX it.
2013-12-13T16:57:28.079781+00:00 app[web.1]:             FROM pg_attribute attr
2013-12-13T16:57:28.079781+00:00 app[web.1]:             WHERE cons.contype = 'p'
2013-12-13T16:57:28.079781+00:00 app[web.1]:               AND cons.conrelid = '"users"'::regclass
2013-12-13T16:57:28.079781+00:00 app[web.1]:
2013-12-13T16:57:28.079781+00:00 app[web.1]: :             SELECT attr.attname
2013-12-13T16:57:28.079781+00:00 app[web.1]:             INNER JOIN pg_constraint cons ON attr.attrelid = ...

Continue Reading →

Rails on Heroku Notes - some Asset Pipeline and a Frame issue

A tiny Rails asset pipeline thing if you are into bookmarklets

This is more a general Rails issue rather than a Heroku issue, but I ran into the problem while deploying to heroku so I'm including it. Rails 3 generated digest as well as undigested version of your assets. Rails 4 no longer does that. For many applications that doesn't matter but if you need to access your assets directly via file name it becomes a big problem. In my case I need to be able to access a javascript file for a bookmarklet. The proposed solution is that you put those kinds of files directly into the public directly. However, I needed to make use of the asset pipeline to take advantage of Rails JST capabilities. If you run into the same problem take a look at Non-stupid non-digest assets in Rails 4 by Alex Speller. It saved me a ton of time and fixed a major headache.

Just in case you want to be framed

It turns out that X-Frame-Options is set to 'SAMEORIGIN' by default in Rails 4. If you wa...

Continue Reading →