~nuclearbob/uci-engine/removed-bootspeed-zeroes

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/sh
# Set up a totally insecure swift instance. This is meant to be run in a
# freshly created Ubuntu container or VM, for locally testing software that
# talks to swift.
# Author: Martin Pitt <martin.pitt@ubuntu.com>
# Author: Celso Providelo <celso.providelo@canonical.com>
set -e

DIR=/srv/swift

[ `id -u` = 0 ] || {
    echo "You need to run this script as root" >&2
    exit 1
}

apt-get install -y python-swiftclient memcached swift swift-account swift-container swift-object swift-proxy
mkdir -p $DIR/1
chown -R swift:swift $DIR

cd /etc/swift
cat <<EOF | tee proxy-server.conf
[DEFAULT]
bind_port = 8080
log_facility = LOG_LOCAL1

[pipeline:main]
pipeline = healthcheck cache tempauth proxy-server

[app:proxy-server]
use = egg:swift#proxy
allow_account_management = true
account_autocreate = true

[filter:tempauth]
use = egg:swift#tempauth
user_admin_admin = admin .admin .reseller_admin
user_testproj_testuser = testpwd .admin

[filter:healthcheck]
use = egg:swift#healthcheck

[filter:cache]
use = egg:swift#memcache

[filter:tempurl]
use = egg:swift#tempurl
EOF

cat <<EOF | tee swift.conf
[swift-hash]
swift_hash_path_suffix = mystuff
EOF

# https://launchpad.net/bugs/1290813
/bin/echo -e '\n[container-sync]' >> container-server.conf

# add devices and ports to configuration and create rings
for i in "object 6010" "account 6020" "container 6030"; do
    what=${i% *}
    port=${i#* }
    sed -i "/\[DEFAULT\]/ a devices = $DIR\nmount_check = false\nbind_port = $port" ${what}-server.conf

   swift-ring-builder ${what}.builder create 18 3 1
   swift-ring-builder ${what}.builder add z1-127.0.0.1:$port/1 1
   swift-ring-builder ${what}.builder rebalance
done

# exits with 1 even if everything succeeded
swift-init restart all || true

# create user account
cat <<EOF
Now check that it works with

    swift -A http://127.0.0.1:8080/auth/v1.0 -U testproj:testuser -K testpwd stat -v
EOF