Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a60f514
commit 5d6ffc6
Showing
24 changed files
with
497 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
description: openstack folsom swift | ||
|
||
components: | ||
- name: swift_proxy | ||
- name: swift_storage | ||
|
||
component_dependencies: | ||
- source_component: swift_storage | ||
dest_component: swift_proxy | ||
|
||
config_item_defaults: | ||
- name: storage_path | ||
value: /srv/node | ||
- name: storage_dev | ||
value: sdb1 | ||
- name: ring_builder_replicas | ||
value: 1 | ||
- name: super_admin_key | ||
value: swauth | ||
|
||
component_config_defaults: | ||
- path: /etc/swift/swift.conf | ||
component: swift_proxy | ||
- path: /etc/swift/proxy-server.conf | ||
component: swift_proxy | ||
- path: /etc/rsyncd.conf | ||
component: swift_storage | ||
- path: /etc/swift/account-server.conf | ||
component: swift_storage | ||
- path: /etc/swift/container-server.conf | ||
component: swift_storage | ||
- path: /etc/swift/object-server.conf | ||
component: swift_storage | ||
|
||
software_config_defaults: | ||
|
||
test_components: | ||
- component: swift_proxy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
-----BEGIN CERTIFICATE----- | ||
MIICsDCCAhmgAwIBAgIJANm8rtfEGouKMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNV | ||
BAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBX | ||
aWRnaXRzIFB0eSBMdGQwHhcNMTEwNTE3MDExMDA3WhcNMTEwNjE2MDExMDA3WjBF | ||
MQswCQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50 | ||
ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKB | ||
gQC82UnvvzUDoOF/+TGtT6a52kCIW4ezeP7FjwoAM5AdDmI45hUsFBCNeCCNfjf1 | ||
PuuQSG7WMkQxISjBymhbEeca+UyWkTyphkCJtTy2+X665vitTqRIAhTuKcvJ61Zs | ||
fIAVOhtUo8vkaNjzLVJybxQ1Xf3nhmZgERyqu9scepQdoQIDAQABo4GnMIGkMB0G | ||
A1UdDgQWBBTzLn+zvHWLicSEmMgWuoZEehGMrTB1BgNVHSMEbjBsgBTzLn+zvHWL | ||
icSEmMgWuoZEehGMraFJpEcwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUt | ||
U3RhdGUxITAfBgNVBAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZIIJANm8rtfE | ||
GouKMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAIgxtcdLQusCImDfM | ||
Mtv8KK6HP+I2A5K7A1nTlgOzHmqlJ9t8n5QW7aidseoRZ14blPKgiyA1eFWx4YPm | ||
KqvZKq0lBNgNhGvPoMzXJwk7OeIUjcuLm0ilPwua/xOnUcwVlJXq/PIgrzbaS9V2 | ||
yUlgpzpCvR4httxTKUI+Qk9w+Fs= | ||
-----END CERTIFICATE----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
-----BEGIN RSA PRIVATE KEY----- | ||
MIICXAIBAAKBgQC82UnvvzUDoOF/+TGtT6a52kCIW4ezeP7FjwoAM5AdDmI45hUs | ||
FBCNeCCNfjf1PuuQSG7WMkQxISjBymhbEeca+UyWkTyphkCJtTy2+X665vitTqRI | ||
AhTuKcvJ61ZsfIAVOhtUo8vkaNjzLVJybxQ1Xf3nhmZgERyqu9scepQdoQIDAQAB | ||
AoGAGGXuQnYukDhxycnVHDIFNU+4NKW2o35HVBjFzv7aaJaaJAW9yIMTHGPfuMgM | ||
zLeDUZG6GBxIaRyCmn7e+p0WgVGmBR/1gG/dUg4T0a8CB2F5pnA973URUhK8dAYS | ||
DdIIIM7inJebHe3niDCqGK9CKW3DgEebXJKwVwCrWVEn6kECQQDtkvgu3HXIRGOZ | ||
HQJsnOjBnCXf5W0Q03SueoqsJznJy6cW4PlTcKdQtx3L3uHISCIEw5UQVijFPXnX | ||
RiJpM2GpAkEAy37g/iCyUzt+YlVZdRiI10stPqkYWYNKvJQx1jx5ecYXooE2kl5G | ||
tVcikJREz7W2C6WYPYjg6dKAaSbkORHHOQJBAKNn5EavImA2Ed9doa49GqcYlMB0 | ||
WFkraGUeKkWQ0WGoLuxAn50xrhOJb/gq/Fc6rhNixyOub2qDB0v3lHGRgskCQDFs | ||
Tl7KOCVI5MgjLIfo/oszgfie/v/2iDdG0tfSdjpiJylbspJX/VpboFR2/kNoQZ+Q | ||
h2oijWWcr31aacGGlNkCQBztmS9zIgP95Wx90nxMqNKm0oxKhBuIm/zUAnmlN6Iu | ||
u+WsyFVfaJgbVQ4fGN9HXrK+7l9oE3w+iFUS6MMQQfY= | ||
-----END RSA PRIVATE KEY----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/bash | ||
|
||
swift-init proxy-server status | ||
if [ $? = 0 ]; then | ||
echo "swift-proxy was installed." | ||
exit 0 | ||
fi | ||
|
||
cd /etc/swift | ||
|
||
dev=$1 | ||
|
||
swift-ring-builder account.builder create 18 $2 1 | ||
swift-ring-builder container.builder create 18 $2 1 | ||
swift-ring-builder object.builder create 18 $2 1 | ||
|
||
zone=1 | ||
for server in `cat /tmp/swift/storage-servers` | ||
do | ||
swift-ring-builder account.builder add z$zone-$server:6002/$dev 100 | ||
swift-ring-builder container.builder add z$zone-$server:6001/$dev 100 | ||
swift-ring-builder object.builder add z$zone-$server:6000/$dev 100 | ||
|
||
zone=`expr $zone + 1` | ||
done | ||
|
||
swift-ring-builder account.builder rebalance | ||
swift-ring-builder container.builder rebalance | ||
swift-ring-builder object.builder rebalance | ||
|
||
chown -R swift:swift /etc/swift | ||
|
||
swift-init proxy start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
|
||
swift-init proxy stop | ||
|
||
rm -rf /etc/swift/* | ||
|
||
exit 0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
|
||
service rsync status | grep running | ||
if [ $? = 0 ]; then | ||
echo "rsync was installed." | ||
exit 0 | ||
fi | ||
|
||
sed -i -e "s/RSYNC_ENABLE.*/RSYNC_ENABLE=true/g" /etc/default/rsync | ||
service rsync start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
|
||
swift-init account-server status | ||
if [ $? = 0 ]; then | ||
echo "swift-account was installed." | ||
exit 0 | ||
fi | ||
|
||
rsync [$1]::ring/*.gz /etc/swift | ||
|
||
chown -R swift:swift /srv/node | ||
|
||
swift-init object-server start | ||
swift-init object-replicator start | ||
swift-init object-updater start | ||
swift-init object-auditor start | ||
swift-init container-server start | ||
swift-init container-replicator start | ||
swift-init container-updater start | ||
swift-init container-auditor start | ||
swift-init account-server start | ||
swift-init account-replicator start | ||
swift-init account-auditor start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
|
||
storage_path=$1 | ||
storage_dev=$2 | ||
|
||
swift-init object-server stop | ||
swift-init object-replicator stop | ||
swift-init object-updater stop | ||
swift-init object-auditor stop | ||
swift-init container-server stop | ||
swift-init container-replicator stop | ||
swift-init container-updater stop | ||
swift-init container-auditor stop | ||
swift-init account-server stop | ||
swift-init account-replicator stop | ||
swift-init account-auditor stop | ||
|
||
rm -rf $storage_path/$storage_dev/* | ||
rm -rf /etc/swift/* | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/bin/bash | ||
|
||
key=$1 | ||
account="system" | ||
username="root" | ||
password="testpass" | ||
|
||
swauth-prep -K $key -A https://127.0.0.1:8080/auth/ | ||
swauth-add-user -K $key -A https://127.0.0.1:8080/auth/ -a $account $username $password | ||
|
||
cd /tmp/swift | ||
|
||
apt-get install curl -y | ||
|
||
curl -k -v -H "X-Storage-User: $account:$username" -H "X-Storage-Pass: $password" https://127.0.0.1:8080/auth/v1.0 > temp 2>&1 | ||
url=`cat temp | grep "X-Storage-Url:" | sed -e "s/.*X-Storage-Url:\s*\(.*\)/\1/"` | ||
token=`cat temp | grep "X-Storage-Token:" | sed -e "s/.*X-Storage-Token:\s*\(.*\)/\1/"` | ||
echo "URL: $url" | ||
echo "TOKEN: $token" | ||
|
||
curl -k -v -H "X-Auth-Token: $token" $url | ||
|
||
swift -A https://127.0.0.1:8080/auth/v1.0 -U $account:$username -K $password stat | ||
echo "hello world" > testfile | ||
swift -A https://127.0.0.1:8080/auth/v1.0 -U $account:$username -K $password upload myfiles testfile | ||
|
||
echo "" | ||
echo "The output of swift list:" | ||
swift -A https://127.0.0.1:8080/auth/v1.0 -U $account:$username -K $password list | ||
|
||
echo "" | ||
echo "Download:" | ||
swift -A https://127.0.0.1:8080/auth/v1.0 -U $account:$username -K $password download myfiles testfile -o testfile_downloaded | ||
|
||
|
||
echo "" | ||
echo "The content of file downloaded:" | ||
cat testfile_downloaded | ||
|
||
if [ $? -ne 0 ]; then | ||
echo "Test failed." | ||
exit 1 | ||
fi | ||
|
||
echo "Test finished. It is OK." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
class swift_f::add_source_list { | ||
include apt | ||
apt::key { | ||
"EC4926EA": | ||
keyserver => "keyserver.ubuntu.com", | ||
alias => folsom | ||
} | ||
|
||
apt::sources_list { | ||
folsom: | ||
ensure => present, | ||
content => 'deb http://ubuntu-cloud.archive.canonical.com/ubuntu precise-updates/folsom main', | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
class swift_f::common { | ||
include swift_f::add_source_list | ||
|
||
user { | ||
swift: | ||
ensure => present | ||
require => Exec[apt-get_update] | ||
} | ||
|
||
file { | ||
"/etc/swift": | ||
ensure => directory, | ||
mode => 644, | ||
owner => swift, | ||
group => swift, | ||
require => User[swift]; | ||
|
||
"/etc/swift/cert.crt": | ||
source => "puppet:///modules/swift_f/cert.crt", | ||
mode => 644, | ||
require => File["/etc/swift"]; | ||
|
||
"/etc/swift/cert.key": | ||
source => "puppet:///modules/swift_f/cert.key", | ||
mode => 644, | ||
require => File["/etc/swift"]; | ||
|
||
"/etc/swift/swift.conf": | ||
content => template("$proposal_id/etc/swift/swift.conf.erb"), | ||
mode => 644, | ||
owner => swift, | ||
group => swift, | ||
require => [File["/etc/swift"]]; | ||
|
||
"/tmp/swift": | ||
ensure => directory, | ||
mode => 644 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
class swift_f{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
class swift_f::swift_proxy::install { | ||
include swift_f::common | ||
|
||
package { | ||
[swauth, memcached, swift, python-swiftclient]: | ||
require => User[swift]; | ||
|
||
swift-proxy: | ||
require => [File["/etc/swift/swift.conf"], Package[swift]] | ||
} | ||
|
||
file { | ||
"/etc/swift/proxy-server.conf": | ||
content => template("$proposal_id/etc/swift/proxy-server.conf.erb"), | ||
mode => 644, | ||
require => Package[swift-proxy]; | ||
|
||
"/tmp/swift/storage-servers": | ||
content => template("swift_f/storage-servers.erb"); | ||
|
||
"/tmp/swift/proxy-init.sh": | ||
source => "puppet:///modules/swift_f/proxy-init.sh", | ||
require => File["/etc/swift/proxy-server.conf", "/tmp/swift"]; | ||
} | ||
|
||
exec { | ||
"/tmp/swift/proxy-init.sh $storage_dev $ring_builder_replicas 2>&1": | ||
require => File["/tmp/swift/proxy-init.sh", "/tmp/swift/storage-servers"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
class swift_f::swift_proxy::test { | ||
file { | ||
"/tmp/swift/test.sh": | ||
source => "puppet:///modules/swift_f/test.sh" | ||
} | ||
|
||
exec { | ||
"/tmp/swift/test.sh $super_admin_key 2>&1": | ||
require => File["/tmp/swift/test.sh"] | ||
} | ||
|
||
} |
18 changes: 18 additions & 0 deletions
18
softwares/swift_f/puppet/manifests/swift_proxy/uninstall.pp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
class swift_f::swift_proxy::uninstall { | ||
package { | ||
[swift, swift-proxy, swauth]: | ||
ensure => purged, | ||
require => Exec["proxy-uninit"] | ||
} | ||
|
||
file { | ||
"/tmp/swift/proxy-uninit.sh": | ||
source => "puppet:///modules/swift_f/proxy-uninit.sh" | ||
} | ||
|
||
exec { | ||
"/tmp/swift/proxy-uninit.sh": | ||
alias => "proxy-uninit", | ||
require => File["/tmp/swift/proxy-uninit.sh"] | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
softwares/swift_f/puppet/manifests/swift_storage/install.pp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
class swift_f::swift_storage::install { | ||
include swift_f::common | ||
|
||
package { | ||
[swift-account, swift-container, swift-object, xfsprogs, rsync]: | ||
require => File["/etc/swift/swift.conf"] | ||
} | ||
|
||
file { | ||
"/etc/rsyncd.conf": | ||
content => template("$proposal_id/etc/rsyncd.conf.erb"), | ||
mode => 644, | ||
require => Package[rsync]; | ||
|
||
"/tmp/swift/rsync-init.sh": | ||
source => "puppet:///modules/swift_f/rsync-init.sh", | ||
require => File["/etc/rsyncd.conf", "/tmp/swift"]; | ||
|
||
"/etc/swift/account-server.conf": | ||
content => template("$proposal_id/etc/swift/account-server.conf.erb"), | ||
mode => 644, | ||
alias => "account-server.conf", | ||
require => Package[swift-account]; | ||
|
||
"/etc/swift/container-server.conf": | ||
content => template("$proposal_id/etc/swift/container-server.conf.erb"), | ||
mode => 644, | ||
alias => "container-server.conf", | ||
require => Package[swift-container]; | ||
|
||
"/etc/swift/object-server.conf": | ||
content => template("$proposal_id/etc/swift/object-server.conf.erb"), | ||
mode => 644, | ||
alias => "object-server.conf", | ||
require => Package[swift-object]; | ||
|
||
"/tmp/swift/storage-init.sh": | ||
source => "puppet:///modules/swift_f/storage-init.sh", | ||
require => File["account-server.conf", "container-server.conf", "object-server.conf", "/tmp/swift"]; | ||
} | ||
|
||
exec { | ||
"/tmp/swift/rsync-init.sh 2>&1": | ||
alias => "rsync-init", | ||
require => File["/tmp/swift/rsync-init.sh"]; | ||
|
||
"/tmp/swift/storage-init.sh $swift_proxy 2>&1": | ||
require => [File["/tmp/swift/storage-init.sh"], Exec["rsync-init"]] | ||
} | ||
} |
Oops, something went wrong.