Tune postgres memory usage based on available mem

On standalone gears, use maximum available memory to set parameters.
Tune MySQL parameters via OPENSHIFT_GEAR_MEMORY_MB
Ensure Drupal gears can migrate

This is a redo of f9c1089, which addressed
https://bugzilla.redhat.com/show_bug.cgi?id=1008043 and
https://bugzilla.redhat.com/show_bug.cgi?id=1013673.
Guard against removing innoDB logs
Process postgresql.conf on each cartridge startup

Basically mimicing what MySQL cartridge does.
Difference in ERB template location is taken into account.
Bump up memory for standalone cartridges
Bump MyISAM memory parameters

Based loosely on
http://serverfault.com/questions/354872/best-my-cnf-configuration-for-a-8gb-mysql-server-with-myisam-use-only
Double up memory limits for embedded MySQL cart
Use oo-erb instead of erb
Merge pull request #3835 from BanzaiMan/dev/hasari/c18

Merged by openshift-bot