You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by me...@apache.org on 2014/07/03 13:26:27 UTC
[1/2] git commit: STRATOS-699 - HAProxy Puppet Configurations
Repository: stratos
Updated Branches:
refs/heads/4.0.0 6a45473b7 -> 862a71d67
STRATOS-699 - HAProxy Puppet Configurations
Signed-off-by: Melan Nimesh <me...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/7cd07583
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/7cd07583
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/7cd07583
Branch: refs/heads/4.0.0
Commit: 7cd07583ce0d1562720e79321bffa507951d8fb5
Parents: 67b8e79
Author: Dinesh Bandara <di...@wso2.com>
Authored: Thu Jul 3 16:40:48 2014 +0530
Committer: Melan Nimesh <me...@apache.org>
Committed: Thu Jul 3 16:49:58 2014 +0530
----------------------------------------------------------------------
tools/puppet3/modules/haproxy/files/README.txt | 12 +++
tools/puppet3/modules/haproxy/manifests/init.pp | 70 ++++++++++++++++++
.../modules/haproxy/manifests/initialize.pp | 77 ++++++++++++++++++++
.../modules/haproxy/manifests/push_templates.pp | 30 ++++++++
.../puppet3/modules/haproxy/manifests/start.pp | 25 +++++++
.../templates/bin/haproxy-extension.sh.erb | 48 ++++++++++++
.../haproxy/templates/conf/jndi.properties.erb | 33 +++++++++
7 files changed, 295 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/7cd07583/tools/puppet3/modules/haproxy/files/README.txt
----------------------------------------------------------------------
diff --git a/tools/puppet3/modules/haproxy/files/README.txt b/tools/puppet3/modules/haproxy/files/README.txt
new file mode 100644
index 0000000..b9c3baa
--- /dev/null
+++ b/tools/puppet3/modules/haproxy/files/README.txt
@@ -0,0 +1,12 @@
+This folder should have following:
+
+1. apache-stratos-haproxy-extension-${version}.zip file
+
+2. Folder having a name as $mb_type which is defined in the nodes.pp file.
+
+eg:
+if $mb_type = activemq, folder structure of this folder would be:
+>$ls
+>activemq apache-stratos-haproxy-extension-4.0.0.zip
+
+3. Under $mb_type folder, please add all the client jars, that should be copied to the haproxy-extension's lib directory.
http://git-wip-us.apache.org/repos/asf/stratos/blob/7cd07583/tools/puppet3/modules/haproxy/manifests/init.pp
----------------------------------------------------------------------
diff --git a/tools/puppet3/modules/haproxy/manifests/init.pp b/tools/puppet3/modules/haproxy/manifests/init.pp
new file mode 100755
index 0000000..f8ce3ed
--- /dev/null
+++ b/tools/puppet3/modules/haproxy/manifests/init.pp
@@ -0,0 +1,70 @@
+#--------------------------------------------------------------
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+#
+#--------------------------------------------------------------
+
+class haproxy(
+ $network_partition_id = $stratos_network_partition_id,
+ $service_filter = $stratos_load_balanced_service_type,
+ $version = '4.0.0',
+ $owner = 'root',
+ $group = 'root',
+ $target = '/mnt',
+){
+
+ $deployment_code = 'haproxy-extension'
+ $carbon_version = $version
+ $service_code = 'haproxy-extension'
+ $carbon_home = "${target}/apache-stratos-${service_code}-${carbon_version}"
+
+ tag($service_code)
+
+ $service_templates = [
+ 'bin/haproxy-extension.sh',
+ 'conf/jndi.properties',
+ ]
+
+ package { ['haproxy', 'socat']:
+ ensure => installed,
+ }
+
+ haproxy::initialize { $deployment_code:
+ repo => $package_repo,
+ version => $carbon_version,
+ service => $service_code,
+ local_dir => $local_package_dir,
+ target => $target,
+ owner => $owner,
+ }
+
+ haproxy::push_templates {
+ $service_templates:
+ target => $carbon_home,
+ require => Haproxy::Initialize[$deployment_code];
+ }
+
+ haproxy::start { $deployment_code:
+ owner => $owner,
+ target => $carbon_home,
+ require => [
+ Package['haproxy'],
+ Haproxy::Push_templates[$service_templates],
+ ];
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/7cd07583/tools/puppet3/modules/haproxy/manifests/initialize.pp
----------------------------------------------------------------------
diff --git a/tools/puppet3/modules/haproxy/manifests/initialize.pp b/tools/puppet3/modules/haproxy/manifests/initialize.pp
new file mode 100755
index 0000000..65bd795
--- /dev/null
+++ b/tools/puppet3/modules/haproxy/manifests/initialize.pp
@@ -0,0 +1,77 @@
+#--------------------------------------------------------------
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+#
+#--------------------------------------------------------------
+
+define haproxy::initialize ($repo, $version, $service, $local_dir, $target, $owner,) {
+ file {
+ "/${local_dir}/apache-stratos-${service}-${version}.zip":
+ ensure => present,
+ source => "puppet:///modules/haproxy/apache-stratos-${service}-${version}.zip";
+ }
+
+ exec {
+ "creating_target_for_${name}":
+ path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
+ command => "mkdir -p ${target}";
+
+ "creating_local_package_repo_for_${name}":
+ path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java/bin/',
+ unless => "test -d ${local_dir}",
+ command => "mkdir -p ${local_dir}";
+
+ "downloading_stratos${service}-${version}.zip_for_${name}":
+ path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
+ cwd => $local_dir,
+ unless => "test -f ${local_dir}/apache-stratos-${service}-${version}.zip",
+ command => "puppet:///modules/haproxy/apache-stratos-${service}-${version}.zip",
+ logoutput => 'on_failure',
+ creates => "${local_dir}/apache-stratos-${service}-${version}.zip",
+ timeout => 0,
+ require => Exec["creating_local_package_repo_for_${name}", "creating_target_for_${name}"];
+
+ "extracting_stratos${service}-${version}.zip_for_${name}":
+ path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
+ cwd => $target,
+ unless => "test -d ${target}/apache-stratos-${service}-${version}/conf",
+ command => "unzip ${local_dir}/apache-stratos-${service}-${version}.zip",
+ logoutput => 'on_failure',
+ creates => "${target}/apache-stratos-${service}-${version}/repository",
+ timeout => 0,
+ require => Exec["downloading_stratos${service}-${version}.zip_for_${name}"];
+
+ "setting_permission_for_${name}":
+ path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
+ cwd => $target,
+ command => "chown -R ${owner}:${owner} ${target}/apache-stratos-${service}-${version} ;
+ chmod -R 755 ${target}/apache-stratos-${service}-${version}",
+ logoutput => 'on_failure',
+ timeout => 0,
+ require => Exec["extracting_stratos${service}-${version}.zip_for_${name}"];
+ }
+
+ file { "/${target}/apache-stratos-${service}-${version}/lib":
+ path => "/${target}/apache-stratos-${service}-${version}/lib",
+ ensure => directory,
+ require => Exec["setting_permission_for_${name}"],
+ source => ["puppet:///modules/haproxy/${mb_type}"],
+ sourceselect => all,
+ recurse => true,
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/7cd07583/tools/puppet3/modules/haproxy/manifests/push_templates.pp
----------------------------------------------------------------------
diff --git a/tools/puppet3/modules/haproxy/manifests/push_templates.pp b/tools/puppet3/modules/haproxy/manifests/push_templates.pp
new file mode 100755
index 0000000..b8ba309
--- /dev/null
+++ b/tools/puppet3/modules/haproxy/manifests/push_templates.pp
@@ -0,0 +1,30 @@
+#--------------------------------------------------------------
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+#
+#--------------------------------------------------------------
+
+define haproxy::push_templates ($target) {
+ file { "${target}/${name}":
+ ensure => present,
+ owner => $haproxy::owner,
+ group => $haproxy::group,
+ mode => '0755',
+ content => template("haproxy/${name}.erb"),
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/7cd07583/tools/puppet3/modules/haproxy/manifests/start.pp
----------------------------------------------------------------------
diff --git a/tools/puppet3/modules/haproxy/manifests/start.pp b/tools/puppet3/modules/haproxy/manifests/start.pp
new file mode 100755
index 0000000..351c4c3
--- /dev/null
+++ b/tools/puppet3/modules/haproxy/manifests/start.pp
@@ -0,0 +1,25 @@
+# ----------------------------------------------------------------------------
+# Copyright 2005-2013 WSO2, Inc. http://www.wso2.org
+#
+# 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.
+# ----------------------------------------------------------------------------
+
+define haproxy::start ($target, $owner) {
+ exec { "starting_${name}":
+ user => $owner,
+ path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/java/bin/',
+ unless => "test -f ${target}/wso2carbon.lck",
+ cwd => "${target}/bin/",
+ command => "touch ${target}/wso2carbon.lck; bash haproxy-extension.sh > /dev/null 2>&1 &",
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/7cd07583/tools/puppet3/modules/haproxy/templates/bin/haproxy-extension.sh.erb
----------------------------------------------------------------------
diff --git a/tools/puppet3/modules/haproxy/templates/bin/haproxy-extension.sh.erb b/tools/puppet3/modules/haproxy/templates/bin/haproxy-extension.sh.erb
new file mode 100755
index 0000000..7f17d2e
--- /dev/null
+++ b/tools/puppet3/modules/haproxy/templates/bin/haproxy-extension.sh.erb
@@ -0,0 +1,48 @@
+#!/bin/bash
+# --------------------------------------------------------------
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+#
+# --------------------------------------------------------------
+
+echo "Starting haproxy extension..."
+script_path="$( cd -P "$( dirname "$SOURCE" )" && pwd )/`dirname $0`"
+lib_path=${script_path}/../lib/
+class_path=`echo ${lib_path}/*.jar | tr ' ' ':'`
+#properties="-Dhaproxy.private.ip=<%= @ipaddress %>
+properties="-Dhaproxy.private.ip=0.0.0.0
+ -Djndi.properties.dir=${script_path}/../conf
+ -Dexecutable.file.path=haproxy
+ -Dtemplates.path=${script_path}/../templates
+ -Dtemplates.name=haproxy.cfg.template
+ -Dscripts.path=${script_path}/../scripts
+ -Dconf.file.path=/tmp/haproxy.cfg
+ -Dstats.socket.file.path=/tmp/haproxy-stats.socket
+ -Dlog4j.properties.file.path=${script_path}/../conf/log4j.properties
+ -Djavax.net.ssl.trustStore=${script_path}/../security/client-truststore.jks
+ -Djavax.net.ssl.trustStorePassword=<%= @truststore_password %>
+ -Dthrift.receiver.ip=<%= @cep_ip %>
+ -Dthrift.receiver.port=<%= @cep_port %>
+ -Dnetwork.partition.id=<%= @network_partition_id %>
+ <% if @stratos_lb_category == 'service.aware.load.balancer' %>-Dstratos.topology.service.filter=service-name=<%= @service_filter %><% end %>
+ -Dcep.stats.publisher.enabled=true"
+
+# Uncomment below line to enable remote debugging
+#debug="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005"
+
+/opt/java/bin/java -cp "${class_path}" ${properties} ${debug} org.apache.stratos.haproxy.extension.Main $*
http://git-wip-us.apache.org/repos/asf/stratos/blob/7cd07583/tools/puppet3/modules/haproxy/templates/conf/jndi.properties.erb
----------------------------------------------------------------------
diff --git a/tools/puppet3/modules/haproxy/templates/conf/jndi.properties.erb b/tools/puppet3/modules/haproxy/templates/conf/jndi.properties.erb
new file mode 100644
index 0000000..e4b4462
--- /dev/null
+++ b/tools/puppet3/modules/haproxy/templates/conf/jndi.properties.erb
@@ -0,0 +1,33 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+#
+# This is a generated file and will be overwritten at the next load balancer startup.
+# Please use loadbalancer.conf for updating mb-ip, mb-port and templates/jndi.properties.template
+# file for updating other configurations.
+#
+<% if @mb_type == 'wso2mb' %>
+ connectionfactoryName=topicConnectionfactory
+ connectionfactory.topicConnectionfactory=amqp://admin:admin@carbon/carbon?brokerlist='tcp://<%= @mb_ip %>:<%= @mb_port %>'
+ java.naming.factory.initial=org.wso2.andes.jndi.PropertiesFileInitialContextFactory
+ java.naming.provider.url=<%= @carbon_home %>/conf/jndi.properties
+<% end %>
+<% if @mb_type == 'activemq' %>
+ connectionfactoryName=TopicConnectionFactory
+ java.naming.provider.url=tcp://<%= @mb_ip %>:<%= @mb_port %>
+ java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
+<% end %>
[2/2] git commit: Merge branch '4.0.0' of
https://git-wip-us.apache.org/repos/asf/stratos into 4.0.0
Posted by me...@apache.org.
Merge branch '4.0.0' of https://git-wip-us.apache.org/repos/asf/stratos into 4.0.0
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/862a71d6
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/862a71d6
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/862a71d6
Branch: refs/heads/4.0.0
Commit: 862a71d67f54a813e2696703b8ce2da327db238a
Parents: 7cd0758 6a45473
Author: Melan Nimesh <me...@apache.org>
Authored: Thu Jul 3 16:55:40 2014 +0530
Committer: Melan Nimesh <me...@apache.org>
Committed: Thu Jul 3 16:55:40 2014 +0530
----------------------------------------------------------------------
.../stratos/modules/distribution/src/main/conf/log4j.properties | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------