From c43c8816fc0e8d51c582a350c45d74370fa2fd1b Mon Sep 17 00:00:00 2001 From: david raistrick Date: Fri, 7 Sep 2012 14:48:50 -0400 Subject: [PATCH 1/2] basic example tree for the supported directory/file structure --- bin/haproxy_join | 0 examples/README | 7 +++++++ examples/build.sh | 6 ++++++ examples/haproxy/conf/backend.d/2backendd.cfg | 1 + examples/haproxy/conf/backend.d/backendd.cfg | 1 + examples/haproxy/conf/defaults.cfg | 1 + examples/haproxy/conf/frontend.cfg | 1 + examples/haproxy/conf/frontend.d/2frontendd.cfg | 1 + examples/haproxy/conf/frontend.d/frontendd.cfg | 1 + examples/haproxy/conf/global.cfg | 1 + examples/haproxy/conf/haproxy.cfg | 0 examples/haproxy/haproxy.cfg | 7 +++++++ 12 files changed, 27 insertions(+) mode change 100644 => 100755 bin/haproxy_join create mode 100644 examples/README create mode 100755 examples/build.sh create mode 100644 examples/haproxy/conf/backend.d/2backendd.cfg create mode 100644 examples/haproxy/conf/backend.d/backendd.cfg create mode 100644 examples/haproxy/conf/defaults.cfg create mode 100644 examples/haproxy/conf/frontend.cfg create mode 100644 examples/haproxy/conf/frontend.d/2frontendd.cfg create mode 100644 examples/haproxy/conf/frontend.d/frontendd.cfg create mode 100644 examples/haproxy/conf/global.cfg create mode 100644 examples/haproxy/conf/haproxy.cfg create mode 100644 examples/haproxy/haproxy.cfg diff --git a/bin/haproxy_join b/bin/haproxy_join old mode 100644 new mode 100755 diff --git a/examples/README b/examples/README new file mode 100644 index 0000000..aef8b15 --- /dev/null +++ b/examples/README @@ -0,0 +1,7 @@ + +example directory and file tree layout so you can see (and copy for your +own use) the supported structure + +to create the output file (example/haproxy/conf/haproxy.cfg) run: +sh build.sh + diff --git a/examples/build.sh b/examples/build.sh new file mode 100755 index 0000000..9d8a9e3 --- /dev/null +++ b/examples/build.sh @@ -0,0 +1,6 @@ +basedir=$(dirname $0) +chmod +x $basedir/../bin/haproxy_join +$basedir/../bin/haproxy_join haproxy.cfg haproxy +echo "output file is:" +ls -l haproxy/haproxy.cfg + diff --git a/examples/haproxy/conf/backend.d/2backendd.cfg b/examples/haproxy/conf/backend.d/2backendd.cfg new file mode 100644 index 0000000..1c77946 --- /dev/null +++ b/examples/haproxy/conf/backend.d/2backendd.cfg @@ -0,0 +1 @@ +#2backendd diff --git a/examples/haproxy/conf/backend.d/backendd.cfg b/examples/haproxy/conf/backend.d/backendd.cfg new file mode 100644 index 0000000..f8f0e4a --- /dev/null +++ b/examples/haproxy/conf/backend.d/backendd.cfg @@ -0,0 +1 @@ +#backendd diff --git a/examples/haproxy/conf/defaults.cfg b/examples/haproxy/conf/defaults.cfg new file mode 100644 index 0000000..61f9d7a --- /dev/null +++ b/examples/haproxy/conf/defaults.cfg @@ -0,0 +1 @@ +#defaults diff --git a/examples/haproxy/conf/frontend.cfg b/examples/haproxy/conf/frontend.cfg new file mode 100644 index 0000000..a483a66 --- /dev/null +++ b/examples/haproxy/conf/frontend.cfg @@ -0,0 +1 @@ +#frontend diff --git a/examples/haproxy/conf/frontend.d/2frontendd.cfg b/examples/haproxy/conf/frontend.d/2frontendd.cfg new file mode 100644 index 0000000..54115e5 --- /dev/null +++ b/examples/haproxy/conf/frontend.d/2frontendd.cfg @@ -0,0 +1 @@ +#2frontendd diff --git a/examples/haproxy/conf/frontend.d/frontendd.cfg b/examples/haproxy/conf/frontend.d/frontendd.cfg new file mode 100644 index 0000000..60f4adf --- /dev/null +++ b/examples/haproxy/conf/frontend.d/frontendd.cfg @@ -0,0 +1 @@ +#frontendd diff --git a/examples/haproxy/conf/global.cfg b/examples/haproxy/conf/global.cfg new file mode 100644 index 0000000..2a1f92c --- /dev/null +++ b/examples/haproxy/conf/global.cfg @@ -0,0 +1 @@ +#global diff --git a/examples/haproxy/conf/haproxy.cfg b/examples/haproxy/conf/haproxy.cfg new file mode 100644 index 0000000..e69de29 diff --git a/examples/haproxy/haproxy.cfg b/examples/haproxy/haproxy.cfg new file mode 100644 index 0000000..cbb9813 --- /dev/null +++ b/examples/haproxy/haproxy.cfg @@ -0,0 +1,7 @@ +#global +#defaults +#frontend +#frontendd +#2frontendd +#backendd +#2backendd From 0a9a16d0c0a20d2af00270fabf58bc904adf89cb Mon Sep 17 00:00:00 2001 From: david raistrick Date: Fri, 7 Sep 2012 14:53:43 -0400 Subject: [PATCH 2/2] update readme to indicate required v optional --- README | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README b/README index a35b4b7..2892926 100644 --- a/README +++ b/README @@ -6,11 +6,11 @@ Details: This script accepts a filename (FILE_NAME) as the first arg and a path (HAPROXY_PATH) as the second. It expects the haproxy files/directories to be located as follows: -HAPROXY_PATH/conf/global.cfg (file) -HAPROXY_PATH/conf/defaults.cfg (file) -HAPROXY_PATH/conf/frontend.cfg (file) -HAPROXY_PATH/conf/frontend.d (dir of frontend configs) -HAPROXY_PATH/conf/backend.d (dir backend configs) +HAPROXY_PATH/conf/global.cfg (file - required) +HAPROXY_PATH/conf/defaults.cfg (file - required) +HAPROXY_PATH/conf/frontend.cfg (file - required) +HAPROXY_PATH/conf/frontend.d (dir of frontend configs - optional) +HAPROXY_PATH/conf/backend.d (dir backend configs - optional) The script will concatenate these files together to in the appropriate order to create a single large haproxy configuration at HAPROXY_PATH/FILE_NAME. Also note that under the frontend.d and backend.d the script only picks up files with a ".cfg" extension. It wil also attempt to create a backup of the already joined config file.