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
5
# Author: Martin Pitt <martin.pitt@ubuntu.com>
6
# Author: Celso Providelo <celso.providelo@canonical.com>
12
echo "You need to run this script as root" >&2
16
apt-get install -y python-swiftclient memcached swift swift-account swift-container swift-object swift-proxy
18
chown -R swift:swift $DIR
21
cat <<EOF | tee proxy-server.conf
24
log_facility = LOG_LOCAL1
27
pipeline = healthcheck cache tempauth proxy-server
31
allow_account_management = true
32
account_autocreate = true
35
use = egg:swift#tempauth
36
user_admin_admin = admin .admin .reseller_admin
37
user_testproj_testuser = testpwd .admin
40
use = egg:swift#healthcheck
43
use = egg:swift#memcache
46
use = egg:swift#tempurl
49
cat <<EOF | tee swift.conf
51
swift_hash_path_suffix = mystuff
54
# https://launchpad.net/bugs/1290813
55
/bin/echo -e '\n[container-sync]' >> container-server.conf
57
# add devices and ports to configuration and create rings
58
for i in "object 6010" "account 6020" "container 6030"; do
61
sed -i "/\[DEFAULT\]/ a devices = $DIR\nmount_check = false\nbind_port = $port" ${what}-server.conf
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
68
# exits with 1 even if everything succeeded
69
swift-init restart all || true
73
Now check that it works with
75
swift -A http://127.0.0.1:8080/auth/v1.0 -U testproj:testuser -K testpwd stat -v