Skip to content

Instantly share code, notes, and snippets.

@leoh0
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save leoh0/893ab4de7f4c05940cc2 to your computer and use it in GitHub Desktop.
Save leoh0/893ab4de7f4c05940cc2 to your computer and use it in GitHub Desktop.
swift saio install script for ubuntu trusty
#!/bin/bash
# vagrant@vagrant-ubuntu-trusty-64:~$ sudo adduser swift
# Adding user `swift' ...
# Adding new group `swift' (1002) ...
# Adding new user `swift' (1002) with group `swift' ...
# Creating home directory `/home/swift' ...
# Copying files from `/etc/skel' ...
# Enter new UNIX password:
# Retype new UNIX password:
# passwd: password updated successfully
# Changing the user information for swift
# Enter the new value, or press ENTER for the default
# Full Name []:
# Room Number []:
# Work Phone []:
# Home Phone []:
# Other []:
# Is the information correct? [Y/n]
# vagrant@vagrant-ubuntu-trusty-64:~$ sudo adduser swift sudo
# Adding user `swift' to group `sudo' ...
# Adding user swift to group sudo
# Done.
sudo adduser swift
sudo adduser swift sudo
sudo su - swift
wget https://gist.github.com/leoh0/893ab4de7f4c05940cc2/raw/fa2dcb984efbb3a5d608df27deaab3375df914c8/1-installing-dependencies.sh
wget https://gist.github.com/leoh0/893ab4de7f4c05940cc2/raw/55cf28d08fc5914f0149ffec3c303b0a53c852eb/2-using-a-loopback-device-for-storage.sh
wget https://gist.github.com/leoh0/893ab4de7f4c05940cc2/raw/ec57c54151e6cc7a1244321763b266669ecfee35/3-common-post-device-setup.sh
wget https://gist.github.com/leoh0/893ab4de7f4c05940cc2/raw/d2215ab7c205d82022e810daa62dc4736c3956a7/4-getting-the-code.sh
wget https://gist.github.com/leoh0/893ab4de7f4c05940cc2/raw/89de0b1a2187ad1b97fc7a25fc4ded3171041e37/5-setting-up-rsync.sh
wget https://gist.github.com/leoh0/893ab4de7f4c05940cc2/raw/8eb7662a2bcc79e91e04a298eb77c6417ba3186f/6-configuring-each-node.sh
wget https://gist.github.com/leoh0/893ab4de7f4c05940cc2/raw/dffa6ce34ce44c1406394decec681350b73c7f52/7-setting-up-scripts-for-running-swift.sh
wget https://gist.github.com/leoh0/893ab4de7f4c05940cc2/raw/29347df53372a2c37fdecd70416f36e7fc07f4e9/8-setup-environment-variable-for-cli.sh
chmod +x 1-installing-dependencies.sh
chmod +x 2-using-a-loopback-device-for-storage.sh
chmod +x 3-common-post-device-setup.sh
chmod +x 4-getting-the-code.sh
chmod +x 5-setting-up-rsync.sh
chmod +x 6-configuring-each-node.sh
chmod +x 7-setting-up-scripts-for-running-swift.sh
chmod +x 8-setup-environment-variable-for-cli.sh
#!/bin/bash
sudo apt-get update
sudo apt-get install -y curl gcc memcached rsync sqlite3 xfsprogs \
git-core libffi-dev python-setuptools
sudo apt-get install -y python-coverage python-dev python-nose \
python-simplejson python-xattr python-eventlet \
python-greenlet python-pastedeploy \
python-netifaces python-pip python-dnspython \
python-mock
#!/bin/bash
# Create the file for the loopback device:
sudo mkdir /srv
sudo truncate -s 1GB /srv/swift-disk
sudo mkfs.xfs /srv/swift-disk
echo '/srv/swift-disk /mnt/sdb1 xfs loop,noatime,nodiratime,nobarrier,logbufs=8 0 0' | \
sudo tee -a /etc/fstab
sudo mkdir /mnt/sdb1
sudo mount /mnt/sdb1
sudo mkdir /mnt/sdb1/1 /mnt/sdb1/2 /mnt/sdb1/3 /mnt/sdb1/4
sudo chown ${USER}:${USER} /mnt/sdb1/*
for x in {1..4}; do sudo ln -s /mnt/sdb1/$x /srv/$x; done
sudo mkdir -p /srv/1/node/sdb1 /srv/2/node/sdb2 /srv/3/node/sdb3 /srv/4/node/sdb4 /var/run/swift
sudo chown -R ${USER}:${USER} /var/run/swift
# **Make sure to include the trailing slash after /srv/$x/**
for x in {1..4}; do sudo chown -R ${USER}:${USER} /srv/$x/; done
#!/bin/bash
str="\
mkdir -p /var/cache/swift /var/cache/swift2 /var/cache/swift3 /var/cache/swift4 \
\nchown ${USER}:${USER} /var/cache/swift** \
\nmkdir -p /var/run/swift \
\nchown ${USER}:${USER} /var/run/swift"
sudo sed -i "/\# By default this script does nothing.$/a${str}" /etc/rc.local
#!/bin/bash
cd $HOME; git clone https://github.com/openstack/python-swiftclient.git
cd $HOME/python-swiftclient; sudo python setup.py develop; cd -
git clone https://github.com/openstack/swift.git
cd $HOME/swift; sudo python setup.py develop; cd -
sudo pip install -U xattr
sudo pip install -r swift/test-requirements.txt
#!/bin/bash
sudo cp $HOME/swift/doc/saio/rsyncd.conf /etc/
sudo sed -i "s/<your-user-name>/${USER}/" /etc/rsyncd.conf
sudo sed -i 's/RSYNC_ENABLE=false/RSYNC_ENABLE=true/g' /etc/default/rsync
sudo service rsync restart
#!/bin/bash
sudo rm -rf /etc/swift
cd $HOME/swift/doc; sudo cp -r saio/swift /etc/swift; cd -
sudo chown -R ${USER}:${USER} /etc/swift
find /etc/swift/ -name \*.conf | xargs sudo sed -i "s/<your-user-name>/${USER}/"
#!/bin/bash
cd $HOME/swift/doc; cp -r saio/bin $HOME/bin; cd -
chmod +x $HOME/bin/*
sed -i "s/dev\/sdb1/srv\/swift-disk/" $HOME/bin/resetswift
sed -i "/find \/var\/log\/swift/d" $HOME/bin/resetswift
cp $HOME/swift/test/sample.conf /etc/swift/test.conf
echo "export SWIFT_TEST_CONFIG_FILE=/etc/swift/test.conf" >> $HOME/.bashrc
echo "export PATH=${PATH}:$HOME/bin" >> $HOME/.bashrc
export SWIFT_TEST_CONFIG_FILE=/etc/swift/test.conf
export PATH=${PATH}:$HOME/bin
$HOME/bin/remakerings
$HOME/bin/startmain
TOKEN=$(curl -is -H 'X-Storage-User: test:tester' -H 'X-Storage-Pass: testing' \
http://127.0.0.1:8080/auth/v1.0 | grep X-Auth-Token: | awk '{print $2}')
curl -v -H "X-Auth-Token: $TOKEN" http://127.0.0.1:8080/v1/AUTH_test
#!/bin/bash
export ST_AUTH=http://127.0.0.1:8080/auth/v1.0
export ST_USER=test:tester
export ST_KEY=testing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment