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
This commit is contained in:
parent
d4184f1ab8
commit
768a1e33e5
28 changed files with 455 additions and 119 deletions
|
@ -22,17 +22,17 @@ INCLUDES = -I${THRIFT_INCLUDE} -I${FB303_INCLUDE}
|
|||
incl_HEADERS = *.hpp
|
||||
incldir = $(prefix)/include/components/log
|
||||
|
||||
dist_comp_SCRIPTS = scribed-central-conf scribed-client-conf scribed-central-start scribed-central-stop scribed-client-start scribed-client-stop scribe-cat
|
||||
dist_comp_SCRIPTS = scribed-central-conf scribed-client-conf scribed-central-start scribed-central-stop scribed-client-start scribed-client-stop scribe-tail-start scribe-tail-stop
|
||||
compdir=$(prefix)/components/log
|
||||
|
||||
comp_DATA = scribe.prefix thrift.prefix scribecat.py
|
||||
comp_DATA = scribe.prefix thrift.prefix
|
||||
scribe.prefix: $(top_builddir)/config.status
|
||||
echo ${SCRIBE_PREFIX} >scribe.prefix
|
||||
|
||||
thrift.prefix: $(top_builddir)/config.status
|
||||
echo ${THRIFT_PREFIX} >thrift.prefix
|
||||
|
||||
EXTRA_DIST = log.composite *.py *.scm *.thrift
|
||||
EXTRA_DIST = log.composite *.scm *.thrift
|
||||
|
||||
BUILT_SOURCES=gen-cpp/fb303_constants.cpp gen-cpp/fb303_types.cpp gen-cpp/scribe_constants.cpp gen-cpp/scribe.cpp gen-cpp/scribe_types.cpp gen-cpp/FacebookService.cpp gen-cpp/scribe.h
|
||||
gen-cpp/fb303_constants.cpp gen-cpp/fb303_types.cpp gen-cpp/scribe_constants.cpp gen-cpp/scribe.cpp gen-cpp/scribe_types.cpp gen-cpp/FacebookService.cpp gen-cpp/scribe.h: scribe.thrift
|
||||
|
@ -57,6 +57,13 @@ liblogger_la_LDFLAGS = -L${THRIFT_LIB} -R${THRIFT_LIB} -lthrift -L${FB303_LIB} -
|
|||
liblogger.so:
|
||||
ln -s .libs/liblogger.so
|
||||
|
||||
comp_PROGRAMS = scribe-cat
|
||||
|
||||
nodist_scribe_cat_SOURCES = gen-cpp/fb303_constants.cpp gen-cpp/fb303_types.cpp gen-cpp/scribe_constants.cpp gen-cpp/scribe.cpp gen-cpp/scribe_types.cpp gen-cpp/FacebookService.cpp gen-cpp/scribe.h
|
||||
scribe_cat_CXXFLAGS = -Wno-unused-parameter
|
||||
scribe_cat_SOURCES = scribe-cat.cpp
|
||||
scribe_cat_LDFLAGS = -L${THRIFT_LIB} -R${THRIFT_LIB} -lthrift -L${FB303_LIB} -R${FB303_LIB} -lfb303 -L${SCRIBE_LIB} -R${SCRIBE_LIB} -lscribe
|
||||
|
||||
client_test_SOURCES = client-test.cpp
|
||||
client_test_LDFLAGS = -lxml2 -lcurl -lmozjs
|
||||
|
||||
|
|
77
sca-cpp/trunk/components/log/scribe-cat.cpp
Normal file
77
sca-cpp/trunk/components/log/scribe-cat.cpp
Normal file
|
@ -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.
|
||||
*/
|
||||
|
||||
/* $Rev$ $Date$ */
|
||||
|
||||
/**
|
||||
* A utility that logs stdin into a scribe log.
|
||||
*/
|
||||
|
||||
#include "string.hpp"
|
||||
#include "function.hpp"
|
||||
#include "list.hpp"
|
||||
#include "value.hpp"
|
||||
#include "monad.hpp"
|
||||
|
||||
#undef debug
|
||||
#define debug(...)
|
||||
#include "scribe.hpp"
|
||||
|
||||
namespace tuscany {
|
||||
namespace scribecat {
|
||||
|
||||
int cat(const string& category, const string& type) {
|
||||
// Connect to Scribe
|
||||
scribe::Scribe& sc = *(new (gc_new<scribe::Scribe>()) scribe::Scribe("localhost", 1464));
|
||||
|
||||
// Read lines from stdin and log them
|
||||
char buf[8192];
|
||||
for (;;) {
|
||||
const char* s = fgets(buf, 8192, stdin);
|
||||
if (s == NULL)
|
||||
return 0;
|
||||
const int l = strlen(s);
|
||||
if (l < 2)
|
||||
return 0;
|
||||
buf[l - 1] = '\0';
|
||||
|
||||
// Log each line as is
|
||||
if (length(type) == 0) {
|
||||
const failable<bool> val = scribe::log(buf, category, sc);
|
||||
if (!hasContent(val))
|
||||
return 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Log each line prefixed with time and a type tag
|
||||
ostringstream os;
|
||||
os << "[" << logTime() << "] [" << type << "] " << buf;
|
||||
const failable<bool> val = scribe::log(c_str(str(os)), category, sc);
|
||||
if (!hasContent(val))
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
int main(const int argc, const char** argv) {
|
||||
return tuscany::scribecat::cat(argc < 2? "default" : argv[1], argc < 3? "" : argv[2]);
|
||||
}
|
||||
|
|
@ -17,16 +17,28 @@
|
|||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
# Write messages to Scribe
|
||||
# Tail a file and pipe into scribe-cat
|
||||
here=`readlink -f $0`; here=`dirname $here`
|
||||
category=$1
|
||||
if [ "$category" = "" ]; then
|
||||
category="default"
|
||||
|
||||
category=""
|
||||
type=""
|
||||
file=""
|
||||
if [ "$3" != "" ]; then
|
||||
category=$1
|
||||
type=$2
|
||||
file=$3
|
||||
else
|
||||
if [ "$2" != "" ]; then
|
||||
category=$1
|
||||
file=$2
|
||||
else
|
||||
file=$1
|
||||
fi
|
||||
fi
|
||||
|
||||
python_prefix=`cat $here/../../modules/python/python.prefix`
|
||||
scribe_prefix=`cat $here/scribe.prefix`
|
||||
thrift_prefix=`cat $here/thrift.prefix`
|
||||
export PYTHONPATH=$PYTHONPATH:${thrift_prefix}/lib/python2.6/site-packages:${thrift_prefix}/contrib/fb303/lib/python2.6/site-packages:${scribe_prefix}/lib/python2.6/site-packages
|
||||
$python_prefix/bin/python $here/scribecat.py $category
|
||||
mkdir -p `dirname $file`
|
||||
touch $file
|
||||
file=`readlink -f $file`
|
||||
|
||||
tail -f -n 0 $file | $here/scribe-cat $category $type &
|
||||
|
46
sca-cpp/trunk/components/log/scribecat.py → sca-cpp/trunk/components/log/scribe-tail-stop
Normal file → Executable file
46
sca-cpp/trunk/components/log/scribecat.py → sca-cpp/trunk/components/log/scribe-tail-stop
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
|||
#!/bin/sh
|
||||
|
||||
# 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
|
||||
|
@ -15,30 +17,26 @@
|
|||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
# Write messages to Scribe
|
||||
# Stop tailing a file
|
||||
here=`readlink -f $0`; here=`dirname $here`
|
||||
|
||||
import sys
|
||||
from scribe import scribe
|
||||
from thrift.transport import TTransport, TSocket
|
||||
from thrift.protocol import TBinaryProtocol
|
||||
category=""
|
||||
type=""
|
||||
file=""
|
||||
if [ "$3" != "" ]; then
|
||||
category=$1
|
||||
type=$2
|
||||
file=$3
|
||||
else
|
||||
if [ "$2" != "" ]; then
|
||||
category=$1
|
||||
file=$2
|
||||
else
|
||||
file=$1
|
||||
fi
|
||||
fi
|
||||
file=`readlink -f $file`
|
||||
|
||||
category = sys.argv[1]
|
||||
host = 'localhost'
|
||||
port = 1464
|
||||
|
||||
entry = scribe.LogEntry(category=category, message=sys.stdin.read())
|
||||
socket = TSocket.TSocket(host=host, port=port)
|
||||
transport = TTransport.TFramedTransport(socket)
|
||||
protocol = TBinaryProtocol.TBinaryProtocol(trans=transport, strictRead=False, strictWrite=False)
|
||||
client = scribe.Client(iprot=protocol, oprot=protocol)
|
||||
transport.open()
|
||||
result = client.Log(messages=[entry])
|
||||
transport.close()
|
||||
|
||||
if result == scribe.ResultCode.OK:
|
||||
sys.exit()
|
||||
if result == scribe.ResultCode.TRY_LATER:
|
||||
print >> sys.stderr, "Try later"
|
||||
sys.exit(84)
|
||||
sys.exit(result)
|
||||
cmd="tail -f -n 0 $file"
|
||||
kill `ps -ef | grep -v grep | grep "${cmd}" | awk '{ print $2 }'`
|
||||
|
|
@ -28,7 +28,7 @@ rm -rf tmp
|
|||
sleep 1
|
||||
|
||||
# Test logging a message
|
||||
echo test | ./scribe-cat
|
||||
echo test | ./scribe-cat >/dev/null
|
||||
sleep 4
|
||||
grep test tmp/scribe/logs/central/default/default_current >/dev/null
|
||||
rc=$?
|
||||
|
|
|
@ -22,6 +22,11 @@ here=`readlink -f $0`; here=`dirname $here`
|
|||
mkdir -p $1
|
||||
root=`readlink -f $1`
|
||||
|
||||
port=$2
|
||||
if [ "$port" = "" ]; then
|
||||
port="1463"
|
||||
fi
|
||||
|
||||
mkdir -p $root/scribe/conf
|
||||
mkdir -p $root/scribe/logs/central
|
||||
mkdir -p $root/scribe/logs/central-secondary
|
||||
|
@ -29,7 +34,7 @@ mkdir -p $root/scribe/logs/central-secondary
|
|||
cat >$root/scribe/conf/scribe-central.conf <<EOF
|
||||
# Generated by: scribed-central-conf $*
|
||||
# Scribe central configuration
|
||||
port=1463
|
||||
port=$port
|
||||
max_msg_per_second=2000000
|
||||
check_interval=3
|
||||
|
||||
|
|
|
@ -21,7 +21,12 @@
|
|||
here=`readlink -f $0`; here=`dirname $here`
|
||||
mkdir -p $1
|
||||
root=`readlink -f $1`
|
||||
|
||||
central=$2
|
||||
cport=$3
|
||||
if [ "$cport" = "" ]; then
|
||||
cport="1463"
|
||||
fi
|
||||
|
||||
mkdir -p $root/scribe/conf
|
||||
mkdir -p $root/scribe/logs/client-secondary
|
||||
|
@ -47,8 +52,8 @@ retry_interval_range=10
|
|||
|
||||
<primary>
|
||||
type=network
|
||||
remote_host=$2
|
||||
remote_port=1463
|
||||
remote_host=$central
|
||||
remote_port=$cport
|
||||
</primary>
|
||||
|
||||
<secondary>
|
||||
|
|
|
@ -22,19 +22,8 @@ here=`readlink -f $0`; here=`dirname $here`
|
|||
mkdir -p $1
|
||||
root=`readlink -f $1`
|
||||
|
||||
# Master server address
|
||||
if [ "$2" = "" ]; then
|
||||
mhost="localhost"
|
||||
mport="5432"
|
||||
mhttpport="80"
|
||||
else
|
||||
mhost="$2"
|
||||
mport="$3"
|
||||
mhttpport="$4"
|
||||
fi
|
||||
|
||||
# Server address
|
||||
addr=$5
|
||||
addr=$2
|
||||
if [ "$addr" = "" ]; then
|
||||
ip="*"
|
||||
port="5432"
|
||||
|
@ -46,6 +35,17 @@ else
|
|||
port=`$here/../../modules/http/httpd-addr port $addr`
|
||||
fi
|
||||
|
||||
# Master server address
|
||||
if [ "$3" = "" ]; then
|
||||
mhost="localhost"
|
||||
mport="5432"
|
||||
mhttpport="80"
|
||||
else
|
||||
mhost="$3"
|
||||
mport="$4"
|
||||
mhttpport="$5"
|
||||
fi
|
||||
|
||||
pgsql_prefix=`cat $here/pgsql.prefix`
|
||||
mkdir -p $root/sqldb/data
|
||||
chmod 700 $root/sqldb/data
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
./pgsql localhost 5432 "create table test(key text, value text);" 1>/dev/null 2>&1
|
||||
../../modules/http/httpd-start tmp/master
|
||||
sleep 2
|
||||
./pgsql-standby-conf tmp/standby localhost 5432 8090 5433
|
||||
./pgsql-standby-conf tmp/standby 5433 localhost 5432 8090
|
||||
./pgsql-start tmp/standby
|
||||
|
||||
# Test
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <time.h>
|
||||
#include "string.hpp"
|
||||
#include "stream.hpp"
|
||||
|
||||
|
@ -137,20 +138,107 @@ ofstream cerr(stderr);
|
|||
ifstream cin(stdin);
|
||||
|
||||
/**
|
||||
* Debug log stream.
|
||||
* Streams used for logging.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Format the current time.
|
||||
*/
|
||||
const string logTime() {
|
||||
const time_t t = ::time(NULL);
|
||||
const tm* lt = localtime(&t);
|
||||
char ft[32];
|
||||
strftime(ft, 31, "%a %b %d %H:%M:%S %Y", lt);
|
||||
return ft;
|
||||
}
|
||||
|
||||
/*
|
||||
* Log stream.
|
||||
*/
|
||||
class logfstream : public ostream {
|
||||
public:
|
||||
logfstream(FILE* file, const string& type) : file(file), type(type), owner(false), head(false) {
|
||||
}
|
||||
|
||||
logfstream(const logfstream& os) : file(os.file), type(type), owner(false), head(os.head) {
|
||||
}
|
||||
|
||||
~logfstream() {
|
||||
if (!owner)
|
||||
return;
|
||||
if (file == NULL)
|
||||
return;
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
logfstream& vprintf(const char* fmt, ...) {
|
||||
whead();
|
||||
va_list args;
|
||||
va_start (args, fmt);
|
||||
vfprintf (file, fmt, args);
|
||||
va_end (args);
|
||||
return *this;
|
||||
}
|
||||
|
||||
logfstream& write(const string& s) {
|
||||
whead();
|
||||
fwrite(c_str(s), 1, length(s), file);
|
||||
if (s == "\n")
|
||||
head = false;
|
||||
return *this;
|
||||
}
|
||||
|
||||
logfstream& flush() {
|
||||
fflush(file);
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
FILE* file;
|
||||
const string type;
|
||||
bool owner;
|
||||
bool head;
|
||||
|
||||
logfstream& whead() {
|
||||
if (head)
|
||||
return *this;
|
||||
head = true;
|
||||
*this << "[" << logTime() << "] [" << type << "] ";
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Info and failure log streams.
|
||||
*/
|
||||
logfstream cinfo(stderr, "info");
|
||||
logfstream cfailure(stderr, "error");
|
||||
|
||||
#ifdef WANT_MAINTAINER_MODE
|
||||
|
||||
template<typename V> const bool debug(const V& v, const string& msg) {
|
||||
cerr << msg << ": " << v << endl;
|
||||
/**
|
||||
* Debug log stream and debug functions.
|
||||
*/
|
||||
logfstream cdebug(stderr, "debug");
|
||||
|
||||
/**
|
||||
* Log a debug message.
|
||||
*/
|
||||
const bool debugLog(const string& msg) {
|
||||
cdebug << msg << endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
const bool debug(const string& msg) {
|
||||
cerr << msg << endl;
|
||||
/**
|
||||
* Log a debug message and a value.
|
||||
*/
|
||||
template<typename V> const bool debugLog(const V& v, const string& msg) {
|
||||
cdebug << msg << ": " << v << endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
#define debug(...) tuscany::debugLog(__VA_ARGS__)
|
||||
|
||||
#else
|
||||
|
||||
#define debug(...)
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
#include "function.hpp"
|
||||
#include "string.hpp"
|
||||
#include "stream.hpp"
|
||||
#include "sstream.hpp"
|
||||
#include "fstream.hpp"
|
||||
|
||||
namespace tuscany
|
||||
{
|
||||
|
@ -275,7 +277,12 @@ template<typename V, typename F> const lambda<failable<V, F>(const V)> success()
|
|||
* Returns a failable monad with a failure in it.
|
||||
*/
|
||||
template<typename V, typename F> const failable<V, F> mkfailure(const F& f) {
|
||||
debug(f, "failable::mkfailure");
|
||||
#ifdef WANT_MAINTAINER_MODE
|
||||
ostringstream os;
|
||||
os << f;
|
||||
if (length(str(os)) != 0)
|
||||
debug(f, "failable::mkfailure");
|
||||
#endif
|
||||
return failable<V, F>(false, f);
|
||||
}
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ class stream_endl {
|
|||
} endl;
|
||||
|
||||
ostream& operator<<(ostream& os, unused const stream_endl e) {
|
||||
os.vprintf("%s", "\n");
|
||||
os.write("\n");
|
||||
return os.flush();
|
||||
}
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ HostNameLookups Off
|
|||
# Log HTTP requests
|
||||
LogLevel info
|
||||
ErrorLog $root/logs/error_log
|
||||
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" combined
|
||||
LogFormat "[%{%a %b %d %H:%M:%S %Y}t] [access] %h %l %u \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" combined
|
||||
CustomLog $root/logs/access_log combined
|
||||
|
||||
# Configure Mime types
|
||||
|
|
|
@ -24,6 +24,9 @@ root=`readlink -f $1`
|
|||
|
||||
conf=`cat $root/conf/httpd.conf | grep "# Generated by: httpd-conf"`
|
||||
host=`echo $conf | awk '{ print $6 }'`
|
||||
gport=`echo $conf | awk '{ print $7 }'`
|
||||
port=`$here/httpd-addr port $gport`
|
||||
pport=`$here/httpd-addr pport $gport`
|
||||
|
||||
sslpport=`$here/httpd-addr pport $2`
|
||||
ssllisten=`$here/httpd-addr listen $2`
|
||||
|
@ -44,7 +47,8 @@ cat >>$root/conf/httpd.conf <<EOF
|
|||
# Redirect all HTTP traffic to HTTPS
|
||||
<Location />
|
||||
RewriteEngine on
|
||||
RewriteCond %{HTTPS} !^on$
|
||||
RewriteCond %{SERVER_PORT} ^$port$ [OR]
|
||||
RewriteCond %{SERVER_PORT} ^$pport$
|
||||
RewriteRule .* https://%{SERVER_NAME}:$sslpport%{REQUEST_URI} [R,L]
|
||||
</Location>
|
||||
|
||||
|
@ -99,8 +103,7 @@ SSLVerifyClient optional
|
|||
SSLVerifyDepth 1
|
||||
|
||||
# Log SSL requests
|
||||
#CustomLog "$root/logs/ssl_request_log" "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
|
||||
LogFormat "%h %l %u %t %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\" \"%{SSL_CLIENT_I_DN}x\" \"%{SSL_CLIENT_S_DN}x\"" sslcombined
|
||||
LogFormat "[%{%a %b %d %H:%M:%S %Y}t] [sslaccess] %h %l %u %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\" \"%{SSL_CLIENT_I_DN}x\" \"%{SSL_CLIENT_S_DN}x\"" sslcombined
|
||||
CustomLog $root/logs/ssl_access_log sslcombined
|
||||
|
||||
EOF
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include <util_script.h>
|
||||
#include <util_md5.h>
|
||||
#include <http_config.h>
|
||||
#include <http_log.h>
|
||||
#include <ap_mpm.h>
|
||||
#include <mod_core.h>
|
||||
|
||||
|
@ -50,6 +51,7 @@
|
|||
#include "stream.hpp"
|
||||
#include "list.hpp"
|
||||
#include "value.hpp"
|
||||
#include "monad.hpp"
|
||||
|
||||
|
||||
namespace tuscany {
|
||||
|
@ -408,44 +410,60 @@ const void* userData(const string& k, const server_rec* s) {
|
|||
/**
|
||||
* Debug log.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Log an optional value.
|
||||
*/
|
||||
const char* debugOptional(const char* s) {
|
||||
if (s == NULL)
|
||||
return "";
|
||||
return s;
|
||||
}
|
||||
|
||||
/**
|
||||
* Log a header
|
||||
*/
|
||||
int debugHeader(unused void* r, const char* key, const char* value) {
|
||||
cerr << " header key: " << key << ", value: " << value << endl;
|
||||
cdebug << " header key: " << key << ", value: " << value << endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Log an environment variable
|
||||
*/
|
||||
int debugEnv(unused void* r, const char* key, const char* value) {
|
||||
cerr << " var key: " << key << ", value: " << value << endl;
|
||||
cdebug << " var key: " << key << ", value: " << value << endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Log a note.
|
||||
*/
|
||||
int debugNote(unused void* r, const char* key, const char* value) {
|
||||
cerr << " note key: " << key << ", value: " << value << endl;
|
||||
cdebug << " note key: " << key << ", value: " << value << endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Log a request.
|
||||
*/
|
||||
const bool debugRequest(request_rec* r, const string& msg) {
|
||||
cerr << msg << ":" << endl;
|
||||
cerr << " server: " << debugOptional(r->server->server_hostname) << endl;
|
||||
cerr << " protocol: " << debugOptional(r->protocol) << endl;
|
||||
cerr << " method: " << debugOptional(r->method) << endl;
|
||||
cerr << " method number: " << r->method_number << endl;
|
||||
cerr << " content type: " << contentType(r) << endl;
|
||||
cerr << " content encoding: " << debugOptional(r->content_encoding) << endl;
|
||||
cdebug << msg << ":" << endl;
|
||||
cdebug << " server: " << debugOptional(r->server->server_hostname) << endl;
|
||||
cdebug << " protocol: " << debugOptional(r->protocol) << endl;
|
||||
cdebug << " method: " << debugOptional(r->method) << endl;
|
||||
cdebug << " method number: " << r->method_number << endl;
|
||||
cdebug << " content type: " << contentType(r) << endl;
|
||||
cdebug << " content encoding: " << debugOptional(r->content_encoding) << endl;
|
||||
apr_table_do(debugHeader, r, r->headers_in, NULL);
|
||||
cerr << " unparsed uri: " << debugOptional(r->unparsed_uri) << endl;
|
||||
cerr << " uri: " << debugOptional(r->uri) << endl;
|
||||
cerr << " path info: " << debugOptional(r->path_info) << endl;
|
||||
cerr << " filename: " << debugOptional(r->filename) << endl;
|
||||
cerr << " uri tokens: " << pathTokens(r->uri) << endl;
|
||||
cerr << " args: " << debugOptional(r->args) << endl;
|
||||
cerr << " user: " << debugOptional(r->user) << endl;
|
||||
cerr << " auth type: " << debugOptional(r->ap_auth_type) << endl;
|
||||
cdebug << " unparsed uri: " << debugOptional(r->unparsed_uri) << endl;
|
||||
cdebug << " uri: " << debugOptional(r->uri) << endl;
|
||||
cdebug << " path info: " << debugOptional(r->path_info) << endl;
|
||||
cdebug << " filename: " << debugOptional(r->filename) << endl;
|
||||
cdebug << " uri tokens: " << pathTokens(r->uri) << endl;
|
||||
cdebug << " args: " << debugOptional(r->args) << endl;
|
||||
cdebug << " user: " << debugOptional(r->user) << endl;
|
||||
cdebug << " auth type: " << debugOptional(r->ap_auth_type) << endl;
|
||||
apr_table_do(debugEnv, r, r->subprocess_env, NULL);
|
||||
apr_table_do(debugEnv, r, r->notes, NULL);
|
||||
return true;
|
||||
|
|
|
@ -41,8 +41,10 @@ namespace json {
|
|||
* Report JSON errors.
|
||||
*/
|
||||
void reportError(unused JSContext *cx, const char *message, JSErrorReport *report) {
|
||||
cerr << (const char*)(report->filename? report->filename : "<no filename>") << ":"
|
||||
#ifdef WANT_MAINTAINER_MODE
|
||||
cdebug << (const char*)(report->filename? report->filename : "<no filename>") << ":"
|
||||
<< (int)report->lineno << ":" << message << endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -671,7 +671,7 @@ int postConfig(apr_pool_t *p, unused apr_pool_t *plog, unused apr_pool_t *ptemp,
|
|||
// Configure the deployed components
|
||||
const failable<bool> res = confComponents(sc);
|
||||
if (!hasContent(res)) {
|
||||
cerr << "[Tuscany] Due to one or more errors mod_tuscany_eval loading failed. Causing apache to stop loading." << endl;
|
||||
cfailure << "[Tuscany] Due to one or more errors mod_tuscany_eval loading failed. Causing apache to stop loading." << endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -689,14 +689,14 @@ void childInit(apr_pool_t* p, server_rec* s) {
|
|||
gc_scoped_pool pool(p);
|
||||
ServerConf* sc = (ServerConf*)ap_get_module_config(s->module_config, &mod_tuscany_eval);
|
||||
if(sc == NULL) {
|
||||
cerr << "[Tuscany] Due to one or more errors mod_tuscany_eval loading failed. Causing apache to stop loading." << endl;
|
||||
cfailure << "[Tuscany] Due to one or more errors mod_tuscany_eval loading failed. Causing apache to stop loading." << endl;
|
||||
exit(APEXIT_CHILDFATAL);
|
||||
}
|
||||
|
||||
// Start the components in the child process
|
||||
const failable<bool> res = startComponents(*sc);
|
||||
if (!hasContent(res)) {
|
||||
cerr << "[Tuscany] Due to one or more errors mod_tuscany_eval loading failed. Causing apache to stop loading." << endl;
|
||||
cfailure << "[Tuscany] Due to one or more errors mod_tuscany_eval loading failed. Causing apache to stop loading." << endl;
|
||||
exit(APEXIT_CHILDFATAL);
|
||||
}
|
||||
|
||||
|
|
|
@ -396,7 +396,7 @@ void childInit(apr_pool_t* p, server_rec* s) {
|
|||
gc_scoped_pool pool(p);
|
||||
ServerConf *conf = (ServerConf*)ap_get_module_config(s->module_config, &mod_tuscany_wiring);
|
||||
if(conf == NULL) {
|
||||
cerr << "[Tuscany] Due to one or more errors mod_tuscany_wiring loading failed. Causing apache to stop loading." << endl;
|
||||
cfailure << "[Tuscany] Due to one or more errors mod_tuscany_wiring loading failed. Causing apache to stop loading." << endl;
|
||||
exit(APEXIT_CHILDFATAL);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue