Makara on heroku
Recently I successfully created a Makara master-slave configuration that works on Heroku. This was not trivial, because of the way Heroku deals with DATABASE_URLS and database.yml files. Apart from that I found a lot of others who were dealing with the same issue, but without a solution.
Therefore I want to write a guide on how to set-up Makara on Heroku. Do you have any suggestions as to where this guide should live (WIKI, somewhere in the Readme)? I suppose I could just write a blog post about it, but it's probably more useful if all documentation regarding this gem lives somewhat on the same spot.
Please let me know whether you think such a guide should exist and where it should live.
Seems like any guide in any place (even on this issue) would help bring exposure when searching.
(I ended up here from a google search "makara on heroku")
I think a wiki page would be great, I find it more readable than a Readme. Besides, I'm really interested in that kind of configuration (I'm trying to do it right now). Please let me know if you made it. :-)
I had the same problem, and my solution was in the readme.
Important: Do NOT use ENV['DATABASE_URL'], as it inteferes with the the database configuration initialization and may cause Makara not to complete the configuration. For the moment, it is easier to use a different ENV variable than to hook into the database initialization in all the supported Rails.
I rename my DATABASE_URL in DATABASE_MASTER_URL, and I use DATABASE_MASTER_URL in the database.yml file.
Enjoy
@arjan0307 I'm looking forward to read your guide, I'm having trouble to run makara on heroku (not mentioning migrations without a DATABASE_URL environment variable...)
@francois-tilkee I created a gist with an example of a database.yml and .profile file that I used to get it to work.
https://gist.github.com/arjan0307/e1a2a810604b5ba8fdf49782f60e5363
You can specify a different URL than DATABASE_URL on heroku, as you can see in the gist.
You may need to recreate your databases on Heroku so that they have the correct urls (MASTER_URL and SLAVE_URL).
You can do this by running: heroku addons:create heroku-postgresql:<PLANNAME> --as MASTER
Thanks for sharing !
Hi @arjan0307 --- will you add a new heroku.md file and a link from the readme with what you guys are finding successful in that environment?
I'm also getting stuck here. Heroku seems to be overwritting the adapter I've chosen. It's using postgresql instead of postgresql_makara.
@arjan0307 does your workaround take care of that?
Edit: I was able to solve it using the configuration suggested here: https://github.com/ankane/distribute_reads#how-to-use.
Have anyone successfully set up makara with PG Bouncher buildpack on heroku?
I can only get pgbouncher to work on my read slaves, and not the master, as I run into these errors.
[Makara] No connections are available in the master pool
@henrikholm89 did you solve that one?
I'm encountering same issue without pgbouncer. I just get 500's when doing POSTS and I got the same error.