diff --git a/bundle-config.yaml.example b/bundle-config.yaml.example index 6d251db..8c1a36c 100644 --- a/bundle-config.yaml.example +++ b/bundle-config.yaml.example @@ -5,7 +5,7 @@ clearwater: # Deployment-wide options # These options should be set to the same value for all Clearwater charms zone: "ims.clearwater.local" - repo: "http://repo.cw-ngv.com/juju-clearwater-1" + repo: "http://repo.cw-ngv.com/juju-clearwater-2" sas: "0.0.0.0" # Bono-specific options @@ -16,7 +16,7 @@ clearwater: # Deployment-wide options # These options should be set to the same value for all Clearwater charms zone: "ims.clearwater.local" - repo: "http://repo.cw-ngv.com/juju-clearwater-1" + repo: "http://repo.cw-ngv.com/juju-clearwater-2" sas: "0.0.0.0" # Sprout-specific options @@ -29,27 +29,27 @@ clearwater: # Deployment-wide options # These options should be set to the same value for all Clearwater charms zone: "ims.clearwater.local" - repo: "http://repo.cw-ngv.com/juju-clearwater-1" + repo: "http://repo.cw-ngv.com/juju-clearwater-2" sas: "0.0.0.0" "clearwater-homestead": options: # Deployment-wide options # These options should be set to the same value for all Clearwater charms zone: "ims.clearwater.local" - repo: "http://repo.cw-ngv.com/juju-clearwater-1" + repo: "http://repo.cw-ngv.com/juju-clearwater-2" sas: "0.0.0.0" "clearwater-homer": options: # Deployment-wide options # These options should be set to the same value for all Clearwater charms zone: "ims.clearwater.local" - repo: "http://repo.cw-ngv.com/juju-clearwater-1" + repo: "http://repo.cw-ngv.com/juju-clearwater-2" "clearwater-ellis": options: # Deployment-wide options # These options should be set to the same value for all Clearwater charms zone: "ims.clearwater.local" - repo: "http://repo.cw-ngv.com/juju-clearwater-1" + repo: "http://repo.cw-ngv.com/juju-clearwater-2" # Ellis-specific options # Ellis' role is to allocate numbers to users, out of a preconfigured pool. The base_number and number_count settings define that pool - for example, with these values, Ellis could allocate sip:1234567000@ims.clearwater.local to sip:1234567999@ims.clearwater.local. diff --git a/charms/bundles/clearwater/bundle/bundles.yaml b/charms/bundles/clearwater/bundle/bundles.yaml index 0bd98c9..0bd7237 100644 --- a/charms/bundles/clearwater/bundle/bundles.yaml +++ b/charms/bundles/clearwater/bundle/bundles.yaml @@ -1,8 +1,7 @@ clearwater: services: "clearwater-bono": - charm: "local:precise/clearwater-bono" - charm_url: "local:precise/clearwater-bono" + charm: "clearwater-bono" num_units: 1 constraints: "arch=amd64" options: @@ -12,8 +11,7 @@ clearwater: "gui-x": "400" "gui-y": "900" "clearwater-sprout": - charm: "local:precise/clearwater-sprout" - charm_url: "local:precise/clearwater-sprout" + charm: "clearwater-sprout" num_units: 1 constraints: "arch=amd64" options: @@ -22,8 +20,7 @@ clearwater: "gui-x": "400" "gui-y": "600" "clearwater-ralf": - charm: "local:precise/clearwater-ralf" - charm_url: "local:precise/clearwater-ralf" + charm: "clearwater-ralf" num_units: 1 constraints: "arch=amd64" options: @@ -32,8 +29,7 @@ clearwater: "gui-x": "800" "gui-y": "750" "clearwater-homestead": - charm: "local:precise/clearwater-homestead" - charm_url: "local:precise/clearwater-homestead" + charm: "clearwater-homestead" num_units: 1 constraints: "arch=amd64" options: @@ -42,8 +38,7 @@ clearwater: "gui-x": "200" "gui-y": "300" "clearwater-homer": - charm: "local:precise/clearwater-homer" - charm_url: "local:precise/clearwater-homer" + charm: "clearwater-homer" num_units: 1 constraints: "arch=amd64" options: @@ -52,8 +47,7 @@ clearwater: "gui-x": "600" "gui-y": "300" "clearwater-ellis": - charm: "local:precise/clearwater-ellis" - charm_url: "local:precise/clearwater-ellis" + charm: "clearwater-ellis" num_units: 1 constraints: "arch=amd64" options: @@ -100,4 +94,4 @@ clearwater: - "dns:programmable-multiple" - - "clearwater-homestead:programmable-multiple" - "dns:programmable-multiple" - series: precise + series: trusty diff --git a/charms/precise/clearwater-bono/hooks/programmable-multiple-relation-changed b/charms/precise/clearwater-bono/hooks/programmable-multiple-relation-changed deleted file mode 100755 index 6af307a..0000000 --- a/charms/precise/clearwater-bono/hooks/programmable-multiple-relation-changed +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -set -e - -# Set our DNS requirements -TTL=300 -id=$(cut -d/ -f2 <<< $JUJU_UNIT_NAME) -ip=$(unit-get public-address) -relation-set domain=$(config-get zone) -relation-set resources='@ '$TTL' IN A '$ip' -@ '$TTL' IN NAPTR 1 1 "S" "SIP+D2T" "" _sip._tcp -@ '$TTL' IN NAPTR 2 1 "S" "SIP+D2U" "" _sip._udp -_sip._tcp '$TTL' IN SRV 0 0 5060 bono-'$id' -_sip._udp '$TTL' IN SRV 0 0 5060 bono-'$id' -bono-'$id' '$TTL' IN A '$ip - -# Update our DNS server -if [ "$(relation-get private-address)" != "" ] -then - echo nameserver $(relation-get private-address) > /etc/dnsmasq.resolv.conf - grep -v ^RESOLV_CONF= /etc/default/dnsmasq > /tmp/dnsmasq.$$ - mv /tmp/dnsmasq.$$ /etc/default/dnsmasq - echo RESOLV_CONF=/etc/dnsmasq.resolv.conf >> /etc/default/dnsmasq - service dnsmasq restart -fi - -# Update Clearwater configuration and restart -$CHARM_DIR/lib/config_script programmable-multiple -$CHARM_DIR/lib/restart diff --git a/charms/precise/clearwater-bono/hooks/start b/charms/precise/clearwater-bono/hooks/start deleted file mode 100755 index b9c8979..0000000 --- a/charms/precise/clearwater-bono/hooks/start +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -# Here put anything that is needed to start the service. -# Note that currently this is run directly after install -# i.e. 'service apache2 start' -set -e - -# This hook needs to be idempotent, so this could be run when bono is -# already running, when it's running but not monitored by monit, when -# it's stopped but being monitored (so it's about to start), or stopped -# and unmonitored. To cover all these cases, restart bono, restart monit, -# then finally have monit monitor bono. Note that restarting monit can -# fail because init will also restart it when it stops and restarting -# bono can fail because monit will restart it. -service bono restart || /usr/bin/true -service clearwater-monit restart || /usr/bin/true -sleep 1 -monit monitor bono diff --git a/charms/precise/clearwater-bono/lib/chef-install.sh b/charms/precise/clearwater-bono/lib/chef-install.sh deleted file mode 100755 index f744d1e..0000000 --- a/charms/precise/clearwater-bono/lib/chef-install.sh +++ /dev/null @@ -1,601 +0,0 @@ -#!/bin/sh -# WARNING: REQUIRES /bin/sh -# -# - must run on /bin/sh on solaris 9 -# - must run on /bin/sh on AIX 6.x -# - if you think you are a bash wizard, you probably do not understand -# this programming language. do not touch. -# - if you are under 40, get peer review from your elders. -# -# Author:: Tyler Cloke (tyler@opscode.com) -# Author:: Stephen Delano (stephen@opscode.com) -# Author:: Seth Chisamore (sethc@opscode.com) -# Author:: Lamont Granquist (lamont@opscode.com) -# Copyright:: Copyright (c) 2010-2013 Chef Software, Inc. -# License:: Apache License, Version 2.0 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -prerelease="false" - -nightlies="false" - -project="chef" - -# Check whether a command exists - returns 0 if it does, 1 if it does not -exists() { - if command -v $1 >/dev/null 2>&1 - then - return 0 - else - return 1 - fi -} - -report_bug() { - echo "Version: $version" - echo "" - echo "Please file a Bug Report at https://github.com/opscode/opscode-omnitruck/issues/new" - echo "Alternatively, feel free to open a Support Ticket at https://www.getchef.com/support/tickets" - echo "More Chef support resources can be found at https://www.getchef.com/support" - echo "" - echo "Please include as many details about the problem as possible i.e., how to reproduce" - echo "the problem (if possible), type of the Operating System and its version, etc.," - echo "and any other relevant details that might help us with troubleshooting." - echo "" -} - -# Get command line arguments -while getopts pnv:f:d:P: opt -do - case "$opt" in - - v) version="$OPTARG";; - p) prerelease="true";; - n) nightlies="true";; - f) cmdline_filename="$OPTARG";; - P) project="$OPTARG";; - d) cmdline_dl_dir="$OPTARG";; - \?) # unknown flag - echo >&2 \ - "usage: $0 [-p] [-v version] [-f filename | -d download_dir]" - exit 1;; - esac -done -shift `expr $OPTIND - 1` - -machine=`uname -m` -os=`uname -s` - -if test "x$TMPDIR" = "x"; then - tmp="/tmp" -else - tmp=$TMPDIR -fi -# secure-ish temp dir creation without having mktemp available (DDoS-able but not expliotable) -tmp_dir="$tmp/install.sh.$$" -(umask 077 && mkdir $tmp_dir) || exit 1 - -# -# Platform and Platform Version detection -# -# NOTE: This should now match ohai platform and platform_version matching. -# do not invented new platform and platform_version schemas, just make this behave -# like what ohai returns as platform and platform_version for the server. -# -# ALSO NOTE: Do not mangle platform or platform_version here. It is less error -# prone and more future-proof to do that in the server, and then all omnitruck clients -# will 'inherit' the changes (install.sh is not the only client of the omnitruck -# endpoint out there). -# - -if test -f "/etc/lsb-release" && grep -q DISTRIB_ID /etc/lsb-release; then - platform=`grep DISTRIB_ID /etc/lsb-release | cut -d "=" -f 2 | tr '[A-Z]' '[a-z]'` - platform_version=`grep DISTRIB_RELEASE /etc/lsb-release | cut -d "=" -f 2` -elif test -f "/etc/debian_version"; then - platform="debian" - platform_version=`cat /etc/debian_version` -elif test -f "/etc/redhat-release"; then - platform=`sed 's/^\(.\+\) release.*/\1/' /etc/redhat-release | tr '[A-Z]' '[a-z]'` - platform_version=`sed 's/^.\+ release \([.0-9]\+\).*/\1/' /etc/redhat-release` - - # If /etc/redhat-release exists, we act like RHEL by default - if test "$platform" = "fedora"; then - # FIXME: stop remapping fedora to el - # FIXME: remove client side platform_version mangling and hard coded yolo - # Change platform version for use below. - platform_version="6.0" - fi - - if test "$platform" = "xenserver"; then - # Current XenServer 6.2 is based on CentOS 5, platform is not reset to "el" server should hanlde response - platform="xenserver" - else - # FIXME: use "redhat" - platform="el" - fi - -elif test -f "/etc/system-release"; then - platform=`sed 's/^\(.\+\) release.\+/\1/' /etc/system-release | tr '[A-Z]' '[a-z]'` - platform_version=`sed 's/^.\+ release \([.0-9]\+\).*/\1/' /etc/system-release | tr '[A-Z]' '[a-z]'` - # amazon is built off of fedora, so act like RHEL - if test "$platform" = "amazon linux ami"; then - # FIXME: remove client side platform_version mangling and hard coded yolo, and remapping to deprecated "el" - platform="el" - platform_version="6.0" - fi -# Apple OS X -elif test -f "/usr/bin/sw_vers"; then - platform="mac_os_x" - # Matching the tab-space with sed is error-prone - platform_version=`sw_vers | awk '/^ProductVersion:/ { print $2 }' | cut -d. -f1,2` - - # x86_64 Apple hardware often runs 32-bit kernels (see OHAI-63) - x86_64=`sysctl -n hw.optional.x86_64` - if test $x86_64 -eq 1; then - machine="x86_64" - fi -elif test -f "/etc/release"; then - machine=`/usr/bin/uname -p` - if grep -q SmartOS /etc/release; then - platform="smartos" - platform_version=`grep ^Image /etc/product | awk '{ print $3 }'` - else - platform="solaris2" - platform_version=`/usr/bin/uname -r` - fi -elif test -f "/etc/SuSE-release"; then - if grep -q 'Enterprise' /etc/SuSE-release; - then - platform="sles" - platform_version=`awk '/^VERSION/ {V = $3}; /^PATCHLEVEL/ {P = $3}; END {print V "." P}' /etc/SuSE-release` - else - platform="suse" - platform_version=`awk '/^VERSION =/ { print $3 }' /etc/SuSE-release` - fi -elif test "x$os" = "xFreeBSD"; then - platform="freebsd" - platform_version=`uname -r | sed 's/-.*//'` -elif test "x$os" = "xAIX"; then - platform="aix" - platform_version="`uname -v`.`uname -r`" - machine="powerpc" -fi - -if test "x$platform" = "x"; then - echo "Unable to determine platform version!" - report_bug - exit 1 -fi - -# -# NOTE: platform manging in the install.sh is DEPRECATED -# -# - install.sh should be true to ohai and should not remap -# platform or platform versions. -# -# - remapping platform and mangling platform version numbers is -# now the complete responsibility of the server-side endpoints -# - -major_version=`echo $platform_version | cut -d. -f1` -case $platform in - # FIXME: should remove this case statement completely - "el") - # FIXME: "el" is deprecated, should use "redhat" - platform_version=$major_version - ;; - "debian") - # FIXME: remove client-side yolo here - case $major_version in - "5") platform_version="6";; # FIXME: need to port this "reverse-yolo" into platform.rb - "6") platform_version="6";; - "7") platform_version="6";; - esac - ;; - "freebsd") - platform_version=$major_version - ;; - "sles") - platform_version=$major_version - ;; - "suse") - platform_version=$major_version - ;; -esac - -if test "x$platform_version" = "x"; then - echo "Unable to determine platform version!" - report_bug - exit 1 -fi - -if test "x$platform" = "xsolaris2"; then - # hack up the path on Solaris to find wget, pkgadd - PATH=/usr/sfw/bin:/usr/sbin:$PATH - export PATH -fi - -checksum_mismatch() { - echo "Package checksum mismatch!" - report_bug - exit 1 -} - -unable_to_retrieve_package() { - echo "Unable to retrieve a valid package!" - report_bug - echo "Metadata URL: $metadata_url" - if test "x$download_url" != "x"; then - echo "Download URL: $download_url" - fi - if test "x$stderr_results" != "x"; then - echo "\nDEBUG OUTPUT FOLLOWS:\n$stderr_results" - fi - exit 1 -} - -http_404_error() { - echo "Omnitruck artifact does not exist for version $version on platform $platform" - echo "" - echo "Either this means:" - echo " - We do not support $platform" - echo " - We do not have an artifact for $version" - echo "" - echo "This is often the latter case due to running a prerelease or RC version of chef" - echo "or a gem version which was only pushed to rubygems and not omnitruck." - echo "" - echo "You may be able to set your knife[:bootstrap_version] to the most recent stable" - echo "release of Chef to fix this problem (or the most recent stable major version number)." - echo "" - echo "In order to test the version parameter, adventurous users may take the Metadata URL" - echo "below and modify the '&v=' parameter until you successfully get a URL that" - echo "does not 404 (e.g. via curl or wget). You should be able to use '&v=11' or '&v=12'" - echo "succesfully." - echo "" - echo "If you cannot fix this problem by setting the bootstrap_version, it probably means" - echo "that $platform is not supported." - echo "" - # deliberately do not call report_bug to suppress bug report noise. - echo "Metadata URL: $metadata_url" - if test "x$download_url" != "x"; then - echo "Download URL: $download_url" - fi - if test "x$stderr_results" != "x"; then - echo "\nDEBUG OUTPUT FOLLOWS:\n$stderr_results" - fi - exit 1 -} - -capture_tmp_stderr() { - # spool up /tmp/stderr from all the commands we called - if test -f "$tmp_dir/stderr"; then - output=`cat $tmp_dir/stderr` - stderr_results="${stderr_results}\nSTDERR from $1:\n\n$output\n" - rm $tmp_dir/stderr - fi -} - -# do_wget URL FILENAME -do_wget() { - echo "trying wget..." - wget -O "$2" "$1" 2>$tmp_dir/stderr - rc=$? - # check for 404 - grep "ERROR 404" $tmp_dir/stderr 2>&1 >/dev/null - if test $? -eq 0; then - echo "ERROR 404" - http_404_error - fi - - # check for bad return status or empty output - if test $rc -ne 0 || test ! -s "$2"; then - capture_tmp_stderr "wget" - return 1 - fi - - return 0 -} - -# do_curl URL FILENAME -do_curl() { - echo "trying curl..." - curl -sL -D $tmp_dir/stderr "$1" > "$2" - rc=$? - # check for 404 - grep "404 Not Found" $tmp_dir/stderr 2>&1 >/dev/null - if test $? -eq 0; then - echo "ERROR 404" - http_404_error - fi - - # check for bad return status or empty output - if test $rc -ne 0 || test ! -s "$2"; then - capture_tmp_stderr "curl" - return 1 - fi - - return 0 -} - -# do_fetch URL FILENAME -do_fetch() { - echo "trying fetch..." - fetch -o "$2" "$1" 2>$tmp_dir/stderr - # check for bad return status - test $? -ne 0 && return 1 - return 0 -} - -# do_curl URL FILENAME -do_perl() { - echo "trying perl..." - perl -e 'use LWP::Simple; getprint($ARGV[0]);' "$1" > "$2" 2>$tmp_dir/stderr - rc=$? - # check for 404 - grep "404 Not Found" $tmp_dir/stderr 2>&1 >/dev/null - if test $? -eq 0; then - echo "ERROR 404" - http_404_error - fi - - # check for bad return status or empty output - if test $rc -ne 0 || test ! -s "$2"; then - capture_tmp_stderr "perl" - return 1 - fi - - return 0 -} - -# do_curl URL FILENAME -do_python() { - echo "trying python..." - python -c "import sys,urllib2 ; sys.stdout.write(urllib2.urlopen(sys.argv[1]).read())" "$1" > "$2" 2>$tmp_dir/stderr - rc=$? - # check for 404 - grep "HTTP Error 404" $tmp_dir/stderr 2>&1 >/dev/null - if test $? -eq 0; then - echo "ERROR 404" - http_404_error - fi - - # check for bad return status or empty output - if test $rc -ne 0 || test ! -s "$2"; then - capture_tmp_stderr "python" - return 1 - fi - return 0 -} - -# returns 0 if checksums match -do_checksum() { - if exists sha256sum; then - echo "Comparing checksum with sha256sum..." - checksum=`sha256sum $1 | awk '{ print $1 }'` - return `test "x$checksum" = "x$2"` - elif exists shasum; then - echo "Comparing checksum with shasum..." - checksum=`shasum -a 256 $1 | awk '{ print $1 }'` - return `test "x$checksum" = "x$2"` - elif exists md5sum; then - echo "Comparing checksum with md5sum..." - checksum=`md5sum $1 | awk '{ print $1 }'` - return `test "x$checksum" = "x$3"` - elif exists md5; then - echo "Comparing checksum with md5..." - # this is for md5 utility on MacOSX (OSX 10.6-10.10) and $4 is the correct field - checksum=`md5 $1 | awk '{ print $4 }'` - return `test "x$checksum" = "x$3"` - else - echo "WARNING: could not find a valid checksum program, pre-install shasum, md5sum or md5 in your O/S image to get valdation..." - return 0 - fi -} - -# do_download URL FILENAME -do_download() { - echo "downloading $1" - echo " to file $2" - - # we try all of these until we get success. - # perl, in particular may be present but LWP::Simple may not be installed - - if exists wget; then - do_wget $1 $2 && return 0 - fi - - if exists curl; then - do_curl $1 $2 && return 0 - fi - - if exists fetch; then - do_fetch $1 $2 && return 0 - fi - - if exists perl; then - do_perl $1 $2 && return 0 - fi - - if exists python; then - do_python $1 $2 && return 0 - fi - - unable_to_retrieve_package -} - -# install_file TYPE FILENAME -# TYPE is "rpm", "deb", "solaris", "sh", etc. -install_file() { - echo "Installing Chef $version" - case "$1" in - "rpm") - echo "installing with rpm..." - rpm -Uvh --oldpackage --replacepkgs "$2" - ;; - "deb") - echo "installing with dpkg..." - dpkg -i "$2" - ;; - "bff") - echo "installing with installp..." - installp -aXYgd "$2" all - ;; - "solaris") - echo "installing with pkgadd..." - echo "conflict=nocheck" > $tmp_dir/nocheck - echo "action=nocheck" >> $tmp_dir/nocheck - echo "mail=" >> $tmp_dir/nocheck - pkgrm -a $tmp_dir/nocheck -n $project >/dev/null 2>&1 || true - pkgadd -n -d "$2" -a $tmp_dir/nocheck $project - ;; - "pkg") - echo "installing with installer..." - cd / && /usr/sbin/installer -pkg "$2" -target / - ;; - "dmg") - echo "installing dmg file..." - hdiutil detach "/Volumes/chef_software" >/dev/null 2>&1 || true - hdiutil attach "$2" -mountpoint "/Volumes/chef_software" - cd / && /usr/sbin/installer -pkg `find "/Volumes/chef_software" -name \*.pkg` -target / - hdiutil detach "/Volumes/chef_software" - ;; - "sh" ) - echo "installing with sh..." - sh "$2" - ;; - *) - echo "Unknown filetype: $1" - report_bug - exit 1 - ;; - esac - if test $? -ne 0; then - echo "Installation failed" - report_bug - exit 1 - fi -} - -echo "Downloading Chef $version for ${platform}..." - - -metadata_filename="$tmp_dir/metadata.txt" - -case "$project" in - "chef") - metadata_url="https://www.opscode.com/chef/metadata?v=${version}&prerelease=${prerelease}&nightlies=${nightlies}&p=${platform}&pv=${platform_version}&m=${machine}" - ;; - "angrychef") - metadata_url="https://www.opscode.com/chef/metadata-angrychef?v=${version}&prerelease=${prerelease}&nightlies=${nightlies}&p=${platform}&pv=${platform_version}&m=${machine}" - ;; - "server") - metadata_url="https://www.opscode.com/chef/metadata-server?v=${version}&prerelease=${prerelease}&nightlies=${nightlies}&p=${platform}&pv=${platform_version}&m=${machine}" - ;; - "chefdk") - metadata_url="https://www.opscode.com/chef/metadata-chefdk?v=${version}&prerelease=${prerelease}&nightlies=${nightlies}&p=${platform}&pv=${platform_version}&m=${machine}" - ;; - "container") - metadata_url="https://www.opscode.com/chef/metadata-container?v=${version}&prerelease=${prerelease}&nightlies=${nightlies}&p=${platform}&pv=${platform_version}&m=${machine}" - ;; - *) -esac - -if test "x$platform" = "xsolaris2"; then - if test "x$platform_version" = "x5.9" -o "x$platform_version" = "x5.10"; then - # solaris 9 lacks openssl, solaris 10 lacks recent enough credentials - your base O/S is completely insecure, please upgrade - metadata_url=`echo $metadata_url | sed -e 's/https/http/'` - fi -fi - -do_download "$metadata_url" "$metadata_filename" - -cat "$metadata_filename" - -# check that all the mandatory fields in the downloaded metadata are there -if grep '^url' $metadata_filename > /dev/null && grep '^sha256' $metadata_filename > /dev/null && grep '^md5' $metadata_filename > /dev/null; then - echo "downloaded metadata file looks valid..." -else - echo "downloaded metadata file is corrupted or an uncaught error was encountered in downloading the file..." - # this generally means one of the download methods downloaded a 404 or something like that and then reported a successful exit code, - # and this should be fixed in the function that was doing the download. - report_bug - exit 1 -fi - -download_url=`awk '$1 == "url" { print $2 }' "$metadata_filename"` - -if test "x$platform" = "xsolaris2"; then - if test "x$platform_version" = "x5.9" -o "x$platform_version" = "x5.10"; then - # solaris 9 lacks openssl, solaris 10 lacks recent enough credentials - your base O/S is completely insecure, please upgrade - download_url=`echo $download_url | sed -e 's/https/http/'` - fi -fi - -filename=`echo $download_url | sed -e 's/^.*\///'` -filetype=`echo $filename | sed -e 's/^.*\.//'` - -# use either $tmp_dir, the provided directory (-d) or the provided filename (-f) -if test "x$cmdline_filename" != "x"; then - download_filename="$cmdline_filename" -elif test "x$cmdline_dl_dir" != "x"; then - download_filename="$cmdline_dl_dir/$filename" -else - download_filename="$tmp_dir/$filename" -fi - -# ensure the parent directory where to download the installer always exists -download_dir=`dirname $download_filename` -(umask 077 && mkdir -p $download_dir) || exit 1 - -sha256=`awk '$1 == "sha256" { print $2 }' "$metadata_filename"` -md5=`awk '$1 == "md5" { print $2 }' "$metadata_filename"` - -# check if we have that file locally available and if so verify the checksum -cached_file_available="false" -if test -f $download_filename; then - echo "$download_filename already exists, verifiying checksum..." - if do_checksum "$download_filename" "$sha256" "$md5"; then - echo "checksum compare succeeded, using existing file!" - cached_file_available="true" - else - echo "checksum mismatch, downloading latest version of the file" - fi -fi - -# download if no local version of the file available -if test "x$cached_file_available" != "xtrue"; then - do_download "$download_url" "$download_filename" - do_checksum "$download_filename" "$sha256" "$md5" || checksum_mismatch -fi - -if test "x$version" = "x"; then - echo - echo "WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING" - echo - echo "You are installing an omnibus package without a version pin. If you are installing" - echo "on production servers via an automated process this is DANGEROUS and you will" - echo "be upgraded without warning on new releases, even to new major releases." - echo "Letting the version float is only appropriate in desktop, test, development or" - echo "CI/CD environments." - echo - echo "WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING" - echo -fi - -install_file $filetype "$download_filename" - -if test "x$tmp_dir" != "x"; then - rm -r "$tmp_dir" -fi diff --git a/charms/precise/clearwater-ralf/copyright b/charms/precise/clearwater-ralf/copyright deleted file mode 100644 index b205a60..0000000 --- a/charms/precise/clearwater-ralf/copyright +++ /dev/null @@ -1,31 +0,0 @@ -Project Clearwater - IMS in the Cloud -Copyright (C) 2013 Metaswitch Networks Ltd - -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, along with the "Special Exception" for use of -the program along with SSL, set forth below. 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 -. - -The author can be reached by email at clearwater@metaswitch.com or by -post at Metaswitch Networks Ltd, 100 Church St, Enfield EN2 6BQ, UK - -Special Exception -Metaswitch Networks Ltd grants you permission to copy, modify, -propagate, and distribute a work formed by combining OpenSSL with The -Software, or a work derivative of such a combination, even if such -copying, modification, propagation, or distribution would otherwise -violate the terms of the GPL. You must comply with the GPL in all -respects for all of the code used other than OpenSSL. -"OpenSSL" means OpenSSL toolkit software distributed by the OpenSSL -Project and licensed under the OpenSSL Licenses, or a work based on such -software and licensed under the OpenSSL Licenses. -"OpenSSL Licenses" means the OpenSSL License and Original SSLeay License -under which the OpenSSL Project distributes the OpenSSL toolkit software, -as those licenses appear in the file LICENSE-OPENSSL. diff --git a/charms/precise/clearwater-ralf/lib/chef_solo_install b/charms/precise/clearwater-ralf/lib/chef_solo_install deleted file mode 100755 index 414404c..0000000 --- a/charms/precise/clearwater-ralf/lib/chef_solo_install +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash - -# This covers installing chef-solo and the Clearwater chef recipes -# Install needed libraries -apt-get -y install git libxml2-dev libxslt1-dev wget curl - -# Install chef -install_sh="http://opscode.com/chef/install.sh" -version_string="-v 11.6.0" -bash <(wget ${install_sh} -O -) ${version_string} - -# Pull down the Clearwater chef recipes -if [ ! -d /home/ubuntu/chef-solo ] -then - mkdir /home/ubuntu/chef-solo - git clone --recursive -b master git://github.com/Metaswitch/chef.git /home/ubuntu/chef-solo -fi - -# Update the chef recipes -cd /home/ubuntu/chef-solo -git checkout release-70 -git submodule update --init - -# Create the solo.rb file -cat > /home/ubuntu/chef-solo/solo.rb < - access_key: - secret_key: - sas: "0.0.0.0" - - clearwater-ellis: - smtp_server: smtp.cw-ngv.com - smtp_username: username - smtp_password: password - email_sender: blackhole@cw-ngv.com - signup_key: secret - base_number: "6505550000" - number_count: 1000 - repo: http://repo.cw-ngv.com/stable - - clearwater-bono: - turn_workaround: password - repo: http://repo.cw-ngv.com/stable - - clearwater-sprout: - reg_min_expires: 400 - session_max_expires: 900 - repo: http://repo.cw-ngv.com/stable - - clearwater-homestead: - repo: http://repo.cw-ngv.com/stable - - clearwater-homer: - repo: http://repo.cw-ngv.com/stable - -## Scale out Usage - -clearwater-route53 does not current support scaling out. - -## Known Limitations and Issues - -The only currently supported DNS service for Clearwater is clearwater-route53 (when deploying in Amazon EC2), so will currently only work on EC2. Additional DNS services will be added for other environments in future. - -# Configuration - -Clearwater has a number of configuration fields which are non-defaultable. These are as follows. - -clearwater-route53 - -- `zone:` This must be set to a DNS zone name which is managed by the AWS Route53 service. -- `access_key:` and `secret_key:` These must be set to the AWS access key and secret key of the AWS account which owns the DNS zone name. - -clearwater-ellis - -- `signup_key:` This is used as a signup key on the Ellis self-provisioning portal, so should be set to a unique string for each installation. -- `base_number:` and `number_count:` These define the telephone number range assigned to the Clearwater system. - -# Contact Information - -## Upstream Project Name - -See http:www.projectclearwater.org and https://github.com/Metaswitch/clearwater-docs/wiki for information about clearwater. - -Clearwater source code and issue list can be found at https://github.com/Metaswitch/. - -The Clearwater mailing list is at lists.projectclearwater.org. diff --git a/charms/precise/clearwater-route53/config.yaml b/charms/precise/clearwater-route53/config.yaml deleted file mode 100644 index d39b7b5..0000000 --- a/charms/precise/clearwater-route53/config.yaml +++ /dev/null @@ -1,18 +0,0 @@ -options: - zone: - description: The DNS root zone for this manager - type: string - sas: - default: "" - description: The location of the SAS server - type: string - enum: - default: "" - description: The location of the ENUM server - type: string - access_key: - description: EC2 Access Key - type: string - secret_key: - description: EC2 Secret Access Key - type: string diff --git a/charms/precise/clearwater-route53/copyright b/charms/precise/clearwater-route53/copyright deleted file mode 100644 index b205a60..0000000 --- a/charms/precise/clearwater-route53/copyright +++ /dev/null @@ -1,31 +0,0 @@ -Project Clearwater - IMS in the Cloud -Copyright (C) 2013 Metaswitch Networks Ltd - -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, along with the "Special Exception" for use of -the program along with SSL, set forth below. 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 -. - -The author can be reached by email at clearwater@metaswitch.com or by -post at Metaswitch Networks Ltd, 100 Church St, Enfield EN2 6BQ, UK - -Special Exception -Metaswitch Networks Ltd grants you permission to copy, modify, -propagate, and distribute a work formed by combining OpenSSL with The -Software, or a work derivative of such a combination, even if such -copying, modification, propagation, or distribution would otherwise -violate the terms of the GPL. You must comply with the GPL in all -respects for all of the code used other than OpenSSL. -"OpenSSL" means OpenSSL toolkit software distributed by the OpenSSL -Project and licensed under the OpenSSL Licenses, or a work based on such -software and licensed under the OpenSSL Licenses. -"OpenSSL Licenses" means the OpenSSL License and Original SSLeay License -under which the OpenSSL Project distributes the OpenSSL toolkit software, -as those licenses appear in the file LICENSE-OPENSSL. diff --git a/charms/precise/clearwater-route53/hooks/config-changed b/charms/precise/clearwater-route53/hooks/config-changed deleted file mode 100755 index cd6a671..0000000 --- a/charms/precise/clearwater-route53/hooks/config-changed +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -# config-changed occurs everytime a new configuration value is updated (juju set) diff --git a/charms/precise/clearwater-route53/hooks/install b/charms/precise/clearwater-route53/hooks/install deleted file mode 100755 index 129fb7f..0000000 --- a/charms/precise/clearwater-route53/hooks/install +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -apt-get install -y ruby1.9.3 build-essential libxslt1-dev zlib1g-dev -gem install aws-sdk-v1 --no-ri --no-rdoc - -ruby lib/clean.rb --access-key `config-get access_key` \ - --secret-key `config-get secret_key` \ - --zone `config-get zone` diff --git a/charms/precise/clearwater-route53/hooks/register-bono-relation-changed b/charms/precise/clearwater-route53/hooks/register-bono-relation-changed deleted file mode 100755 index ae0e81e..0000000 --- a/charms/precise/clearwater-route53/hooks/register-bono-relation-changed +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -set -e - -peer_ip=`relation-get public-address` -root_zone=`config-get zone` - -$CHARM_DIR/lib/declare_domains.sh $root_zone - -if [[ -z $peer_ip ]] -then - juju-log "Peer connected but has no IP address" - exit 0; -fi - -juju-log "Discovered new bono node: $peer_ip" - -ruby $CHARM_DIR/lib/add_address.rb --access-key `config-get access_key` \ - --secret-key `config-get secret_key` \ - --zone `config-get zone` \ - --role bono \ - --address $peer_ip diff --git a/charms/precise/clearwater-route53/hooks/register-bono-relation-departed b/charms/precise/clearwater-route53/hooks/register-bono-relation-departed deleted file mode 100755 index 7e60eff..0000000 --- a/charms/precise/clearwater-route53/hooks/register-bono-relation-departed +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -set -e - -peer_ip=`relation-get public-address` -root_zone=`config-get zone` - -if [[ -z $peer_ip ]] -then - juju-log "Peer disconnected but has no IP address" - exit 0; -fi - -juju-log "Lost a bono node: $peer_ip" - -ruby $CHARM_DIR/lib/remove_address.rb --access-key `config-get access_key` \ - --secret-key `config-get secret_key` \ - --zone `config-get zone` \ - --role bono \ - --address $peer_ip - -$CHARM_DIR/lib/declare_domains.sh $root_zone diff --git a/charms/precise/clearwater-route53/hooks/register-bono-relation-joined b/charms/precise/clearwater-route53/hooks/register-bono-relation-joined deleted file mode 100755 index ae0e81e..0000000 --- a/charms/precise/clearwater-route53/hooks/register-bono-relation-joined +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -set -e - -peer_ip=`relation-get public-address` -root_zone=`config-get zone` - -$CHARM_DIR/lib/declare_domains.sh $root_zone - -if [[ -z $peer_ip ]] -then - juju-log "Peer connected but has no IP address" - exit 0; -fi - -juju-log "Discovered new bono node: $peer_ip" - -ruby $CHARM_DIR/lib/add_address.rb --access-key `config-get access_key` \ - --secret-key `config-get secret_key` \ - --zone `config-get zone` \ - --role bono \ - --address $peer_ip diff --git a/charms/precise/clearwater-route53/hooks/register-ellis-relation-changed b/charms/precise/clearwater-route53/hooks/register-ellis-relation-changed deleted file mode 100755 index 114f01b..0000000 --- a/charms/precise/clearwater-route53/hooks/register-ellis-relation-changed +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -set -e - -peer_ip=`relation-get public-address` -root_zone=`config-get zone` - -$CHARM_DIR/lib/declare_domains.sh $root_zone - -if [[ -z $peer_ip ]] -then - juju-log "Peer connected but has no IP address" - exit 0; -fi - -juju-log "Discovered new ellis node: $peer_ip" - -ruby $CHARM_DIR/lib/add_address.rb --access-key `config-get access_key` \ - --secret-key `config-get secret_key` \ - --zone `config-get zone` \ - --role ellis \ - --address $peer_ip diff --git a/charms/precise/clearwater-route53/hooks/register-ellis-relation-departed b/charms/precise/clearwater-route53/hooks/register-ellis-relation-departed deleted file mode 100755 index 6274367..0000000 --- a/charms/precise/clearwater-route53/hooks/register-ellis-relation-departed +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -set -e - -peer_ip=`relation-get public-address` -root_zone=`config-get zone` - -if [[ -z $peer_ip ]] -then - juju-log "Peer disconnected but has no IP address" - exit 0; -fi - -juju-log "Lost an ellis node: $peer_ip" - -ruby $CHARM_DIR/lib/remove_address.rb --access-key `config-get access_key` \ - --secret-key `config-get secret_key` \ - --zone `config-get zone` \ - --role ellis \ - --address $peer_ip - -$CHARM_DIR/lib/declare_domains.sh $root_zone diff --git a/charms/precise/clearwater-route53/hooks/register-ellis-relation-joined b/charms/precise/clearwater-route53/hooks/register-ellis-relation-joined deleted file mode 100755 index 114f01b..0000000 --- a/charms/precise/clearwater-route53/hooks/register-ellis-relation-joined +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -set -e - -peer_ip=`relation-get public-address` -root_zone=`config-get zone` - -$CHARM_DIR/lib/declare_domains.sh $root_zone - -if [[ -z $peer_ip ]] -then - juju-log "Peer connected but has no IP address" - exit 0; -fi - -juju-log "Discovered new ellis node: $peer_ip" - -ruby $CHARM_DIR/lib/add_address.rb --access-key `config-get access_key` \ - --secret-key `config-get secret_key` \ - --zone `config-get zone` \ - --role ellis \ - --address $peer_ip diff --git a/charms/precise/clearwater-route53/hooks/register-homer-relation-changed b/charms/precise/clearwater-route53/hooks/register-homer-relation-changed deleted file mode 100755 index b6ffa7a..0000000 --- a/charms/precise/clearwater-route53/hooks/register-homer-relation-changed +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -set -e - -peer_ip=`relation-get private-address` -root_zone=`config-get zone` - -$CHARM_DIR/lib/declare_domains.sh $root_zone - -if [[ -z $peer_ip ]] -then - juju-log "Peer connected but has no IP address" - exit 0; -fi - -juju-log "Discovered new homer node: $peer_ip" - -ruby $CHARM_DIR/lib/add_address.rb --access-key `config-get access_key` \ - --secret-key `config-get secret_key` \ - --zone `config-get zone` \ - --role homer \ - --address $peer_ip diff --git a/charms/precise/clearwater-route53/hooks/register-homer-relation-departed b/charms/precise/clearwater-route53/hooks/register-homer-relation-departed deleted file mode 100755 index acda8e0..0000000 --- a/charms/precise/clearwater-route53/hooks/register-homer-relation-departed +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -set -e - -peer_ip=`relation-get private-address` -root_zone=`config-get zone` - -if [[ -z $peer_ip ]] -then - juju-log "Peer disconnected but has no IP address" - exit 0; -fi - -juju-log "Lost a homer node: $peer_ip" - -ruby $CHARM_DIR/lib/remove_address.rb --access-key `config-get access_key` \ - --secret-key `config-get secret_key` \ - --zone `config-get zone` \ - --role homer \ - --address $peer_ip - -$CHARM_DIR/lib/declare_domains.sh $root_zone diff --git a/charms/precise/clearwater-route53/hooks/register-homer-relation-joined b/charms/precise/clearwater-route53/hooks/register-homer-relation-joined deleted file mode 100755 index b6ffa7a..0000000 --- a/charms/precise/clearwater-route53/hooks/register-homer-relation-joined +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -set -e - -peer_ip=`relation-get private-address` -root_zone=`config-get zone` - -$CHARM_DIR/lib/declare_domains.sh $root_zone - -if [[ -z $peer_ip ]] -then - juju-log "Peer connected but has no IP address" - exit 0; -fi - -juju-log "Discovered new homer node: $peer_ip" - -ruby $CHARM_DIR/lib/add_address.rb --access-key `config-get access_key` \ - --secret-key `config-get secret_key` \ - --zone `config-get zone` \ - --role homer \ - --address $peer_ip diff --git a/charms/precise/clearwater-route53/hooks/register-homestead-relation-changed b/charms/precise/clearwater-route53/hooks/register-homestead-relation-changed deleted file mode 100755 index 0834639..0000000 --- a/charms/precise/clearwater-route53/hooks/register-homestead-relation-changed +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -set -e - -peer_ip=`relation-get private-address` -root_zone=`config-get zone` - -$CHARM_DIR/lib/declare_domains.sh $root_zone - -if [[ -z $peer_ip ]] -then - juju-log "Peer connected but has no IP address" - exit 0; -fi - -juju-log "Discovered new homestead node: $peer_ip" - -ruby $CHARM_DIR/lib/add_address.rb --access-key `config-get access_key` \ - --secret-key `config-get secret_key` \ - --zone `config-get zone` \ - --role homestead \ - --address $peer_ip diff --git a/charms/precise/clearwater-route53/hooks/register-homestead-relation-departed b/charms/precise/clearwater-route53/hooks/register-homestead-relation-departed deleted file mode 100755 index 2d73744..0000000 --- a/charms/precise/clearwater-route53/hooks/register-homestead-relation-departed +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -set -e - -peer_ip=`relation-get private-address` -root_zone=`config-get zone` - -if [[ -z $peer_ip ]] -then - juju-log "Peer disconnected but has no IP address" - exit 0; -fi - -juju-log "Lost a homestead node: $peer_ip" - -ruby $CHARM_DIR/lib/remove_address.rb --access-key `config-get access_key` \ - --secret-key `config-get secret_key` \ - --zone `config-get zone` \ - --role homestead \ - --address $peer_ip - -$CHARM_DIR/lib/declare_domains.sh $root_zone diff --git a/charms/precise/clearwater-route53/hooks/register-homestead-relation-joined b/charms/precise/clearwater-route53/hooks/register-homestead-relation-joined deleted file mode 100755 index 0834639..0000000 --- a/charms/precise/clearwater-route53/hooks/register-homestead-relation-joined +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -set -e - -peer_ip=`relation-get private-address` -root_zone=`config-get zone` - -$CHARM_DIR/lib/declare_domains.sh $root_zone - -if [[ -z $peer_ip ]] -then - juju-log "Peer connected but has no IP address" - exit 0; -fi - -juju-log "Discovered new homestead node: $peer_ip" - -ruby $CHARM_DIR/lib/add_address.rb --access-key `config-get access_key` \ - --secret-key `config-get secret_key` \ - --zone `config-get zone` \ - --role homestead \ - --address $peer_ip diff --git a/charms/precise/clearwater-route53/hooks/register-ralf-relation-changed b/charms/precise/clearwater-route53/hooks/register-ralf-relation-changed deleted file mode 100755 index ccf0c5e..0000000 --- a/charms/precise/clearwater-route53/hooks/register-ralf-relation-changed +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -set -e - -peer_ip=`relation-get private-address` -root_zone=`config-get zone` - -$CHARM_DIR/lib/declare_domains.sh $root_zone - -if [[ -z $peer_ip ]] -then - juju-log "Peer connected but has no IP address" - exit 0; -fi - -juju-log "Discovered new ralf node: $peer_ip" - -ruby $CHARM_DIR/lib/add_address.rb --access-key `config-get access_key` \ - --secret-key `config-get secret_key` \ - --zone `config-get zone` \ - --role ralf \ - --address $peer_ip diff --git a/charms/precise/clearwater-route53/hooks/register-ralf-relation-departed b/charms/precise/clearwater-route53/hooks/register-ralf-relation-departed deleted file mode 100755 index ef6215e..0000000 --- a/charms/precise/clearwater-route53/hooks/register-ralf-relation-departed +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -set -e - -peer_ip=`relation-get private-address` -root_zone=`config-get zone` - -if [[ -z $peer_ip ]] -then - juju-log "Peer disconnected but has no IP address" - exit 0; -fi - -juju-log "Lost a ralf node: $peer_ip" - -ruby $CHARM_DIR/lib/remove_address.rb --access-key `config-get access_key` \ - --secret-key `config-get secret_key` \ - --zone `config-get zone` \ - --role ralf \ - --address $peer_ip - -$CHARM_DIR/lib/declare_domains.sh $root_zone diff --git a/charms/precise/clearwater-route53/hooks/register-ralf-relation-joined b/charms/precise/clearwater-route53/hooks/register-ralf-relation-joined deleted file mode 100755 index ccf0c5e..0000000 --- a/charms/precise/clearwater-route53/hooks/register-ralf-relation-joined +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -set -e - -peer_ip=`relation-get private-address` -root_zone=`config-get zone` - -$CHARM_DIR/lib/declare_domains.sh $root_zone - -if [[ -z $peer_ip ]] -then - juju-log "Peer connected but has no IP address" - exit 0; -fi - -juju-log "Discovered new ralf node: $peer_ip" - -ruby $CHARM_DIR/lib/add_address.rb --access-key `config-get access_key` \ - --secret-key `config-get secret_key` \ - --zone `config-get zone` \ - --role ralf \ - --address $peer_ip diff --git a/charms/precise/clearwater-route53/hooks/register-sprout-relation-changed b/charms/precise/clearwater-route53/hooks/register-sprout-relation-changed deleted file mode 100755 index 743def7..0000000 --- a/charms/precise/clearwater-route53/hooks/register-sprout-relation-changed +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -set -e - -peer_ip=`relation-get private-address` -root_zone=`config-get zone` - -$CHARM_DIR/lib/declare_domains.sh $root_zone - -if [[ -z $peer_ip ]] -then - juju-log "Peer connected but has no IP address" - exit 0; -fi - -juju-log "Discovered new sprout node: $peer_ip" - -ruby $CHARM_DIR/lib/add_address.rb --access-key `config-get access_key` \ - --secret-key `config-get secret_key` \ - --zone `config-get zone` \ - --role sprout \ - --address $peer_ip diff --git a/charms/precise/clearwater-route53/hooks/register-sprout-relation-departed b/charms/precise/clearwater-route53/hooks/register-sprout-relation-departed deleted file mode 100755 index ceb7ddd..0000000 --- a/charms/precise/clearwater-route53/hooks/register-sprout-relation-departed +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -set -e - -peer_ip=`relation-get private-address` -root_zone=`config-get zone` - -if [[ -z $peer_ip ]] -then - juju-log "Peer disconnected but has no IP address" - exit 0; -fi - -juju-log "Lost a sprout node: $peer_ip" - -ruby $CHARM_DIR/lib/remove_address.rb --access-key `config-get access_key` \ - --secret-key `config-get secret_key` \ - --zone `config-get zone` \ - --role sprout \ - --address $peer_ip - -$CHARM_DIR/lib/declare_domains.sh $root_zone diff --git a/charms/precise/clearwater-route53/hooks/register-sprout-relation-joined b/charms/precise/clearwater-route53/hooks/register-sprout-relation-joined deleted file mode 100755 index 743def7..0000000 --- a/charms/precise/clearwater-route53/hooks/register-sprout-relation-joined +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -set -e - -peer_ip=`relation-get private-address` -root_zone=`config-get zone` - -$CHARM_DIR/lib/declare_domains.sh $root_zone - -if [[ -z $peer_ip ]] -then - juju-log "Peer connected but has no IP address" - exit 0; -fi - -juju-log "Discovered new sprout node: $peer_ip" - -ruby $CHARM_DIR/lib/add_address.rb --access-key `config-get access_key` \ - --secret-key `config-get secret_key` \ - --zone `config-get zone` \ - --role sprout \ - --address $peer_ip diff --git a/charms/precise/clearwater-route53/lib/add_address.rb b/charms/precise/clearwater-route53/lib/add_address.rb deleted file mode 100644 index 8494238..0000000 --- a/charms/precise/clearwater-route53/lib/add_address.rb +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env ruby - -require_relative './route53' - -opts = Route53.parse_options -route53 = Route53.new(opts[:access_key], opts[:secret_key], opts[:zone]) -route53.add(opts[:role], opts[:address]) diff --git a/charms/precise/clearwater-route53/lib/clean.rb b/charms/precise/clearwater-route53/lib/clean.rb deleted file mode 100644 index fd26869..0000000 --- a/charms/precise/clearwater-route53/lib/clean.rb +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env ruby - -require_relative './route53' - -opts = Route53.parse_options -route53 = Route53.new(opts[:access_key], opts[:secret_key], opts[:zone]) -route53.clean() diff --git a/charms/precise/clearwater-route53/lib/declare_domains.sh b/charms/precise/clearwater-route53/lib/declare_domains.sh deleted file mode 100755 index 5773886..0000000 --- a/charms/precise/clearwater-route53/lib/declare_domains.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -root_zone=$1 - -if [[ -z $root_zone ]] -then - exit 2 -fi - -relation-set home_domain=$root_zone -relation-set sprout_domain=sprout.$root_zone -relation-set homestead_domain=homestead.$root_zone:8888 -relation-set provisioning_domain=homestead.$root_zone:8889 -relation-set homer_domain=homer.$root_zone:7888 -relation-set ellis_domain=ellis.$root_zone -relation-set ralf_domain=ralf.$root_zone -relation-set sas_domain=`config-get sas` -relation-set enum_domain=`config-get enum` diff --git a/charms/precise/clearwater-route53/lib/remove_address.rb b/charms/precise/clearwater-route53/lib/remove_address.rb deleted file mode 100644 index b9c6350..0000000 --- a/charms/precise/clearwater-route53/lib/remove_address.rb +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env ruby - -require_relative './route53' - -opts = Route53.parse_options -route53 = Route53.new(opts[:access_key], opts[:secret_key], opts[:zone]) -route53.remove(opts[:role], opts[:address]) diff --git a/charms/precise/clearwater-route53/lib/route53.rb b/charms/precise/clearwater-route53/lib/route53.rb deleted file mode 100644 index 7ce7936..0000000 --- a/charms/precise/clearwater-route53/lib/route53.rb +++ /dev/null @@ -1,108 +0,0 @@ -#!/usr/bin/env ruby - -require 'aws-sdk-v1' -require 'optparse' -require 'resolv' - -class Route53 - def initialize(access_key, secret_key, zone) - route53 = AWS::Route53.new(access_key_id: access_key, - secret_access_key: secret_key) - - zones = route53.hosted_zones - - @zone = zones.find { |z| z.name == "#{zone}." } - if @zone.nil? - zones.create(zone) - @zone = zones.find { |z| z.name == "#{zone}." } - end - - fail "Couldn't find or create zone #{zone}" if zone.nil? - end - - def hostname(role) - if role == "bono" - @zone.name - else - "#{role}.#{@zone.name}" - end - end - - def add(role, address) - record_sets = @zone.resource_record_sets - record_set = record_sets[hostname(role), "A"] - if record_set.exists? - unless record_set.resource_records.find { |rr| rr[:value] == address } - # Update the existing record - record_set.resource_records = record_set.resource_records + [{ value: address }] - record_set.update - end - else - # Create a single record - record_sets.create(hostname(role), "A", ttl: 60, resource_records: [{ value: address }]) - end - end - - def remove(role, address) - record_sets = @zone.resource_record_sets - record_set = record_sets[hostname(role), "A"] - if record_set.exists? and record_set.resource_records.find { |rr| rr[:value] == address } - # Remove the record or the whole set - if record_set.resource_records.size == 1 - record_set.delete - else - record_set.resource_records = record_set.resource_records - [{ value: address }] - record_set.update - end - end - end - - def clean - record_sets = @zone.resource_record_sets - record_sets.each do |rs| - if rs.type == "A" - rs.delete - end - end - end - -private - - def self.parse_options - options = {} - opts = OptionParser.new do |opts| - opts.banner = "Usage: route53 [options]" - - opts.on("--access-key KEY", String, "EC2 Access Key") do |key| - options[:access_key] = key - end - - opts.on("--secret-key KEY", String, "EC2 Secret Access Key") do |key| - options[:secret_key] = key - end - - opts.on("--zone ZONE", String, "DNS root zone to configure domain in") do |zone| - options[:zone] = zone - end - - opts.on("--role ROLE", String, "Node role to modify") do |role| - options[:role] = role - end - - opts.on("--address ADDRESS", String, "IP address of the node") do |address| - options[:address] = Resolv.getaddress(address) - end - end - - opts.parse! - - [:access_key, :secret_key, :zone].each do |s| - if options[s].nil? - puts opts - exit - end - end - - options - end -end diff --git a/charms/precise/clearwater-route53/metadata.yaml b/charms/precise/clearwater-route53/metadata.yaml deleted file mode 100644 index 305022d..0000000 --- a/charms/precise/clearwater-route53/metadata.yaml +++ /dev/null @@ -1,23 +0,0 @@ -name: clearwater-route53 -summary: Route53 DNS Agent for Project Clearwater -maintainer: Project Clearwater Maintainers -description: Updates DNS records for Clearwater using AWS Route53 service - -categories: - - miscellaneous - -subordinate: false - -provides: - register-homestead: - interface: dns-register - register-homer: - interface: dns-register - register-sprout: - interface: dns-register - register-bono: - interface: dns-register - register-ralf: - interface: dns-register - register-ellis: - interface: dns-register diff --git a/charms/precise/clearwater-sipp/copyright b/charms/precise/clearwater-sipp/copyright deleted file mode 100644 index b205a60..0000000 --- a/charms/precise/clearwater-sipp/copyright +++ /dev/null @@ -1,31 +0,0 @@ -Project Clearwater - IMS in the Cloud -Copyright (C) 2013 Metaswitch Networks Ltd - -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, along with the "Special Exception" for use of -the program along with SSL, set forth below. 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 -. - -The author can be reached by email at clearwater@metaswitch.com or by -post at Metaswitch Networks Ltd, 100 Church St, Enfield EN2 6BQ, UK - -Special Exception -Metaswitch Networks Ltd grants you permission to copy, modify, -propagate, and distribute a work formed by combining OpenSSL with The -Software, or a work derivative of such a combination, even if such -copying, modification, propagation, or distribution would otherwise -violate the terms of the GPL. You must comply with the GPL in all -respects for all of the code used other than OpenSSL. -"OpenSSL" means OpenSSL toolkit software distributed by the OpenSSL -Project and licensed under the OpenSSL Licenses, or a work based on such -software and licensed under the OpenSSL Licenses. -"OpenSSL Licenses" means the OpenSSL License and Original SSLeay License -under which the OpenSSL Project distributes the OpenSSL toolkit software, -as those licenses appear in the file LICENSE-OPENSSL. diff --git a/charms/precise/clearwater-sipp/hooks/config-changed b/charms/precise/clearwater-sipp/hooks/config-changed deleted file mode 100755 index 89573fa..0000000 --- a/charms/precise/clearwater-sipp/hooks/config-changed +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash -set -e - -# Update the /etc/clearwater/config file, the node.json, and re-run -# chef-solo -$CHARM_DIR/lib/config_script -$CHARM_DIR/lib/node_json_script -chef-solo -c /home/ubuntu/chef-solo/solo.rb -j /home/ubuntu/chef-solo/node.json -$CHARM_DIR/lib/restart diff --git a/charms/precise/clearwater-sipp/lib/chef_solo_install b/charms/precise/clearwater-sipp/lib/chef_solo_install deleted file mode 100755 index 414404c..0000000 --- a/charms/precise/clearwater-sipp/lib/chef_solo_install +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash - -# This covers installing chef-solo and the Clearwater chef recipes -# Install needed libraries -apt-get -y install git libxml2-dev libxslt1-dev wget curl - -# Install chef -install_sh="http://opscode.com/chef/install.sh" -version_string="-v 11.6.0" -bash <(wget ${install_sh} -O -) ${version_string} - -# Pull down the Clearwater chef recipes -if [ ! -d /home/ubuntu/chef-solo ] -then - mkdir /home/ubuntu/chef-solo - git clone --recursive -b master git://github.com/Metaswitch/chef.git /home/ubuntu/chef-solo -fi - -# Update the chef recipes -cd /home/ubuntu/chef-solo -git checkout release-70 -git submodule update --init - -# Create the solo.rb file -cat > /home/ubuntu/chef-solo/solo.rb <. - -The author can be reached by email at clearwater@metaswitch.com or by -post at Metaswitch Networks Ltd, 100 Church St, Enfield EN2 6BQ, UK - -Special Exception -Metaswitch Networks Ltd grants you permission to copy, modify, -propagate, and distribute a work formed by combining OpenSSL with The -Software, or a work derivative of such a combination, even if such -copying, modification, propagation, or distribution would otherwise -violate the terms of the GPL. You must comply with the GPL in all -respects for all of the code used other than OpenSSL. -"OpenSSL" means OpenSSL toolkit software distributed by the OpenSSL -Project and licensed under the OpenSSL Licenses, or a work based on such -software and licensed under the OpenSSL Licenses. -"OpenSSL Licenses" means the OpenSSL License and Original SSLeay License -under which the OpenSSL Project distributes the OpenSSL toolkit software, -as those licenses appear in the file LICENSE-OPENSSL. diff --git a/charms/precise/clearwater-sprout/hooks/config-changed b/charms/precise/clearwater-sprout/hooks/config-changed deleted file mode 100755 index 89573fa..0000000 --- a/charms/precise/clearwater-sprout/hooks/config-changed +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash -set -e - -# Update the /etc/clearwater/config file, the node.json, and re-run -# chef-solo -$CHARM_DIR/lib/config_script -$CHARM_DIR/lib/node_json_script -chef-solo -c /home/ubuntu/chef-solo/solo.rb -j /home/ubuntu/chef-solo/node.json -$CHARM_DIR/lib/restart diff --git a/charms/precise/clearwater-sprout/hooks/programmable-multiple-relation-changed b/charms/precise/clearwater-sprout/hooks/programmable-multiple-relation-changed deleted file mode 100755 index 723854a..0000000 --- a/charms/precise/clearwater-sprout/hooks/programmable-multiple-relation-changed +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -set -e - -# Set our DNS requirements -TTL=300 -id=$(cut -d/ -f2 <<< $JUJU_UNIT_NAME) -ip=$(unit-get private-address) -relation-set domain=$(config-get zone) -relation-set resources='sprout '$TTL' IN A '$ip' -sprout '$TTL' IN NAPTR 1 1 "S" "SIP+D2T" "" _sip._tcp.sprout -_sip._tcp.sprout '$TTL' IN SRV 0 0 5054 sprout-'$id' -sprout-'$id' '$TTL' IN A '$ip - -# Update our DNS server -if [ "$(relation-get private-address)" != "" ] -then - echo nameserver $(relation-get private-address) > /etc/dnsmasq.resolv.conf - grep -v ^RESOLV_CONF= /etc/default/dnsmasq > /tmp/dnsmasq.$$ - mv /tmp/dnsmasq.$$ /etc/default/dnsmasq - echo RESOLV_CONF=/etc/dnsmasq.resolv.conf >> /etc/default/dnsmasq - service dnsmasq restart -fi - -# Update Clearwater configuration and restart -$CHARM_DIR/lib/config_script programmable-multiple -$CHARM_DIR/lib/restart diff --git a/charms/precise/clearwater-sprout/icon.svg b/charms/precise/clearwater-sprout/icon.svg deleted file mode 100644 index f9ac92c..0000000 --- a/charms/precise/clearwater-sprout/icon.svg +++ /dev/null @@ -1,407 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - diff --git a/charms/precise/clearwater-sprout/lib/chef_solo_install b/charms/precise/clearwater-sprout/lib/chef_solo_install deleted file mode 100755 index 414404c..0000000 --- a/charms/precise/clearwater-sprout/lib/chef_solo_install +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash - -# This covers installing chef-solo and the Clearwater chef recipes -# Install needed libraries -apt-get -y install git libxml2-dev libxslt1-dev wget curl - -# Install chef -install_sh="http://opscode.com/chef/install.sh" -version_string="-v 11.6.0" -bash <(wget ${install_sh} -O -) ${version_string} - -# Pull down the Clearwater chef recipes -if [ ! -d /home/ubuntu/chef-solo ] -then - mkdir /home/ubuntu/chef-solo - git clone --recursive -b master git://github.com/Metaswitch/chef.git /home/ubuntu/chef-solo -fi - -# Update the chef recipes -cd /home/ubuntu/chef-solo -git checkout release-70 -git submodule update --init - -# Create the solo.rb file -cat > /home/ubuntu/chef-solo/solo.rb < /etc/dnsmasq.resolv.conf + grep -v ^RESOLV_CONF= /etc/default/dnsmasq > /tmp/dnsmasq.$$ + mv /tmp/dnsmasq.$$ /etc/default/dnsmasq + echo RESOLV_CONF=/etc/dnsmasq.resolv.conf >> /etc/default/dnsmasq + service dnsmasq restart +fi + +# Update Clearwater configuration and restart +$CHARM_DIR/lib/config_script programmable-multiple +$CHARM_DIR/lib/restart diff --git a/charms/precise/clearwater-bono/hooks/ralf-ctf-relation-changed b/charms/trusty/clearwater-bono/hooks/ralf-ctf-relation-changed similarity index 100% rename from charms/precise/clearwater-bono/hooks/ralf-ctf-relation-changed rename to charms/trusty/clearwater-bono/hooks/ralf-ctf-relation-changed diff --git a/charms/trusty/clearwater-bono/hooks/start b/charms/trusty/clearwater-bono/hooks/start new file mode 100755 index 0000000..9eceaf9 --- /dev/null +++ b/charms/trusty/clearwater-bono/hooks/start @@ -0,0 +1,15 @@ +#!/bin/bash +# Here put anything that is needed to start the service. +# Note that currently this is run directly after install +# i.e. 'service apache2 start' +set -e + +# This hook needs to be idempotent, so this could be run when bono is +# already running, when it's running but not monitored by monit, when +# it's stopped but being monitored (so it's about to start), or stopped +# and unmonitored. To cover all these cases, restart bono, reload monit, +# then finally have monit monitor bono. Note that reloading monit can +# fail and restarting bono can fail because monit will restart it. +service bono restart || true +reload clearwater-monit &> /dev/null || true +monit monitor -g bono diff --git a/charms/precise/clearwater-bono/hooks/stop b/charms/trusty/clearwater-bono/hooks/stop similarity index 85% rename from charms/precise/clearwater-bono/hooks/stop rename to charms/trusty/clearwater-bono/hooks/stop index 0517bc1..1500c68 100755 --- a/charms/precise/clearwater-bono/hooks/stop +++ b/charms/trusty/clearwater-bono/hooks/stop @@ -8,5 +8,5 @@ set -e # Stop bono via monit -service clearwater-monit start || /bin/true -monit stop bono +reload clearwater-monit &> /dev/null || true +monit stop -g bono diff --git a/charms/precise/clearwater-bono/hooks/ue-relation-joined b/charms/trusty/clearwater-bono/hooks/ue-relation-joined similarity index 100% rename from charms/precise/clearwater-bono/hooks/ue-relation-joined rename to charms/trusty/clearwater-bono/hooks/ue-relation-joined diff --git a/charms/precise/clearwater-bono/hooks/upgrade-charm b/charms/trusty/clearwater-bono/hooks/upgrade-charm similarity index 100% rename from charms/precise/clearwater-bono/hooks/upgrade-charm rename to charms/trusty/clearwater-bono/hooks/upgrade-charm diff --git a/charms/precise/clearwater-bono/icon.svg b/charms/trusty/clearwater-bono/icon.svg similarity index 100% rename from charms/precise/clearwater-bono/icon.svg rename to charms/trusty/clearwater-bono/icon.svg diff --git a/charms/precise/clearwater-bono/lib/chef_solo_install b/charms/trusty/clearwater-bono/lib/chef_solo_install similarity index 70% rename from charms/precise/clearwater-bono/lib/chef_solo_install rename to charms/trusty/clearwater-bono/lib/chef_solo_install index 1c92213..cbbeab1 100755 --- a/charms/precise/clearwater-bono/lib/chef_solo_install +++ b/charms/trusty/clearwater-bono/lib/chef_solo_install @@ -1,22 +1,19 @@ #!/bin/bash # This covers installing chef-solo and the Clearwater chef recipes -# Install needed libraries -apt-get -y install git libxml2-dev libxslt1-dev wget curl - -# Install chef -$CHARM_DIR/lib/chef-install.sh -v 11.6.0 +# Install chef and needed tools/libraries +apt-get -y install chef git libxml2-dev libxslt1-dev wget curl # Pull down the Clearwater chef recipes if [ ! -d /home/ubuntu/chef-solo ] then mkdir /home/ubuntu/chef-solo - git clone --recursive -b master git://github.com/Metaswitch/chef.git /home/ubuntu/chef-solo + git clone --recursive git://github.com/Metaswitch/chef.git /home/ubuntu/chef-solo fi # Update the chef recipes cd /home/ubuntu/chef-solo -git checkout release-70 +git checkout release-90 git submodule update --init # Create the solo.rb file diff --git a/charms/precise/clearwater-bono/lib/config_script b/charms/trusty/clearwater-bono/lib/config_script similarity index 83% rename from charms/precise/clearwater-bono/lib/config_script rename to charms/trusty/clearwater-bono/lib/config_script index e595fc9..ab8fb7b 100755 --- a/charms/precise/clearwater-bono/lib/config_script +++ b/charms/trusty/clearwater-bono/lib/config_script @@ -21,13 +21,31 @@ sas_server=$(config-get sas) local_ip=$(unit-get private-address) public_ip=$(unit-get public-address) public_hostname=bono-$(cut -d/ -f2 <<< $JUJU_UNIT_NAME).$(config-get zone) +node_idx=$(($(cut -d/ -f2 <<< $JUJU_UNIT_NAME) + 1)) turn_workaround=$(config-get turn_workaround) cdf=$(config-get cdf) target_latency_us=$(config-get target_latency_us) # Write configuration back mkdir -p /etc/clearwater -cat >/etc/clearwater/config </etc/clearwater/local_config </etc/clearwater/shared_config <. +# +# The author can be reached by email at clearwater@metaswitch.com or by +# post at Metaswitch Networks Ltd, 100 Church St, Enfield EN2 6BQ, UK +# +# Special Exception +# Metaswitch Networks Ltd grants you permission to copy, modify, +# propagate, and distribute a work formed by combining OpenSSL with The +# Software, or a work derivative of such a combination, even if such +# copying, modification, propagation, or distribution would otherwise +# violate the terms of the GPL. You must comply with the GPL in all +# respects for all of the code used other than OpenSSL. +# "OpenSSL" means OpenSSL toolkit software distributed by the OpenSSL +# Project and licensed under the OpenSSL Licenses, or a work based on such +# software and licensed under the OpenSSL Licenses. +# "OpenSSL Licenses" means the OpenSSL License and Original SSLeay License +# under which the OpenSSL Project distributes the OpenSSL toolkit software, +# as those licenses appear in the file LICENSE-OPENSSL. + +# This script generates a JSON-ified set of DNS records based on an IP, A +# records and SRV records. These are suitable for the API to +# https://github.com/chuckbutler/DNS-Charm. + +import sys +import json + +if len(sys.argv) < 4: + print "Usage: generate_dns_records.py IP CLUSTER_A_RECORD SPECIFIC_A_RECORD [SRV_PORT SRV_ADDR...]" + +ip = sys.argv[1] +cluster_a = sys.argv[2] +specific_a = sys.argv[3] +port = None +srv_addrs = [] + +ttl = "300" + +if len(sys.argv) > 5: + port = sys.argv[4] + srv_addrs = sys.argv[5:] + +ret = [{"rr":"A", "alias": cluster_a, "ttl": ttl,"addr": ip}, + {"rr":"A", "alias": specific_a, "ttl": ttl,"addr": ip}] + +for a in srv_addrs: + ret.append({"rr": "SRV", "alias": a, "ttl": ttl,"priority": "1", "weight": "1", "port": port, "target": specific_a}) + +print json.dumps(ret) diff --git a/charms/precise/clearwater-bono/lib/node_json_script b/charms/trusty/clearwater-bono/lib/node_json_script similarity index 100% rename from charms/precise/clearwater-bono/lib/node_json_script rename to charms/trusty/clearwater-bono/lib/node_json_script diff --git a/charms/precise/clearwater-bono/lib/node_json_template b/charms/trusty/clearwater-bono/lib/node_json_template similarity index 100% rename from charms/precise/clearwater-bono/lib/node_json_template rename to charms/trusty/clearwater-bono/lib/node_json_template diff --git a/charms/precise/clearwater-bono/lib/restart b/charms/trusty/clearwater-bono/lib/restart similarity index 100% rename from charms/precise/clearwater-bono/lib/restart rename to charms/trusty/clearwater-bono/lib/restart diff --git a/charms/precise/clearwater-bono/metadata.yaml b/charms/trusty/clearwater-bono/metadata.yaml similarity index 100% rename from charms/precise/clearwater-bono/metadata.yaml rename to charms/trusty/clearwater-bono/metadata.yaml diff --git a/charms/precise/clearwater-bono/revision b/charms/trusty/clearwater-bono/revision similarity index 100% rename from charms/precise/clearwater-bono/revision rename to charms/trusty/clearwater-bono/revision diff --git a/charms/precise/clearwater-ellis/README.md b/charms/trusty/clearwater-ellis/README.md similarity index 92% rename from charms/precise/clearwater-ellis/README.md rename to charms/trusty/clearwater-ellis/README.md index aa8cb93..f95608d 100644 --- a/charms/precise/clearwater-ellis/README.md +++ b/charms/trusty/clearwater-ellis/README.md @@ -36,22 +36,22 @@ The config.yaml configuration file takes the following format. signup_key: secret base_number: "6505550000" number_count: 1000 - repo: http://repo.cw-ngv.com/stable + repo: http://repo.cw-ngv.com/juju-clearwater-2 clearwater-bono: turn_workaround: password - repo: http://repo.cw-ngv.com/stable + repo: http://repo.cw-ngv.com/juju-clearwater-2 clearwater-sprout: reg_min_expires: 400 session_max_expires: 900 - repo: http://repo.cw-ngv.com/stable + repo: http://repo.cw-ngv.com/juju-clearwater-2 clearwater-homestead: - repo: http://repo.cw-ngv.com/stable + repo: http://repo.cw-ngv.com/juju-clearwater-2 clearwater-homer: - repo: http://repo.cw-ngv.com/stable + repo: http://repo.cw-ngv.com/juju-clearwater-2 Note that the clearwater-ellis charm can only be deployed on the `amd64` architecture. diff --git a/charms/precise/clearwater-ellis/config.yaml b/charms/trusty/clearwater-ellis/config.yaml similarity index 94% rename from charms/precise/clearwater-ellis/config.yaml rename to charms/trusty/clearwater-ellis/config.yaml index 8f6c65f..632cde8 100644 --- a/charms/precise/clearwater-ellis/config.yaml +++ b/charms/trusty/clearwater-ellis/config.yaml @@ -29,6 +29,6 @@ options: description: The count of numbers to allocate type: int repo: - default: http://repo.cw-ngv.com/juju-clearwater-1/ + default: http://repo.cw-ngv.com/juju-clearwater-2/ description: The location of the repo server type: string diff --git a/charms/precise/clearwater-homer/copyright b/charms/trusty/clearwater-ellis/copyright similarity index 97% rename from charms/precise/clearwater-homer/copyright rename to charms/trusty/clearwater-ellis/copyright index b205a60..39f1ec8 100644 --- a/charms/precise/clearwater-homer/copyright +++ b/charms/trusty/clearwater-ellis/copyright @@ -1,5 +1,5 @@ Project Clearwater - IMS in the Cloud -Copyright (C) 2013 Metaswitch Networks Ltd +Copyright (C) 2016 Metaswitch Networks Ltd 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 diff --git a/charms/precise/clearwater-ellis/hooks/as-catalog-relation-changed b/charms/trusty/clearwater-ellis/hooks/as-catalog-relation-changed similarity index 100% rename from charms/precise/clearwater-ellis/hooks/as-catalog-relation-changed rename to charms/trusty/clearwater-ellis/hooks/as-catalog-relation-changed diff --git a/charms/precise/clearwater-ellis/hooks/as-catalog-relation-departed b/charms/trusty/clearwater-ellis/hooks/as-catalog-relation-departed similarity index 100% rename from charms/precise/clearwater-ellis/hooks/as-catalog-relation-departed rename to charms/trusty/clearwater-ellis/hooks/as-catalog-relation-departed diff --git a/charms/precise/clearwater-ellis/hooks/config-changed b/charms/trusty/clearwater-ellis/hooks/config-changed similarity index 86% rename from charms/precise/clearwater-ellis/hooks/config-changed rename to charms/trusty/clearwater-ellis/hooks/config-changed index a61c627..d331123 100755 --- a/charms/precise/clearwater-ellis/hooks/config-changed +++ b/charms/trusty/clearwater-ellis/hooks/config-changed @@ -1,7 +1,7 @@ #!/bin/bash set -e -# Update the /etc/clearwater/config file, the node.json, and re-run +# Update the /etc/clearwater/*_config files, the node.json, and re-run # chef-solo $CHARM_DIR/lib/config_script $CHARM_DIR/lib/node_json_script diff --git a/charms/precise/clearwater-ellis/hooks/homestead-prov-relation-changed b/charms/trusty/clearwater-ellis/hooks/homestead-prov-relation-changed similarity index 100% rename from charms/precise/clearwater-ellis/hooks/homestead-prov-relation-changed rename to charms/trusty/clearwater-ellis/hooks/homestead-prov-relation-changed diff --git a/charms/precise/clearwater-ellis/hooks/install b/charms/trusty/clearwater-ellis/hooks/install similarity index 100% rename from charms/precise/clearwater-ellis/hooks/install rename to charms/trusty/clearwater-ellis/hooks/install diff --git a/charms/precise/clearwater-ellis/hooks/programmable-multiple-relation-changed b/charms/trusty/clearwater-ellis/hooks/programmable-multiple-relation-changed similarity index 91% rename from charms/precise/clearwater-ellis/hooks/programmable-multiple-relation-changed rename to charms/trusty/clearwater-ellis/hooks/programmable-multiple-relation-changed index e80524f..4620607 100755 --- a/charms/precise/clearwater-ellis/hooks/programmable-multiple-relation-changed +++ b/charms/trusty/clearwater-ellis/hooks/programmable-multiple-relation-changed @@ -2,12 +2,11 @@ set -e # Set our DNS requirements -TTL=300 id=$(cut -d/ -f2 <<< $JUJU_UNIT_NAME) ip=$(unit-get public-address) relation-set domain=$(config-get zone) -relation-set resources='ellis '$TTL' IN A '$ip' -ellis-'$id' '$TTL' IN A '$ip +DNS_JSON=$($CHARM_DIR/lib/generate_dns_records $ip ellis ellis-$id) +relation-set resources="$DNS_JSON" # Update our DNS server if [ "$(relation-get private-address)" != "" ] diff --git a/charms/precise/clearwater-ellis/hooks/start b/charms/trusty/clearwater-ellis/hooks/start similarity index 64% rename from charms/precise/clearwater-ellis/hooks/start rename to charms/trusty/clearwater-ellis/hooks/start index a17cee2..e649b6c 100755 --- a/charms/precise/clearwater-ellis/hooks/start +++ b/charms/trusty/clearwater-ellis/hooks/start @@ -7,11 +7,9 @@ set -e # This hook needs to be idempotent, so this could be run when ellis is # already running, when it's running but not monitored by monit, when # it's stopped but being monitored (so it's about to start), or stopped -# and unmonitored. To cover all these cases, restart ellis, restart monit, +# and unmonitored. To cover all these cases, restart ellis, reload monit, # then finally have monit monitor ellis. Note that restarting monit can -# fail because init will also restart it when it stops and restarting -# ellis can fail because monit will restart it. +# fail and restarting ellis can fail because monit will restart it. service ellis restart || /usr/bin/true -service clearwater-monit restart || /usr/bin/true -sleep 1 -monit monitor ellis +reload clearwater-monit &> /dev/null || true +monit monitor -g ellis diff --git a/charms/precise/clearwater-ellis/hooks/stop b/charms/trusty/clearwater-ellis/hooks/stop similarity index 100% rename from charms/precise/clearwater-ellis/hooks/stop rename to charms/trusty/clearwater-ellis/hooks/stop diff --git a/charms/precise/clearwater-ellis/hooks/upgrade-charm b/charms/trusty/clearwater-ellis/hooks/upgrade-charm similarity index 100% rename from charms/precise/clearwater-ellis/hooks/upgrade-charm rename to charms/trusty/clearwater-ellis/hooks/upgrade-charm diff --git a/charms/precise/clearwater-ellis/hooks/xdms-relation-changed b/charms/trusty/clearwater-ellis/hooks/xdms-relation-changed similarity index 100% rename from charms/precise/clearwater-ellis/hooks/xdms-relation-changed rename to charms/trusty/clearwater-ellis/hooks/xdms-relation-changed diff --git a/charms/precise/clearwater-ellis/icon.svg b/charms/trusty/clearwater-ellis/icon.svg similarity index 100% rename from charms/precise/clearwater-ellis/icon.svg rename to charms/trusty/clearwater-ellis/icon.svg diff --git a/charms/precise/clearwater-homer/lib/chef_solo_install b/charms/trusty/clearwater-ellis/lib/chef_solo_install similarity index 64% rename from charms/precise/clearwater-homer/lib/chef_solo_install rename to charms/trusty/clearwater-ellis/lib/chef_solo_install index 414404c..cbbeab1 100755 --- a/charms/precise/clearwater-homer/lib/chef_solo_install +++ b/charms/trusty/clearwater-ellis/lib/chef_solo_install @@ -1,24 +1,19 @@ #!/bin/bash # This covers installing chef-solo and the Clearwater chef recipes -# Install needed libraries -apt-get -y install git libxml2-dev libxslt1-dev wget curl - -# Install chef -install_sh="http://opscode.com/chef/install.sh" -version_string="-v 11.6.0" -bash <(wget ${install_sh} -O -) ${version_string} +# Install chef and needed tools/libraries +apt-get -y install chef git libxml2-dev libxslt1-dev wget curl # Pull down the Clearwater chef recipes if [ ! -d /home/ubuntu/chef-solo ] then mkdir /home/ubuntu/chef-solo - git clone --recursive -b master git://github.com/Metaswitch/chef.git /home/ubuntu/chef-solo + git clone --recursive git://github.com/Metaswitch/chef.git /home/ubuntu/chef-solo fi # Update the chef recipes cd /home/ubuntu/chef-solo -git checkout release-70 +git checkout release-90 git submodule update --init # Create the solo.rb file diff --git a/charms/precise/clearwater-ellis/lib/config_script b/charms/trusty/clearwater-ellis/lib/config_script similarity index 86% rename from charms/precise/clearwater-ellis/lib/config_script rename to charms/trusty/clearwater-ellis/lib/config_script index 92b7efc..89e2aaf 100755 --- a/charms/precise/clearwater-ellis/lib/config_script +++ b/charms/trusty/clearwater-ellis/lib/config_script @@ -26,6 +26,7 @@ sas_server=$(config-get sas) local_ip=$(unit-get private-address) public_ip=$(unit-get public-address) public_hostname=ellis-$(cut -d/ -f2 <<< $JUJU_UNIT_NAME).$(config-get zone) +node_idx=$(($(cut -d/ -f2 <<< $JUJU_UNIT_NAME) + 1)) smtp_smarthost=$(config-get smtp_server) smtp_username=$(config-get smtp_username) smtp_password=$(config-get smtp_password) @@ -34,7 +35,24 @@ signup_key=$(config-get signup_key) # Write configuration back mkdir -p /etc/clearwater -cat >/etc/clearwater/config </etc/clearwater/local_config </etc/clearwater/shared_config <. +# +# The author can be reached by email at clearwater@metaswitch.com or by +# post at Metaswitch Networks Ltd, 100 Church St, Enfield EN2 6BQ, UK +# +# Special Exception +# Metaswitch Networks Ltd grants you permission to copy, modify, +# propagate, and distribute a work formed by combining OpenSSL with The +# Software, or a work derivative of such a combination, even if such +# copying, modification, propagation, or distribution would otherwise +# violate the terms of the GPL. You must comply with the GPL in all +# respects for all of the code used other than OpenSSL. +# "OpenSSL" means OpenSSL toolkit software distributed by the OpenSSL +# Project and licensed under the OpenSSL Licenses, or a work based on such +# software and licensed under the OpenSSL Licenses. +# "OpenSSL Licenses" means the OpenSSL License and Original SSLeay License +# under which the OpenSSL Project distributes the OpenSSL toolkit software, +# as those licenses appear in the file LICENSE-OPENSSL. + +# This script generates a JSON-ified set of DNS records based on an IP, A +# records and SRV records. These are suitable for the API to +# https://github.com/chuckbutler/DNS-Charm. + +import sys +import json + +if len(sys.argv) < 4: + print "Usage: generate_dns_records.py IP CLUSTER_A_RECORD SPECIFIC_A_RECORD [SRV_PORT SRV_ADDR...]" + +ip = sys.argv[1] +cluster_a = sys.argv[2] +specific_a = sys.argv[3] +port = None +srv_addrs = [] + +ttl = "300" + +if len(sys.argv) > 5: + port = sys.argv[4] + srv_addrs = sys.argv[5:] + +ret = [{"rr":"A", "alias": cluster_a, "ttl": ttl,"addr": ip}, + {"rr":"A", "alias": specific_a, "ttl": ttl,"addr": ip}] + +for a in srv_addrs: + ret.append({"rr": "SRV", "alias": a, "ttl": ttl,"priority": "1", "weight": "1", "port": port, "target": specific_a}) + +print json.dumps(ret) diff --git a/charms/precise/clearwater-ellis/lib/node_json_script b/charms/trusty/clearwater-ellis/lib/node_json_script similarity index 100% rename from charms/precise/clearwater-ellis/lib/node_json_script rename to charms/trusty/clearwater-ellis/lib/node_json_script diff --git a/charms/precise/clearwater-ellis/lib/node_json_template b/charms/trusty/clearwater-ellis/lib/node_json_template similarity index 100% rename from charms/precise/clearwater-ellis/lib/node_json_template rename to charms/trusty/clearwater-ellis/lib/node_json_template diff --git a/charms/precise/clearwater-ellis/lib/restart b/charms/trusty/clearwater-ellis/lib/restart similarity index 100% rename from charms/precise/clearwater-ellis/lib/restart rename to charms/trusty/clearwater-ellis/lib/restart diff --git a/charms/precise/clearwater-ellis/metadata.yaml b/charms/trusty/clearwater-ellis/metadata.yaml similarity index 100% rename from charms/precise/clearwater-ellis/metadata.yaml rename to charms/trusty/clearwater-ellis/metadata.yaml diff --git a/charms/precise/clearwater-ellis/revision b/charms/trusty/clearwater-ellis/revision similarity index 100% rename from charms/precise/clearwater-ellis/revision rename to charms/trusty/clearwater-ellis/revision diff --git a/charms/precise/clearwater-homer/README.md b/charms/trusty/clearwater-homer/README.md similarity index 93% rename from charms/precise/clearwater-homer/README.md rename to charms/trusty/clearwater-homer/README.md index 3b9de57..9419547 100644 --- a/charms/precise/clearwater-homer/README.md +++ b/charms/trusty/clearwater-homer/README.md @@ -36,22 +36,22 @@ The config.yaml configuration file takes the following format. signup_key: secret base_number: "6505550000" number_count: 1000 - repo: http://repo.cw-ngv.com/stable + repo: http://repo.cw-ngv.com/juju-clearwater-2 clearwater-bono: turn_workaround: password - repo: http://repo.cw-ngv.com/stable + repo: http://repo.cw-ngv.com/juju-clearwater-2 clearwater-sprout: reg_min_expires: 400 session_max_expires: 900 - repo: http://repo.cw-ngv.com/stable + repo: http://repo.cw-ngv.com/juju-clearwater-2 clearwater-homestead: - repo: http://repo.cw-ngv.com/stable + repo: http://repo.cw-ngv.com/juju-clearwater-2 clearwater-homer: - repo: http://repo.cw-ngv.com/stable + repo: http://repo.cw-ngv.com/juju-clearwater-2 Note that the clearwater-homer charm can only be deployed on the `amd64` architecture. diff --git a/charms/precise/clearwater-homer/config.yaml b/charms/trusty/clearwater-homer/config.yaml similarity index 74% rename from charms/precise/clearwater-homer/config.yaml rename to charms/trusty/clearwater-homer/config.yaml index 814163b..cfffd92 100644 --- a/charms/precise/clearwater-homer/config.yaml +++ b/charms/trusty/clearwater-homer/config.yaml @@ -3,6 +3,6 @@ options: description: The DNS root zone for this service type: string repo: - default: http://repo.cw-ngv.com/juju-clearwater-1/ + default: http://repo.cw-ngv.com/juju-clearwater-2/ description: The location of the repo server type: string diff --git a/charms/precise/clearwater-bono/copyright b/charms/trusty/clearwater-homer/copyright similarity index 97% rename from charms/precise/clearwater-bono/copyright rename to charms/trusty/clearwater-homer/copyright index b205a60..39f1ec8 100644 --- a/charms/precise/clearwater-bono/copyright +++ b/charms/trusty/clearwater-homer/copyright @@ -1,5 +1,5 @@ Project Clearwater - IMS in the Cloud -Copyright (C) 2013 Metaswitch Networks Ltd +Copyright (C) 2016 Metaswitch Networks Ltd 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 diff --git a/charms/precise/clearwater-homer/hooks/config-changed b/charms/trusty/clearwater-homer/hooks/config-changed similarity index 73% rename from charms/precise/clearwater-homer/hooks/config-changed rename to charms/trusty/clearwater-homer/hooks/config-changed index 89573fa..c658148 100755 --- a/charms/precise/clearwater-homer/hooks/config-changed +++ b/charms/trusty/clearwater-homer/hooks/config-changed @@ -1,7 +1,7 @@ #!/bin/bash set -e -# Update the /etc/clearwater/config file, the node.json, and re-run +# Update the /etc/clearwater/*_config files, the node.json, and re-run # chef-solo $CHARM_DIR/lib/config_script $CHARM_DIR/lib/node_json_script diff --git a/charms/precise/clearwater-homer/hooks/homer-relation-changed b/charms/trusty/clearwater-homer/hooks/homer-relation-changed similarity index 100% rename from charms/precise/clearwater-homer/hooks/homer-relation-changed rename to charms/trusty/clearwater-homer/hooks/homer-relation-changed diff --git a/charms/precise/clearwater-homer/hooks/homer-relation-departed b/charms/trusty/clearwater-homer/hooks/homer-relation-departed similarity index 92% rename from charms/precise/clearwater-homer/hooks/homer-relation-departed rename to charms/trusty/clearwater-homer/hooks/homer-relation-departed index 2765915..fb395c2 100755 --- a/charms/precise/clearwater-homer/hooks/homer-relation-departed +++ b/charms/trusty/clearwater-homer/hooks/homer-relation-departed @@ -13,8 +13,8 @@ if [ $this_index -gt $peer_index ] decommissioned=$(nodetool netstats | grep DECOMMISSIONED > /dev/null; echo $?) if [[ $decommissioned == 1* ]] then - monit stop homer - monit unmonitor cassandra + monit stop -g homer + monit unmonitor -g cassandra nodetool decommission fi else diff --git a/charms/precise/clearwater-homer/hooks/homer-relation-joined b/charms/trusty/clearwater-homer/hooks/homer-relation-joined similarity index 100% rename from charms/precise/clearwater-homer/hooks/homer-relation-joined rename to charms/trusty/clearwater-homer/hooks/homer-relation-joined diff --git a/charms/precise/clearwater-homer/hooks/install b/charms/trusty/clearwater-homer/hooks/install similarity index 100% rename from charms/precise/clearwater-homer/hooks/install rename to charms/trusty/clearwater-homer/hooks/install diff --git a/charms/precise/clearwater-homer/hooks/programmable-multiple-relation-changed b/charms/trusty/clearwater-homer/hooks/programmable-multiple-relation-changed similarity index 85% rename from charms/precise/clearwater-homer/hooks/programmable-multiple-relation-changed rename to charms/trusty/clearwater-homer/hooks/programmable-multiple-relation-changed index 1b65f47..c74c7fb 100755 --- a/charms/precise/clearwater-homer/hooks/programmable-multiple-relation-changed +++ b/charms/trusty/clearwater-homer/hooks/programmable-multiple-relation-changed @@ -2,12 +2,11 @@ set -e # Set our DNS requirements -TTL=300 id=$(cut -d/ -f2 <<< $JUJU_UNIT_NAME) ip=$(unit-get private-address) relation-set domain=$(config-get zone) -relation-set resources='homer '$TTL' IN A '$ip' -homer-'$id' '$TTL' IN A '$ip +DNS_JSON=$($CHARM_DIR/lib/generate_dns_records $ip homer homer-$id) +relation-set resources="$DNS_JSON" # Update our DNS server if [ "$(relation-get private-address)" != "" ] diff --git a/charms/precise/clearwater-homer/hooks/start b/charms/trusty/clearwater-homer/hooks/start similarity index 64% rename from charms/precise/clearwater-homer/hooks/start rename to charms/trusty/clearwater-homer/hooks/start index 91c4c67..9f07cb6 100755 --- a/charms/precise/clearwater-homer/hooks/start +++ b/charms/trusty/clearwater-homer/hooks/start @@ -7,11 +7,9 @@ set -e # This hook needs to be idempotent, so this could be run when homer is # already running, when it's running but not monitored by monit, when # it's stopped but being monitored (so it's about to start), or stopped -# and unmonitored. To cover all these cases, restart homer, restart monit, +# and unmonitored. To cover all these cases, restart homer, reload monit, # then finally have monit monitor homer Note that restarting monit can -# fail because init will also restart it when it stops and restarting -# homert can fail because monit will restart it. +# fail and restarting homert can fail because monit will restart it. service homer restart || /usr/bin/true -service clearwater-monit restart || /usr/bin/true -sleep 1 -monit monitor homer +reload clearwater-monit &> /dev/null || true +monit monitor -g homer diff --git a/charms/precise/clearwater-homer/hooks/stop b/charms/trusty/clearwater-homer/hooks/stop similarity index 85% rename from charms/precise/clearwater-homer/hooks/stop rename to charms/trusty/clearwater-homer/hooks/stop index adeb11c..db2c89b 100755 --- a/charms/precise/clearwater-homer/hooks/stop +++ b/charms/trusty/clearwater-homer/hooks/stop @@ -8,5 +8,5 @@ set -e # Stop homer via monit -service clearwater-monit start || /bin/true -monit stop homer +reload clearwater-monit &> /dev/null || true +monit stop -g homer diff --git a/charms/precise/clearwater-homer/hooks/upgrade-charm b/charms/trusty/clearwater-homer/hooks/upgrade-charm similarity index 100% rename from charms/precise/clearwater-homer/hooks/upgrade-charm rename to charms/trusty/clearwater-homer/hooks/upgrade-charm diff --git a/charms/precise/clearwater-homer/hooks/xdms-user-relation-joined b/charms/trusty/clearwater-homer/hooks/xdms-user-relation-joined similarity index 100% rename from charms/precise/clearwater-homer/hooks/xdms-user-relation-joined rename to charms/trusty/clearwater-homer/hooks/xdms-user-relation-joined diff --git a/charms/precise/clearwater-homer/icon.svg b/charms/trusty/clearwater-homer/icon.svg similarity index 100% rename from charms/precise/clearwater-homer/icon.svg rename to charms/trusty/clearwater-homer/icon.svg diff --git a/charms/precise/clearwater-homestead/lib/chef_solo_install b/charms/trusty/clearwater-homer/lib/chef_solo_install similarity index 64% rename from charms/precise/clearwater-homestead/lib/chef_solo_install rename to charms/trusty/clearwater-homer/lib/chef_solo_install index 414404c..cbbeab1 100755 --- a/charms/precise/clearwater-homestead/lib/chef_solo_install +++ b/charms/trusty/clearwater-homer/lib/chef_solo_install @@ -1,24 +1,19 @@ #!/bin/bash # This covers installing chef-solo and the Clearwater chef recipes -# Install needed libraries -apt-get -y install git libxml2-dev libxslt1-dev wget curl - -# Install chef -install_sh="http://opscode.com/chef/install.sh" -version_string="-v 11.6.0" -bash <(wget ${install_sh} -O -) ${version_string} +# Install chef and needed tools/libraries +apt-get -y install chef git libxml2-dev libxslt1-dev wget curl # Pull down the Clearwater chef recipes if [ ! -d /home/ubuntu/chef-solo ] then mkdir /home/ubuntu/chef-solo - git clone --recursive -b master git://github.com/Metaswitch/chef.git /home/ubuntu/chef-solo + git clone --recursive git://github.com/Metaswitch/chef.git /home/ubuntu/chef-solo fi # Update the chef recipes cd /home/ubuntu/chef-solo -git checkout release-70 +git checkout release-90 git submodule update --init # Create the solo.rb file diff --git a/charms/precise/clearwater-homer/lib/config_script b/charms/trusty/clearwater-homer/lib/config_script similarity index 78% rename from charms/precise/clearwater-homer/lib/config_script rename to charms/trusty/clearwater-homer/lib/config_script index 19458bc..aa4817a 100755 --- a/charms/precise/clearwater-homer/lib/config_script +++ b/charms/trusty/clearwater-homer/lib/config_script @@ -22,10 +22,28 @@ sas_server=$(config-get sas) local_ip=$(unit-get private-address) public_ip=$(unit-get public-address) public_hostname=homer-$(cut -d/ -f2 <<< $JUJU_UNIT_NAME).$(config-get zone) +node_idx=$(($(cut -d/ -f2 <<< $JUJU_UNIT_NAME) + 1)) # Write configuration back mkdir -p /etc/clearwater -cat >/etc/clearwater/config </etc/clearwater/local_config </etc/clearwater/shared_config <. +# +# The author can be reached by email at clearwater@metaswitch.com or by +# post at Metaswitch Networks Ltd, 100 Church St, Enfield EN2 6BQ, UK +# +# Special Exception +# Metaswitch Networks Ltd grants you permission to copy, modify, +# propagate, and distribute a work formed by combining OpenSSL with The +# Software, or a work derivative of such a combination, even if such +# copying, modification, propagation, or distribution would otherwise +# violate the terms of the GPL. You must comply with the GPL in all +# respects for all of the code used other than OpenSSL. +# "OpenSSL" means OpenSSL toolkit software distributed by the OpenSSL +# Project and licensed under the OpenSSL Licenses, or a work based on such +# software and licensed under the OpenSSL Licenses. +# "OpenSSL Licenses" means the OpenSSL License and Original SSLeay License +# under which the OpenSSL Project distributes the OpenSSL toolkit software, +# as those licenses appear in the file LICENSE-OPENSSL. + +# This script generates a JSON-ified set of DNS records based on an IP, A +# records and SRV records. These are suitable for the API to +# https://github.com/chuckbutler/DNS-Charm. + +import sys +import json + +if len(sys.argv) < 4: + print "Usage: generate_dns_records.py IP CLUSTER_A_RECORD SPECIFIC_A_RECORD [SRV_PORT SRV_ADDR...]" + +ip = sys.argv[1] +cluster_a = sys.argv[2] +specific_a = sys.argv[3] +port = None +srv_addrs = [] + +ttl = "300" + +if len(sys.argv) > 5: + port = sys.argv[4] + srv_addrs = sys.argv[5:] + +ret = [{"rr":"A", "alias": cluster_a, "ttl": ttl,"addr": ip}, + {"rr":"A", "alias": specific_a, "ttl": ttl,"addr": ip}] + +for a in srv_addrs: + ret.append({"rr": "SRV", "alias": a, "ttl": ttl,"priority": "1", "weight": "1", "port": port, "target": specific_a}) + +print json.dumps(ret) diff --git a/charms/precise/clearwater-homer/lib/node_json_clustered_script b/charms/trusty/clearwater-homer/lib/node_json_clustered_script similarity index 100% rename from charms/precise/clearwater-homer/lib/node_json_clustered_script rename to charms/trusty/clearwater-homer/lib/node_json_clustered_script diff --git a/charms/precise/clearwater-homer/lib/node_json_clustered_template b/charms/trusty/clearwater-homer/lib/node_json_clustered_template similarity index 100% rename from charms/precise/clearwater-homer/lib/node_json_clustered_template rename to charms/trusty/clearwater-homer/lib/node_json_clustered_template diff --git a/charms/precise/clearwater-homer/lib/node_json_script b/charms/trusty/clearwater-homer/lib/node_json_script similarity index 100% rename from charms/precise/clearwater-homer/lib/node_json_script rename to charms/trusty/clearwater-homer/lib/node_json_script diff --git a/charms/precise/clearwater-homer/lib/node_json_template b/charms/trusty/clearwater-homer/lib/node_json_template similarity index 100% rename from charms/precise/clearwater-homer/lib/node_json_template rename to charms/trusty/clearwater-homer/lib/node_json_template diff --git a/charms/precise/clearwater-homer/lib/restart b/charms/trusty/clearwater-homer/lib/restart similarity index 100% rename from charms/precise/clearwater-homer/lib/restart rename to charms/trusty/clearwater-homer/lib/restart diff --git a/charms/precise/clearwater-homer/metadata.yaml b/charms/trusty/clearwater-homer/metadata.yaml similarity index 100% rename from charms/precise/clearwater-homer/metadata.yaml rename to charms/trusty/clearwater-homer/metadata.yaml diff --git a/charms/precise/clearwater-homer/revision b/charms/trusty/clearwater-homer/revision similarity index 100% rename from charms/precise/clearwater-homer/revision rename to charms/trusty/clearwater-homer/revision diff --git a/charms/precise/clearwater-homestead/README.md b/charms/trusty/clearwater-homestead/README.md similarity index 93% rename from charms/precise/clearwater-homestead/README.md rename to charms/trusty/clearwater-homestead/README.md index 7ad39ea..fca1380 100644 --- a/charms/precise/clearwater-homestead/README.md +++ b/charms/trusty/clearwater-homestead/README.md @@ -36,22 +36,22 @@ The config.yaml configuration file takes the following format. signup_key: secret base_number: "6505550000" number_count: 1000 - repo: http://repo.cw-ngv.com/stable + repo: http://repo.cw-ngv.com/juju-clearwater-2 clearwater-bono: turn_workaround: password - repo: http://repo.cw-ngv.com/stable + repo: http://repo.cw-ngv.com/juju-clearwater-2 clearwater-sprout: reg_min_expires: 400 session_max_expires: 900 - repo: http://repo.cw-ngv.com/stable + repo: http://repo.cw-ngv.com/juju-clearwater-2 clearwater-homestead: - repo: http://repo.cw-ngv.com/stable + repo: http://repo.cw-ngv.com/juju-clearwater-2 clearwater-homer: - repo: http://repo.cw-ngv.com/stable + repo: http://repo.cw-ngv.com/juju-clearwater-2 Note that the clearwater-homestead charm can only be deployed on the `amd64` architecture. diff --git a/charms/precise/clearwater-homestead/config.yaml b/charms/trusty/clearwater-homestead/config.yaml similarity index 87% rename from charms/precise/clearwater-homestead/config.yaml rename to charms/trusty/clearwater-homestead/config.yaml index 60b7968..50de84a 100644 --- a/charms/precise/clearwater-homestead/config.yaml +++ b/charms/trusty/clearwater-homestead/config.yaml @@ -11,6 +11,6 @@ options: description: Target request latency for overload control (microseconds) type: int repo: - default: http://repo.cw-ngv.com/juju-clearwater-1/ + default: http://repo.cw-ngv.com/juju-clearwater-2/ description: The location of the repo server type: string diff --git a/charms/precise/clearwater-homestead/copyright b/charms/trusty/clearwater-homestead/copyright similarity index 97% rename from charms/precise/clearwater-homestead/copyright rename to charms/trusty/clearwater-homestead/copyright index b205a60..39f1ec8 100644 --- a/charms/precise/clearwater-homestead/copyright +++ b/charms/trusty/clearwater-homestead/copyright @@ -1,5 +1,5 @@ Project Clearwater - IMS in the Cloud -Copyright (C) 2013 Metaswitch Networks Ltd +Copyright (C) 2016 Metaswitch Networks Ltd 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 diff --git a/charms/precise/clearwater-ralf/hooks/config-changed b/charms/trusty/clearwater-homestead/hooks/config-changed similarity index 73% rename from charms/precise/clearwater-ralf/hooks/config-changed rename to charms/trusty/clearwater-homestead/hooks/config-changed index 89573fa..c658148 100755 --- a/charms/precise/clearwater-ralf/hooks/config-changed +++ b/charms/trusty/clearwater-homestead/hooks/config-changed @@ -1,7 +1,7 @@ #!/bin/bash set -e -# Update the /etc/clearwater/config file, the node.json, and re-run +# Update the /etc/clearwater/*_config files, the node.json, and re-run # chef-solo $CHARM_DIR/lib/config_script $CHARM_DIR/lib/node_json_script diff --git a/charms/precise/clearwater-homestead/hooks/homestead-cscf-relation-joined b/charms/trusty/clearwater-homestead/hooks/homestead-cscf-relation-joined similarity index 100% rename from charms/precise/clearwater-homestead/hooks/homestead-cscf-relation-joined rename to charms/trusty/clearwater-homestead/hooks/homestead-cscf-relation-joined diff --git a/charms/precise/clearwater-homestead/hooks/homestead-prov-user-relation-joined b/charms/trusty/clearwater-homestead/hooks/homestead-prov-user-relation-joined similarity index 100% rename from charms/precise/clearwater-homestead/hooks/homestead-prov-user-relation-joined rename to charms/trusty/clearwater-homestead/hooks/homestead-prov-user-relation-joined diff --git a/charms/precise/clearwater-homestead/hooks/homestead-relation-changed b/charms/trusty/clearwater-homestead/hooks/homestead-relation-changed similarity index 100% rename from charms/precise/clearwater-homestead/hooks/homestead-relation-changed rename to charms/trusty/clearwater-homestead/hooks/homestead-relation-changed diff --git a/charms/precise/clearwater-homestead/hooks/homestead-relation-departed b/charms/trusty/clearwater-homestead/hooks/homestead-relation-departed similarity index 92% rename from charms/precise/clearwater-homestead/hooks/homestead-relation-departed rename to charms/trusty/clearwater-homestead/hooks/homestead-relation-departed index 899d4a1..5a0fd4f 100755 --- a/charms/precise/clearwater-homestead/hooks/homestead-relation-departed +++ b/charms/trusty/clearwater-homestead/hooks/homestead-relation-departed @@ -13,8 +13,8 @@ if [ $this_index -gt $peer_index ] decommissioned=$(nodetool netstats | grep DECOMMISSIONED > /dev/null; echo $?) if [[ $decommissioned == 1* ]] then - monit stop homestead - monit unmonitor cassandra + monit stop -g homestead + monit unmonitor -g cassandra nodetool decommission fi else diff --git a/charms/precise/clearwater-homestead/hooks/homestead-relation-joined b/charms/trusty/clearwater-homestead/hooks/homestead-relation-joined similarity index 100% rename from charms/precise/clearwater-homestead/hooks/homestead-relation-joined rename to charms/trusty/clearwater-homestead/hooks/homestead-relation-joined diff --git a/charms/trusty/clearwater-homestead/hooks/hss-relation-changed b/charms/trusty/clearwater-homestead/hooks/hss-relation-changed new file mode 100755 index 0000000..fd00bc8 --- /dev/null +++ b/charms/trusty/clearwater-homestead/hooks/hss-relation-changed @@ -0,0 +1,6 @@ +#!/bin/bash +set -e + +# Update Clearwater configuration and restart +$CHARM_DIR/lib/config_script hss +$CHARM_DIR/lib/restart diff --git a/charms/trusty/clearwater-homestead/hooks/hss-relation-departed b/charms/trusty/clearwater-homestead/hooks/hss-relation-departed new file mode 100755 index 0000000..fd00bc8 --- /dev/null +++ b/charms/trusty/clearwater-homestead/hooks/hss-relation-departed @@ -0,0 +1,6 @@ +#!/bin/bash +set -e + +# Update Clearwater configuration and restart +$CHARM_DIR/lib/config_script hss +$CHARM_DIR/lib/restart diff --git a/charms/precise/clearwater-homestead/hooks/install b/charms/trusty/clearwater-homestead/hooks/install similarity index 100% rename from charms/precise/clearwater-homestead/hooks/install rename to charms/trusty/clearwater-homestead/hooks/install diff --git a/charms/precise/clearwater-homestead/hooks/programmable-multiple-relation-changed b/charms/trusty/clearwater-homestead/hooks/programmable-multiple-relation-changed similarity index 85% rename from charms/precise/clearwater-homestead/hooks/programmable-multiple-relation-changed rename to charms/trusty/clearwater-homestead/hooks/programmable-multiple-relation-changed index fe22450..7270ff3 100755 --- a/charms/precise/clearwater-homestead/hooks/programmable-multiple-relation-changed +++ b/charms/trusty/clearwater-homestead/hooks/programmable-multiple-relation-changed @@ -2,12 +2,11 @@ set -e # Set our DNS requirements -TTL=300 id=$(cut -d/ -f2 <<< $JUJU_UNIT_NAME) ip=$(unit-get private-address) relation-set domain=$(config-get zone) -relation-set resources='homestead '$TTL' IN A '$ip' -homestead-'$id' '$TTL' IN A '$ip +DNS_JSON=$($CHARM_DIR/lib/generate_dns_records $ip homestead homestead-$id) +relation-set resources="$DNS_JSON" # Update our DNS server if [ "$(relation-get private-address)" != "" ] diff --git a/charms/precise/clearwater-homestead/hooks/start b/charms/trusty/clearwater-homestead/hooks/start similarity index 71% rename from charms/precise/clearwater-homestead/hooks/start rename to charms/trusty/clearwater-homestead/hooks/start index 7c0bf1b..ea9108a 100755 --- a/charms/precise/clearwater-homestead/hooks/start +++ b/charms/trusty/clearwater-homestead/hooks/start @@ -7,13 +7,11 @@ set -e # This hook needs to be idempotent, so this could be run when homestead is # already running, when it's running but not monitored by monit, when # it's stopped but being monitored (so it's about to start), or stopped -# and unmonitored. To cover all these cases, restart homestead, restart monit, +# and unmonitored. To cover all these cases, restart homestead, reload monit, # then finally have monit monitor homestead. Note that restarting monit can -# fail because init will also restart it when it stops and restarting -# homestead can fail because monit will restart it. +# fail and restarting homestead can fail because monit will restart it. service homestead restart || /usr/bin/true service homestead-prov restart || /usr/bin/true -service clearwater-monit restart || /usr/bin/true -sleep 1 -monit monitor homestead -monit monitor homestead-prov +reload clearwater-monit &> /dev/null || true +monit monitor -g homestead +monit monitor -g homestead-prov diff --git a/charms/precise/clearwater-homestead/hooks/stop b/charms/trusty/clearwater-homestead/hooks/stop similarity index 79% rename from charms/precise/clearwater-homestead/hooks/stop rename to charms/trusty/clearwater-homestead/hooks/stop index 687db4c..871559d 100755 --- a/charms/precise/clearwater-homestead/hooks/stop +++ b/charms/trusty/clearwater-homestead/hooks/stop @@ -8,6 +8,6 @@ set -e # Stop homestead via monit -service clearwater-monit start || /bin/true -monit stop homestead -monit stop homestead-prov +reload clearwater-monit &> /dev/null || true +monit stop -g homestead +monit stop -g homestead-prov diff --git a/charms/precise/clearwater-homestead/hooks/upgrade-charm b/charms/trusty/clearwater-homestead/hooks/upgrade-charm similarity index 100% rename from charms/precise/clearwater-homestead/hooks/upgrade-charm rename to charms/trusty/clearwater-homestead/hooks/upgrade-charm diff --git a/charms/precise/clearwater-homestead/icon.svg b/charms/trusty/clearwater-homestead/icon.svg similarity index 100% rename from charms/precise/clearwater-homestead/icon.svg rename to charms/trusty/clearwater-homestead/icon.svg diff --git a/charms/precise/clearwater-ellis/lib/chef_solo_install b/charms/trusty/clearwater-homestead/lib/chef_solo_install similarity index 64% rename from charms/precise/clearwater-ellis/lib/chef_solo_install rename to charms/trusty/clearwater-homestead/lib/chef_solo_install index 414404c..cbbeab1 100755 --- a/charms/precise/clearwater-ellis/lib/chef_solo_install +++ b/charms/trusty/clearwater-homestead/lib/chef_solo_install @@ -1,24 +1,19 @@ #!/bin/bash # This covers installing chef-solo and the Clearwater chef recipes -# Install needed libraries -apt-get -y install git libxml2-dev libxslt1-dev wget curl - -# Install chef -install_sh="http://opscode.com/chef/install.sh" -version_string="-v 11.6.0" -bash <(wget ${install_sh} -O -) ${version_string} +# Install chef and needed tools/libraries +apt-get -y install chef git libxml2-dev libxslt1-dev wget curl # Pull down the Clearwater chef recipes if [ ! -d /home/ubuntu/chef-solo ] then mkdir /home/ubuntu/chef-solo - git clone --recursive -b master git://github.com/Metaswitch/chef.git /home/ubuntu/chef-solo + git clone --recursive git://github.com/Metaswitch/chef.git /home/ubuntu/chef-solo fi # Update the chef recipes cd /home/ubuntu/chef-solo -git checkout release-70 +git checkout release-90 git submodule update --init # Create the solo.rb file diff --git a/charms/precise/clearwater-homestead/lib/config_script b/charms/trusty/clearwater-homestead/lib/config_script similarity index 55% rename from charms/precise/clearwater-homestead/lib/config_script rename to charms/trusty/clearwater-homestead/lib/config_script index bc3396f..8ad93ec 100755 --- a/charms/precise/clearwater-homestead/lib/config_script +++ b/charms/trusty/clearwater-homestead/lib/config_script @@ -12,6 +12,9 @@ xdms_hostname=homer.$(config-get zone):7888 ralf_hostname= sas_server=0.0.0.0 enum_server= +hss_hostname=0.0.0.0 +hss_realm= +hss_port=3868 # Import existing configuration [ ! -f /etc/clearwater/config ] || . /etc/clearwater/config @@ -22,11 +25,39 @@ sas_server=$(config-get sas) local_ip=$(unit-get private-address) public_ip=$(unit-get public-address) public_hostname=homestead-$(cut -d/ -f2 <<< $JUJU_UNIT_NAME).$(config-get zone) +node_idx=$(($(cut -d/ -f2 <<< $JUJU_UNIT_NAME) + 1)) +[ "$relation_name" != "hss" ] || [ "$(relation-get public-address)" = "" ] || hss_hostname=$(relation-get public-address) +[ "$relation_name" != "hss" ] || [ "$(relation-get hss-realm)" = "" ] || hss_realm=$(relation-get hss-realm) +[ "$relation_name" != "hss" ] || [ "$(relation-get hss-port)" = "" ] || hss_port=$(relation-get hss-port) target_latency_us=$(config-get target_latency_us) +# If the HSS relation is empty, reset its configuration +if [ "$relation_name" = "hss" ] && [ "$(relation-list)" = "" ] ; then + hss_hostname=0.0.0.0 + hss_realm= + hss_port=3868 +fi + # Write configuration back mkdir -p /etc/clearwater -cat >/etc/clearwater/config </etc/clearwater/local_config </etc/clearwater/shared_config <. +# +# The author can be reached by email at clearwater@metaswitch.com or by +# post at Metaswitch Networks Ltd, 100 Church St, Enfield EN2 6BQ, UK +# +# Special Exception +# Metaswitch Networks Ltd grants you permission to copy, modify, +# propagate, and distribute a work formed by combining OpenSSL with The +# Software, or a work derivative of such a combination, even if such +# copying, modification, propagation, or distribution would otherwise +# violate the terms of the GPL. You must comply with the GPL in all +# respects for all of the code used other than OpenSSL. +# "OpenSSL" means OpenSSL toolkit software distributed by the OpenSSL +# Project and licensed under the OpenSSL Licenses, or a work based on such +# software and licensed under the OpenSSL Licenses. +# "OpenSSL Licenses" means the OpenSSL License and Original SSLeay License +# under which the OpenSSL Project distributes the OpenSSL toolkit software, +# as those licenses appear in the file LICENSE-OPENSSL. + +# This script generates a JSON-ified set of DNS records based on an IP, A +# records and SRV records. These are suitable for the API to +# https://github.com/chuckbutler/DNS-Charm. + +import sys +import json + +if len(sys.argv) < 4: + print "Usage: generate_dns_records.py IP CLUSTER_A_RECORD SPECIFIC_A_RECORD [SRV_PORT SRV_ADDR...]" + +ip = sys.argv[1] +cluster_a = sys.argv[2] +specific_a = sys.argv[3] +port = None +srv_addrs = [] + +ttl = "300" + +if len(sys.argv) > 5: + port = sys.argv[4] + srv_addrs = sys.argv[5:] + +ret = [{"rr":"A", "alias": cluster_a, "ttl": ttl,"addr": ip}, + {"rr":"A", "alias": specific_a, "ttl": ttl,"addr": ip}] + +for a in srv_addrs: + ret.append({"rr": "SRV", "alias": a, "ttl": ttl,"priority": "1", "weight": "1", "port": port, "target": specific_a}) + +print json.dumps(ret) diff --git a/charms/precise/clearwater-homestead/lib/node_json_clustered_script b/charms/trusty/clearwater-homestead/lib/node_json_clustered_script similarity index 100% rename from charms/precise/clearwater-homestead/lib/node_json_clustered_script rename to charms/trusty/clearwater-homestead/lib/node_json_clustered_script diff --git a/charms/precise/clearwater-homestead/lib/node_json_clustered_template b/charms/trusty/clearwater-homestead/lib/node_json_clustered_template similarity index 100% rename from charms/precise/clearwater-homestead/lib/node_json_clustered_template rename to charms/trusty/clearwater-homestead/lib/node_json_clustered_template diff --git a/charms/precise/clearwater-homestead/lib/node_json_script b/charms/trusty/clearwater-homestead/lib/node_json_script similarity index 100% rename from charms/precise/clearwater-homestead/lib/node_json_script rename to charms/trusty/clearwater-homestead/lib/node_json_script diff --git a/charms/precise/clearwater-homestead/lib/node_json_template b/charms/trusty/clearwater-homestead/lib/node_json_template similarity index 100% rename from charms/precise/clearwater-homestead/lib/node_json_template rename to charms/trusty/clearwater-homestead/lib/node_json_template diff --git a/charms/precise/clearwater-homestead/lib/restart b/charms/trusty/clearwater-homestead/lib/restart similarity index 100% rename from charms/precise/clearwater-homestead/lib/restart rename to charms/trusty/clearwater-homestead/lib/restart diff --git a/charms/precise/clearwater-homestead/metadata.yaml b/charms/trusty/clearwater-homestead/metadata.yaml similarity index 90% rename from charms/precise/clearwater-homestead/metadata.yaml rename to charms/trusty/clearwater-homestead/metadata.yaml index adeb0cb..ca91190 100644 --- a/charms/precise/clearwater-homestead/metadata.yaml +++ b/charms/trusty/clearwater-homestead/metadata.yaml @@ -6,6 +6,9 @@ categories: - misc subordinate: false requires: + hss: + interface: 3GPP-Cx + optional: true programmable-multiple: interface: dns-multi provides: diff --git a/charms/precise/clearwater-homestead/revision b/charms/trusty/clearwater-homestead/revision similarity index 100% rename from charms/precise/clearwater-homestead/revision rename to charms/trusty/clearwater-homestead/revision diff --git a/charms/precise/clearwater-ralf/README.md b/charms/trusty/clearwater-ralf/README.md similarity index 92% rename from charms/precise/clearwater-ralf/README.md rename to charms/trusty/clearwater-ralf/README.md index e2a6ee4..2121bba 100644 --- a/charms/precise/clearwater-ralf/README.md +++ b/charms/trusty/clearwater-ralf/README.md @@ -36,22 +36,22 @@ The config.yaml configuration file takes the following format. signup_key: secret base_number: "6505550000" number_count: 1000 - repo: http://repo.cw-ngv.com/stable + repo: http://repo.cw-ngv.com/juju-clearwater-2 clearwater-bono: turn_workaround: password - repo: http://repo.cw-ngv.com/stable + repo: http://repo.cw-ngv.com/juju-clearwater-2 clearwater-sprout: reg_min_expires: 400 session_max_expires: 900 - repo: http://repo.cw-ngv.com/stable + repo: http://repo.cw-ngv.com/juju-clearwater-2 clearwater-homestead: - repo: http://repo.cw-ngv.com/stable + repo: http://repo.cw-ngv.com/juju-clearwater-2 clearwater-homer: - repo: http://repo.cw-ngv.com/stable + repo: http://repo.cw-ngv.com/juju-clearwater-2 Note that the clearwater-ralf charm can only be deployed on the `amd64` architecture. diff --git a/charms/precise/clearwater-ralf/config.yaml b/charms/trusty/clearwater-ralf/config.yaml similarity index 91% rename from charms/precise/clearwater-ralf/config.yaml rename to charms/trusty/clearwater-ralf/config.yaml index ad7a80f..560ba02 100644 --- a/charms/precise/clearwater-ralf/config.yaml +++ b/charms/trusty/clearwater-ralf/config.yaml @@ -19,6 +19,6 @@ options: description: Target request latency for overload control (microseconds) type: int repo: - default: http://repo.cw-ngv.com/juju-clearwater-1/ + default: http://repo.cw-ngv.com/juju-clearwater-2/ description: The location of the repo server type: string diff --git a/charms/trusty/clearwater-ralf/copyright b/charms/trusty/clearwater-ralf/copyright new file mode 100644 index 0000000..39f1ec8 --- /dev/null +++ b/charms/trusty/clearwater-ralf/copyright @@ -0,0 +1,31 @@ +Project Clearwater - IMS in the Cloud +Copyright (C) 2016 Metaswitch Networks Ltd + +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, along with the "Special Exception" for use of +the program along with SSL, set forth below. 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 +. + +The author can be reached by email at clearwater@metaswitch.com or by +post at Metaswitch Networks Ltd, 100 Church St, Enfield EN2 6BQ, UK + +Special Exception +Metaswitch Networks Ltd grants you permission to copy, modify, +propagate, and distribute a work formed by combining OpenSSL with The +Software, or a work derivative of such a combination, even if such +copying, modification, propagation, or distribution would otherwise +violate the terms of the GPL. You must comply with the GPL in all +respects for all of the code used other than OpenSSL. +"OpenSSL" means OpenSSL toolkit software distributed by the OpenSSL +Project and licensed under the OpenSSL Licenses, or a work based on such +software and licensed under the OpenSSL Licenses. +"OpenSSL Licenses" means the OpenSSL License and Original SSLeay License +under which the OpenSSL Project distributes the OpenSSL toolkit software, +as those licenses appear in the file LICENSE-OPENSSL. diff --git a/charms/precise/clearwater-bono/hooks/config-changed b/charms/trusty/clearwater-ralf/hooks/config-changed similarity index 73% rename from charms/precise/clearwater-bono/hooks/config-changed rename to charms/trusty/clearwater-ralf/hooks/config-changed index 89573fa..c658148 100755 --- a/charms/precise/clearwater-bono/hooks/config-changed +++ b/charms/trusty/clearwater-ralf/hooks/config-changed @@ -1,7 +1,7 @@ #!/bin/bash set -e -# Update the /etc/clearwater/config file, the node.json, and re-run +# Update the /etc/clearwater/*_config files, the node.json, and re-run # chef-solo $CHARM_DIR/lib/config_script $CHARM_DIR/lib/node_json_script diff --git a/charms/precise/clearwater-ralf/hooks/install b/charms/trusty/clearwater-ralf/hooks/install similarity index 100% rename from charms/precise/clearwater-ralf/hooks/install rename to charms/trusty/clearwater-ralf/hooks/install diff --git a/charms/precise/clearwater-ralf/hooks/programmable-multiple-relation-changed b/charms/trusty/clearwater-ralf/hooks/programmable-multiple-relation-changed similarity index 86% rename from charms/precise/clearwater-ralf/hooks/programmable-multiple-relation-changed rename to charms/trusty/clearwater-ralf/hooks/programmable-multiple-relation-changed index 8481292..a728764 100755 --- a/charms/precise/clearwater-ralf/hooks/programmable-multiple-relation-changed +++ b/charms/trusty/clearwater-ralf/hooks/programmable-multiple-relation-changed @@ -2,12 +2,11 @@ set -e # Set our DNS requirements -TTL=300 id=$(cut -d/ -f2 <<< $JUJU_UNIT_NAME) ip=$(unit-get private-address) relation-set domain=$(config-get zone) -relation-set resources='ralf '$TTL' IN A '$ip' -ralf-'$id' '$TTL' IN A '$ip +DNS_JSON=$($CHARM_DIR/lib/generate_dns_records $ip ralf ralf-$id) +relation-set resources="$DNS_JSON" # Update our DNS server if [ "$(relation-get private-address)" != "" ] diff --git a/charms/precise/clearwater-ralf/hooks/ralf-cscf-relation-joined b/charms/trusty/clearwater-ralf/hooks/ralf-cscf-relation-joined similarity index 100% rename from charms/precise/clearwater-ralf/hooks/ralf-cscf-relation-joined rename to charms/trusty/clearwater-ralf/hooks/ralf-cscf-relation-joined diff --git a/charms/precise/clearwater-ralf/hooks/start b/charms/trusty/clearwater-ralf/hooks/start similarity index 64% rename from charms/precise/clearwater-ralf/hooks/start rename to charms/trusty/clearwater-ralf/hooks/start index 95103d5..4ad372f 100755 --- a/charms/precise/clearwater-ralf/hooks/start +++ b/charms/trusty/clearwater-ralf/hooks/start @@ -7,11 +7,9 @@ set -e # This hook needs to be idempotent, so this could be run when ralf is # already running, when it's running but not monitored by monit, when # it's stopped but being monitored (so it's about to start), or stopped -# and unmonitored. To cover all these cases, restart ralf, restart monit, +# and unmonitored. To cover all these cases, restart ralf, reload monit, # then finally have monit monitor ralf. Note that restarting monit can -# fail because init will also restart it when it stops and restarting -# ralf can fail because monit will restart it. +# fail and restarting ralf can fail because monit will restart it. service ralf restart || /usr/bin/true -service clearwater-monit restart || /usr/bin/true -sleep 1 -monit monitor ralf +reload clearwater-monit &> /dev/null || true +monit monitor -g ralf diff --git a/charms/precise/clearwater-ralf/hooks/stop b/charms/trusty/clearwater-ralf/hooks/stop similarity index 85% rename from charms/precise/clearwater-ralf/hooks/stop rename to charms/trusty/clearwater-ralf/hooks/stop index 202009c..2825786 100755 --- a/charms/precise/clearwater-ralf/hooks/stop +++ b/charms/trusty/clearwater-ralf/hooks/stop @@ -8,5 +8,5 @@ set -e # Stop ralf via monit -service clearwater-monit start || /bin/true -monit stop ralf +reload clearwater-monit &> /dev/null || true +monit stop -g ralf diff --git a/charms/precise/clearwater-ralf/hooks/upgrade-charm b/charms/trusty/clearwater-ralf/hooks/upgrade-charm similarity index 100% rename from charms/precise/clearwater-ralf/hooks/upgrade-charm rename to charms/trusty/clearwater-ralf/hooks/upgrade-charm diff --git a/charms/precise/clearwater-ralf/icon.svg b/charms/trusty/clearwater-ralf/icon.svg similarity index 100% rename from charms/precise/clearwater-ralf/icon.svg rename to charms/trusty/clearwater-ralf/icon.svg diff --git a/charms/trusty/clearwater-ralf/lib/chef_solo_install b/charms/trusty/clearwater-ralf/lib/chef_solo_install new file mode 100755 index 0000000..cbbeab1 --- /dev/null +++ b/charms/trusty/clearwater-ralf/lib/chef_solo_install @@ -0,0 +1,30 @@ +#!/bin/bash + +# This covers installing chef-solo and the Clearwater chef recipes +# Install chef and needed tools/libraries +apt-get -y install chef git libxml2-dev libxslt1-dev wget curl + +# Pull down the Clearwater chef recipes +if [ ! -d /home/ubuntu/chef-solo ] +then + mkdir /home/ubuntu/chef-solo + git clone --recursive git://github.com/Metaswitch/chef.git /home/ubuntu/chef-solo +fi + +# Update the chef recipes +cd /home/ubuntu/chef-solo +git checkout release-90 +git submodule update --init + +# Create the solo.rb file +cat > /home/ubuntu/chef-solo/solo.rb </etc/clearwater/config </etc/clearwater/local_config </etc/clearwater/shared_config <. +# +# The author can be reached by email at clearwater@metaswitch.com or by +# post at Metaswitch Networks Ltd, 100 Church St, Enfield EN2 6BQ, UK +# +# Special Exception +# Metaswitch Networks Ltd grants you permission to copy, modify, +# propagate, and distribute a work formed by combining OpenSSL with The +# Software, or a work derivative of such a combination, even if such +# copying, modification, propagation, or distribution would otherwise +# violate the terms of the GPL. You must comply with the GPL in all +# respects for all of the code used other than OpenSSL. +# "OpenSSL" means OpenSSL toolkit software distributed by the OpenSSL +# Project and licensed under the OpenSSL Licenses, or a work based on such +# software and licensed under the OpenSSL Licenses. +# "OpenSSL Licenses" means the OpenSSL License and Original SSLeay License +# under which the OpenSSL Project distributes the OpenSSL toolkit software, +# as those licenses appear in the file LICENSE-OPENSSL. + +# This script generates a JSON-ified set of DNS records based on an IP, A +# records and SRV records. These are suitable for the API to +# https://github.com/chuckbutler/DNS-Charm. + +import sys +import json + +if len(sys.argv) < 4: + print "Usage: generate_dns_records.py IP CLUSTER_A_RECORD SPECIFIC_A_RECORD [SRV_PORT SRV_ADDR...]" + +ip = sys.argv[1] +cluster_a = sys.argv[2] +specific_a = sys.argv[3] +port = None +srv_addrs = [] + +ttl = "300" + +if len(sys.argv) > 5: + port = sys.argv[4] + srv_addrs = sys.argv[5:] + +ret = [{"rr":"A", "alias": cluster_a, "ttl": ttl,"addr": ip}, + {"rr":"A", "alias": specific_a, "ttl": ttl,"addr": ip}] + +for a in srv_addrs: + ret.append({"rr": "SRV", "alias": a, "ttl": ttl,"priority": "1", "weight": "1", "port": port, "target": specific_a}) + +print json.dumps(ret) diff --git a/charms/precise/clearwater-ralf/lib/node_json_clustered_script b/charms/trusty/clearwater-ralf/lib/node_json_clustered_script similarity index 100% rename from charms/precise/clearwater-ralf/lib/node_json_clustered_script rename to charms/trusty/clearwater-ralf/lib/node_json_clustered_script diff --git a/charms/precise/clearwater-ralf/lib/node_json_clustered_template b/charms/trusty/clearwater-ralf/lib/node_json_clustered_template similarity index 100% rename from charms/precise/clearwater-ralf/lib/node_json_clustered_template rename to charms/trusty/clearwater-ralf/lib/node_json_clustered_template diff --git a/charms/precise/clearwater-ralf/lib/node_json_script b/charms/trusty/clearwater-ralf/lib/node_json_script similarity index 100% rename from charms/precise/clearwater-ralf/lib/node_json_script rename to charms/trusty/clearwater-ralf/lib/node_json_script diff --git a/charms/precise/clearwater-ralf/lib/node_json_template b/charms/trusty/clearwater-ralf/lib/node_json_template similarity index 100% rename from charms/precise/clearwater-ralf/lib/node_json_template rename to charms/trusty/clearwater-ralf/lib/node_json_template diff --git a/charms/precise/clearwater-ralf/lib/restart b/charms/trusty/clearwater-ralf/lib/restart similarity index 100% rename from charms/precise/clearwater-ralf/lib/restart rename to charms/trusty/clearwater-ralf/lib/restart diff --git a/charms/precise/clearwater-ralf/metadata.yaml b/charms/trusty/clearwater-ralf/metadata.yaml similarity index 100% rename from charms/precise/clearwater-ralf/metadata.yaml rename to charms/trusty/clearwater-ralf/metadata.yaml diff --git a/charms/precise/clearwater-ralf/revision b/charms/trusty/clearwater-ralf/revision similarity index 100% rename from charms/precise/clearwater-ralf/revision rename to charms/trusty/clearwater-ralf/revision diff --git a/charms/precise/clearwater-sipp/README.md b/charms/trusty/clearwater-sipp/README.md similarity index 98% rename from charms/precise/clearwater-sipp/README.md rename to charms/trusty/clearwater-sipp/README.md index 2151711..a8362f8 100644 --- a/charms/precise/clearwater-sipp/README.md +++ b/charms/trusty/clearwater-sipp/README.md @@ -23,7 +23,7 @@ Once installed, clearwater-sip-stress will generate SIP traffic to TCP port 5060 # Configuration - `zone:` The home domain of this IMS deployment - this could be a real domain that you own, or an internal-only name like "clearwater.local". -- `repo`: The URL of the Clearwater package repository server. Our latest relese, updated roughly every two weeks, is at http://repo.cw-ngv.com/stable. +- `repo`: The URL of the Clearwater package repository server. Our latest relese, updated roughly every two weeks, is at http://repo.cw-ngv.com/juju-clearwater-2. # Files downloaded diff --git a/charms/precise/clearwater-sipp/config.yaml b/charms/trusty/clearwater-sipp/config.yaml similarity index 84% rename from charms/precise/clearwater-sipp/config.yaml rename to charms/trusty/clearwater-sipp/config.yaml index 32e3439..244659e 100644 --- a/charms/precise/clearwater-sipp/config.yaml +++ b/charms/trusty/clearwater-sipp/config.yaml @@ -4,7 +4,7 @@ options: description: The DNS root zone for this service type: string repo: - default: http://repo.cw-ngv.com/juju-clearwater-1 + default: http://repo.cw-ngv.com/juju-clearwater-2 description: The location of the repo server type: string user_count: diff --git a/charms/trusty/clearwater-sipp/copyright b/charms/trusty/clearwater-sipp/copyright new file mode 100644 index 0000000..39f1ec8 --- /dev/null +++ b/charms/trusty/clearwater-sipp/copyright @@ -0,0 +1,31 @@ +Project Clearwater - IMS in the Cloud +Copyright (C) 2016 Metaswitch Networks Ltd + +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, along with the "Special Exception" for use of +the program along with SSL, set forth below. 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 +. + +The author can be reached by email at clearwater@metaswitch.com or by +post at Metaswitch Networks Ltd, 100 Church St, Enfield EN2 6BQ, UK + +Special Exception +Metaswitch Networks Ltd grants you permission to copy, modify, +propagate, and distribute a work formed by combining OpenSSL with The +Software, or a work derivative of such a combination, even if such +copying, modification, propagation, or distribution would otherwise +violate the terms of the GPL. You must comply with the GPL in all +respects for all of the code used other than OpenSSL. +"OpenSSL" means OpenSSL toolkit software distributed by the OpenSSL +Project and licensed under the OpenSSL Licenses, or a work based on such +software and licensed under the OpenSSL Licenses. +"OpenSSL Licenses" means the OpenSSL License and Original SSLeay License +under which the OpenSSL Project distributes the OpenSSL toolkit software, +as those licenses appear in the file LICENSE-OPENSSL. diff --git a/charms/trusty/clearwater-sipp/hooks/config-changed b/charms/trusty/clearwater-sipp/hooks/config-changed new file mode 100755 index 0000000..c658148 --- /dev/null +++ b/charms/trusty/clearwater-sipp/hooks/config-changed @@ -0,0 +1,9 @@ +#!/bin/bash +set -e + +# Update the /etc/clearwater/*_config files, the node.json, and re-run +# chef-solo +$CHARM_DIR/lib/config_script +$CHARM_DIR/lib/node_json_script +chef-solo -c /home/ubuntu/chef-solo/solo.rb -j /home/ubuntu/chef-solo/node.json +$CHARM_DIR/lib/restart diff --git a/charms/precise/clearwater-sipp/hooks/install b/charms/trusty/clearwater-sipp/hooks/install similarity index 100% rename from charms/precise/clearwater-sipp/hooks/install rename to charms/trusty/clearwater-sipp/hooks/install diff --git a/charms/precise/clearwater-sipp/hooks/pcscf-relation-changed b/charms/trusty/clearwater-sipp/hooks/pcscf-relation-changed similarity index 100% rename from charms/precise/clearwater-sipp/hooks/pcscf-relation-changed rename to charms/trusty/clearwater-sipp/hooks/pcscf-relation-changed diff --git a/charms/precise/clearwater-sipp/hooks/programmable-multiple-relation-changed b/charms/trusty/clearwater-sipp/hooks/programmable-multiple-relation-changed similarity index 86% rename from charms/precise/clearwater-sipp/hooks/programmable-multiple-relation-changed rename to charms/trusty/clearwater-sipp/hooks/programmable-multiple-relation-changed index f46fafe..b7eaac4 100755 --- a/charms/precise/clearwater-sipp/hooks/programmable-multiple-relation-changed +++ b/charms/trusty/clearwater-sipp/hooks/programmable-multiple-relation-changed @@ -2,11 +2,11 @@ set -e # Set our DNS requirements -TTL=300 id=$(cut -d/ -f2 <<< $JUJU_UNIT_NAME) ip=$(unit-get public-address) relation-set domain=$(config-get zone) -relation-set resources='sipp-'$id' '$TTL' IN A '$ip +DNS_JSON=$($CHARM_DIR/lib/generate_dns_records $ip sipp sipp-$id) +relation-set resources="$DNS_JSON" # Update our DNS server if [ "$(relation-get private-address)" != "" ] diff --git a/charms/precise/clearwater-sipp/hooks/start b/charms/trusty/clearwater-sipp/hooks/start similarity index 100% rename from charms/precise/clearwater-sipp/hooks/start rename to charms/trusty/clearwater-sipp/hooks/start diff --git a/charms/precise/clearwater-sipp/hooks/stop b/charms/trusty/clearwater-sipp/hooks/stop similarity index 100% rename from charms/precise/clearwater-sipp/hooks/stop rename to charms/trusty/clearwater-sipp/hooks/stop diff --git a/charms/precise/clearwater-sipp/hooks/upgrade-charm b/charms/trusty/clearwater-sipp/hooks/upgrade-charm similarity index 100% rename from charms/precise/clearwater-sipp/hooks/upgrade-charm rename to charms/trusty/clearwater-sipp/hooks/upgrade-charm diff --git a/charms/precise/clearwater-route53/icon.svg b/charms/trusty/clearwater-sipp/icon.svg similarity index 100% rename from charms/precise/clearwater-route53/icon.svg rename to charms/trusty/clearwater-sipp/icon.svg diff --git a/charms/trusty/clearwater-sipp/lib/chef_solo_install b/charms/trusty/clearwater-sipp/lib/chef_solo_install new file mode 100755 index 0000000..cbbeab1 --- /dev/null +++ b/charms/trusty/clearwater-sipp/lib/chef_solo_install @@ -0,0 +1,30 @@ +#!/bin/bash + +# This covers installing chef-solo and the Clearwater chef recipes +# Install chef and needed tools/libraries +apt-get -y install chef git libxml2-dev libxslt1-dev wget curl + +# Pull down the Clearwater chef recipes +if [ ! -d /home/ubuntu/chef-solo ] +then + mkdir /home/ubuntu/chef-solo + git clone --recursive git://github.com/Metaswitch/chef.git /home/ubuntu/chef-solo +fi + +# Update the chef recipes +cd /home/ubuntu/chef-solo +git checkout release-90 +git submodule update --init + +# Create the solo.rb file +cat > /home/ubuntu/chef-solo/solo.rb </etc/clearwater/config </etc/clearwater/local_config </etc/clearwater/shared_config <. +# +# The author can be reached by email at clearwater@metaswitch.com or by +# post at Metaswitch Networks Ltd, 100 Church St, Enfield EN2 6BQ, UK +# +# Special Exception +# Metaswitch Networks Ltd grants you permission to copy, modify, +# propagate, and distribute a work formed by combining OpenSSL with The +# Software, or a work derivative of such a combination, even if such +# copying, modification, propagation, or distribution would otherwise +# violate the terms of the GPL. You must comply with the GPL in all +# respects for all of the code used other than OpenSSL. +# "OpenSSL" means OpenSSL toolkit software distributed by the OpenSSL +# Project and licensed under the OpenSSL Licenses, or a work based on such +# software and licensed under the OpenSSL Licenses. +# "OpenSSL Licenses" means the OpenSSL License and Original SSLeay License +# under which the OpenSSL Project distributes the OpenSSL toolkit software, +# as those licenses appear in the file LICENSE-OPENSSL. + +# This script generates a JSON-ified set of DNS records based on an IP, A +# records and SRV records. These are suitable for the API to +# https://github.com/chuckbutler/DNS-Charm. + +import sys +import json + +if len(sys.argv) < 4: + print "Usage: generate_dns_records.py IP CLUSTER_A_RECORD SPECIFIC_A_RECORD [SRV_PORT SRV_ADDR...]" + +ip = sys.argv[1] +cluster_a = sys.argv[2] +specific_a = sys.argv[3] +port = None +srv_addrs = [] + +ttl = "300" + +if len(sys.argv) > 5: + port = sys.argv[4] + srv_addrs = sys.argv[5:] + +ret = [{"rr":"A", "alias": cluster_a, "ttl": ttl,"addr": ip}, + {"rr":"A", "alias": specific_a, "ttl": ttl,"addr": ip}] + +for a in srv_addrs: + ret.append({"rr": "SRV", "alias": a, "ttl": ttl,"priority": "1", "weight": "1", "port": port, "target": specific_a}) + +print json.dumps(ret) diff --git a/charms/precise/clearwater-sipp/lib/node_json_script b/charms/trusty/clearwater-sipp/lib/node_json_script similarity index 100% rename from charms/precise/clearwater-sipp/lib/node_json_script rename to charms/trusty/clearwater-sipp/lib/node_json_script diff --git a/charms/precise/clearwater-sipp/lib/node_json_template b/charms/trusty/clearwater-sipp/lib/node_json_template similarity index 100% rename from charms/precise/clearwater-sipp/lib/node_json_template rename to charms/trusty/clearwater-sipp/lib/node_json_template diff --git a/charms/precise/clearwater-sipp/lib/restart b/charms/trusty/clearwater-sipp/lib/restart similarity index 100% rename from charms/precise/clearwater-sipp/lib/restart rename to charms/trusty/clearwater-sipp/lib/restart diff --git a/charms/precise/clearwater-sipp/metadata.yaml b/charms/trusty/clearwater-sipp/metadata.yaml similarity index 100% rename from charms/precise/clearwater-sipp/metadata.yaml rename to charms/trusty/clearwater-sipp/metadata.yaml diff --git a/charms/precise/clearwater-route53/revision b/charms/trusty/clearwater-sipp/revision similarity index 100% rename from charms/precise/clearwater-route53/revision rename to charms/trusty/clearwater-sipp/revision diff --git a/charms/precise/clearwater-sprout/README.md b/charms/trusty/clearwater-sprout/README.md similarity index 93% rename from charms/precise/clearwater-sprout/README.md rename to charms/trusty/clearwater-sprout/README.md index 9398f6d..e2b4ca0 100644 --- a/charms/precise/clearwater-sprout/README.md +++ b/charms/trusty/clearwater-sprout/README.md @@ -36,22 +36,22 @@ The config.yaml configuration file takes the following format. signup_key: secret base_number: "6505550000" number_count: 1000 - repo: http://repo.cw-ngv.com/stable + repo: http://repo.cw-ngv.com/juju-clearwater-2 clearwater-bono: turn_workaround: password - repo: http://repo.cw-ngv.com/stable + repo: http://repo.cw-ngv.com/juju-clearwater-2 clearwater-sprout: reg_min_expires: 400 session_max_expires: 900 - repo: http://repo.cw-ngv.com/stable + repo: http://repo.cw-ngv.com/juju-clearwater-2 clearwater-homestead: - repo: http://repo.cw-ngv.com/stable + repo: http://repo.cw-ngv.com/juju-clearwater-2 clearwater-homer: - repo: http://repo.cw-ngv.com/stable + repo: http://repo.cw-ngv.com/juju-clearwater-2 Note that the clearwater-sprout charm can only be deployed on the `amd64` architecture. diff --git a/charms/precise/clearwater-sprout/config.yaml b/charms/trusty/clearwater-sprout/config.yaml similarity index 92% rename from charms/precise/clearwater-sprout/config.yaml rename to charms/trusty/clearwater-sprout/config.yaml index 63b312e..7024c6f 100644 --- a/charms/precise/clearwater-sprout/config.yaml +++ b/charms/trusty/clearwater-sprout/config.yaml @@ -23,6 +23,6 @@ options: description: Target request latency for overload control (microseconds) type: int repo: - default: http://repo.cw-ngv.com/juju-clearwater-1/ + default: http://repo.cw-ngv.com/juju-clearwater-2/ description: The location of the repo server type: string diff --git a/charms/trusty/clearwater-sprout/copyright b/charms/trusty/clearwater-sprout/copyright new file mode 100644 index 0000000..39f1ec8 --- /dev/null +++ b/charms/trusty/clearwater-sprout/copyright @@ -0,0 +1,31 @@ +Project Clearwater - IMS in the Cloud +Copyright (C) 2016 Metaswitch Networks Ltd + +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, along with the "Special Exception" for use of +the program along with SSL, set forth below. 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 +. + +The author can be reached by email at clearwater@metaswitch.com or by +post at Metaswitch Networks Ltd, 100 Church St, Enfield EN2 6BQ, UK + +Special Exception +Metaswitch Networks Ltd grants you permission to copy, modify, +propagate, and distribute a work formed by combining OpenSSL with The +Software, or a work derivative of such a combination, even if such +copying, modification, propagation, or distribution would otherwise +violate the terms of the GPL. You must comply with the GPL in all +respects for all of the code used other than OpenSSL. +"OpenSSL" means OpenSSL toolkit software distributed by the OpenSSL +Project and licensed under the OpenSSL Licenses, or a work based on such +software and licensed under the OpenSSL Licenses. +"OpenSSL Licenses" means the OpenSSL License and Original SSLeay License +under which the OpenSSL Project distributes the OpenSSL toolkit software, +as those licenses appear in the file LICENSE-OPENSSL. diff --git a/charms/precise/clearwater-sprout/hooks/as-relation-joined b/charms/trusty/clearwater-sprout/hooks/as-relation-joined similarity index 100% rename from charms/precise/clearwater-sprout/hooks/as-relation-joined rename to charms/trusty/clearwater-sprout/hooks/as-relation-joined diff --git a/charms/trusty/clearwater-sprout/hooks/config-changed b/charms/trusty/clearwater-sprout/hooks/config-changed new file mode 100755 index 0000000..c658148 --- /dev/null +++ b/charms/trusty/clearwater-sprout/hooks/config-changed @@ -0,0 +1,9 @@ +#!/bin/bash +set -e + +# Update the /etc/clearwater/*_config files, the node.json, and re-run +# chef-solo +$CHARM_DIR/lib/config_script +$CHARM_DIR/lib/node_json_script +chef-solo -c /home/ubuntu/chef-solo/solo.rb -j /home/ubuntu/chef-solo/node.json +$CHARM_DIR/lib/restart diff --git a/charms/precise/clearwater-sprout/hooks/homestead-hss-relation-changed b/charms/trusty/clearwater-sprout/hooks/homestead-hss-relation-changed similarity index 100% rename from charms/precise/clearwater-sprout/hooks/homestead-hss-relation-changed rename to charms/trusty/clearwater-sprout/hooks/homestead-hss-relation-changed diff --git a/charms/precise/clearwater-sprout/hooks/install b/charms/trusty/clearwater-sprout/hooks/install similarity index 100% rename from charms/precise/clearwater-sprout/hooks/install rename to charms/trusty/clearwater-sprout/hooks/install diff --git a/charms/precise/clearwater-sprout/hooks/pcscf-relation-joined b/charms/trusty/clearwater-sprout/hooks/pcscf-relation-joined similarity index 100% rename from charms/precise/clearwater-sprout/hooks/pcscf-relation-joined rename to charms/trusty/clearwater-sprout/hooks/pcscf-relation-joined diff --git a/charms/trusty/clearwater-sprout/hooks/programmable-multiple-relation-changed b/charms/trusty/clearwater-sprout/hooks/programmable-multiple-relation-changed new file mode 100755 index 0000000..23b917b --- /dev/null +++ b/charms/trusty/clearwater-sprout/hooks/programmable-multiple-relation-changed @@ -0,0 +1,23 @@ +#!/bin/bash +set -e + +# Set our DNS requirements +id=$(cut -d/ -f2 <<< $JUJU_UNIT_NAME) +ip=$(unit-get private-address) +relation-set domain=$(config-get zone) +DNS_JSON=$($CHARM_DIR/lib/generate_dns_records $ip sprout sprout-$id 5054 _sip._tcp.sprout) +relation-set resources="$DNS_JSON" + +# Update our DNS server +if [ "$(relation-get private-address)" != "" ] +then + echo nameserver $(relation-get private-address) > /etc/dnsmasq.resolv.conf + grep -v ^RESOLV_CONF= /etc/default/dnsmasq > /tmp/dnsmasq.$$ + mv /tmp/dnsmasq.$$ /etc/default/dnsmasq + echo RESOLV_CONF=/etc/dnsmasq.resolv.conf >> /etc/default/dnsmasq + service dnsmasq restart +fi + +# Update Clearwater configuration and restart +$CHARM_DIR/lib/config_script programmable-multiple +$CHARM_DIR/lib/restart diff --git a/charms/precise/clearwater-sprout/hooks/ralf-ctf-relation-changed b/charms/trusty/clearwater-sprout/hooks/ralf-ctf-relation-changed similarity index 100% rename from charms/precise/clearwater-sprout/hooks/ralf-ctf-relation-changed rename to charms/trusty/clearwater-sprout/hooks/ralf-ctf-relation-changed diff --git a/charms/precise/clearwater-sprout/hooks/sprout-relation-changed b/charms/trusty/clearwater-sprout/hooks/sprout-relation-changed similarity index 100% rename from charms/precise/clearwater-sprout/hooks/sprout-relation-changed rename to charms/trusty/clearwater-sprout/hooks/sprout-relation-changed diff --git a/charms/precise/clearwater-sprout/hooks/sprout-relation-departed b/charms/trusty/clearwater-sprout/hooks/sprout-relation-departed similarity index 85% rename from charms/precise/clearwater-sprout/hooks/sprout-relation-departed rename to charms/trusty/clearwater-sprout/hooks/sprout-relation-departed index 945fe05..cbb60e9 100755 --- a/charms/precise/clearwater-sprout/hooks/sprout-relation-departed +++ b/charms/trusty/clearwater-sprout/hooks/sprout-relation-departed @@ -9,9 +9,7 @@ this_index=$(echo $JUJU_UNIT_NAME | cut -d'/' -f2) if [ $this_index -gt $peer_index ] then # Remove this node. - monit unmonitor sprout - monit unmonitor poll_sprout_sip - monit unmonitor poll_sprout_http + monit unmonitor -g sprout service sprout start-quiesce else # Remove the node.json in databags that corresponds to the node being removed. diff --git a/charms/precise/clearwater-sprout/hooks/sprout-relation-joined b/charms/trusty/clearwater-sprout/hooks/sprout-relation-joined similarity index 100% rename from charms/precise/clearwater-sprout/hooks/sprout-relation-joined rename to charms/trusty/clearwater-sprout/hooks/sprout-relation-joined diff --git a/charms/precise/clearwater-sprout/hooks/start b/charms/trusty/clearwater-sprout/hooks/start similarity index 64% rename from charms/precise/clearwater-sprout/hooks/start rename to charms/trusty/clearwater-sprout/hooks/start index 61df72c..64f8b4d 100755 --- a/charms/precise/clearwater-sprout/hooks/start +++ b/charms/trusty/clearwater-sprout/hooks/start @@ -7,11 +7,9 @@ set -e # This hook needs to be idempotent, so this could be run when sprout is # already running, when it's running but not monitored by monit, when # it's stopped but being monitored (so it's about to start), or stopped -# and unmonitored. To cover all these cases, restart sprout, restart monit, +# and unmonitored. To cover all these cases, restart sprout, reload monit, # then finally have monit monitor sprout. Note that restarting monit can -# fail because init will also restart it when it stops and restarting -# sprout can fail because monit will restart it. +# fail and restarting sprout can fail because monit will restart it. service sprout restart || /usr/bin/true -service clearwater-monit restart || /usr/bin/true -sleep 1 -monit monitor sprout +reload clearwater-monit &> /dev/null || true +monit monitor -g sprout diff --git a/charms/precise/clearwater-sprout/hooks/stop b/charms/trusty/clearwater-sprout/hooks/stop similarity index 85% rename from charms/precise/clearwater-sprout/hooks/stop rename to charms/trusty/clearwater-sprout/hooks/stop index 6f6d272..10d56d9 100755 --- a/charms/precise/clearwater-sprout/hooks/stop +++ b/charms/trusty/clearwater-sprout/hooks/stop @@ -8,5 +8,5 @@ set -e # Stop sprout via monit -service clearwater-monit start || /bin/true -monit stop sprout +reload clearwater-monit &> /dev/null || true +monit stop -g sprout diff --git a/charms/precise/clearwater-sprout/hooks/upgrade-charm b/charms/trusty/clearwater-sprout/hooks/upgrade-charm similarity index 100% rename from charms/precise/clearwater-sprout/hooks/upgrade-charm rename to charms/trusty/clearwater-sprout/hooks/upgrade-charm diff --git a/charms/precise/clearwater-sprout/hooks/xdms-relation-changed b/charms/trusty/clearwater-sprout/hooks/xdms-relation-changed similarity index 100% rename from charms/precise/clearwater-sprout/hooks/xdms-relation-changed rename to charms/trusty/clearwater-sprout/hooks/xdms-relation-changed diff --git a/charms/precise/clearwater-sipp/icon.svg b/charms/trusty/clearwater-sprout/icon.svg similarity index 100% rename from charms/precise/clearwater-sipp/icon.svg rename to charms/trusty/clearwater-sprout/icon.svg diff --git a/charms/trusty/clearwater-sprout/lib/chef_solo_install b/charms/trusty/clearwater-sprout/lib/chef_solo_install new file mode 100755 index 0000000..cbbeab1 --- /dev/null +++ b/charms/trusty/clearwater-sprout/lib/chef_solo_install @@ -0,0 +1,30 @@ +#!/bin/bash + +# This covers installing chef-solo and the Clearwater chef recipes +# Install chef and needed tools/libraries +apt-get -y install chef git libxml2-dev libxslt1-dev wget curl + +# Pull down the Clearwater chef recipes +if [ ! -d /home/ubuntu/chef-solo ] +then + mkdir /home/ubuntu/chef-solo + git clone --recursive git://github.com/Metaswitch/chef.git /home/ubuntu/chef-solo +fi + +# Update the chef recipes +cd /home/ubuntu/chef-solo +git checkout release-90 +git submodule update --init + +# Create the solo.rb file +cat > /home/ubuntu/chef-solo/solo.rb </etc/clearwater/config </etc/clearwater/local_config </etc/clearwater/shared_config <. +# +# The author can be reached by email at clearwater@metaswitch.com or by +# post at Metaswitch Networks Ltd, 100 Church St, Enfield EN2 6BQ, UK +# +# Special Exception +# Metaswitch Networks Ltd grants you permission to copy, modify, +# propagate, and distribute a work formed by combining OpenSSL with The +# Software, or a work derivative of such a combination, even if such +# copying, modification, propagation, or distribution would otherwise +# violate the terms of the GPL. You must comply with the GPL in all +# respects for all of the code used other than OpenSSL. +# "OpenSSL" means OpenSSL toolkit software distributed by the OpenSSL +# Project and licensed under the OpenSSL Licenses, or a work based on such +# software and licensed under the OpenSSL Licenses. +# "OpenSSL Licenses" means the OpenSSL License and Original SSLeay License +# under which the OpenSSL Project distributes the OpenSSL toolkit software, +# as those licenses appear in the file LICENSE-OPENSSL. + +# This script generates a JSON-ified set of DNS records based on an IP, A +# records and SRV records. These are suitable for the API to +# https://github.com/chuckbutler/DNS-Charm. + +import sys +import json + +if len(sys.argv) < 4: + print "Usage: generate_dns_records.py IP CLUSTER_A_RECORD SPECIFIC_A_RECORD [SRV_PORT SRV_ADDR...]" + +ip = sys.argv[1] +cluster_a = sys.argv[2] +specific_a = sys.argv[3] +port = None +srv_addrs = [] + +ttl = "300" + +if len(sys.argv) > 5: + port = sys.argv[4] + srv_addrs = sys.argv[5:] + +ret = [{"rr":"A", "alias": cluster_a, "ttl": ttl,"addr": ip}, + {"rr":"A", "alias": specific_a, "ttl": ttl,"addr": ip}] + +for a in srv_addrs: + ret.append({"rr": "SRV", "alias": a, "ttl": ttl,"priority": "1", "weight": "1", "port": port, "target": specific_a}) + +print json.dumps(ret) diff --git a/charms/precise/clearwater-sprout/lib/node_json_clustered_script b/charms/trusty/clearwater-sprout/lib/node_json_clustered_script similarity index 100% rename from charms/precise/clearwater-sprout/lib/node_json_clustered_script rename to charms/trusty/clearwater-sprout/lib/node_json_clustered_script diff --git a/charms/precise/clearwater-sprout/lib/node_json_clustered_template b/charms/trusty/clearwater-sprout/lib/node_json_clustered_template similarity index 100% rename from charms/precise/clearwater-sprout/lib/node_json_clustered_template rename to charms/trusty/clearwater-sprout/lib/node_json_clustered_template diff --git a/charms/precise/clearwater-sprout/lib/node_json_script b/charms/trusty/clearwater-sprout/lib/node_json_script similarity index 100% rename from charms/precise/clearwater-sprout/lib/node_json_script rename to charms/trusty/clearwater-sprout/lib/node_json_script diff --git a/charms/precise/clearwater-sprout/lib/node_json_template b/charms/trusty/clearwater-sprout/lib/node_json_template similarity index 100% rename from charms/precise/clearwater-sprout/lib/node_json_template rename to charms/trusty/clearwater-sprout/lib/node_json_template diff --git a/charms/precise/clearwater-sprout/lib/restart b/charms/trusty/clearwater-sprout/lib/restart similarity index 100% rename from charms/precise/clearwater-sprout/lib/restart rename to charms/trusty/clearwater-sprout/lib/restart diff --git a/charms/precise/clearwater-sprout/metadata.yaml b/charms/trusty/clearwater-sprout/metadata.yaml similarity index 100% rename from charms/precise/clearwater-sprout/metadata.yaml rename to charms/trusty/clearwater-sprout/metadata.yaml diff --git a/charms/precise/clearwater-sprout/revision b/charms/trusty/clearwater-sprout/revision similarity index 100% rename from charms/precise/clearwater-sprout/revision rename to charms/trusty/clearwater-sprout/revision diff --git a/charms/trusty/hss-proxy/README.md b/charms/trusty/hss-proxy/README.md new file mode 100644 index 0000000..76e774a --- /dev/null +++ b/charms/trusty/hss-proxy/README.md @@ -0,0 +1,17 @@ +# Overview + +This is a proxy [Juju charm](https://jujucharms.com/about) for the 3GPP-Cx interface to the HSS. Since it is just a proxy, it does not actually provide HSS function - it can just be configured with the location of the HSS, and then terminate the relation with the 3GPP-Cx user. + +# Configuration + +- `hss_host`: The host on which the HSS is running. +- `hss_realm`: The realm to which the HSS belongs. +- `hss_port`: The port on which the HSS listens. + +# Contact and Upstream Project Information + +Project Clearwater is an open-source IMS core, developed by [Metaswitch Networks](http://www.metaswitch.com) and released under the [GNU GPLv3](http://www.projectclearwater.org/download/license/). You can find more information about it on [our website](http://www.projectclearwater.org/) or [our documentation site](https://clearwater.readthedocs.org). + +Clearwater source code and issue list can be found at https://github.com/Metaswitch/. + +If you have problems when using Project Clearwater, read [our troubleshooting documentation](http://clearwater.readthedocs.org/en/latest/Troubleshooting_and_Recovery/index.html) for help, or see [our support page](http://clearwater.readthedocs.org/en/latest/Support/index.html) to find out how to ask mailing list questions or raise issues. diff --git a/charms/trusty/hss-proxy/config.yaml b/charms/trusty/hss-proxy/config.yaml new file mode 100644 index 0000000..e9c5590 --- /dev/null +++ b/charms/trusty/hss-proxy/config.yaml @@ -0,0 +1,13 @@ +options: + hss_host: + default: "" + description: The host on which the HSS is running + type: string + hss_realm: + default: "" + description: The realm to which the HSS belongs + type: string + hss_port: + default: 3868 + description: The port on which the HSS listens + type: int diff --git a/charms/trusty/hss-proxy/copyright b/charms/trusty/hss-proxy/copyright new file mode 100644 index 0000000..39f1ec8 --- /dev/null +++ b/charms/trusty/hss-proxy/copyright @@ -0,0 +1,31 @@ +Project Clearwater - IMS in the Cloud +Copyright (C) 2016 Metaswitch Networks Ltd + +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, along with the "Special Exception" for use of +the program along with SSL, set forth below. 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 +. + +The author can be reached by email at clearwater@metaswitch.com or by +post at Metaswitch Networks Ltd, 100 Church St, Enfield EN2 6BQ, UK + +Special Exception +Metaswitch Networks Ltd grants you permission to copy, modify, +propagate, and distribute a work formed by combining OpenSSL with The +Software, or a work derivative of such a combination, even if such +copying, modification, propagation, or distribution would otherwise +violate the terms of the GPL. You must comply with the GPL in all +respects for all of the code used other than OpenSSL. +"OpenSSL" means OpenSSL toolkit software distributed by the OpenSSL +Project and licensed under the OpenSSL Licenses, or a work based on such +software and licensed under the OpenSSL Licenses. +"OpenSSL Licenses" means the OpenSSL License and Original SSLeay License +under which the OpenSSL Project distributes the OpenSSL toolkit software, +as those licenses appear in the file LICENSE-OPENSSL. diff --git a/charms/trusty/hss-proxy/hooks/config-changed b/charms/trusty/hss-proxy/hooks/config-changed new file mode 100755 index 0000000..1685cf7 --- /dev/null +++ b/charms/trusty/hss-proxy/hooks/config-changed @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +# Do nothing - we are a proxy charm. diff --git a/charms/trusty/hss-proxy/hooks/cscf-relation-joined b/charms/trusty/hss-proxy/hooks/cscf-relation-joined new file mode 100755 index 0000000..d488339 --- /dev/null +++ b/charms/trusty/hss-proxy/hooks/cscf-relation-joined @@ -0,0 +1,6 @@ +#!/bin/bash +set -e + +relation-set public-address=$(config-get hss_host) +relation-set hss-realm=$(config-get hss_realm) +relation-set hss-port=$(config-get hss_port) diff --git a/charms/trusty/hss-proxy/hooks/install b/charms/trusty/hss-proxy/hooks/install new file mode 100755 index 0000000..619d377 --- /dev/null +++ b/charms/trusty/hss-proxy/hooks/install @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +# Do nothing - we're a proxy charm. diff --git a/charms/precise/clearwater-route53/hooks/upgrade-charm b/charms/trusty/hss-proxy/hooks/upgrade-charm similarity index 89% rename from charms/precise/clearwater-route53/hooks/upgrade-charm rename to charms/trusty/hss-proxy/hooks/upgrade-charm index 891c9e2..50bffee 100755 --- a/charms/precise/clearwater-route53/hooks/upgrade-charm +++ b/charms/trusty/hss-proxy/hooks/upgrade-charm @@ -3,6 +3,7 @@ # contents have been unpacked # Best practice suggests you execute the hooks/install and # hooks/config-changed to ensure all updates are processed +set -e -# $CHARM_DIR/hooks/install +$CHARM_DIR/hooks/install $CHARM_DIR/hooks/config-changed diff --git a/charms/trusty/hss-proxy/metadata.yaml b/charms/trusty/hss-proxy/metadata.yaml new file mode 100644 index 0000000..06fd893 --- /dev/null +++ b/charms/trusty/hss-proxy/metadata.yaml @@ -0,0 +1,10 @@ +name: hss-proxy +summary: Proxy charm for the 3GPP-Cx interface to the HSS +maintainer: Project Clearwater Maintainers +description: Proxy charm for the 3GPP-Cx interface to the HSS +tags: + - misc +subordinate: false +provides: + cscf: + interface: 3GPP-Cx diff --git a/charms/precise/clearwater-sipp/revision b/charms/trusty/hss-proxy/revision similarity index 100% rename from charms/precise/clearwater-sipp/revision rename to charms/trusty/hss-proxy/revision diff --git a/clearwater-sipp-config.yaml.example b/clearwater-sipp-config.yaml.example index 3b97ecd..38633ea 100644 --- a/clearwater-sipp-config.yaml.example +++ b/clearwater-sipp-config.yaml.example @@ -2,4 +2,4 @@ # Deployment-wide options # These options should be set to the same value for all Clearwater charms (i.e. the same as in bundle-config.yaml.example) zone: "ims.clearwater.local" - repo: "http://repo.cw-ngv.com/stable" + repo: "http://repo.cw-ngv.com/juju-clearwater-2"