Refactor and cleanup some of the config scripts. Add a sample using mod_proxy_balancer to distribute requests across three servers.

git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@980009 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
jsdelfino 2010-07-28 09:50:12 +00:00
commit fe93d86e55
62 changed files with 1735 additions and 111 deletions

View file

@ -19,6 +19,7 @@
# Generate a Scribe central conf
here=`readlink -f $0`; here=`dirname $here`
mkdir -p $1
root=`readlink -f $1`
mkdir -p $root/scribe/conf
@ -26,6 +27,7 @@ mkdir -p $root/scribe/logs/central
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
max_msg_per_second=2000000

View file

@ -19,6 +19,7 @@
# Generate a Scribe client conf
here=`readlink -f $0`; here=`dirname $here`
mkdir -p $1
root=`readlink -f $1`
central=$2
@ -26,6 +27,7 @@ mkdir -p $root/scribe/conf
mkdir -p $root/scribe/logs/client-secondary
cat >$root/scribe/conf/scribe-client.conf <<EOF
# Generated by: scribed-client-conf $*
# Scribe client configuration
port=1464
max_msg_per_second=2000000

View file

@ -42,6 +42,7 @@ cp $here/axis2.xml $root/axis2c/axis2.xml
# Configure HTTPD Axis2 module
cat >>$root/conf/httpd.conf <<EOF
# Generated by: axis2-conf $*
# Support for Web Services
SCASetEnv AXIS2C_HOME $root/axis2c
LoadModule axis2_module $root/axis2c/lib/libmod_axis2.so

View file

@ -860,6 +860,7 @@ AC_CONFIG_FILES([Makefile
samples/store-sql/Makefile
samples/store-nosql/Makefile
samples/store-vhost/Makefile
samples/store-cluster/Makefile
doc/Makefile
doc/Doxyfile
ubuntu/Makefile

View file

@ -20,7 +20,7 @@ INCLUDES = -I${HTTPD_INCLUDE}
incl_HEADERS = *.hpp
incldir = $(prefix)/include/modules/http
dist_mod_SCRIPTS = httpd-conf httpd-start httpd-stop httpd-restart ssl-ca-conf ssl-cert-conf httpd-ssl-conf
dist_mod_SCRIPTS = httpd-conf httpd-start httpd-stop httpd-restart ssl-ca-conf ssl-cert-conf httpd-ssl-conf proxy-conf proxy-ssl-conf proxy-member-conf proxy-ssl-member-conf vhost-conf vhost-ssl-conf
moddir=$(prefix)/modules/http
curl_test_SOURCES = curl-test.cpp
@ -43,7 +43,7 @@ httpd-modules.prefix: $(top_builddir)/config.status
curl.prefix: $(top_builddir)/config.status
echo ${CURL_PREFIX} >curl.prefix
dist_noinst_SCRIPTS = httpd-test http-test
dist_noinst_SCRIPTS = httpd-test http-test proxy-test
noinst_PROGRAMS = curl-test curl-get
TESTS = httpd-test http-test
TESTS = httpd-test http-test proxy-test

View file

@ -19,6 +19,7 @@
# Generate a minimal HTTPD configuration
here=`readlink -f $0`; here=`dirname $here`
mkdir -p $1
root=`readlink -f $1`
host=$2
port=`echo $3 | awk -F "/" '{ print $1 }'`
@ -26,19 +27,20 @@ pport=`echo $3 | awk -F "/" '{ print $2 }'`
if [ "$pport" = "" ]; then
pport=$port
fi
mkdir -p $4
htdocs=`readlink -f $4`
user=`id -un`
group=`id -gn`
modules_prefix=`cat $here/httpd-modules.prefix`
vhost=$5
mkdir -p $root
mkdir -p $root/logs
mkdir -p $root/conf
cat >$root/conf/httpd.conf <<EOF
# Generated by: httpd-conf $*
# Apache HTTPD server configuration
# Set server name
# Main server name
ServerName http://$host:$pport
PidFile $root/logs/httpd.pid
@ -114,37 +116,40 @@ Allow from all
# Allow access to service components
<Location />
Options FollowSymLinks
Order deny,allow
Allow from all
</Location>
# Setup HTTP virtual hosts
# Setup HTTP virtual host
Listen $port
<VirtualHost *:$port>
ServerName http://$host:$pport
UseCanonicalName Off
Include conf/svhost.conf
</VirtualHost>
EOF
# Generate mass dynamic virtual hosting configuration
if [ "$vhost" = "vhost" ]; then
cat >>$root/conf/httpd.conf <<EOF
# Setup mass dynamic virtual hosting
NameVirtualHost *:$port
<VirtualHost *:$port>
ServerName http://vhost.$host:$pport
ServerAlias *.$host
# Generate vhost configuration
cat >$root/conf/vhost.conf <<EOF
# Generated by: httpd-conf $*
# Virtual host configuration
UseCanonicalName Off
VirtualDocumentRoot $htdocs/domains/%1/
</VirtualHost>
# Isolate virtual host based requests
MaxRequestsPerChild 1
EOF
fi
cat >$root/conf/svhost.conf <<EOF
# Generated by: httpd-conf $*
# Static virtual host configuration
Include conf/vhost.conf
EOF
cat >$root/conf/dvhost.conf <<EOF
# Generated by: httpd-conf $*
# Mass dynamic virtual host configuration
Include conf/vhost.conf
EOF

View file

@ -20,21 +20,24 @@
# Generate a minimal HTTPD SSL configuration
here=`readlink -f $0`; here=`dirname $here`
root=`readlink -f $1`
host=$2
sslport=`echo $3 | awk -F "/" '{ print $1 }'`
sslpport=`echo $3 | awk -F "/" '{ print $2 }'`
conf=`cat $root/conf/httpd.conf | grep "# Generated by: httpd-conf"`
host=`echo $conf | awk '{ print $6 }'`
port=`echo $conf | awk '{ print $7 }' | awk -F "/" '{ print $1 }'`
sslport=`echo $2 | awk -F "/" '{ print $1 }'`
sslpport=`echo $2 | awk -F "/" '{ print $2 }'`
if [ "$sslpport" = "" ]; then
sslpport=$sslport
fi
htdocs=`readlink -f $4`
htdocs=`echo $conf | awk '{ print $8 }'`
htdocs=`readlink -f $htdocs`
httpd_prefix=`cat $here/httpd.prefix`
vhost=$5
# Extract organization name from our CA certificate
org=`openssl x509 -noout -subject -nameopt multiline -in $root/conf/ca.crt | grep organizationName | awk -F "= " '{ print $2 }'`
# Generate HTTPD configuration
cat >>$root/conf/httpd.conf <<EOF
# Generated by: httpd-ssl-conf $*
# Redirect all HTTP traffic to HTTPS
<Location />
RewriteEngine on
@ -52,27 +55,20 @@ SSLMutex "file:$root/logs/ssl_mutex"
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
# Setup HTTPS virtual hosts
# Setup HTTPS virtual host
Listen $sslport
SSLCACertificateFile "$root/conf/ca.crt"
SSLCertificateFile "$root/conf/server.crt"
SSLCertificateKeyFile "$root/conf/server.key"
<VirtualHost *:$sslport>
ServerName https://$host:$sslpport
UseCanonicalName Off
# Enable SSL
Include conf/ssl-vhost.conf
Include conf/ssl-svhost.conf
# Allow the server admin to view the server status
<Location /server-status>
SetHandler server-status
HostnameLookups on
Deny from All
Allow from localhost
Allow from $host
Allow from all
Require user admin
</Location>
@ -81,13 +77,14 @@ Require user admin
# Report extended server status
ExtendedStatus On
# Route all wiring through HTTPS
SCAWiringServerName https://$host:$sslpport
EOF
# Generate VirtualHost SSL configuration
# Generate HTTPS vhost configuration
cat >$root/conf/ssl-vhost.conf <<EOF
# Generated by: httpd-ssl-conf $*
# Virtual host configuration
UseCanonicalName Off
# Enable SSL
SSLEngine on
SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
@ -119,30 +116,31 @@ Require valid-user
EOF
# Generate mass dynamic virtual hosting configuration
if [ "$vhost" = "vhost" ]; then
cat >>$root/conf/httpd.conf <<EOF
# Setup mass dynamic virtual hosting
NameVirtualHost *:$sslport
SSLStrictSNIVHostCheck Off
<VirtualHost *:$sslport>
ServerName https://vhost.$host:$sslpport
ServerAlias *.$host
UseCanonicalName Off
VirtualDocumentRoot $htdocs/domains/%1/
# Enable SSL
SSLCACertificateFile "$root/conf/ca.crt"
SSLCertificateFile "$root/conf/vhost.crt"
SSLCertificateKeyFile "$root/conf/vhost.key"
cat >$root/conf/ssl-svhost.conf <<EOF
# Generated by: httpd-ssl-conf $*
# Static virtual host configuration
Include conf/ssl-vhost.conf
</VirtualHost>
# Configure SSL certificates
SSLCACertificateFile "$root/conf/ca.crt"
SSLCertificateChainFile "$root/conf/ca.crt"
SSLCertificateFile "$root/conf/server.crt"
SSLCertificateKeyFile "$root/conf/server.key"
EOF
fi
cat >$root/conf/ssl-dvhost.conf <<EOF
# Mass dynamic virtual host configuration
# Generated by: httpd-ssl-conf $*
Include conf/ssl-vhost.conf
# Configure SSL certificates
SSLCACertificateFile "$root/conf/ca.crt"
SSLCertificateChainFile "$root/conf/ca.crt"
SSLCertificateFile "$root/conf/vhost.crt"
SSLCertificateKeyFile "$root/conf/vhost.key"
EOF
# Create test users for HTTP basic authentication
$httpd_prefix/bin/htpasswd -bc $root/conf/httpd.passwd test test 2>/dev/null

View file

@ -0,0 +1,40 @@
#!/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
# 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.
# Generate a minimal HTTPD proxy balancer configuration
here=`readlink -f $0`; here=`dirname $here`
root=`readlink -f $1`
cat >>$root/conf/vhost.conf <<EOF
# Generated by: proxy-conf $*
# Configure HTTP proxy and balancer
ProxyRequests Off
ProxyPreserveHost On
ProxyStatus On
ProxyPass / balancer://cluster/
<Proxy balancer://cluster>
Order deny,allow
Allow from all
ProxySet lbmethod=byrequests
</Proxy>
EOF

View file

@ -0,0 +1,33 @@
#!/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
# 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.
# Add a proxy balancer member
here=`readlink -f $0`; here=`dirname $here`
root=`readlink -f $1`
host=$2
port=`echo $3 | awk -F "/" '{ print $1 }'`
cat >>$root/conf/vhost.conf <<EOF
# Generated by: proxy-member-conf $*
# Add proxy balancer member
BalancerMember balancer://cluster http://$host:$port
ProxyPassReverse / http://$host:$port/
EOF

View file

@ -0,0 +1,70 @@
#!/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
# 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.
# Generate a minimal HTTPD proxy balancer configuration
here=`readlink -f $0`; here=`dirname $here`
root=`readlink -f $1`
cat >>$root/conf/ssl-vhost.conf <<EOF
# Generated by: proxy-ssl-conf $*
# Enable SSL proxy
SSLProxyEngine on
SSLProxyCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
# Configure proxy and balancer
ProxyRequests Off
ProxyPreserveHost On
ProxyStatus On
ProxyPass /balancer-manager !
ProxyPass / balancer://sslcluster/
<Proxy balancer://sslcluster>
Order deny,allow
Allow from all
ProxySet lbmethod=byrequests
</Proxy>
# Enable balancer manager
<Location /balancer-manager>
SetHandler balancer-manager
HostnameLookups on
Deny from all
Allow from all
Require user admin
</Location>
EOF
cat >>$root/conf/ssl-svhost.conf <<EOF
# Generated by: proxy-ssl-conf $*
# Setup SSL proxy certificates
SSLProxyCACertificateFile "$root/conf/ca.crt"
SSLProxyMachineCertificateFile "$root/conf/server.pem"
EOF
cat >>$root/conf/ssl-dvhost.conf <<EOF
# Generated by: proxy-ssl-conf $*
# Setup SSL proxy certificates
SSLProxyCACertificateFile "$root/conf/ca.crt"
SSLProxyMachineCertificateFile "$root/conf/server.pem"
EOF

View file

@ -0,0 +1,33 @@
#!/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
# 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.
# Add a proxy balancer member
here=`readlink -f $0`; here=`dirname $here`
root=`readlink -f $1`
host=$2
sslport=`echo $3 | awk -F "/" '{ print $1 }'`
cat >>$root/conf/ssl-vhost.conf <<EOF
# Generated by: proxy-ssl-member-conf $*
# Add proxy balancer member
BalancerMember balancer://sslcluster https://$host:$sslport
ProxyPassReverse / https://$host:$sslport/
EOF

View file

@ -0,0 +1,37 @@
#!/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
# 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.
# Setup
./httpd-conf tmp localhost 8091/8090 htdocs
./httpd-start tmp
./httpd-conf tmp/proxy localhost 8090 tmp/proxy/htdocs
./proxy-conf tmp/proxy
./proxy-member-conf tmp/proxy localhost 8091
./httpd-start tmp/proxy
sleep 2
# Test
./curl-test
rc=$?
# Cleanup
./httpd-stop tmp/proxy
./httpd-stop tmp
sleep 2
return $rc

View file

@ -19,6 +19,7 @@
# Generate a test certification authority certificate
here=`readlink -f $0`; here=`dirname $here`
mkdir -p $1
root=`readlink -f $1`
host=$2

View file

@ -19,6 +19,7 @@
# Generate a test certificate
here=`readlink -f $0`; here=`dirname $here`
mkdir -p $1
root=`readlink -f $1`
host=$2
if [ "$3" != "" ]; then
@ -61,3 +62,8 @@ openssl ca -batch -config $root/conf/openssl-ca.conf -out $root/conf/$certname.c
# Export it to PKCS12 format, that's the format Web browsers want to import
openssl pkcs12 -export -passout pass: -out $root/conf/$certname.p12 -inkey $root/conf/$certname.key -in $root/conf/$certname.crt -certfile $root/conf/ca.crt
# Convert the certificate to PEM format and concatenate the key to it, for use
# by mod_proxy
openssl x509 -in $root/conf/$certname.crt -out $root/conf/$certname.pem
cat $root/conf/$certname.key >> $root/conf/$certname.pem

View file

@ -0,0 +1,25 @@
#!/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
# 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.
# Generate a test certification authority certificate
here=`readlink -f $0`; here=`dirname $here`
root=`readlink -f $1`
ls $root/conf/*.crt $root/conf/*.key $root/conf/*.pem $root/conf/*.p12 2>/dev/null

View file

@ -0,0 +1,47 @@
#!/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
# 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.
# Generate mass dynamic virtual hosting configuration
here=`readlink -f $0`; here=`dirname $here`
root=`readlink -f $1`
conf=`cat $root/conf/httpd.conf | grep "# Generated by: httpd-conf"`
host=`echo $conf | awk '{ print $6 }'`
port=`echo $conf | awk '{ print $7 }' | awk -F "/" '{ print $1 }'`
pport=`echo $conf | awk '{ print $7 }' | awk -F "/" '{ print $2 }'`
if [ "$pport" = "" ]; then
pport=$port
fi
htdocs=`echo $conf | awk '{ print $8 }'`
htdocs=`readlink -f $htdocs`
cat >>$root/conf/httpd.conf <<EOF
# Generated by: vhost-conf $*
# Setup mass dynamic virtual hosting
NameVirtualHost *:$port
<VirtualHost *:$port>
ServerName http://vhost.$host:$pport
ServerAlias *.$host
VirtualDocumentRoot $htdocs/domains/%1/
Include conf/dvhost.conf
</VirtualHost>
EOF

View file

@ -0,0 +1,49 @@
#!/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
# 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.
# Generate mass dynamic virtual hosting configuration
here=`readlink -f $0`; here=`dirname $here`
root=`readlink -f $1`
conf=`cat $root/conf/httpd.conf | grep "# Generated by: httpd-conf"`
host=`echo $conf | awk '{ print $6 }'`
sslconf=`cat $root/conf/httpd.conf | grep "# Generated by: httpd-ssl-conf"`
sslport=`echo $sslconf | awk '{ print $6 }' | awk -F "/" '{ print $1 }'`
sslpport=`echo $sslconf | awk '{ print $6 }' | awk -F "/" '{ print $2 }'`
if [ "$sslpport" = "" ]; then
sslpport=$sslport
fi
htdocs=`echo $conf | awk '{ print $8 }'`
htdocs=`readlink -f $htdocs`
cat >>$root/conf/httpd.conf <<EOF
# Generated by: vhost-ssl-conf $*
# Setup mass dynamic virtual hosting
NameVirtualHost *:$sslport
SSLStrictSNIVHostCheck Off
<VirtualHost *:$sslport>
ServerName https://vhost.$host:$sslpport
ServerAlias *.$host
VirtualDocumentRoot $htdocs/domains/%1/
Include conf/ssl-dvhost.conf
</VirtualHost>
EOF

View file

@ -22,6 +22,7 @@ here=`readlink -f $0`; here=`dirname $here`
root=`readlink -f $1`
cat >>$root/conf/httpd.conf <<EOF
# Generated by: java-conf $*
# Support for Java SCA components
LoadModule mod_tuscany_eval $here/libmod_tuscany_java.so

View file

@ -20,11 +20,10 @@
<html><body>
<h1>Sign out</h1>
<form name="signout" action="/" method="GET">
<form name="signout" action="/login" method="GET">
<script type="text/javascript">
function submitSignout() {
document.cookie = 'open_id_session_id=;expires=' + new Date(1970,01,01).toGMTString() + ';path=/';
document.signout.action = "/login";
document.signout.submit();
return true;
}

View file

@ -20,17 +20,11 @@
# Generate an OpenID server conf
here=`readlink -f $0`; here=`dirname $here`
root=`readlink -f $1`
host=$2
port=`echo $3 | awk -F "/" '{ print $1 }'`
pport=`echo $3 | awk -F "/" '{ print $2 }'`
if [ "$pport" = "" ]; then
pport=$port
fi
htdocs=`readlink -f $4`
openid_prefix=`cat openid.prefix`
# Configure HTTPD mod_auth_openid module
cat >>$root/conf/httpd.conf <<EOF
# Generated by: openid-conf $*
# Support for OpenID authentication
LoadModule authopenid_module $openid_prefix/modules/mod_auth_openid.so

View file

@ -20,16 +20,12 @@
# Generate an OpenID Step2 server conf
here=`readlink -f $0`; here=`dirname $here`
root=`readlink -f $1`
host=$2
port=`echo $3 | awk -F "/" '{ print $1 }'`
pport=`echo $3 | awk -F "/" '{ print $2 }'`
if [ "$pport" = "" ]; then
pport=$port
fi
htdocs=`readlink -f $4`
conf=`cat $root/conf/httpd.conf | grep "# Generated by: httpd-conf"`
host=`echo $conf | awk '{ print $6 }'`
# Configure HTTPD to serve OpenID XRDS and LRDD documents
cat >>$root/conf/httpd.conf <<EOF
# Generated by: openid-step2-conf $*
# Serve OpenID XRDS document
Alias /openid $root/conf/openid.xrds
<Location /openid>

View file

@ -19,8 +19,8 @@
# Setup
../../modules/http/httpd-conf tmp localhost 8090 htdocs
./openid-conf tmp localhost 8090 htdocs
./openid-step2-conf tmp localhost 8090 htdocs
./openid-conf tmp
./openid-step2-conf tmp
../../modules/server/server-conf tmp
../../modules/server/scheme-conf tmp
cat >>tmp/conf/httpd.conf <<EOF

View file

@ -22,6 +22,7 @@ here=`readlink -f $0`; here=`dirname $here`
root=`readlink -f $1`
cat >>$root/conf/httpd.conf <<EOF
# Generated by: python-conf $*
# Support for Python SCA components
LoadModule mod_tuscany_eval $here/libmod_tuscany_python.so

View file

@ -22,6 +22,7 @@ here=`readlink -f $0`; here=`dirname $here`
root=`readlink -f $1`
cat >>$root/conf/httpd.conf <<EOF
# Generated by: cpp-conf $*
# Support for C++ SCA components
LoadModule mod_tuscany_eval $here/libmod_tuscany_eval.so

View file

@ -769,9 +769,9 @@ const command_rec commands[] = {
AP_INIT_TAKE1("SCAVirtualContribution", (const char*(*)())confVirtualContribution, NULL, RSRC_CONF, "SCA virtual host contribution location"),
AP_INIT_TAKE1("SCAVirtualComposite", (const char*(*)())confVirtualComposite, NULL, RSRC_CONF, "SCA virtual composite location"),
AP_INIT_TAKE12("SCASetEnv", (const char*(*)())confEnv, NULL, OR_FILEINFO, "Environment variable name and optional value"),
AP_INIT_TAKE1("SSLCACertificateFile", (const char*(*)())confCAFile, NULL, RSRC_CONF, "SSL CA certificate file"),
AP_INIT_TAKE1("SSLCertificateFile", (const char*(*)())confCertFile, NULL, RSRC_CONF, "SSL certificate file"),
AP_INIT_TAKE1("SSLCertificateKeyFile", (const char*(*)())confCertKeyFile, NULL, RSRC_CONF, "SSL certificate key file"),
AP_INIT_TAKE1("SCAWiringSSLCACertificateFile", (const char*(*)())confCAFile, NULL, RSRC_CONF, "SCA wiring SSL CA certificate file"),
AP_INIT_TAKE1("SCAWiringSSLCertificateFile", (const char*(*)())confCertFile, NULL, RSRC_CONF, "SCA wiring SSL certificate file"),
AP_INIT_TAKE1("SCAWiringSSLCertificateKeyFile", (const char*(*)())confCertKeyFile, NULL, RSRC_CONF, "SCA wiring SSL certificate key file"),
{NULL, NULL, NULL, 0, NO_ARGS, NULL}
};

View file

@ -22,6 +22,7 @@ here=`readlink -f $0`; here=`dirname $here`
root=`readlink -f $1`
cat >>$root/conf/httpd.conf <<EOF
# Generated by: scheme-conf $*
# Support for Scheme SCA components
LoadModule mod_tuscany_eval $here/libmod_tuscany_eval.so

View file

@ -21,12 +21,63 @@
here=`readlink -f $0`; here=`dirname $here`
root=`readlink -f $1`
conf=`cat $root/conf/httpd.conf | grep "# Generated by: httpd-conf"`
host=`echo $conf | awk '{ print $6 }'`
port=`echo $conf | awk '{ print $7 }' | awk -F "/" '{ print $1 }'`
pport=`echo $conf | awk '{ print $7 }' | awk -F "/" '{ print $2 }'`
if [ "$pport" = "" ]; then
pport=$port
fi
servername="http://$host:$pport"
sslconf=`cat $root/conf/httpd.conf | grep "# Generated by: httpd-ssl-conf"`
if [ "$sslconf" != "" ]; then
sslport=`echo $sslconf | awk '{ print $6 }' | awk -F "/" '{ print $1 }'`
sslpport=`echo $sslconf | awk '{ print $6 }' | awk -F "/" '{ print $2 }'`
if [ "$sslpport" = "" ]; then
sslpport=$sslport
fi
servername="https://$host:$sslpport"
fi
cat >>$root/conf/httpd.conf <<EOF
# Generated by: server-conf $*
# Support for SCA component wiring
LoadModule mod_tuscany_wiring $here/libmod_tuscany_wiring.so
# Route all wiring through the configured server name
SCAWiringServerName $servername
# Serve HTTP binding JavaScript client code
Alias /js/tuscany-ref.js $here/htdocs/js/tuscany-ref.js
EOF
ssl=`cat $root/conf/httpd.conf | grep "# Generated by: httpd-ssl-conf"`
if [ "$ssl" != "" ]; then
cat >>$root/conf/httpd.conf <<EOF
# Configure SSL certificates
SCAWiringSSLCACertificateFile "$root/conf/ca.crt"
SCAWiringSSLCertificateFile "$root/conf/server.crt"
SCAWiringSSLCertificateKeyFile "$root/conf/server.key"
EOF
fi
vhost=`cat $root/conf/httpd.conf | grep VirtualDocumentRoot`
proxy=`cat $root/conf/httpd.conf | grep ProxyPass`
vhost=`cat $root/conf/httpd.conf | grep "# Generated by: vhost-conf"`
if [ "$vhost" != "" ]; then
proxy=`cat $root/conf/httpd.conf | grep "# Generated by: proxy-conf"`
if [ "$proxy" = "" ]; then
cat >>$root/conf/httpd.conf <<EOF
# Isolate requests from different virtual hosts
MaxRequestsPerChild 1
EOF
fi
fi

View file

@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
SUBDIRS = store-scheme store-cpp store-python store-java store-gae store-sql store-nosql store-vhost
SUBDIRS = store-scheme store-cpp store-python store-java store-gae store-sql store-nosql store-vhost store-cluster
sample_DATA = README
sampledir=$(prefix)/samples

View file

@ -0,0 +1,36 @@
# 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.
if WANT_PYTHON
if WANT_SQLDB
if WANT_OPENID
if WANT_LOG
if WANT_QUEUE
dist_sample_SCRIPTS = start stop ssl-start
sampledir = $(prefix)/samples/store-cluster
nobase_dist_sample_DATA = htdocs/*.html htdocs/domains/*/*.html domains/*/*.py domains/*/*.composite
dist_noinst_SCRIPTS = server-test
#TESTS = server-test
endif
endif
endif
endif
endif

View file

@ -0,0 +1,29 @@
# 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.
# Currency converter implementation
def convert(fr, to, amount):
if to == "EUR":
return amount * 0.70
return amount
def symbol(currency):
if currency == "EUR":
return "E"
return "$"

View file

@ -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.
# Catalog implementation
def getcatalog(converter, currencyCode):
code = currencyCode()
def convert(price):
return converter("convert", "USD", code, price)
symbol = converter("symbol", code)
return (
(("'javaClass", "services.Item"), ("'name", "Passion"), ("'currencyCode", code), ("'currencySymbol", symbol), ("'price", convert(2.99))),
(("'javaClass", "services.Item"), ("'name", "Mango"), ("'currencyCode", code), ("'currencySymbol", symbol), ("'price", convert(3.55))),
(("'javaClass", "services.Item"), ("'name", "Pineapple"), ("'currencyCode", code), ("'currencySymbol", symbol), ("'price", convert(1.55)))
)

View file

@ -0,0 +1,75 @@
# 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.
# Shopping cart implementation
import uuid
import sys
cartId = "1234"
# Get the shopping cart from the cache
# Return an empty cart if not found
def getcart(id, cache):
cart = cache("get", (id,))
if cart is None:
return ()
return cart
# Post a new item to the cart, create a new cart if necessary
def post(collection, item, cache):
id = str(uuid.uuid1())
cart = ((item[0], id, item[2]),) + getcart(cartId, cache)
cache("put", (cartId,), cart)
return (id,)
# Find an item in the cart
def find(id, cart):
if cart == ():
return ("Item", "0", ())
elif id == cart[0][1]:
return cart[0]
else:
return find(id, cart[1:])
# Get items from the cart
def get(id, cache):
if id == ():
return ("Your Cart", cartId) + getcart(cartId, cache)
return find(id[0], getcart(cartId, cache))
# Delete items from the cart
def delete(id, cache):
if id == ():
return cache("delete", (cartId,))
return True
# Return the price of an item
def price(item):
return float(filter(lambda x: x[0] == "'price", item[2])[0][1])
# Sum the prices of a list of items
def sum(items):
if items == ():
return 0
return price(items[0]) + sum(items[1:])
# Return the total price of the items in the cart
def gettotal(cache):
cart = getcart(cartId, cache)
return sum(cart)

View file

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* 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.
-->
<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
xmlns:t="http://tuscany.apache.org/xmlns/sca/1.1"
targetNamespace="http://store"
name="store">
<component name="Store">
<t:implementation.python script="store.py"/>
<service name="Widget">
<t:binding.http uri="store"/>
</service>
<reference name="catalog" target="Catalog"/>
<reference name="shoppingCart" target="ShoppingCart/Cart"/>
<reference name="shoppingTotal" target="ShoppingCart/Total"/>
</component>
<component name="Catalog">
<t:implementation.python script="fruits-catalog.py"/>
<property name="currencyCode">USD</property>
<service name="Catalog">
<t:binding.jsonrpc uri="catalog"/>
</service>
<reference name="currencyConverter" target="CurrencyConverter"/>
</component>
<component name="ShoppingCart">
<t:implementation.python script="shopping-cart.py"/>
<service name="ShoppingCart">
<t:binding.atom uri="shoppingCart"/>
</service>
<service name="Total">
<t:binding.jsonrpc uri="total"/>
</service>
<reference name="cache" target="Cache"/>
</component>
<component name="CurrencyConverter">
<t:implementation.python script="currency-converter.py"/>
<service name="CurrencyConverter">
<t:binding.jsonrpc uri="currencyConverter"/>
</service>
</component>
<component name="Cache">
<implementation.cpp path="../../../../components/cache" library="libmemcache"/>
<service name="Cache">
<t:binding.atom uri="cache"/>
</service>
</component>
</composite>

View file

@ -0,0 +1,40 @@
# 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.
# Store implementation
def post(item, catalog, shoppingCart, shoppingTotal):
return shoppingCart("post", item)
def getall(catalog, shoppingCart, shoppingTotal):
return shoppingCart("getall")
def get(id, catalog, shoppingCart, shoppingTotal):
return shoppingCart("get", id)
def getcatalog(catalog, shoppingCart, shoppingTotal):
return catalog("getcatalog")
def gettotal(catalog, shoppingCart, shoppingTotal):
return shoppingCart("gettotal")
def deleteall(catalog, shoppingCart, shoppingTotal):
return shoppingCart("deleteall")
def delete(id, catalog, shoppingCart, shoppingTotal):
return shoppingCart("delete", id)

View file

@ -0,0 +1,29 @@
# 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.
# Currency converter implementation
def convert(fr, to, amount):
if to == "EUR":
return amount * 0.70
return amount
def symbol(currency):
if currency == "EUR":
return "E"
return "$"

View file

@ -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.
# Catalog implementation
def getcatalog(converter, currencyCode):
code = currencyCode()
def convert(price):
return converter("convert", "USD", code, price)
symbol = converter("symbol", code)
return (
(("'javaClass", "services.Item"), ("'name", "Apple"), ("'currencyCode", code), ("'currencySymbol", symbol), ("'price", convert(2.99))),
(("'javaClass", "services.Item"), ("'name", "Orange"), ("'currencyCode", code), ("'currencySymbol", symbol), ("'price", convert(3.55))),
(("'javaClass", "services.Item"), ("'name", "Pear"), ("'currencyCode", code), ("'currencySymbol", symbol), ("'price", convert(1.55)))
)

View file

@ -0,0 +1,75 @@
# 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.
# Shopping cart implementation
import uuid
import sys
cartId = "1234"
# Get the shopping cart from the cache
# Return an empty cart if not found
def getcart(id, cache):
cart = cache("get", (id,))
if cart is None:
return ()
return cart
# Post a new item to the cart, create a new cart if necessary
def post(collection, item, cache):
id = str(uuid.uuid1())
cart = ((item[0], id, item[2]),) + getcart(cartId, cache)
cache("put", (cartId,), cart)
return (id,)
# Find an item in the cart
def find(id, cart):
if cart == ():
return ("Item", "0", ())
elif id == cart[0][1]:
return cart[0]
else:
return find(id, cart[1:])
# Get items from the cart
def get(id, cache):
if id == ():
return ("Your Cart", cartId) + getcart(cartId, cache)
return find(id[0], getcart(cartId, cache))
# Delete items from the cart
def delete(id, cache):
if id == ():
return cache("delete", (cartId,))
return True
# Return the price of an item
def price(item):
return float(filter(lambda x: x[0] == "'price", item[2])[0][1])
# Sum the prices of a list of items
def sum(items):
if items == ():
return 0
return price(items[0]) + sum(items[1:])
# Return the total price of the items in the cart
def gettotal(cache):
cart = getcart(cartId, cache)
return sum(cart)

View file

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* 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.
-->
<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
xmlns:t="http://tuscany.apache.org/xmlns/sca/1.1"
targetNamespace="http://store"
name="store">
<component name="Store">
<t:implementation.python script="store.py"/>
<service name="Widget">
<t:binding.http uri="store"/>
</service>
<reference name="catalog" target="Catalog"/>
<reference name="shoppingCart" target="ShoppingCart/Cart"/>
<reference name="shoppingTotal" target="ShoppingCart/Total"/>
</component>
<component name="Catalog">
<t:implementation.python script="fruits-catalog.py"/>
<property name="currencyCode">USD</property>
<service name="Catalog">
<t:binding.jsonrpc uri="catalog"/>
</service>
<reference name="currencyConverter" target="CurrencyConverter"/>
</component>
<component name="ShoppingCart">
<t:implementation.python script="shopping-cart.py"/>
<service name="ShoppingCart">
<t:binding.atom uri="shoppingCart"/>
</service>
<service name="Total">
<t:binding.jsonrpc uri="total"/>
</service>
<reference name="cache" target="Cache"/>
</component>
<component name="CurrencyConverter">
<t:implementation.python script="currency-converter.py"/>
<service name="CurrencyConverter">
<t:binding.jsonrpc uri="currencyConverter"/>
</service>
</component>
<component name="Cache">
<implementation.cpp path="../../../../components/cache" library="libmemcache"/>
<service name="Cache">
<t:binding.atom uri="cache"/>
</service>
</component>
</composite>

View file

@ -0,0 +1,40 @@
# 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.
# Store implementation
def post(item, catalog, shoppingCart, shoppingTotal):
return shoppingCart("post", item)
def getall(catalog, shoppingCart, shoppingTotal):
return shoppingCart("getall")
def get(id, catalog, shoppingCart, shoppingTotal):
return shoppingCart("get", id)
def getcatalog(catalog, shoppingCart, shoppingTotal):
return catalog("getcatalog")
def gettotal(catalog, shoppingCart, shoppingTotal):
return shoppingCart("gettotal")
def deleteall(catalog, shoppingCart, shoppingTotal):
return shoppingCart("deleteall")
def delete(id, catalog, shoppingCart, shoppingTotal):
return shoppingCart("delete", id)

View file

@ -0,0 +1,157 @@
<!--
* 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.
-->
<html>
<head>
<title>Store</title>
<script type="text/javascript" src="/js/tuscany-ref.js"></script>
<script type="text/javascript">
var component = new tuscany.sca.Component("Store");
//@Reference
var catalog = new tuscany.sca.Reference("catalog");
//@Reference
var shoppingCart = new tuscany.sca.Reference("shoppingCart");
//@Reference
var shoppingTotal = new tuscany.sca.Reference("shoppingTotal");
var catalogItems;
function catalog_getcatalogResponse(items, exception) {
if (exception){
alert(exception.message);
return;
}
var catalog = "";
for (var i=0; i<items.length; i++) {
var item = items[i].name + ' - ' + items[i].price;
catalog += '<input name="items" type="checkbox" value="' +
item + '">' + item + ' <br>';
}
document.getElementById('catalog').innerHTML=catalog;
catalogItems = items;
}
function shoppingCart_getResponse(feed) {
if (feed != null) {
var entries = feed.getElementsByTagName("entry");
var list = "";
for (var i=0; i<entries.length; i++) {
var content = entries[i].getElementsByTagName("content")[0];
var name = content.getElementsByTagName("name")[0].firstChild.nodeValue;
var price = content.getElementsByTagName("price")[0].firstChild.nodeValue;
list += name + ' - ' + price + ' <br>';
}
document.getElementById("shoppingCart").innerHTML = list;
shoppingTotal.apply("gettotal", shoppingTotal_gettotalResponse);
}
}
function shoppingTotal_gettotalResponse(total, exception) {
if (exception) {
alert(exception.message);
return;
}
document.getElementById('total').innerHTML = total;
}
function shoppingCart_postResponse(entry) {
shoppingCart.get("", shoppingCart_getResponse);
}
function addToCart() {
var items = document.catalogForm.items;
var j = 0;
for (var i=0; i<items.length; i++)
if (items[i].checked) {
var entry = '<entry xmlns="http://www.w3.org/2005/Atom"><title type="text">Item</title><content type="application/xml">' +
'<item>' +
'<javaClass>' + catalogItems[i].javaClass + '</javaClass>' +
'<name>' + catalogItems[i].name + '</name>' +
'<currencyCode>' + catalogItems[i].currencyCode + '</currencyCode>' +
'<currencySymbol>' + catalogItems[i].currencySymbol + '</currencySymbol>' +
'<price>' + catalogItems[i].price + '</price>' +
'</item>' +
'</content></entry>';
shoppingCart.post(entry, shoppingCart_postResponse);
items[i].checked = false;
}
}
function checkoutCart() {
document.getElementById('store').innerHTML='<h2>' +
'Thanks for Shopping With Us!</h2>'+
'<h2>Your Order</h2>'+
'<form name="orderForm">'+
document.getElementById('shoppingCart').innerHTML+
'<br>'+
document.getElementById('total').innerHTML+
'<br>'+
'<br>'+
'<input type="submit" value="Continue Shopping">'+
'</form>';
shoppingCart.del("", null);
}
function deleteCart() {
shoppingCart.del("", null);
document.getElementById('shoppingCart').innerHTML = "";
document.getElementById('total').innerHTML = "";
}
function init() {
try {
catalog.apply("getcatalog", catalog_getcatalogResponse);
shoppingCart.get("", shoppingCart_getResponse);
} catch(e){
alert(e);
}
}
</script>
</head>
<body onload="init()">
<h1>Jane's Store</h1>
<div id="store">
<h2>Catalog</h2>
<form name="catalogForm">
<div id="catalog" ></div>
<br>
<input type="button" onClick="addToCart()" value="Add to Cart">
</form>
<br>
<h2>Your Shopping Cart</h2>
<form name="shoppingCartForm">
<div id="shoppingCart"></div>
<br>
<div id="total"></div>
<br>
<input type="button" onClick="checkoutCart()" value="Checkout">
<input type="button" onClick="deleteCart()" value="Empty">
<a href="shoppingCart/">(feed)</a>
</form>
</div>
</body>
</html>

View file

@ -0,0 +1,157 @@
<!--
* 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.
-->
<html>
<head>
<title>Store</title>
<script type="text/javascript" src="/js/tuscany-ref.js"></script>
<script type="text/javascript">
var component = new tuscany.sca.Component("Store");
//@Reference
var catalog = new tuscany.sca.Reference("catalog");
//@Reference
var shoppingCart = new tuscany.sca.Reference("shoppingCart");
//@Reference
var shoppingTotal = new tuscany.sca.Reference("shoppingTotal");
var catalogItems;
function catalog_getcatalogResponse(items, exception) {
if (exception){
alert(exception.message);
return;
}
var catalog = "";
for (var i=0; i<items.length; i++) {
var item = items[i].name + ' - ' + items[i].price;
catalog += '<input name="items" type="checkbox" value="' +
item + '">' + item + ' <br>';
}
document.getElementById('catalog').innerHTML=catalog;
catalogItems = items;
}
function shoppingCart_getResponse(feed) {
if (feed != null) {
var entries = feed.getElementsByTagName("entry");
var list = "";
for (var i=0; i<entries.length; i++) {
var content = entries[i].getElementsByTagName("content")[0];
var name = content.getElementsByTagName("name")[0].firstChild.nodeValue;
var price = content.getElementsByTagName("price")[0].firstChild.nodeValue;
list += name + ' - ' + price + ' <br>';
}
document.getElementById("shoppingCart").innerHTML = list;
shoppingTotal.apply("gettotal", shoppingTotal_gettotalResponse);
}
}
function shoppingTotal_gettotalResponse(total, exception) {
if (exception) {
alert(exception.message);
return;
}
document.getElementById('total').innerHTML = total;
}
function shoppingCart_postResponse(entry) {
shoppingCart.get("", shoppingCart_getResponse);
}
function addToCart() {
var items = document.catalogForm.items;
var j = 0;
for (var i=0; i<items.length; i++)
if (items[i].checked) {
var entry = '<entry xmlns="http://www.w3.org/2005/Atom"><title type="text">Item</title><content type="application/xml">' +
'<item>' +
'<javaClass>' + catalogItems[i].javaClass + '</javaClass>' +
'<name>' + catalogItems[i].name + '</name>' +
'<currencyCode>' + catalogItems[i].currencyCode + '</currencyCode>' +
'<currencySymbol>' + catalogItems[i].currencySymbol + '</currencySymbol>' +
'<price>' + catalogItems[i].price + '</price>' +
'</item>' +
'</content></entry>';
shoppingCart.post(entry, shoppingCart_postResponse);
items[i].checked = false;
}
}
function checkoutCart() {
document.getElementById('store').innerHTML='<h2>' +
'Thanks for Shopping With Us!</h2>'+
'<h2>Your Order</h2>'+
'<form name="orderForm">'+
document.getElementById('shoppingCart').innerHTML+
'<br>'+
document.getElementById('total').innerHTML+
'<br>'+
'<br>'+
'<input type="submit" value="Continue Shopping">'+
'</form>';
shoppingCart.del("", null);
}
function deleteCart() {
shoppingCart.del("", null);
document.getElementById('shoppingCart').innerHTML = "";
document.getElementById('total').innerHTML = "";
}
function init() {
try {
catalog.apply("getcatalog", catalog_getcatalogResponse);
shoppingCart.get("", shoppingCart_getResponse);
} catch(e){
alert(e);
}
}
</script>
</head>
<body onload="init()">
<h1>Joe's Store</h1>
<div id="store">
<h2>Catalog</h2>
<form name="catalogForm">
<div id="catalog" ></div>
<br>
<input type="button" onClick="addToCart()" value="Add to Cart">
</form>
<br>
<h2>Your Shopping Cart</h2>
<form name="shoppingCartForm">
<div id="shoppingCart"></div>
<br>
<div id="total"></div>
<br>
<input type="button" onClick="checkoutCart()" value="Checkout">
<input type="button" onClick="deleteCart()" value="Empty">
<a href="shoppingCart/">(feed)</a>
</form>
</div>
</body>
</html>

View file

@ -0,0 +1,34 @@
<!--
* 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.
-->
<html>
<head>
<title>Store</title>
</head>
<body>
<h1>Store</h1>
<p>For this sample to work, add the sample domain to your /etc/hosts as follows:<br/>
127.0.0.1 sca-store.com jane.sca-store.com joe.sca-store.com</p>
<p/>
<p>Jane's store at <a href="http://jane.sca-store.com/">jane.sca-store.com</a>
<br/>Joe's store at <a href="http://joe.sca-store.com/">joe.sca-store.com</a></p>
</body>
</html>

View file

@ -0,0 +1,62 @@
#!/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
# 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 "Testing..."
here=`readlink -f $0`; here=`dirname $here`
curl_prefix=`cat $here/../../modules/http/curl.prefix`
# Setup
./start
sleep 2
# For this test to work, add the test domain to your etc/hosts as follows:
# 127.0.0.1 sca-store.com joe.sca-store.com joe.sca-store.com
# then run ../../ubuntu/ip-redirect-all 80 8091
# Test HTTP GET
$curl_prefix/bin/curl http://joe.sca-store.com/ 2>/dev/null >tmp/index.html
diff tmp/index.html htdocs/domains/joe/index.html
rc=$?
# Test Catalog
if [ "$rc" = "0" ]; then
$curl_prefix/bin/curl http://joe.sca-store.com/references/Store/catalog -X POST -H "Content-type: application/json-rpc" --data @../store-cpp/htdocs/test/getcatalog-request.txt >tmp/getcatalog-result.txt 2>/dev/null
diff tmp/getcatalog-result.txt ../store-cpp/htdocs/test/getcatalog-result.txt
rc=$?
fi
# Test Shopping Cart
if [ "$rc" = "0" ]; then
$curl_prefix/bin/curl http://joe.sca-store.com/references/Store/shoppingCart -X POST -H "Content-type: application/atom+xml" --data @../store-cpp/htdocs/test/shopping-cart-entry.xml 2>/dev/null
rc=$?
fi
if [ "$rc" = "0" ]; then
$curl_prefix/bin/curl http://joe.sca-store.com/references/Store/shoppingCart >tmp/shopping-cart-feed.xml 2>/dev/null
grep "3.55" tmp/shopping-cart-feed.xml >/dev/null
rc=$?
fi
# Cleanup
./stop
sleep 2
if [ "$rc" = "0" ]; then
echo "OK"
fi
return $rc

View file

@ -0,0 +1,113 @@
#!/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
# 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.
# Generate SSL certificates
../../modules/http/ssl-ca-conf tmp/ssl sca-store.com
../../modules/http/ssl-cert-conf tmp/ssl sca-store.com server
../../modules/http/ssl-cert-conf tmp/ssl *.sca-store.com vhost
# Start three identical app servers
../../modules/http/httpd-conf tmp/server1 sca-store.com 8101/80 htdocs
../../modules/http/vhost-conf tmp/server1
cp `../../modules/http/ssl-ls tmp/ssl` tmp/server1/conf
../../modules/http/httpd-ssl-conf tmp/server1 8441/443
../../modules/http/vhost-ssl-conf tmp/server1
../../modules/server/server-conf tmp/server1
../../modules/python/python-conf tmp/server1
cat >>tmp/server1/conf/httpd.conf <<EOF
# Configure SCA Composite for mass dynamic virtual hosting
SCAVirtualContribution `pwd`/domains/
SCAVirtualComposite store.composite
EOF
../../modules/http/httpd-start tmp/server1
../../modules/http/httpd-conf tmp/server2 sca-store.com 8102/80 htdocs
../../modules/http/vhost-conf tmp/server2
cp `../../modules/http/ssl-ls tmp/ssl` tmp/server2/conf
../../modules/http/httpd-ssl-conf tmp/server2 8442/443
../../modules/http/vhost-ssl-conf tmp/server2
../../modules/server/server-conf tmp/server2
../../modules/python/python-conf tmp/server2
cat >>tmp/server2/conf/httpd.conf <<EOF
# Configure SCA Composite for mass dynamic virtual hosting
SCAVirtualContribution `pwd`/domains/
SCAVirtualComposite store.composite
EOF
../../modules/http/httpd-start tmp/server2
../../modules/http/httpd-conf tmp/server3 sca-store.com 8103/80 htdocs
../../modules/http/vhost-conf tmp/server3
cp `../../modules/http/ssl-ls tmp/ssl` tmp/server3/conf
../../modules/http/httpd-ssl-conf tmp/server3 8443/443
../../modules/http/vhost-ssl-conf tmp/server3
../../modules/server/server-conf tmp/server3
../../modules/python/python-conf tmp/server3
cat >>tmp/server3/conf/httpd.conf <<EOF
# Configure SCA Composite for mass dynamic virtual hosting
SCAVirtualContribution `pwd`/domains/
SCAVirtualComposite store.composite
EOF
../../modules/http/httpd-start tmp/server3
# Start two identical proxy balancers
../../modules/http/httpd-conf tmp/proxy1 sca-store.com 8091/80 tmp/proxy1/htdocs
../../modules/http/vhost-conf tmp/proxy1
../../modules/http/proxy-conf tmp/proxy1 sca-store.com 8091/80 tmp/proxy1/htdocs
cp `../../modules/http/ssl-ls tmp/ssl` tmp/proxy1/conf
../../modules/http/httpd-ssl-conf tmp/proxy1 8093/443
../../modules/http/vhost-ssl-conf tmp/proxy1
../../modules/http/proxy-ssl-conf tmp/proxy1
../../modules/http/proxy-member-conf tmp/proxy1 localhost 8101
../../modules/http/proxy-ssl-member-conf tmp/proxy1 localhost 8441
../../modules/http/proxy-member-conf tmp/proxy1 localhost 8102
../../modules/http/proxy-ssl-member-conf tmp/proxy1 localhost 8442
../../modules/http/proxy-member-conf tmp/proxy1 localhost 8103
../../modules/http/proxy-ssl-member-conf tmp/proxy1 localhost 8443
../../modules/http/httpd-start tmp/proxy1
../../modules/http/httpd-conf tmp/proxy2 sca-store.com 8092/80 tmp/proxy2/htdocs
../../modules/http/vhost-conf tmp/proxy2
../../modules/http/proxy-conf tmp/proxy2 sca-store.com 8092/80 tmp/proxy2/htdocs
cp `../../modules/http/ssl-ls tmp/ssl` tmp/proxy2/conf
../../modules/http/httpd-ssl-conf tmp/proxy2 8094/443
../../modules/http/vhost-ssl-conf tmp/proxy2
../../modules/http/proxy-ssl-conf tmp/proxy2
../../modules/http/proxy-member-conf tmp/proxy2 localhost 8101
../../modules/http/proxy-ssl-member-conf tmp/proxy2 localhost 8441
../../modules/http/proxy-member-conf tmp/proxy2 localhost 8102
../../modules/http/proxy-ssl-member-conf tmp/proxy2 localhost 8442
../../modules/http/proxy-member-conf tmp/proxy2 localhost 8103
../../modules/http/proxy-ssl-member-conf tmp/proxy2 localhost 8443
../../modules/http/httpd-start tmp/proxy2
# Start a shared memcached
# Todo change to one per server
../../components/cache/memcached-start
# Redirect traffic from port 80 to 8091 and use proxy1
#../../ubuntu/ip-redirect-all 80 8091
#../../ubuntu/ip-redirect-all 443 8093
# Redirect traffic from port 80 to 8092 and use proxy2
#../../ubuntu/ip-redirect-all 80 8092
#../../ubuntu/ip-redirect-all 443 8094

View file

@ -0,0 +1,83 @@
#!/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
# 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.
# Start three identical app servers
../../modules/http/httpd-conf tmp/server1 sca-store.com 8101/80 htdocs
../../modules/http/vhost-conf tmp/server1
../../modules/server/server-conf tmp/server1
../../modules/python/python-conf tmp/server1
cat >>tmp/server1/conf/httpd.conf <<EOF
# Configure SCA Composite for mass dynamic virtual hosting
SCAVirtualContribution `pwd`/domains/
SCAVirtualComposite store.composite
EOF
../../modules/http/httpd-start tmp/server1
../../modules/http/httpd-conf tmp/server2 sca-store.com 8102/80 htdocs
../../modules/http/vhost-conf tmp/server2
../../modules/server/server-conf tmp/server2
../../modules/python/python-conf tmp/server2
cat >>tmp/server2/conf/httpd.conf <<EOF
# Configure SCA Composite for mass dynamic virtual hosting
SCAVirtualContribution `pwd`/domains/
SCAVirtualComposite store.composite
EOF
../../modules/http/httpd-start tmp/server2
../../modules/http/httpd-conf tmp/server3 sca-store.com 8103/80 htdocs
../../modules/http/vhost-conf tmp/server3
../../modules/server/server-conf tmp/server3
../../modules/python/python-conf tmp/server3
cat >>tmp/server3/conf/httpd.conf <<EOF
# Configure SCA Composite for mass dynamic virtual hosting
SCAVirtualContribution `pwd`/domains/
SCAVirtualComposite store.composite
EOF
../../modules/http/httpd-start tmp/server3
# Start two identical proxy balancers
../../modules/http/httpd-conf tmp/proxy1 sca-store.com 8091/80 tmp/proxy1/htdocs
../../modules/http/vhost-conf tmp/proxy1
../../modules/http/proxy-conf tmp/proxy1
../../modules/http/proxy-member-conf tmp/proxy1 localhost 8101
../../modules/http/proxy-member-conf tmp/proxy1 localhost 8102
../../modules/http/proxy-member-conf tmp/proxy1 localhost 8103
../../modules/http/httpd-start tmp/proxy1
../../modules/http/httpd-conf tmp/proxy2 sca-store.com 8092/80 tmp/proxy2/htdocs
../../modules/http/vhost-conf tmp/proxy2
../../modules/http/proxy-conf tmp/proxy2
../../modules/http/proxy-member-conf tmp/proxy2 localhost 8101
../../modules/http/proxy-member-conf tmp/proxy2 localhost 8102
../../modules/http/proxy-member-conf tmp/proxy2 localhost 8103
../../modules/http/httpd-start tmp/proxy2
# Start a shared memcached
# Todo change to one per server
../../components/cache/memcached-start
# Redirect traffic from port 80 to 8091 and use proxy1
#../../ubuntu/ip-redirect-all 80 8091
# Redirect traffic from port 80 to 8092 and use proxy2
#../../ubuntu/ip-redirect-all 80 8092

View file

@ -0,0 +1,25 @@
#!/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
# 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.
../../modules/http/httpd-stop tmp/server1
../../modules/http/httpd-stop tmp/server2
../../modules/http/httpd-stop tmp/server3
../../modules/http/httpd-stop tmp/proxy1
../../modules/http/httpd-stop tmp/proxy2
../../components/cache/memcached-stop

View file

@ -20,7 +20,7 @@
../../modules/http/ssl-ca-conf tmp localhost
../../modules/http/ssl-cert-conf tmp localhost
../../modules/http/httpd-conf tmp localhost 8090 htdocs
../../modules/http/httpd-ssl-conf tmp localhost 8453 htdocs
../../modules/http/httpd-ssl-conf tmp 8453
../../modules/server/server-conf tmp
../../modules/server/cpp-conf tmp
cat >>tmp/conf/httpd.conf <<EOF

View file

@ -20,7 +20,7 @@
../../modules/http/ssl-ca-conf tmp localhost
../../modules/http/ssl-cert-conf tmp localhost
../../modules/http/httpd-conf tmp localhost 8090 htdocs
../../modules/http/httpd-ssl-conf tmp localhost 8453 htdocs
../../modules/http/httpd-ssl-conf tmp 8453
../../modules/server/server-conf tmp
../../modules/java/java-conf tmp
cat >>tmp/conf/httpd.conf <<EOF

View file

@ -20,7 +20,7 @@
../../modules/http/ssl-ca-conf tmp localhost
../../modules/http/ssl-cert-conf tmp localhost
../../modules/http/httpd-conf tmp localhost 8090 htdocs
../../modules/http/httpd-ssl-conf tmp localhost 8453 htdocs
../../modules/http/httpd-ssl-conf tmp 8453
../../modules/server/server-conf tmp
../../modules/server/scheme-conf tmp
cat >>tmp/conf/httpd.conf <<EOF

View file

@ -18,7 +18,6 @@
# under the License.
# Redirect ports 80 and 443
intf=$1
../../ubuntu/ip-redirect 80 8090 $intf
../../ubuntu/ip-redirect 443 8453 $intf
../../ubuntu/ip-redirect-all 80 8090
../../ubuntu/ip-redirect-all 443 8453

View file

@ -20,7 +20,7 @@
../../modules/http/ssl-ca-conf tmp localhost
../../modules/http/ssl-cert-conf tmp localhost
../../modules/http/httpd-conf tmp localhost 8090 htdocs
../../modules/http/httpd-ssl-conf tmp localhost 8453 htdocs
../../modules/http/httpd-ssl-conf tmp 8453
../../modules/server/server-conf tmp
../../modules/python/python-conf tmp
cat >>tmp/conf/httpd.conf <<EOF

View file

@ -25,13 +25,13 @@ else
fi
# Ports 80, 443, 8090, 8453 need to be open
sudo ../../ubuntu/ip-redirect 80 8090
sudo ../../ubuntu/ip-redirect 443 8453
sudo ../../ubuntu/ip-redirect-all 80 8090
sudo ../../ubuntu/ip-redirect-all 443 8453
../../modules/http/ssl-ca-conf tmp $host
../../modules/http/ssl-cert-conf tmp $host
../../modules/http/httpd-conf tmp $host 8090/80 htdocs
../../modules/http/httpd-ssl-conf tmp $host 8453/443 htdocs
../../modules/http/httpd-ssl-conf tmp 8453/443
../../modules/server/server-conf tmp
../../modules/python/python-conf tmp
cat >>tmp/conf/httpd.conf <<EOF

View file

@ -20,7 +20,7 @@
../../modules/http/ssl-ca-conf tmp localhost
../../modules/http/ssl-cert-conf tmp localhost
../../modules/http/httpd-conf tmp localhost 8090 htdocs
../../modules/http/httpd-ssl-conf tmp localhost 8453 htdocs
../../modules/http/httpd-ssl-conf tmp 8453
../../modules/server/server-conf tmp
../../modules/server/scheme-conf tmp
cat >>tmp/conf/httpd.conf <<EOF

View file

@ -20,7 +20,7 @@
../../modules/http/ssl-ca-conf tmp localhost
../../modules/http/ssl-cert-conf tmp localhost
../../modules/http/httpd-conf tmp localhost 8090 htdocs
../../modules/http/httpd-ssl-conf tmp localhost 8453 htdocs
../../modules/http/httpd-ssl-conf tmp 8453
../../modules/server/server-conf tmp
../../modules/server/scheme-conf tmp
cat >>tmp/conf/httpd.conf <<EOF

View file

@ -23,8 +23,10 @@
../../modules/http/ssl-ca-conf tmp sca-store.com
../../modules/http/ssl-cert-conf tmp sca-store.com server
../../modules/http/ssl-cert-conf tmp *.sca-store.com vhost
../../modules/http/httpd-conf tmp sca-store.com 8090 htdocs vhost
../../modules/http/httpd-ssl-conf tmp sca-store.com 8453 htdocs vhost
../../modules/http/httpd-conf tmp sca-store.com 8090 htdocs
../../modules/http/vhost-conf tmp
../../modules/http/httpd-ssl-conf tmp 8453
../../modules/http/vhost-ssl-conf tmp
../../modules/server/server-conf tmp
../../modules/python/python-conf tmp
cat >>tmp/conf/httpd.conf <<EOF

View file

@ -17,7 +17,8 @@
# specific language governing permissions and limitations
# under the License.
../../modules/http/httpd-conf tmp sca-store.com 8090 htdocs vhost
../../modules/http/httpd-conf tmp sca-store.com 8090 htdocs
../../modules/http/vhost-conf tmp
../../modules/server/server-conf tmp
../../modules/python/python-conf tmp
cat >>tmp/conf/httpd.conf <<EOF

View file

@ -26,14 +26,16 @@ else
fi
# Ports 80, 443, 8090, 8453 need to be open
sudo ../../ubuntu/ip-redirect 80 8090
sudo ../../ubuntu/ip-redirect 443 8453
sudo ../../ubuntu/ip-redirect-all 80 8090
sudo ../../ubuntu/ip-redirect-all 443 8453
../../modules/http/ssl-ca-conf tmp $host
../../modules/http/ssl-cert-conf tmp $host server
../../modules/http/ssl-cert-conf tmp "*.$host" vhost
../../modules/http/httpd-conf tmp $host 8090/80 htdocs vhost
../../modules/http/httpd-ssl-conf tmp $host 8453/443 htdocs vhost
../../modules/http/httpd-conf tmp $host 8090/80 htdocs
../../modules/http/vhost-conf tmp
../../modules/http/httpd-ssl-conf tmp 8453/443
../../modules/http/vhost-ssl-conf tmp
../../modules/server/server-conf tmp
../../modules/python/python-conf tmp
cat >>tmp/conf/httpd.conf <<EOF

View file

@ -15,5 +15,5 @@
# specific language governing permissions and limitations
# under the License.
dist_noinst_SCRIPTS = ubuntu-bin-image ubuntu-dev-image ubuntu-gcc-4.5 ubuntu-install ubuntu-install-all uec2-bin-image uec2-conf uec2-setenv uec2-start uec2-status uec2-stop
dist_noinst_SCRIPTS = ip-redirect ip-redirect-all ubuntu-bin-image ubuntu-bin-all-image ubuntu-dev-image ubuntu-dev-all-image ubuntu-gcc-4.5 ubuntu-install ubuntu-install-all uec2-bin-image uec2-bin-all-image uec2-dev-image uec2-dev-all-image uec2-conf uec2-setenv uec2-ssh uec2-start uec2-status uec2-stop

View file

@ -15,18 +15,19 @@
# specific language governing permissions and limitations
# under the License.
# Redirect TCP/IP traffic from one port to another port, useful to handle
# incoming traffic on standard reserved ports like 80 or 443 for example
# in an unprivileged user server process bound to a non-reserved port
# Example: ip-redirect 80 8090 eth0
# Redirect TCP/IP traffic to a particular IP address from one port to another
# port. This is useful to handle incoming traffic on a standard reserved port
# like 80 or 443 for example in an unprivileged user process bound to a non
# reserved port.
# Example: ip-redirect 80 8090 10.1.1.1
source=$1
target=$2
if [ "$3" != "" ]; then
intf=$3
else
intf="eth0"
fi
sport=$1
tport=$2
dest=$3
sudo /sbin/iptables -t nat -A PREROUTING -i $intf -p tcp --dport $source -j REDIRECT --to-port $target
# Redirect external incoming traffic
sudo /sbin/iptables -t nat -A PREROUTING --destination $dest -p tcp --dport $sport -j REDIRECT --to-port $tport
# Redirect local traffic as well
sudo /sbin/iptables -t nat -A OUTPUT --destination $dest -p tcp --dport $sport -j REDIRECT --to-port $tport

View file

@ -0,0 +1,26 @@
# 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.
# Redirect TCP/IP traffic to all local addresses from one port to another
# Example: ip-redirect 80 8090
here=`readlink -f $0`; here=`dirname $here`
sport=$1
tport=$2
/sbin/ifconfig | grep "inet addr:" | awk -F ":" '{ print $2 }' | awk '{ print $1 }' | xargs -i $here/ip-redirect $sport $tport {}

View file

@ -0,0 +1,23 @@
# 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.
# Install a Tuscany image on an EC2 instance
host=$1
# Download and execute Tuscany SCA install script
ssh -i $HOME/.ec2/ec2-tuscany-keypair.pem ubuntu@$host "wget http://svn.apache.org/repos/asf/tuscany/sca-cpp/trunk/ubuntu/ubuntu-bin-all-image; chmod 700 ./ubuntu-bin-all-image; ./ubuntu-bin-all-image"

View file

@ -0,0 +1,23 @@
# 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.
# Build a Tuscany image on an EC2 instance
host=$1
# Download and execute Tuscany SCA install script
ssh -i $HOME/.ec2/ec2-tuscany-keypair.pem ubuntu@$host "wget http://svn.apache.org/repos/asf/tuscany/sca-cpp/trunk/ubuntu/ubuntu-dev-all-image; chmod 700 ./ubuntu-dev-all-image; ./ubuntu-dev-all-image"