~allanlesage/uci-engine/coverage-extractor

« back to all changes in this revision

Viewing changes to gatekeeper/setup-swift.sh

  • Committer: Celso Providelo
  • Date: 2014-04-25 12:34:29 UTC
  • mto: (450.1.2 uci-engine-gatekeeper)
  • mto: This revision was merged to the branch mainline in revision 456.
  • Revision ID: celso.providelo@canonical.com-20140425123429-qcmfjm9wyptol4xi
Including gatekeeper component

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
# Set up a totally insecure swift instance. This is meant to be run in a
 
3
# freshly created Ubuntu container or VM, for locally testing software that
 
4
# talks to swift.
 
5
# Author: Martin Pitt <martin.pitt@ubuntu.com>
 
6
# Author: Celso Providelo <celso.providelo@canonical.com>
 
7
set -e
 
8
 
 
9
DIR=/srv/swift
 
10
 
 
11
[ `id -u` = 0 ] || {
 
12
    echo "You need to run this script as root" >&2
 
13
    exit 1
 
14
}
 
15
 
 
16
apt-get install -y python-swiftclient memcached swift swift-account swift-container swift-object swift-proxy
 
17
mkdir -p $DIR/1
 
18
chown -R swift:swift $DIR
 
19
 
 
20
cd /etc/swift
 
21
cat <<EOF | tee proxy-server.conf
 
22
[DEFAULT]
 
23
bind_port = 8080
 
24
log_facility = LOG_LOCAL1
 
25
 
 
26
[pipeline:main]
 
27
pipeline = healthcheck cache tempauth proxy-server
 
28
 
 
29
[app:proxy-server]
 
30
use = egg:swift#proxy
 
31
allow_account_management = true
 
32
account_autocreate = true
 
33
 
 
34
[filter:tempauth]
 
35
use = egg:swift#tempauth
 
36
user_admin_admin = admin .admin .reseller_admin
 
37
user_testproj_testuser = testpwd .admin
 
38
 
 
39
[filter:healthcheck]
 
40
use = egg:swift#healthcheck
 
41
 
 
42
[filter:cache]
 
43
use = egg:swift#memcache
 
44
 
 
45
[filter:tempurl]
 
46
use = egg:swift#tempurl
 
47
EOF
 
48
 
 
49
cat <<EOF | tee swift.conf
 
50
[swift-hash]
 
51
swift_hash_path_suffix = mystuff
 
52
EOF
 
53
 
 
54
# https://launchpad.net/bugs/1290813
 
55
/bin/echo -e '\n[container-sync]' >> container-server.conf
 
56
 
 
57
# add devices and ports to configuration and create rings
 
58
for i in "object 6010" "account 6020" "container 6030"; do
 
59
    what=${i% *}
 
60
    port=${i#* }
 
61
    sed -i "/\[DEFAULT\]/ a devices = $DIR\nmount_check = false\nbind_port = $port" ${what}-server.conf
 
62
 
 
63
   swift-ring-builder ${what}.builder create 18 3 1
 
64
   swift-ring-builder ${what}.builder add z1-127.0.0.1:$port/1 1
 
65
   swift-ring-builder ${what}.builder rebalance
 
66
done
 
67
 
 
68
# exits with 1 even if everything succeeded
 
69
swift-init restart all || true
 
70
 
 
71
# create user account
 
72
cat <<EOF
 
73
Now check that it works with
 
74
 
 
75
    swift -A http://127.0.0.1:8080/auth/v1.0 -U testproj:testuser -K testpwd stat -v
 
76
EOF