Created
January 31, 2012 12:59
-
-
Save yaronp68/1710373 to your computer and use it in GitHub Desktop.
Apache Load Balancer Custom Commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| customCommands ([ | |
| "add-node" : { node, instanceID -> | |
| def proxyConfigFile = new File(context.serviceDirectory + "/install/conf/extra/httpd-proxy-balancer.conf") | |
| def config = proxyConfigFile.text | |
| def modifiedConfig = config.replace("# Generated code - DO NOT MODIFY", "# Generated code - DO NOT MODIFY" + System.getProperty("line.separator") + "BalancerMember " + node + " route=" + instanceID) | |
| proxyConfigFile.text = modifiedConfig | |
| ServiceUtils.killProcess(context.externalProcessId) | |
| }, | |
| "remove-node" : { node, instanceID -> | |
| def proxyConfigFile = new File(context.serviceDirectory + "/install/conf/extra/httpd-proxy-balancer.conf") | |
| def config = proxyConfigFile.text | |
| def modifiedConfig = config.replace("BalancerMember " + node + " route=" + instanceID, "") | |
| proxyConfigFile.text = modifiedConfig | |
| ServiceUtils.killProcess(context.externalProcessId) | |
| } | |
| ]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment