From bfa9a59f0e2b731a1b6ea752a90f46c220a2c1d2 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Sat, 1 Sep 2012 14:39:28 -0700 Subject: [PATCH] vstart.sh: -r to start radosgw Uses a fixed access/secret key for easier testing. Starts a standalone apache2 process with basic config (based on the teuthology one). Signed-off-by: Sage Weil --- src/stop.sh | 4 ++- src/vstart.sh | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 79 insertions(+), 2 deletions(-) diff --git a/src/stop.sh b/src/stop.sh index 604cd91dedf07..3a3ed16e67926 100755 --- a/src/stop.sh +++ b/src/stop.sh @@ -14,6 +14,7 @@ stop_all=1 stop_mon=0 stop_mds=0 stop_osd=0 +stop_rgw=0 while [ $# -ge 1 ]; do case $1 in @@ -40,7 +41,7 @@ while [ $# -ge 1 ]; do done if [ $stop_all -eq 1 ]; then - killall ceph-mon ceph-mds ceph-osd + killall ceph-mon ceph-mds ceph-osd radosgw lt-radosgw apache2 pkill -f valgrind.bin.\*ceph-mon $SUDO pkill -f valgrind.bin.\*ceph-osd pkill -f valgrind.bin.\*ceph-mds @@ -48,4 +49,5 @@ else [ $stop_mon -eq 1 ] && do_killall ceph-mon [ $stop_mds -eq 1 ] && do_killall ceph-mds [ $stop_osd -eq 1 ] && do_killall ceph-osd + [ $stop_rgw -eq 1 ] && do_killall radosgw lt-radosgw apache2 fi diff --git a/src/vstart.sh b/src/vstart.sh index 96216953188e4..a8a177c2f0e99 100755 --- a/src/vstart.sh +++ b/src/vstart.sh @@ -3,6 +3,7 @@ [ -z "$CEPH_NUM_MON" ] && CEPH_NUM_MON=3 [ -z "$CEPH_NUM_OSD" ] && CEPH_NUM_OSD=1 [ -z "$CEPH_NUM_MDS" ] && CEPH_NUM_MDS=3 +[ -z "$CEPH_NUM_RGW" ] && CEPH_NUM_RGW=1 extra_conf="" new=0 @@ -12,6 +13,7 @@ start_all=1 start_mon=0 start_mds=0 start_osd=0 +start_rgw=0 localhost=0 nodaemon=0 smallmds=0 @@ -51,6 +53,9 @@ case $1 in -l | --localhost ) localhost=1 ;; + -r ) + start_rgw=1 + ;; --new | -n ) new=1 ;; @@ -230,7 +235,6 @@ else CEPH_ADM="$CEPH_BIN/ceph -c $conf" fi - MONS="" count=0 for f in a b c d e f g h i j k l m n o p q r s t u v w x y z @@ -448,5 +452,76 @@ EOF $cmd fi + +# rgw +if [ "$start_rgw" -eq 1 ]; then + for rgw in `seq 0 $((CEPH_NUM_RGW-1))` + do + rgwport=$(( 8000 + $rgw )) + if [ "$new" -eq 1 ]; then + if [ $overwrite_conf -eq 1 ]; then + dnsname=`hostname -f` + cat <> $conf +[client.radosgw.rgw$rgw] + host = $HOSTNAME +$DAEMONOPTS + keyring = out/keyring.client.radosgw.rgw$rgw + rgw socket path = out/sock.client.radosgw.rgw$rgw + rgw dns name = $dnsname +EOF + mkdir -p out/htdocs + mkdir -p out/fastcgi_sock + cat < out/apache.conf +LoadModule env_module /usr/lib/apache2/modules/mod_env.so +LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so +LoadModule fastcgi_module /usr/lib/apache2/modules/mod_fastcgi.so + +Listen $rgwport +ServerName rgwtest.example.com + +ServerRoot $PWD/out +ErrorLog $PWD/out/apache.error.log +LogFormat "%h l %u %t \"%r\" %>s %b \"{Referer}i\" \"%{User-agent}i\"" combined +CustomLog $PWD/out/apache.access.log combined +PidFile $PWD/out/apache.pid +DocumentRoot $PWD/out/htdocs +FastCgiIPCDir $PWD/out/fastcgi_sock +FastCgiExternalServer $PWD/out/htdocs/rgw.fcgi -socket $PWD/out/sock.client.radosgw.rgw$rgw +RewriteEngine On + +RewriteRule ^/([a-zA-Z0-9-_.]*)([/]?.*) /rgw.fcgi?page=$1¶ms=$2&%{QUERY_STRING} [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L] + +# Set fastcgi environment variables. +# Note that this is separate from Unix environment variables! +SetEnv RGW_LOG_LEVEL 20 +SetEnv RGW_PRINT_CONTINUE yes +SetEnv RGW_SHOULD_LOG yes + + + Options +ExecCGI + AllowOverride All + SetHandler fastcgi-script + + +AllowEncodedSlashes On +ServerSignature Off +EOF + $SUDO $CEPH_ADM auth get-or-create client.radosgw.rgw$rgw osd 'allow rwx' mon 'allow r' -o out/keyring.client.radosgw.rgw$rgw + + #akey=`echo $$ | md5sum | cut -c 1-20` + #skey=`dd if=/dev/urandom of=/tmp/random.$$ bs=1 count=40 2>/dev/null ; base64 < /tmp/random.$$ ; rm /tmp/random.$$` + akey='0555b35654ad1656d804' + skey='h7GhxuBLTrlhVUyxSPUKUV8r/2EI4ngqJxD7iBdBYLhwluN30JaT3Q==' + echo access key $akey + echo secret key $skey + $CEPH_BIN/radosgw-admin user create --uid tester --access-key $akey --secret $skey --display-name 'M. Tester' --email tester@ceph.com + fi + fi + echo start rgw$rgw on http://localhost:$rgwport + run 'rgw' $SUDO $CEPH_BIN/radosgw -n client.radosgw.rgw$rgw $ARGS + run 'apache2' $SUDO apache2 -f $PWD/out/apache.conf + done +fi + echo "started. stop.sh to stop. see out/* (e.g. 'tail -f out/????') for debug output." -- 2.39.5