stratos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From im...@apache.org
Subject git commit: Changed frontend bind ip to haproxy private ip, added new configuration & updated install.txt
Date Wed, 05 Feb 2014 12:25:42 GMT
Updated Branches:
  refs/heads/master f44be6042 -> 9b1bd2c51


Changed frontend bind ip to haproxy private ip, added new configuration & updated install.txt


Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/9b1bd2c5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/9b1bd2c5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/9b1bd2c5

Branch: refs/heads/master
Commit: 9b1bd2c514131ff963143d8a36627221178cd104
Parents: f44be60
Author: Imesh Gunaratne <imesh@apache.org>
Authored: Wed Feb 5 07:25:29 2014 -0500
Committer: Imesh Gunaratne <imesh@apache.org>
Committed: Wed Feb 5 07:25:29 2014 -0500

----------------------------------------------------------------------
 .../load-balancer/haproxy-extension/INSTALL.txt | 19 ++++++++---
 .../src/main/bin/haproxy-extension.sh           |  7 ++--
 .../stratos/haproxy/extension/Constants.java    |  1 +
 .../haproxy/extension/HAProxyConfigWriter.java  | 36 +++++++++-----------
 .../haproxy/extension/HAProxyContext.java       |  8 +++++
 5 files changed, 45 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/9b1bd2c5/extensions/load-balancer/haproxy-extension/INSTALL.txt
----------------------------------------------------------------------
diff --git a/extensions/load-balancer/haproxy-extension/INSTALL.txt b/extensions/load-balancer/haproxy-extension/INSTALL.txt
index 5df5c5a..fad3434 100644
--- a/extensions/load-balancer/haproxy-extension/INSTALL.txt
+++ b/extensions/load-balancer/haproxy-extension/INSTALL.txt
@@ -11,14 +11,25 @@ below steps to proceed with the installation:
 2. Extract apache-stratos-haproxy-extension-4.0.0-SNAPSHOT-bin.zip to a desired location:
<haproxy-extension-home>.
 
 3. Open <haproxy-extension-home>/bin/haproxy-extension.sh file in a text editor and
update following system properties:
-   -Dexecutable.file.path=<haproxy-home>/haproxy        # HAProxy executable file path
-   -Dthrift.receiver.ip=localhost                       # CEP IP Address
-   -Dthrift.receiver.port=7615                          # CEP Port
+
+   # Define haproxy host private ip address:
+   -Dhaproxy.private.ip=127.0.0.1
+
+   # Define the haproxy executable file path:
+   -Dexecutable.file.path=<haproxy-home>/haproxy
+
+   # Enable/disable cep statistics publisher:
+   -Dcep.stats.publisher.enabled=false
+
+   # If cep statistics publisher is enabled define the following properties:
+   -Dthrift.receiver.ip=127.0.0.1
+   -Dthrift.receiver.port=7615
+   -Dnetwork.partition.id=network-partition-1
 
 4. Open <haproxy-extension-home>/conf/jndi.properties file in a text editor and update
message broker information:
    connectionfactory.topicConnectionfactory=amqp://admin:admin@carbon/carbon?brokerlist='tcp://<message-broker-ip>:<message-broker-port>'
 
-5. Run <haproxy-extension-home>/bin/haproxy-extension.sh
+5. Run <haproxy-extension-home>/bin/haproxy-extension.sh as the root user.
 
 
 Thank you for using Apache Stratos!

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/9b1bd2c5/extensions/load-balancer/haproxy-extension/src/main/bin/haproxy-extension.sh
----------------------------------------------------------------------
diff --git a/extensions/load-balancer/haproxy-extension/src/main/bin/haproxy-extension.sh
b/extensions/load-balancer/haproxy-extension/src/main/bin/haproxy-extension.sh
index 82d4f57..717b6e7 100755
--- a/extensions/load-balancer/haproxy-extension/src/main/bin/haproxy-extension.sh
+++ b/extensions/load-balancer/haproxy-extension/src/main/bin/haproxy-extension.sh
@@ -24,8 +24,9 @@ echo "Starting haproxy extension..."
 script_path="$( cd -P "$( dirname "$SOURCE" )" && pwd )/`dirname $0`"
 lib_path=${script_path}/../lib/
 class_path=`echo ${lib_path}/*.jar | tr ' ' ':'`
-properties="-Djndi.properties.dir=${script_path}/../conf
+properties="-Dhaproxy.private.ip=127.0.0.1
             -Dexecutable.file.path=haproxy
+            -Djndi.properties.dir=${script_path}/../conf
             -Dtemplates.path=${script_path}/../templates
             -Dtemplates.name=haproxy.cfg.template
             -Dscripts.path=${script_path}/../scripts
@@ -35,9 +36,9 @@ properties="-Djndi.properties.dir=${script_path}/../conf
             -Djavax.net.ssl.trustStore=${script_path}/../security/client-truststore.jks
             -Djavax.net.ssl.trustStorePassword=wso2carbon
             -Dcep.stats.publisher.enabled=false
-            -Dthrift.receiver.ip=localhost
+            -Dthrift.receiver.ip=127.0.0.1
             -Dthrift.receiver.port=7615
-            -Dnetwork.partition.id=
+            -Dnetwork.partition.id=network-partition-1
             -Dstratos.messaging.topology.member.filter="
 
 # Uncomment below line to enable remote debugging

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/9b1bd2c5/extensions/load-balancer/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/Constants.java
----------------------------------------------------------------------
diff --git a/extensions/load-balancer/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/Constants.java
b/extensions/load-balancer/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/Constants.java
index fe9783c..1167172 100644
--- a/extensions/load-balancer/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/Constants.java
+++ b/extensions/load-balancer/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/Constants.java
@@ -23,6 +23,7 @@ package org.apache.stratos.haproxy.extension;
  * HA proxy extension constants.
  */
 public class Constants {
+    public static final String HAPROXY_PRIVATE_IP = "haproxy.private.ip";
     public static final String EXECUTABLE_FILE_PATH = "executable.file.path";
     public static final String TEMPLATES_PATH = "templates.path";
     public static final String TEMPLATES_NAME = "templates.name";

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/9b1bd2c5/extensions/load-balancer/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/HAProxyConfigWriter.java
----------------------------------------------------------------------
diff --git a/extensions/load-balancer/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/HAProxyConfigWriter.java
b/extensions/load-balancer/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/HAProxyConfigWriter.java
index fc20234..db28b0e 100644
--- a/extensions/load-balancer/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/HAProxyConfigWriter.java
+++ b/extensions/load-balancer/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/HAProxyConfigWriter.java
@@ -66,26 +66,24 @@ public class HAProxyConfigWriter {
                 }
 
                 for (Port port : service.getPorts()) {
-                    for(String hostName : cluster.getHostNames()) {
-                        String frontendId = cluster.getClusterId() + "-host-" + hostName
+ "-proxy-" + port.getProxy();
-                        String backendId = frontendId + "-members";
-
-                        // Frontend block
-                        frontendBackendCollection.append("frontend ").append(frontendId).append(NEW_LINE);
-                        frontendBackendCollection.append("\tbind ").append(hostName).append(":").append(port.getProxy()).append(NEW_LINE);
-                        frontendBackendCollection.append("\tmode ").append(port.getProtocol()).append(NEW_LINE);
-                        frontendBackendCollection.append("\tdefault_backend ").append(backendId).append(NEW_LINE);
-                        frontendBackendCollection.append(NEW_LINE);
-
-                        // Backend block
-                        frontendBackendCollection.append("backend ").append(backendId).append(NEW_LINE);
-                        frontendBackendCollection.append("\tmode ").append(port.getProtocol()).append(NEW_LINE);
-                        for (Member member : cluster.getMembers()) {
-                            frontendBackendCollection.append("\tserver ").append(member.getMemberId()).append("
")
-                                    .append(member.getMemberIp()).append(":").append(port.getValue()).append(NEW_LINE);
-                        }
-                        frontendBackendCollection.append(NEW_LINE);
+                    String frontendId = cluster.getClusterId() + "-host-" + HAProxyContext.getInstance().getHAProxyPrivateIp()
+ "-proxy-" + port.getProxy();
+                    String backendId = frontendId + "-members";
+
+                    // Frontend block
+                    frontendBackendCollection.append("frontend ").append(frontendId).append(NEW_LINE);
+                    frontendBackendCollection.append("\tbind ").append(HAProxyContext.getInstance().getHAProxyPrivateIp()).append(":").append(port.getProxy()).append(NEW_LINE);
+                    frontendBackendCollection.append("\tmode ").append(port.getProtocol()).append(NEW_LINE);
+                    frontendBackendCollection.append("\tdefault_backend ").append(backendId).append(NEW_LINE);
+                    frontendBackendCollection.append(NEW_LINE);
+
+                    // Backend block
+                    frontendBackendCollection.append("backend ").append(backendId).append(NEW_LINE);
+                    frontendBackendCollection.append("\tmode ").append(port.getProtocol()).append(NEW_LINE);
+                    for (Member member : cluster.getMembers()) {
+                        frontendBackendCollection.append("\tserver ").append(member.getMemberId()).append("
")
+                                .append(member.getMemberIp()).append(":").append(port.getValue()).append(NEW_LINE);
                     }
+                    frontendBackendCollection.append(NEW_LINE);
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/9b1bd2c5/extensions/load-balancer/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/HAProxyContext.java
----------------------------------------------------------------------
diff --git a/extensions/load-balancer/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/HAProxyContext.java
b/extensions/load-balancer/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/HAProxyContext.java
index bd2bf79..c835f5d 100644
--- a/extensions/load-balancer/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/HAProxyContext.java
+++ b/extensions/load-balancer/haproxy-extension/src/main/java/org/apache/stratos/haproxy/extension/HAProxyContext.java
@@ -30,6 +30,7 @@ public class HAProxyContext {
     private static final Log log = LogFactory.getLog(HAProxyContext.class);
     private static volatile HAProxyContext context;
 
+    private String haProxyPrivateIp;
     private String executableFilePath;
     private String templatePath;
     private String templateName;
@@ -42,6 +43,7 @@ public class HAProxyContext {
     private String networkPartitionId;
 
     private HAProxyContext() {
+        this.haProxyPrivateIp = System.getProperty(Constants.HAPROXY_PRIVATE_IP);
         this.executableFilePath = System.getProperty(Constants.EXECUTABLE_FILE_PATH);
         this.templatePath = System.getProperty(Constants.TEMPLATES_PATH);
         this.templateName = System.getProperty(Constants.TEMPLATES_NAME);
@@ -54,6 +56,7 @@ public class HAProxyContext {
         this.networkPartitionId = System.getProperty(Constants.NETWORK_PARTITION_ID);
 
         if (log.isDebugEnabled()) {
+            log.debug(Constants.HAPROXY_PRIVATE_IP + " = " + haProxyPrivateIp);
             log.debug(Constants.EXECUTABLE_FILE_PATH + " = " + executableFilePath);
             log.debug(Constants.TEMPLATES_PATH + " = " + templatePath);
             log.debug(Constants.TEMPLATES_NAME + " = " + templateName);
@@ -79,6 +82,7 @@ public class HAProxyContext {
     }
 
     public void validate() {
+        validateSystemProperty(Constants.HAPROXY_PRIVATE_IP);
         validateSystemProperty(Constants.EXECUTABLE_FILE_PATH);
         validateSystemProperty(Constants.TEMPLATES_PATH);
         validateSystemProperty(Constants.TEMPLATES_NAME);
@@ -101,6 +105,10 @@ public class HAProxyContext {
         }
     }
 
+    public String getHAProxyPrivateIp() {
+        return haProxyPrivateIp;
+    }
+
     public String getExecutableFilePath() {
         return executableFilePath;
     }


Mime
View raw message