diff options
Diffstat (limited to 'charms/trusty/zookeeper')
36 files changed, 680 insertions, 0 deletions
diff --git a/charms/trusty/zookeeper/.bzr/README b/charms/trusty/zookeeper/.bzr/README new file mode 100644 index 0000000..f82dc1c --- /dev/null +++ b/charms/trusty/zookeeper/.bzr/README @@ -0,0 +1,3 @@ +This is a Bazaar control directory. +Do not change any files in this directory. +See http://bazaar.canonical.com/ for more information about Bazaar. diff --git a/charms/trusty/zookeeper/.bzr/branch-format b/charms/trusty/zookeeper/.bzr/branch-format new file mode 100644 index 0000000..9eb09b7 --- /dev/null +++ b/charms/trusty/zookeeper/.bzr/branch-format @@ -0,0 +1 @@ +Bazaar-NG meta directory, format 1 diff --git a/charms/trusty/zookeeper/.bzr/branch/branch.conf b/charms/trusty/zookeeper/.bzr/branch/branch.conf new file mode 100644 index 0000000..01ebfba --- /dev/null +++ b/charms/trusty/zookeeper/.bzr/branch/branch.conf @@ -0,0 +1 @@ +parent_location = http://bazaar.launchpad.net/~charmers/charms/trusty/zookeeper/trunk/ diff --git a/charms/trusty/zookeeper/.bzr/branch/format b/charms/trusty/zookeeper/.bzr/branch/format new file mode 100644 index 0000000..dc392f4 --- /dev/null +++ b/charms/trusty/zookeeper/.bzr/branch/format @@ -0,0 +1 @@ +Bazaar Branch Format 7 (needs bzr 1.6) diff --git a/charms/trusty/zookeeper/.bzr/branch/last-revision b/charms/trusty/zookeeper/.bzr/branch/last-revision new file mode 100644 index 0000000..8c28e96 --- /dev/null +++ b/charms/trusty/zookeeper/.bzr/branch/last-revision @@ -0,0 +1 @@ +13 chuck@dasroot.net-20141031214845-9yvqu184ifre9jp4 diff --git a/charms/trusty/zookeeper/.bzr/branch/tags b/charms/trusty/zookeeper/.bzr/branch/tags new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/charms/trusty/zookeeper/.bzr/branch/tags diff --git a/charms/trusty/zookeeper/.bzr/checkout/conflicts b/charms/trusty/zookeeper/.bzr/checkout/conflicts new file mode 100644 index 0000000..0dc2d3a --- /dev/null +++ b/charms/trusty/zookeeper/.bzr/checkout/conflicts @@ -0,0 +1 @@ +BZR conflict list format 1 diff --git a/charms/trusty/zookeeper/.bzr/checkout/dirstate b/charms/trusty/zookeeper/.bzr/checkout/dirstate Binary files differnew file mode 100644 index 0000000..d9658e8 --- /dev/null +++ b/charms/trusty/zookeeper/.bzr/checkout/dirstate diff --git a/charms/trusty/zookeeper/.bzr/checkout/format b/charms/trusty/zookeeper/.bzr/checkout/format new file mode 100644 index 0000000..e0261c7 --- /dev/null +++ b/charms/trusty/zookeeper/.bzr/checkout/format @@ -0,0 +1 @@ +Bazaar Working Tree Format 6 (bzr 1.14) diff --git a/charms/trusty/zookeeper/.bzr/checkout/views b/charms/trusty/zookeeper/.bzr/checkout/views new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/charms/trusty/zookeeper/.bzr/checkout/views diff --git a/charms/trusty/zookeeper/.bzr/repository/format b/charms/trusty/zookeeper/.bzr/repository/format new file mode 100644 index 0000000..b200528 --- /dev/null +++ b/charms/trusty/zookeeper/.bzr/repository/format @@ -0,0 +1 @@ +Bazaar repository format 2a (needs bzr 1.16 or later) diff --git a/charms/trusty/zookeeper/.bzr/repository/indices/3c2f9bccb787d7e4c58ceea02b4606c0.cix b/charms/trusty/zookeeper/.bzr/repository/indices/3c2f9bccb787d7e4c58ceea02b4606c0.cix Binary files differnew file mode 100644 index 0000000..8fe8b04 --- /dev/null +++ b/charms/trusty/zookeeper/.bzr/repository/indices/3c2f9bccb787d7e4c58ceea02b4606c0.cix diff --git a/charms/trusty/zookeeper/.bzr/repository/indices/3c2f9bccb787d7e4c58ceea02b4606c0.iix b/charms/trusty/zookeeper/.bzr/repository/indices/3c2f9bccb787d7e4c58ceea02b4606c0.iix Binary files differnew file mode 100644 index 0000000..5f4e20b --- /dev/null +++ b/charms/trusty/zookeeper/.bzr/repository/indices/3c2f9bccb787d7e4c58ceea02b4606c0.iix diff --git a/charms/trusty/zookeeper/.bzr/repository/indices/3c2f9bccb787d7e4c58ceea02b4606c0.rix b/charms/trusty/zookeeper/.bzr/repository/indices/3c2f9bccb787d7e4c58ceea02b4606c0.rix Binary files differnew file mode 100644 index 0000000..10e1ba3 --- /dev/null +++ b/charms/trusty/zookeeper/.bzr/repository/indices/3c2f9bccb787d7e4c58ceea02b4606c0.rix diff --git a/charms/trusty/zookeeper/.bzr/repository/indices/3c2f9bccb787d7e4c58ceea02b4606c0.six b/charms/trusty/zookeeper/.bzr/repository/indices/3c2f9bccb787d7e4c58ceea02b4606c0.six new file mode 100644 index 0000000..a2afde6 --- /dev/null +++ b/charms/trusty/zookeeper/.bzr/repository/indices/3c2f9bccb787d7e4c58ceea02b4606c0.six @@ -0,0 +1,5 @@ +B+Tree Graph Index 2 +node_ref_lists=0 +key_elements=1 +len=0 +row_lengths= diff --git a/charms/trusty/zookeeper/.bzr/repository/indices/3c2f9bccb787d7e4c58ceea02b4606c0.tix b/charms/trusty/zookeeper/.bzr/repository/indices/3c2f9bccb787d7e4c58ceea02b4606c0.tix Binary files differnew file mode 100644 index 0000000..3fc4172 --- /dev/null +++ b/charms/trusty/zookeeper/.bzr/repository/indices/3c2f9bccb787d7e4c58ceea02b4606c0.tix diff --git a/charms/trusty/zookeeper/.bzr/repository/pack-names b/charms/trusty/zookeeper/.bzr/repository/pack-names new file mode 100644 index 0000000..062d941 --- /dev/null +++ b/charms/trusty/zookeeper/.bzr/repository/pack-names @@ -0,0 +1,7 @@ +B+Tree Graph Index 2 +node_ref_lists=0 +key_elements=1 +len=1 +row_lengths=1 +xœÁ±€ @j¦Èñ?Cb¨,,lÜÞ»÷{ò¼s®ºG[Ã#œÆ‹Ùã°ÈœÚ¼CZ +H†lj6!Pnj¡
\ No newline at end of file diff --git a/charms/trusty/zookeeper/.bzr/repository/packs/3c2f9bccb787d7e4c58ceea02b4606c0.pack b/charms/trusty/zookeeper/.bzr/repository/packs/3c2f9bccb787d7e4c58ceea02b4606c0.pack Binary files differnew file mode 100644 index 0000000..6ae57de --- /dev/null +++ b/charms/trusty/zookeeper/.bzr/repository/packs/3c2f9bccb787d7e4c58ceea02b4606c0.pack diff --git a/charms/trusty/zookeeper/README.md b/charms/trusty/zookeeper/README.md new file mode 100644 index 0000000..7842422 --- /dev/null +++ b/charms/trusty/zookeeper/README.md @@ -0,0 +1,10 @@ +ZooKeeper is a centralized service for maintaining configuration information, +naming, providing distributed synchronization, and providing group services. +All of these kinds of services are used in some form or another by distributed +applications. Each time they are implemented there is a lot of work that goes +into fixing the bugs and race conditions that are inevitable. Because of the +difficulty of implementing these kinds of services, applications initially +usually skimp on them ,which make them brittle in the presence of change and +difficult to manage. Even when done correctly, different implementations of +these services lead to management complexity when the applications are +deployed. diff --git a/charms/trusty/zookeeper/config.yaml b/charms/trusty/zookeeper/config.yaml new file mode 100644 index 0000000..ecb02ac --- /dev/null +++ b/charms/trusty/zookeeper/config.yaml @@ -0,0 +1,39 @@ +options: + zk-port: + type: int + default: 2181 + description: ZooKeeper Client Access Port + source: + type: string + default: archive + description: | + Location and packages to install zookeeper: + . + * archive: Install using the zookeeperd package from the main + Ubuntu Archive. + * dev: Install using the hadoop-zookeeper-server package from + ppa:hadoop-ubuntu/dev. + * testing: Install using the hadoop-zookeeper-server package from + ppa:hadoop-ubuntu/testing. + * stable: Install using the hadoop-zookeeper-server package from + ppa:hadoop-ubuntu/stable. + . + The packages provides in the hadoop-ubuntu team PPA's are based + directly on upstream ZooKeeper releases but are not fully built from + source. + default_weight: + type: int + default: 1 + description: default weight + default_group: + type: int + default: 0 + description: default group + external_server: + type: string + default: "" + description: | + Extra servers ( external to juju ) to add + to zoo.cnf. Format should be id:group:weight:host:port:port + group can be defined as "default" as opposed to a number to use + the default_group defined above diff --git a/charms/trusty/zookeeper/copyright b/charms/trusty/zookeeper/copyright new file mode 100644 index 0000000..a6ddcf8 --- /dev/null +++ b/charms/trusty/zookeeper/copyright @@ -0,0 +1,17 @@ +Format: http://dep.debian.net/deps/dep5/ + +Files: * +Copyright: Copyright 2012, Canonical Ltd., All Rights Reserved. +License: GPL-3 + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + . + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + . + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. diff --git a/charms/trusty/zookeeper/hooks/install b/charms/trusty/zookeeper/hooks/install new file mode 120000 index 0000000..91a1891 --- /dev/null +++ b/charms/trusty/zookeeper/hooks/install @@ -0,0 +1 @@ +zookeeper-common
\ No newline at end of file diff --git a/charms/trusty/zookeeper/hooks/quorum-relation-changed b/charms/trusty/zookeeper/hooks/quorum-relation-changed new file mode 120000 index 0000000..91a1891 --- /dev/null +++ b/charms/trusty/zookeeper/hooks/quorum-relation-changed @@ -0,0 +1 @@ +zookeeper-common
\ No newline at end of file diff --git a/charms/trusty/zookeeper/hooks/quorum-relation-departed b/charms/trusty/zookeeper/hooks/quorum-relation-departed new file mode 120000 index 0000000..91a1891 --- /dev/null +++ b/charms/trusty/zookeeper/hooks/quorum-relation-departed @@ -0,0 +1 @@ +zookeeper-common
\ No newline at end of file diff --git a/charms/trusty/zookeeper/hooks/quorum-relation-joined b/charms/trusty/zookeeper/hooks/quorum-relation-joined new file mode 120000 index 0000000..91a1891 --- /dev/null +++ b/charms/trusty/zookeeper/hooks/quorum-relation-joined @@ -0,0 +1 @@ +zookeeper-common
\ No newline at end of file diff --git a/charms/trusty/zookeeper/hooks/start b/charms/trusty/zookeeper/hooks/start new file mode 120000 index 0000000..91a1891 --- /dev/null +++ b/charms/trusty/zookeeper/hooks/start @@ -0,0 +1 @@ +zookeeper-common
\ No newline at end of file diff --git a/charms/trusty/zookeeper/hooks/stop b/charms/trusty/zookeeper/hooks/stop new file mode 120000 index 0000000..91a1891 --- /dev/null +++ b/charms/trusty/zookeeper/hooks/stop @@ -0,0 +1 @@ +zookeeper-common
\ No newline at end of file diff --git a/charms/trusty/zookeeper/hooks/upgrade-charm b/charms/trusty/zookeeper/hooks/upgrade-charm new file mode 120000 index 0000000..91a1891 --- /dev/null +++ b/charms/trusty/zookeeper/hooks/upgrade-charm @@ -0,0 +1 @@ +zookeeper-common
\ No newline at end of file diff --git a/charms/trusty/zookeeper/hooks/zookeeper-common b/charms/trusty/zookeeper/hooks/zookeeper-common new file mode 100755 index 0000000..578d856 --- /dev/null +++ b/charms/trusty/zookeeper/hooks/zookeeper-common @@ -0,0 +1,216 @@ +#!/bin/bash + +set -eux + +# By default we install from the main Ubuntu archive. +source=`config-get source` +case $source in + archive) + juju-log "Configuring zookeeper using the Ubuntu archive packages..." + zk_package="zookeeperd" + zk_service="zookeeper" + zk_conf="/etc/zookeeper/conf/zoo.cfg" + zk_myid="/etc/zookeeper/conf/myid" + zk_install="/etc/init/zookeeper.conf" + ;; + dev|testing|stable) + juju-log "Configuring zookeeper using the Hadoop Ubuntu Team PPA..." + zk_package="hadoop-zookeeper-server" + zk_service="hadoop-zookeeper-server" + zk_conf="/etc/hadoop-zookeeper/conf/zoo.cfg" + zk_myid="/etc/hadoop-zookeeper/conf/myid" + zk_install="/etc/init/hadoop-zookeeper-server.conf" + ;; + *) + juju-log "Unsupported source..." + exit 1 + ;; +esac + +base_packages="ntp" +zk_port="`config-get zk-port`" + +configure_sources () { + source=`config-get source` + case $source in + archive) + juju-log "Configuring zookeeper using the Ubuntu archive packages..." + ;; + dev|testing|stable) + juju-log "Configuring zookeeper using the Hadoop Ubuntu Team PPA..." + add-apt-repository ppa:hadoop-ubuntu/$source + apt-get update + ;; + *) + juju-log "Unsupported source..." + exit 1 + ;; + esac +} + +install_zookeeper () { + juju-log "Installing ZooKeeper..." + apt-get install -y $zk_package $base_packages +} + +configure_zookeeper () { + juju-log "Purging any standalone configuration..." + # Purge + sed -i "/^server./d" $zk_conf + sed -i "/^weight./d" $zk_conf + sed -i "/^group./d" $zk_conf + juju-log "Generating unique ID for this instance..." + unit_no=`echo $JUJU_UNIT_NAME | cut -d / -f 2` + default_weight=`config-get default_weight` + default_group=`config-get default_group` + echo $unit_no > $zk_myid + juju-log "Adding this unit to the quorum..." + hostname=`unit-get private-address` + # Add the config + echo "server.${unit_no}=${hostname}:2888:3888" >> $zk_conf + echo "group.${default_group}=${unit_no}" >> $zk_conf + echo "weight.${unit_no}=${default_weight}" >> $zk_conf + # Expose port as required + open-port $zk_port +} + +# Service Control Commands +restart_zookeeper () { + juju-log "Restarting ZooKeeper" + service $zk_service status && service $zk_service restart || : +} + +start_zookeeper() { + juju-log "Starting ZooKeeper" + service $zk_service status || service $zk_service start +} + +stop_zookeeper() { + juju-log "Stopping ZooKeeper" + service $zk_service stop || : +} + +update_group() { + member_id=$1 + [ -z ${member_id} ] && return 0 + default_group=`config-get default_group` + group_arr=( $(grep "group.${default_group}" ${zk_conf} | awk -F'=' '{ print $2 }' | tr ":" "\n") ) + member_found="no" + for member in "${group_arr[@]}" + do + [ "${member_id}" == "${member}" ] && member_found="yes" + done + [ "${member_found}" == "no" ] && group_arr=("${group_arr[@]}" "${member_id}") + retVal="group.${default_group}=${group_arr[@]}" + retVal=`echo ${retVal} | tr " " ":"` + sed -i "s/^group.${default_group}.*/${retVal}/" ${zk_conf} + sed -i "s/^group.${default_group}=:/group.${default_group}=/" ${zk_conf} +} + +update_external_server() { + # Add extra server ( if configured ) + external_server=`config-get external_server` + if [[ "${external_server}" != "" ]]; then + external_id=`echo ${external_server} | cut -d : -f 1` + external_group=`echo ${external_server} | cut -d : -f 2` + if [[ "${external_group}" == "default" ]]; then + external_group=`config-get default_group` + fi + external_weight=`echo ${external_server} | cut -d : -f 3` + external_host=`echo ${external_server} | cut -d : -f 4` + external_port1=`echo ${external_server} | cut -d : -f 5` + external_port2=`echo ${external_server} | cut -d : -f 6` + sed -i "/^server.${external_id}/d" $zk_conf + sed -i "/^weight.${external_id}/d" $zk_conf + echo "server.${external_id}=${external_host}:${external_port1}:${external_port2}" >> $zk_conf + update_group ${external_id} + echo "weight.${external_id}=${external_weight}" >> $zk_conf + open-port ${external_port1} + open-port ${external_port2} + fi +} + +update_quorum() { + default_group=`config-get default_group` + default_weight=`config-get default_weight` + # Purge out existing quorum config to deal with departure of + # ZK nodes + sed -i "/^server./d" $zk_conf + sed -i "/^weight./d" $zk_conf + sed -i "/^group./d" $zk_conf + # Add this node back into the list + juju-log "Adding this unit to the quorum..." + unit_no=`echo $JUJU_UNIT_NAME | cut -d / -f 2` + hostname=`unit-get private-address` + server_arr[0]="server.${unit_no}=${hostname}:2888:3888" + weight_arr[0]="weight.${unit_no}=${default_weight}" + group_arr[0]=${unit_no} + # Re-create based on current relations + for member in `relation-list` + do + juju-log "Adding $member to quorum" + member_id=`echo ${member} | cut -d / -f 2` + member_hostname=`relation-get private-address ${member}` + server_arr=("${server_arr[@]}" "server.${member_id}=${member_hostname}:2888:3888") + weight_arr=("${weight_arr[@]}" "weight.${member_id}=${default_weight}") + group_arr=("${group_arr[@]}" "${member_id}") + done + # Dump the new config + # servers + for server_line in "${server_arr[@]}" + do + echo "${server_line}" >> ${zk_conf} + done + # weight + for member_line in "${weight_arr[@]}" + do + echo "${member_line}" >> $zk_conf + done + # group + echo "group.${default_group}=${group_arr[@]}" | tr " " ":" >> $zk_conf +} + +setup_zk_interface() { + juju-log "Setup ZooKeeper Client" + relation-set port=$zk_port +} + +COMMAND=`basename $0` + +case $COMMAND in + install) + configure_sources + install_zookeeper + configure_zookeeper + update_external_server + restart_zookeeper + ;; + config-changed) + update_external_server + restart_zookeeper + ;; + start) + start_zookeeper + ;; + stop) + stop_zookeeper + ;; + quorum-relation-joined) + ;; + quorum-relation-changed|quorum-relation-departed) + update_quorum + update_external_server + restart_zookeeper + ;; + zookeeper-relation-joined) + setup_zk_interface + ;; + upgrade-charm) + configure_zookeeper + update_external_server + restart_zookeeper + ;; + *) + juju-log "Command not recognised" + ;; +esac diff --git a/charms/trusty/zookeeper/hooks/zookeeper-relation-joined b/charms/trusty/zookeeper/hooks/zookeeper-relation-joined new file mode 120000 index 0000000..91a1891 --- /dev/null +++ b/charms/trusty/zookeeper/hooks/zookeeper-relation-joined @@ -0,0 +1 @@ +zookeeper-common
\ No newline at end of file diff --git a/charms/trusty/zookeeper/icon.svg b/charms/trusty/zookeeper/icon.svg new file mode 100644 index 0000000..6cbf74d --- /dev/null +++ b/charms/trusty/zookeeper/icon.svg @@ -0,0 +1,292 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="96" + height="96" + id="svg6517" + version="1.1" + inkscape:version="0.48.4 r9939" + sodipodi:docname="juju-icon-placeholder-z.svg"> + <defs + id="defs6519"> + <linearGradient + id="Background"> + <stop + id="stop4178" + offset="0" + style="stop-color:#b8b8b8;stop-opacity:1" /> + <stop + id="stop4180" + offset="1" + style="stop-color:#c9c9c9;stop-opacity:1" /> + </linearGradient> + <filter + style="color-interpolation-filters:sRGB;" + inkscape:label="Inner Shadow" + id="filter1121"> + <feFlood + flood-opacity="0.59999999999999998" + flood-color="rgb(0,0,0)" + result="flood" + id="feFlood1123" /> + <feComposite + in="flood" + in2="SourceGraphic" + operator="out" + result="composite1" + id="feComposite1125" /> + <feGaussianBlur + in="composite1" + stdDeviation="1" + result="blur" + id="feGaussianBlur1127" /> + <feOffset + dx="0" + dy="2" + result="offset" + id="feOffset1129" /> + <feComposite + in="offset" + in2="SourceGraphic" + operator="atop" + result="composite2" + id="feComposite1131" /> + </filter> + <filter + style="color-interpolation-filters:sRGB;" + inkscape:label="Drop Shadow" + id="filter950"> + <feFlood + flood-opacity="0.25" + flood-color="rgb(0,0,0)" + result="flood" + id="feFlood952" /> + <feComposite + in="flood" + in2="SourceGraphic" + operator="in" + result="composite1" + id="feComposite954" /> + <feGaussianBlur + in="composite1" + stdDeviation="1" + result="blur" + id="feGaussianBlur956" /> + <feOffset + dx="0" + dy="1" + result="offset" + id="feOffset958" /> + <feComposite + in="SourceGraphic" + in2="offset" + operator="over" + result="composite2" + id="feComposite960" /> + <feBlend + blend="normal" + id="feBlend3895" + in2="composite2" /> + </filter> + <clipPath + clipPathUnits="userSpaceOnUse" + id="clipPath873"> + <g + transform="matrix(0,-0.66666667,0.66604479,0,-258.25992,677.00001)" + id="g875" + inkscape:label="Layer 1" + style="fill:#ff00ff;fill-opacity:1;stroke:none;display:inline"> + <path + style="fill:#ff00ff;fill-opacity:1;stroke:none;display:inline" + d="m 46.702703,898.22775 50.594594,0 C 138.16216,898.22775 144,904.06497 144,944.92583 l 0,50.73846 c 0,40.86071 -5.83784,46.69791 -46.702703,46.69791 l -50.594594,0 C 5.8378378,1042.3622 0,1036.525 0,995.66429 L 0,944.92583 C 0,904.06497 5.8378378,898.22775 46.702703,898.22775 Z" + id="path877" + inkscape:connector-curvature="0" + sodipodi:nodetypes="sssssssss" /> + </g> + </clipPath> + <filter + inkscape:collect="always" + id="filter891" + inkscape:label="Badge Shadow"> + <feGaussianBlur + inkscape:collect="always" + stdDeviation="0.71999962" + id="feGaussianBlur893" /> + </filter> + </defs> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="8.1490724" + inkscape:cx="6.3116087" + inkscape:cy="46.975739" + inkscape:document-units="px" + inkscape:current-layer="layer3" + showgrid="true" + fit-margin-top="0" + fit-margin-left="0" + fit-margin-right="0" + fit-margin-bottom="0" + inkscape:window-width="1849" + inkscape:window-height="1218" + inkscape:window-x="123" + inkscape:window-y="68" + inkscape:window-maximized="0" + showborder="true" + showguides="true" + inkscape:guide-bbox="true" + inkscape:showpageshadow="false"> + <inkscape:grid + type="xygrid" + id="grid821" /> + <sodipodi:guide + orientation="1,0" + position="16,48" + id="guide823" /> + <sodipodi:guide + orientation="0,1" + position="64,80" + id="guide825" /> + <sodipodi:guide + orientation="1,0" + position="80,40" + id="guide827" /> + <sodipodi:guide + orientation="0,1" + position="64,16" + id="guide829" /> + </sodipodi:namedview> + <metadata + id="metadata6522"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title /> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="BACKGROUND" + inkscape:groupmode="layer" + id="layer1" + transform="translate(268,-635.29076)" + style="display:inline"> + <path + style="fill:#333333;fill-opacity:0.93333334000000001;stroke:none;display:inline;filter:url(#filter1121);opacity:0.7" + d="m -268,700.15563 0,-33.72973 c 0,-27.24324 3.88785,-31.13513 31.10302,-31.13513 l 33.79408,0 c 27.21507,0 31.1029,3.89189 31.1029,31.13513 l 0,33.72973 c 0,27.24325 -3.88783,31.13514 -31.1029,31.13514 l -33.79408,0 C -264.11215,731.29077 -268,727.39888 -268,700.15563 Z" + id="path6455" + inkscape:connector-curvature="0" + sodipodi:nodetypes="sssssssss" /> + </g> + <g + inkscape:groupmode="layer" + id="layer3" + inkscape:label="PLACEHOLDER LETTER" + style="display:inline"> + <text + xml:space="preserve" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;filter:url(#filter950);font-family:Sans" + x="34.504002" + y="62.644001" + id="text3891" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan3893" + x="34.504002" + y="62.644001" + style="font-size:56px;font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;fill:#ffffff;fill-opacity:1;font-family:Ubuntu;-inkscape-font-specification:Ubuntu Medium">z</tspan></text> + <rect + style="opacity:0.69999999999999996;fill:none;stroke:none" + id="rect3021" + width="64" + height="64" + x="16" + y="16" /> + </g> + <g + inkscape:groupmode="layer" + id="layer2" + inkscape:label="BADGE" + style="display:none" + sodipodi:insensitive="true"> + <g + style="display:inline" + transform="translate(-340.00001,-581)" + id="g4394" + clip-path="none"> + <g + id="g855"> + <g + inkscape:groupmode="maskhelper" + id="g870" + clip-path="url(#clipPath873)" + style="opacity:0.6;filter:url(#filter891)"> + <path + transform="matrix(1.4999992,0,0,1.4999992,-29.999795,-237.54282)" + d="m 264,552.36218 c 0,6.62742 -5.37258,12 -12,12 -6.62742,0 -12,-5.37258 -12,-12 0,-6.62741 5.37258,-12 12,-12 6.62742,0 12,5.37259 12,12 z" + sodipodi:ry="12" + sodipodi:rx="12" + sodipodi:cy="552.36218" + sodipodi:cx="252" + id="path844" + style="color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" + sodipodi:type="arc" /> + </g> + <g + id="g862"> + <path + sodipodi:type="arc" + style="color:#000000;fill:#f5f5f5;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" + id="path4398" + sodipodi:cx="252" + sodipodi:cy="552.36218" + sodipodi:rx="12" + sodipodi:ry="12" + d="m 264,552.36218 c 0,6.62742 -5.37258,12 -12,12 -6.62742,0 -12,-5.37258 -12,-12 0,-6.62741 5.37258,-12 12,-12 6.62742,0 12,5.37259 12,12 z" + transform="matrix(1.4999992,0,0,1.4999992,-29.999795,-238.54282)" /> + <path + transform="matrix(1.25,0,0,1.25,33,-100.45273)" + d="m 264,552.36218 c 0,6.62742 -5.37258,12 -12,12 -6.62742,0 -12,-5.37258 -12,-12 0,-6.62741 5.37258,-12 12,-12 6.62742,0 12,5.37259 12,12 z" + sodipodi:ry="12" + sodipodi:rx="12" + sodipodi:cy="552.36218" + sodipodi:cx="252" + id="path4400" + style="color:#000000;fill:#dd4814;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" + sodipodi:type="arc" /> + <path + sodipodi:type="star" + style="color:#000000;fill:#f5f5f5;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" + id="path4459" + sodipodi:sides="5" + sodipodi:cx="666.19574" + sodipodi:cy="589.50385" + sodipodi:r1="7.2431178" + sodipodi:r2="4.3458705" + sodipodi:arg1="1.0471976" + sodipodi:arg2="1.6755161" + inkscape:flatsided="false" + inkscape:rounded="0.1" + inkscape:randomized="0" + d="m 669.8173,595.77657 c -0.39132,0.22593 -3.62645,-1.90343 -4.07583,-1.95066 -0.44938,-0.0472 -4.05653,1.36297 -4.39232,1.06062 -0.3358,-0.30235 0.68963,-4.03715 0.59569,-4.47913 -0.0939,-0.44198 -2.5498,-3.43681 -2.36602,-3.8496 0.18379,-0.41279 4.05267,-0.59166 4.44398,-0.81759 0.39132,-0.22593 2.48067,-3.48704 2.93005,-3.4398 0.44938,0.0472 1.81505,3.67147 2.15084,3.97382 0.3358,0.30236 4.08294,1.2817 4.17689,1.72369 0.0939,0.44198 -2.9309,2.86076 -3.11469,3.27355 -0.18379,0.41279 0.0427,4.27917 -0.34859,4.5051 z" + transform="matrix(1.511423,-0.16366377,0.16366377,1.511423,-755.37346,-191.93651)" /> + </g> + </g> + </g> + </g> +</svg> diff --git a/charms/trusty/zookeeper/metadata.yaml b/charms/trusty/zookeeper/metadata.yaml new file mode 100644 index 0000000..871ce24 --- /dev/null +++ b/charms/trusty/zookeeper/metadata.yaml @@ -0,0 +1,19 @@ +name: zookeeper +maintainer: James Page <james.page@ubuntu.com> +summary: High-performance coordination service for distributed applications +tags: + - database +description: | + ZooKeeper is a centralized, reliable, service for maintaining + configuration information, naming, providing distributed + synchronization, and group services. All of these kinds of services + are used in some form or another by distributed applications. This + package contains the shell scripts and an example configuration but + does not automatically start up the service. The example configuration + is installed with the update-alternatives mechanism. +provides: + zookeeper: + interface: zookeeper +peers: + quorum: + interface: zookeeper-quorum diff --git a/charms/trusty/zookeeper/revision b/charms/trusty/zookeeper/revision new file mode 100644 index 0000000..48082f7 --- /dev/null +++ b/charms/trusty/zookeeper/revision @@ -0,0 +1 @@ +12 diff --git a/charms/trusty/zookeeper/tests/00-setup b/charms/trusty/zookeeper/tests/00-setup new file mode 100644 index 0000000..48cd230 --- /dev/null +++ b/charms/trusty/zookeeper/tests/00-setup @@ -0,0 +1,16 @@ +#!/bin/bash + +# This script sets up the requirements for amulet tests. + +set -x + +# Check if amulet is installed before adding the stable repository and updating apt-get. +dpkg -s amulet +if [ $? -ne 0 ]; then + sudo add-apt-repository -y ppa:juju/stable + sudo apt-get update -qq + sudo apt-get install -y amulet +fi + +# Install any additional python packages or other required software. +sudo apt-get install -y python3-requests
\ No newline at end of file diff --git a/charms/trusty/zookeeper/tests/10-bundles-test.py b/charms/trusty/zookeeper/tests/10-bundles-test.py new file mode 100644 index 0000000..67710c7 --- /dev/null +++ b/charms/trusty/zookeeper/tests/10-bundles-test.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python3 + +# This amulet test deploys the bundles.yaml file in this directory. + +import os +import unittest +import yaml +import amulet + +seconds_to_wait = 720 + + +class BundleTest(unittest.TestCase): + """ Create a class for testing the charm in the unit test framework. """ + @classmethod + def setUpClass(cls): + """ Set up an amulet deployment using the bundle. """ + d = amulet.Deployment() + bundle_path = os.path.join(os.path.dirname(__file__), 'bundles.yaml') + with open(bundle_path, 'r') as bundle_file: + contents = yaml.safe_load(bundle_file) + d.load(contents) + d.setup(seconds_to_wait) + d.sentry.wait(seconds_to_wait) + cls.d = d + + def test_deployed(self): + """ Test to see if the bundle deployed successfully. """ + self.assertTrue(self.d.deployed) + + +if __name__ == '__main__': + unittest.main()
\ No newline at end of file diff --git a/charms/trusty/zookeeper/tests/bundles.yaml b/charms/trusty/zookeeper/tests/bundles.yaml new file mode 100644 index 0000000..0b7699c --- /dev/null +++ b/charms/trusty/zookeeper/tests/bundles.yaml @@ -0,0 +1,7 @@ +zookeeper-automated-bundle: + relations: [] + series: trusty + services: + zookeeper: + charm: zookeeper + num_units: 1 |