From 768a1e33e56c579edbcab1d4ea73d06b85cdd06c Mon Sep 17 00:00:00 2001 From: jsdelfino Date: Thu, 19 Aug 2010 04:10:43 +0000 Subject: Script fixes to get database working with the HTTPS-enabled store-cluster sample configuration. Also some logging improvements and aggregation of the sample logs using scribe. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@987012 13f79535-47bb-0310-9956-ffa450edef68 --- sca-cpp/trunk/samples/store-cluster/proxy-conf | 6 +++ sca-cpp/trunk/samples/store-cluster/server-conf | 5 ++ .../trunk/samples/store-cluster/server-ssl-conf | 5 ++ .../trunk/samples/store-cluster/sqldb-master-conf | 12 ++++- .../trunk/samples/store-cluster/sqldb-standby-conf | 20 ++++++-- sca-cpp/trunk/samples/store-cluster/ssl-start | 59 ++++++++++++++++++++-- sca-cpp/trunk/samples/store-cluster/ssl-stop | 15 +++++- sca-cpp/trunk/samples/store-cluster/start | 36 +++++++++---- sca-cpp/trunk/samples/store-cluster/stop | 5 ++ .../trunk/samples/store-cluster/tunnel-ssl-conf | 15 ++---- 10 files changed, 146 insertions(+), 32 deletions(-) (limited to 'sca-cpp/trunk/samples') diff --git a/sca-cpp/trunk/samples/store-cluster/proxy-conf b/sca-cpp/trunk/samples/store-cluster/proxy-conf index bdfee78917..a72629d140 100755 --- a/sca-cpp/trunk/samples/store-cluster/proxy-conf +++ b/sca-cpp/trunk/samples/store-cluster/proxy-conf @@ -24,3 +24,9 @@ port=$2 ../../modules/http/httpd-conf $root sca-store.com $port/80 $root/htdocs ../../modules/http/vhost-conf $root ../../modules/http/proxy-conf $root + +# Aggregate proxy balancer logs +category=`basename $root` +../../components/log/scribe-tail-start $category $root/logs/error_log +../../components/log/scribe-tail-start $category $root/logs/access_log + diff --git a/sca-cpp/trunk/samples/store-cluster/server-conf b/sca-cpp/trunk/samples/store-cluster/server-conf index 0aeb39813d..66b9639eeb 100755 --- a/sca-cpp/trunk/samples/store-cluster/server-conf +++ b/sca-cpp/trunk/samples/store-cluster/server-conf @@ -32,3 +32,8 @@ SCAVirtualComposite store.composite EOF +# Aggregate app server logs +category=`basename $root` +../../components/log/scribe-tail-start $category $root/logs/error_log +../../components/log/scribe-tail-start $category $root/logs/access_log + diff --git a/sca-cpp/trunk/samples/store-cluster/server-ssl-conf b/sca-cpp/trunk/samples/store-cluster/server-ssl-conf index 35c83f8d65..39fe830f19 100755 --- a/sca-cpp/trunk/samples/store-cluster/server-ssl-conf +++ b/sca-cpp/trunk/samples/store-cluster/server-ssl-conf @@ -38,3 +38,8 @@ SCAVirtualComposite store.composite EOF +# Aggregate app server logs +category=`basename $root` +../../components/log/scribe-tail-start $category $root/logs/error_log +../../components/log/scribe-tail-start $category $root/logs/access_log + diff --git a/sca-cpp/trunk/samples/store-cluster/sqldb-master-conf b/sca-cpp/trunk/samples/store-cluster/sqldb-master-conf index cd85f1e328..f191b4eb3e 100755 --- a/sca-cpp/trunk/samples/store-cluster/sqldb-master-conf +++ b/sca-cpp/trunk/samples/store-cluster/sqldb-master-conf @@ -19,6 +19,16 @@ root=$1 port=$2 +httpport=$3 + +# Aggregate database server logs +category=`basename $root` +../../components/log/scribe-tail-start $category "sqldb" $root/logs/postgresql +../../components/log/scribe-tail-start $category $root/logs/error_log +../../components/log/scribe-tail-start $category $root/logs/access_log + +# Configure a database backup HTTP server +../../modules/http/httpd-conf $root localhost $httpport $root/htdocs # Configure a database server if [ ! -f $root/sqldb/data/postgresql.conf ]; then @@ -29,7 +39,7 @@ fi ../../components/sqldb/pgsql-conf $root $port if [ "$create" = "true" ]; then ../../components/sqldb/pgsql-start $root - ../../components/sqldb/pgsql localhost $port "create table store(key text, value text);" 1>/dev/null 2>&1 + ../../components/sqldb/pgsql localhost $port "create table store(key text, value text);" 1>>$root/logs/postgresql 2>&1 ../../components/sqldb/pgsql-stop $root fi diff --git a/sca-cpp/trunk/samples/store-cluster/sqldb-standby-conf b/sca-cpp/trunk/samples/store-cluster/sqldb-standby-conf index d1dec9930b..a3f3808346 100755 --- a/sca-cpp/trunk/samples/store-cluster/sqldb-standby-conf +++ b/sca-cpp/trunk/samples/store-cluster/sqldb-standby-conf @@ -18,11 +18,21 @@ # under the License. root=$1 -mhost=$2 -mport=$3 -mhttpport=$4 -port=$5 +port=$2 +httpport=$3 +mhost=$4 +mport=$5 +mhttpport=$6 + +# Aggregate database server logs +category=`basename $root` +../../components/log/scribe-tail-start $category "sqldb" $root/logs/postgresql +../../components/log/scribe-tail-start $category $root/logs/error_log +../../components/log/scribe-tail-start $category $root/logs/access_log + +# Configure a database backup HTTP server +../../modules/http/httpd-conf $root localhost $httpport $root/htdocs # Configure a standby database server -../../components/sqldb/pgsql-standby-conf $root $mhost $mport $mhttpport $port +../../components/sqldb/pgsql-standby-conf $root $port $mhost $mport $mhttpport diff --git a/sca-cpp/trunk/samples/store-cluster/ssl-start b/sca-cpp/trunk/samples/store-cluster/ssl-start index 8fe0af41d3..1347d524a8 100755 --- a/sca-cpp/trunk/samples/store-cluster/ssl-start +++ b/sca-cpp/trunk/samples/store-cluster/ssl-start @@ -17,6 +17,8 @@ # specific language governing permissions and limitations # under the License. +set -x + # Generate SSL certificates ../../modules/http/ssl-ca-conf tmp/ssl sca-store.com ../../modules/http/ssl-cert-conf tmp/ssl sca-store.com server @@ -24,22 +26,65 @@ ../../modules/http/ssl-cert-conf tmp/ssl sca-store.com proxy ../../modules/http/ssl-cert-conf tmp/ssl sca-store.com tunnel -# Start three memcached servers and a tunnel server +# Start an SSL tunnel +./tunnel-ssl-conf tmp/tunnel 8119 8563 +../../modules/http/httpd-start tmp/tunnel +sleep 1 + +# Start scribe logging +../../modules/http/tunnel-ssl-conf tmp/tunnel 1465 localhost 563 1463 +../../modules/http/httpd-restart tmp/tunnel +../../components/log/scribed-central-conf tmp/monitor +../../components/log/scribed-client-conf tmp/monitor localhost 1465 +../../components/log/scribed-central-start tmp/monitor +../../components/log/scribed-client-start tmp/monitor +sleep 1 + +# Start three memcached servers +../../modules/http/tunnel-ssl-conf tmp/tunnel 11211 localhost 563 11411 ../../components/cache/memcached-start 127.0.0.1:11411 +../../modules/http/tunnel-ssl-conf tmp/tunnel 11212 localhost 563 11412 ../../components/cache/memcached-start 127.0.0.1:11412 +../../modules/http/tunnel-ssl-conf tmp/tunnel 11213 localhost 563 11413 ../../components/cache/memcached-start 127.0.0.1:11413 -./tunnel-ssl-conf tmp/tunnel1 -../../modules/http/httpd-start tmp/tunnel1 +../../modules/http/httpd-restart tmp/tunnel +sleep 1 + +# Start a master and two hot standby databases +../../modules/http/tunnel-ssl-conf tmp/tunnel 5432 localhost 563 5532 +../../modules/http/tunnel-ssl-conf tmp/tunnel 8502 localhost 563 8602 +../../modules/http/httpd-restart tmp/tunnel +./sqldb-master-conf tmp/sqldb1 127.0.0.1:5532 127.0.0.1:8602 +../../components/sqldb/pgsql-start tmp/sqldb1 +../../modules/http/httpd-start tmp/sqldb1 +sleep 1 + +../../modules/http/tunnel-ssl-conf tmp/tunnel 5433 localhost 563 5533 +../../modules/http/tunnel-ssl-conf tmp/tunnel 8503 localhost 563 8603 +../../modules/http/httpd-restart tmp/tunnel +./sqldb-standby-conf tmp/sqldb2 127.0.0.1:5533 127.0.0.1:8603 localhost 5432 8502 +../../components/sqldb/pgsql-start tmp/sqldb2 +../../modules/http/httpd-start tmp/sqldb2 + +../../modules/http/tunnel-ssl-conf tmp/tunnel 5434 localhost 563 5534 +../../modules/http/tunnel-ssl-conf tmp/tunnel 8504 localhost 563 8604 +../../modules/http/httpd-restart tmp/tunnel +./sqldb-standby-conf tmp/sqldb3 127.0.0.1:5534 127.0.0.1:8604 localhost 5432 8502 +../../components/sqldb/pgsql-start tmp/sqldb3 +../../modules/http/httpd-start tmp/sqldb3 # Start three app servers ./server-ssl-conf tmp/server1 8101 8441 ../../modules/http/httpd-start tmp/server1 +sleep 1 ./server-ssl-conf tmp/server2 8102 8442 ../../modules/http/httpd-start tmp/server2 +sleep 1 ./server-ssl-conf tmp/server3 8103 8443 ../../modules/http/httpd-start tmp/server3 +sleep 1 # Start two proxy balancers ./proxy-ssl-conf tmp/proxy1 8091 8093 @@ -60,11 +105,15 @@ ../../modules/http/proxy-ssl-member-conf tmp/proxy2 localhost 8443 ../../modules/http/httpd-start tmp/proxy2 -# Redirect traffic from port 80 to 8091 and use proxy1 +# Redirect traffic from ports 80 and 443 to proxy1 #../../ubuntu/ip-redirect-all 80 8091 #../../ubuntu/ip-redirect-all 443 8093 -# Redirect traffic from port 80 to 8092 and use proxy2 +# Redirect traffic from ports 80 and 443 to proxy2 #../../ubuntu/ip-redirect-all 80 8092 #../../ubuntu/ip-redirect-all 443 8094 +# Redirect traffic from ports 119 and 563 to tunnel +#../../ubuntu/ip-redirect-all 119 8119 +#../../ubuntu/ip-redirect-all 563 8563 + diff --git a/sca-cpp/trunk/samples/store-cluster/ssl-stop b/sca-cpp/trunk/samples/store-cluster/ssl-stop index 3c52c60399..ff36721315 100755 --- a/sca-cpp/trunk/samples/store-cluster/ssl-stop +++ b/sca-cpp/trunk/samples/store-cluster/ssl-stop @@ -17,6 +17,8 @@ # specific language governing permissions and limitations # under the License. +set -x + ../../modules/http/httpd-stop tmp/server1 ../../modules/http/httpd-stop tmp/server2 ../../modules/http/httpd-stop tmp/server3 @@ -28,4 +30,15 @@ ../../components/cache/memcached-stop 127.0.0.1:11412 ../../components/cache/memcached-stop 127.0.0.1:11413 -../../modules/http/httpd-stop tmp/tunnel1 +../../components/sqldb/pgsql-stop tmp/sqldb3 +../../modules/http/httpd-stop tmp/sqldb3 +../../components/sqldb/pgsql-stop tmp/sqldb2 +../../modules/http/httpd-stop tmp/sqldb2 +../../components/sqldb/pgsql-stop tmp/sqldb1 +../../modules/http/httpd-stop tmp/sqldb1 + +../../modules/http/httpd-stop tmp/tunnel + +../../components/log/scribed-client-stop tmp/monitor +../../components/log/scribed-central-stop tmp/monitor +../../components/log/scribe-tail-stop tmp diff --git a/sca-cpp/trunk/samples/store-cluster/start b/sca-cpp/trunk/samples/store-cluster/start index 2b3afc320c..3b8cc673e7 100755 --- a/sca-cpp/trunk/samples/store-cluster/start +++ b/sca-cpp/trunk/samples/store-cluster/start @@ -17,28 +17,44 @@ # specific language governing permissions and limitations # under the License. +set -x + +# Start scribe logging +../../components/log/scribed-central-conf tmp/monitor +../../components/log/scribed-client-conf tmp/monitor localhost +../../components/log/scribed-central-start tmp/monitor +../../components/log/scribed-client-start tmp/monitor +sleep 1 + # Start three memcached servers ../../components/cache/memcached-start 11211 ../../components/cache/memcached-start 11212 ../../components/cache/memcached-start 11213 -# Start three app servers, with a master database and -# two hot standby databases +# Start a master and two hot standby databases +./sqldb-master-conf tmp/sqldb1 5432 8502 +../../components/sqldb/pgsql-start tmp/sqldb1 +../../modules/http/httpd-start tmp/sqldb1 +sleep 1 + +./sqldb-standby-conf tmp/sqldb2 5433 8503 localhost 5432 8502 +../../components/sqldb/pgsql-start tmp/sqldb2 +../../modules/http/httpd-start tmp/sqldb2 + +./sqldb-standby-conf tmp/sqldb3 5434 8504 localhost 5432 8502 +../../components/sqldb/pgsql-start tmp/sqldb3 +../../modules/http/httpd-start tmp/sqldb3 + +# Start three app servers ./server-conf tmp/server1 8101 -./sqldb-master-conf tmp/server1 5432 -../../components/sqldb/pgsql-start tmp/server1 ../../modules/http/httpd-start tmp/server1 sleep 1 ./server-conf tmp/server2 8102 -./sqldb-standby-conf tmp/server2 localhost 5432 8101 5433 -../../components/sqldb/pgsql-start tmp/server2 ../../modules/http/httpd-start tmp/server2 sleep 1 ./server-conf tmp/server3 8103 -./sqldb-standby-conf tmp/server3 localhost 5432 8101 5434 -../../components/sqldb/pgsql-start tmp/server3 ../../modules/http/httpd-start tmp/server3 sleep 1 @@ -55,9 +71,9 @@ sleep 1 ../../modules/http/proxy-member-conf tmp/proxy2 localhost 8103 ../../modules/http/httpd-start tmp/proxy2 -# Redirect traffic from port 80 to 8091 and use proxy1 +# Redirect traffic from port 80 to proxy1 #../../ubuntu/ip-redirect-all 80 8091 -# Redirect traffic from port 80 to 8092 and use proxy2 +# Redirect traffic from port 80 to proxy2 #../../ubuntu/ip-redirect-all 80 8092 diff --git a/sca-cpp/trunk/samples/store-cluster/stop b/sca-cpp/trunk/samples/store-cluster/stop index d3d29f9cb2..4a6de4ffd7 100755 --- a/sca-cpp/trunk/samples/store-cluster/stop +++ b/sca-cpp/trunk/samples/store-cluster/stop @@ -17,6 +17,8 @@ # specific language governing permissions and limitations # under the License. +set -x + ../../components/sqldb/pgsql-stop tmp/server2 ../../components/sqldb/pgsql-stop tmp/server3 ../../components/sqldb/pgsql-stop tmp/server1 @@ -32,3 +34,6 @@ ../../components/cache/memcached-stop 11212 ../../components/cache/memcached-stop 11213 +../../components/log/scribed-client-stop tmp/monitor +../../components/log/scribed-central-stop tmp/monitor +../../components/log/scribe-tail-stop tmp diff --git a/sca-cpp/trunk/samples/store-cluster/tunnel-ssl-conf b/sca-cpp/trunk/samples/store-cluster/tunnel-ssl-conf index bbaf511e51..1b70a5d2c8 100755 --- a/sca-cpp/trunk/samples/store-cluster/tunnel-ssl-conf +++ b/sca-cpp/trunk/samples/store-cluster/tunnel-ssl-conf @@ -18,16 +18,11 @@ # under the License. root=$1 +port=$2 +sslport=$3 -# Configure SSL tunnels to the memcached servers -../../modules/http/httpd-conf $root localhost 127.0.0.1:11210 htdocs +# Configure an SSL-enabled tunnel server +../../modules/http/httpd-conf $root sca-store.com $port/119 $root/htdocs tar -C tmp/ssl -c `../../modules/http/ssl-cert-find tmp/ssl` | tar -C $root -x -../../modules/http/tunnel-ssl-conf $root 11211 localhost 8441 11411 -../../modules/http/tunnel-ssl-conf $root 11212 localhost 8442 11412 -../../modules/http/tunnel-ssl-conf $root 11213 localhost 8443 11413 - -# Configure SSL tunnels to the postgresql servers -../../modules/http/tunnel-ssl-conf $root 5532 localhost 8441 5432 -../../modules/http/tunnel-ssl-conf $root 5533 localhost 8441 5433 -../../modules/http/tunnel-ssl-conf $root 5534 localhost 8441 5433 +../../modules/http/httpd-ssl-conf $root $sslport/563 -- cgit v1.2.3