You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by kx...@apache.org on 2015/09/28 16:49:37 UTC
[08/39] couchdb commit: updated refs/heads/developer-preview-2.0 to
3ac3db6
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/developer-preview-2.0
Commit: 587646f1fec6f665f70c97c24f3eef95780b409a
Parents: 68e83c2
Author: Robert Newson <rn...@apache.org>
Authored: Mon Aug 17 13:56:41 2015 +0100
Committer: Robert Newson <rn...@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):