If you want to have full text search capability on Heroku, you should definitely use texticle or acts_as_tsearch. It is possible to use acts_as_farret on Heroku, but since you can only write to /tmp directory and your index file will be deleted sooner or later, you should not use it.
I first used texticle, and later switched over to acts_as_tsearch because I wasn’t happy with performance. Acts_as_tsearch is working really fine for me, and since your database on Heroku is already Postgres, there should be minimal configuration required. I even switched my local database from MySQL to Postgres to make both development and production environments consistent.
I have been using MySQL for probably as long as I could remember. For Bloglation, search capability is an important feature since it’s hard to browse each post one by one. I will probably implement tagging functionality, but even so, it’s important to be able to search the contents with a keyword(s). While Ultrasphinx works well, Heroku only supports WebSolr… I was using acts_as_ferret using /tmp for index files, but the problem using the /tmp directory is that ferret index files most likely to disappear at some point.
Then, I found out that Postgres supports full-text search and since Heroku uses Postgres, I could use other plug-ins like acts_as_tsearch or texticle for free. Free is important to me, since it’s not making any money.
Searching online, there are various ways to do it like Pivotal Labs’ script or Heroku’s Taps gem, but I wanted to do it in an old way like AEdifice to check everything is going alright at each step.
1. First thing to do is to backup MySQL
For me, it was important to backup preserving encoding, since it had many different languages. First I pulled db from Heroku thinking that I Continue reading
This shouldn’t have been this difficult, but it has because while there are many cool tutorials are out there, they are mostly outdated, and for some reason, the instruction on Heroku was not accessible.
While I picked acts_as_ferret because Heroku supports it, many seemed to prefer Thinking Sphinx. So, if you are not constrained (like me with Heroku), you should try that out too.
1. Install acts_as_ferret
Full instruction is outlined on github, so you should check it out. You can also find the installation instruction and complete list of methods here, too.
While the instruction asks you to put version name, since Heroku only has version 0.4.3 installed, specifying a version will break it.
Now I am moving on to Open Translation Project. I’ve done some translation work before, including one of Paul Graham’s essay – Why to not not start a startup. BTW, he finally made a link from the essay to my translation. I used Google Translate as base, but I couldn’t believe how bad the translation was. Yahoo’s Babel Fish was a little better, but not as much. That’s where I got the idea of creating this possibly massive project.
Anyhow, I wanted to find a way of selecting an article or blog that was translated the most. I had one model that stored basic information of original article/blog. Then its children are translations. So, I need to count rows of children with the same parent. In MySQL, I had the following statement in Rails.
@top_origs = OrigPost.find(:all,
:select => 'orig_posts.*, count(posts.id) as post_count',
:joins => 'left outer join posts on posts.orig_post_id = orig_posts.id',
:group => 'orig_posts.id',
:order => 'post_count DESC',
:limit => 5)
I just moved my PlaygroundsRUs site from AWS to Heroku, and I couldn’t be happier. My first full month bill from Amazon was about $75, and $74 of that (99% of the total cost) was for running an instance. Harlan told me about Heroku after he deployed his ForkThis demo on there.
Most of the transition was smooth, but there were a few hiccups on the way. One of them still hasn’t been resolved (one of the plugins is having conflict with PostgresSQL, which is used by Heroku). I will enumerate what I had to go through so that it might be easier for you.
1. Secret YAML files
I have a public GitHub account for deploying on AWS using ec2onrails. Since it’s public and anyone can see it, I had to omit sensitive
files in config directory that contained passwords and keys. It’s easily done by specifying those files in
and listing them in
used by ec2onrails.
I found out that for Heroku, the same can be achieved by creating another branch, including those files, merging with master, and pushing it to Heroku. So, the following lines should do the trick.
git checkout production
[remove those yml files from .gitignore]
git merge master
git push heroku production:master