couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject couchdb commit: updated refs/heads/master to 587646f
Date Mon, 17 Aug 2015 12:56:53 GMT
Repository: couchdb
Updated Branches:
  refs/heads/master 68e83c23b -> 587646f1f


boot haproxy in dev/run


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/587646f1
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/587646f1
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/587646f1

Branch: refs/heads/master
Commit: 587646f1fec6f665f70c97c24f3eef95780b409a
Parents: 68e83c2
Author: Robert Newson <rnewson@apache.org>
Authored: Mon Aug 17 13:56:41 2015 +0100
Committer: Robert Newson <rnewson@apache.org>
Committed: Mon Aug 17 13:56:41 2015 +0100

----------------------------------------------------------------------
 dev/run | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/587646f1/dev/run
----------------------------------------------------------------------
diff --git a/dev/run b/dev/run
index 74c51b0..81993b5 100755
--- a/dev/run
+++ b/dev/run
@@ -31,6 +31,7 @@ from pbkdf2 import pbkdf2_hex
 
 COMMON_SALT = uuid.uuid4().hex
 COMMON_CSRF_SECRET = uuid.uuid4().hex
+HAPROXY_PORT = os.environ.get("HAPROXY_PORT", "5984")
 
 try:
     from urllib import urlopen
@@ -193,6 +194,41 @@ def write_config(ctx, node, env):
             handle.write(content)
 
 
+def find_haproxy():
+    p = sp.Popen(
+        ["which", "haproxy"],
+        stdin=sp.PIPE,
+        stdout=sp.PIPE,
+        stderr=sp.STDOUT
+    )
+    (res, _) = p.communicate()
+    if res.strip():
+        return res.strip()
+    return "/usr/sbin/haproxy"
+
+
+def boot_haproxy(ctx):
+    config = os.path.join(ctx['rootdir'], "rel", "haproxy.cfg")
+    cmd = [
+        find_haproxy(),
+        "-f",
+        config
+    ]
+    logfname = os.path.join(ctx['devdir'], "logs", "haproxy.log")
+    log = open(logfname, "w")
+    env = os.environ.copy()
+    if "HAPROXY_PORT" not in env:
+        env["HAPROXY_PORT"] = HAPROXY_PORT
+    return sp.Popen(
+            " ".join(cmd),
+            shell=True,
+            stdin=sp.PIPE,
+            stdout=log,
+            stderr=sp.STDOUT,
+            env=env
+        )
+
+
 def hack_default_ini(ctx, node, content):
     # Replace log file
     logfile = os.path.join(ctx['devdir'], "logs", "%s.log" % node)
@@ -275,6 +311,7 @@ def kill_processes(ctx):
 def boot_nodes(ctx):
     for node in ctx['nodes']:
         ctx['procs'].append(boot_node(ctx, node))
+    ctx['procs'].append(boot_haproxy(ctx))
 
 
 def ensure_all_nodes_alive(ctx):


Mime
View raw message