Search code examples
openshifthaproxy

Can I tweak Openshift's haproxy.cfg using a file in my scalable app's git repository?


I would like to maintain some haproxy.cfg customizations for my scalable OpenShift application in git, and have Openshift pick up and use my settings on deployment.

Is this possible?

I know that Openshift generates the haproxy settings in that file. Ideally I would be able to change the httpchk url or disable the public haproxy-status page, and have Openshift merge my config with the server-provided settings.


Solution

  • I know the question is a bit old, but maybe it will help someone else. You can use rhc scp command to download and upload any file to your main gear:

    • download the file from your gear: rhc scp APPNAME download . haproxy/conf/haproxy.cfg

    • edit it

    • upload the file back to your gear: rhc scp APPNAME upload haproxy.cfg haproxy/conf/haproxy.cfg

    You can also:

    • add your haproxy configuration file to your git repo (e.g. conf/haproxy.cfg)
    • add an action hook script to your .openshift/action_hooks git directory (e.g. pre_reload, pre_restart) like so:
      #!/bin/bash
      cp $OPENSHIFT_REPO_DIR/conf/haproxy.cfg ~/haproxy/conf/haproxy.cfg
      
    • Don't forget to make it executable (git update-index --chmod=+x .openshift/action_hooks/*)