]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
vstart.sh: -r to start radosgw
authorSage Weil <sage@inktank.com>
Sat, 1 Sep 2012 21:39:28 +0000 (14:39 -0700)
committerSage Weil <sage@inktank.com>
Sat, 1 Sep 2012 21:51:04 +0000 (14:51 -0700)
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 <sage@inktank.com>
src/stop.sh
src/vstart.sh

index 604cd91dedf0782e0f10c5a04b301a940fa4cf06..3a3ed16e6792623fcf8df73d27768c28b95ccafb 100755 (executable)
@@ -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
index 96216953188e423b07b7f10520d12d15e5f4b311..a8a177c2f0e9938a899233605baffd4d64caab2a 100755 (executable)
@@ -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 <<EOF >> $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 <<EOF > 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&params=$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
+
+<Directory $PWD/out/htdocs>
+  Options +ExecCGI
+  AllowOverride All
+  SetHandler fastcgi-script
+</Directory>
+
+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."