Audit a swift cluster

Swift integrity tools. There is quite a bit of tools shipped with Swift to ensure you have the right object on your cluster. At first there is the basic : swift-object-info It will take a swift object stored on the filesystem and print some infos about it, like this : swift@storage01:0/016/0b221bab535ac1b8f0d91e394f225016$ swift-object-info 1327991417.01411.data Path: /AUTH_root/foobar/file.txt Account: AUTH_root Container: foobar Object: file.txt Object hash: 0b221bab535ac1b8f0d91e394f225016 Ring locations: 192.168.254.12:6000 - /srv/node/sdb1/objects/0/016/0b221bab535ac1b8f0d91e394f225016/1327991417.01411.data Content-Type: text/plain Timestamp: 2012-01-31 06:30:17.014110 (1327991417.01411) ETag: 053a0f8516a5023b9af76c49ca917d3e (valid) Content-Length: 24 (valid) User Metadata: {‘X-Object-Meta-Mtime’: ‘1327968327.21’} ...

February 1, 2012

My stats for this year running and cycling

Running 1,266 km (786 miles): Cycling 3865 km (2401 miles): Let’s see if I can improve for next year

December 28, 2011

Swift and Keystone middleware

[NB: Much things has changed since I have written this article but keeping it here for info] It seems that integrating Swift and Keystone together present some challenges to people and this is absolutely normal as there is a lot of changes going on. This is my attempt to document how everything is plugged together. ...

November 24, 2011

Debugging python-novaclient on the command line.

I have done lately quite a bit of work with python-novaclient the (nova/keystone) openstack client. I often experiment it with ipython in the console. There is a nice debugging facility in novaclient which you can see while using –debug argument on the command line and if you wanted to use it with ipython you could have that at the beginning of your session : ...

September 2, 2011

Rackspace CloudDNS python binding

I have released a python binding to Rackspace CloudDNS here which allow you to create/update/delete domains and records. It’s available on github https://github.com/rackspace/python-clouddns/ The binding is pretty simple and have unfortunately no documentation (or even tests) but you can figure out most of it from here : https://github.com/rackspace/python-clouddns/blob/master/tests/t.py ...

July 17, 2011

Mass editing firewall on Rackspace Cloud.

A lot of our customers in Rackspace cloud has been asking how to mass edit firewalls of servers when you have multiple servers without doing it manually. Part of my cloudservers-api-demo I have written a simple firewall scripts abstracting the Operating System firewall software to allow/enable/disable the firewall and ports/networks. The script has been kept very simple by design and currently allow only to : <p style="display: inline !important;"> enable the firewall </p> <p> </span></li> <li> <span style="font-size: medium;"> <p style="display: inline !important;"> disable the firewall </p> <p> </span></li> <li> <span style="font-size: medium;"> <p style="display: inline !important;"> allow or disallow a port or a network </p> <p> </span></li> <li> <span style="font-size: medium;"> <p style="display: inline !important;"> see firewall status </p> <p> </span></li> </ul> <h3> PREREQUISITES </h3> <ul> <li> <span style="font-size: medium;"> <p style="display: inline !important;"> A management server under Ubuntu maverick. </p> <p> </span></li> <li> <span style="font-size: medium;"> <p style="display: inline !important;"> A supported Operating System for clients which includes : </p> <p> </span></li> <li> <span style="font-size: medium;"> <p style="display: inline !important;"> Debian. </p> <p> </span></li> <li> <span style="font-size: medium;"> <p style="display: inline !important;"> Ubuntu. </p> <p> </span></li> <li> <span style="font-size: medium;"> <p style="display: inline !important;"> RHEL. </p> <p> </span></li> <li> <span style="font-size: medium;"> <p style="display: inline !important;"> Fedora </p> <p> </span></li> <li> <span style="font-size: medium;"> <p style="display: inline !important;"> My patched python-cloudservers library (see below for installs). </p> <p> </span></li> <li> <span style="font-size: medium;"> <p style="display: inline !important;"> Your SSH key installed on all VM for root users. </p> <p> </span></li> </ul> <h3> Install </h3> <ul> <li> <span style="font-size: medium;"> <p style="display: inline !important;"> After you have kicked a VM with a Ubuntu maverick and connected to it as root you want first execute intall some prereq packages : </p> <p> </span></li> </ul> apt-get update && apt-get -y install python-stdeb git <p> checkout my python-cloudservers library : </p> git clone git://github.com/chmouel/python-cloudservers.git <p> after being checked-out you will go into the python-cloudservers directory which has just been created and do this : </p> cd python-cloudservers/ python setup.py install <p> this should automatically install all the dependences. </p> <p> Now you can install my api-demo which include the firewall script : </p> cd ../ git clone git://github.com/chmouel/cloudservers-api-demo <p> You need to configure some environemnt variable first which keep information about your rackspace account. </p> <p> edit your ~/.bashrc (or /etc/environement if you want to make it global) and configure those variable : </p> export RCLOUD_DATACENTER=UK export UK_RCLOUD_USER="MY_USERNAME" export UK_RCLOUD_KEY="MY_API_KEY" export UK_RCLOUD_AURL="https://lon.auth.api.rackspacecloud.com/v1.0" <p> or for the US you would have : </p> export RCLOUD_DATACENTER=US export UK_RCLOUD_USER="MY_USERNAME" export UK_RCLOUD_KEY="MY_API_KEY" export UK_RCLOUD_AURL="https://auth.api.rackspacecloud.com/v1.0" <p> source the ~/.bashrc or relog into your account to have those accounts set-up you can test it to see if that works by going to : </p> ~/cloudservers-api-demo/python <p> and launch the command : </p> ./list-servers.py <p> to test if this is working properly (it should list your servers for your DATACENTER) </p> <p> you are now basically ready to mass update firewall on all servers. </p> <p> Let's say you have two web servers named web1 and web2 and two db servers named db1 and db2 and you would like to allow the 80 port on the web servers and 3306 port on the db servers. </p> <p> You would have to go to this directory : </p> ~/cloudservers-api-demo/firewall/ <p> and first execute this command to see the help/usages : </p> ./fw-control.py --help <p> so let's say to enable the firewall on all the web and db server first you can do : </p> ./fw-control.py -s "web db" enable <p> it will connect and enable the firewall on all the servers which match the name web and db. </p> <p> now let's say we want to enable port 80 on the web : </p> ./fw-control.py -s "web" allow port 80 <p> if you log into the servers you can check with </p> iptables -L -n <p> that it it has been enabled properly. </p> <p> This is simple enough for you to modify the script to your liking to make it more modular for your specific environement. </p>

May 5, 2011

Howto shutdown your Cloud Server and not getting billed for it.

Currently in Rackspace-Cloud when you are shutting-down your Cloud Servers you are still paying for it. The reason is that when the Cloud Server is shut-down your CloudServer is still sitting on the hyper-visor and still use resources on the Cloud and then get you billed for it. There is a way to get around it by having the CloudServer stored as an image into CloudFiles. The caveat with this solution is that every-time you are creating a server out of the stored image you are getting a new IP and in certain cases you would need to make a change in your application with the new IP. ...

April 7, 2011

Uploading to Rackspace Cloud Files via FTP

Sometime ago I wrote a FTP proxy to RackSpace Cloud Files which expose Rackspace Cloud Files as a FTP server acting as a proxy. Thanks to the OpenSource community a user on github took it and add support OpenStack and all the latest features available in Cloud Files. It is now pretty robust and works pretty well via nautilus even with the pseudo hierarchical folder feature. The fun part here is that it allow you to effectively have a Cloud Drive where you can easily store your files/backup from your Linux desktop via nautilus built-in ftp support. ...

April 6, 2011

Installing python-cloudfiles from pypi

I have just uploaded python-cloudfiles to pypi available here This make things easy to add as a dependence of your project like you can have something like this in your setup.py : requirements = ['python-cloudfiles'] and it will automatically download it as part of the dependence with easy_install or pip. cool kids on latest debian/ubuntu can do stuff like this (from python-stdeb package) : pypi-install python-cloudfiles which would automatically download the tarball from pypi and install it as a packages (like the way it should be for prod machine!) ...

February 16, 2011

How to use fireuploader with the Rackspace Cloud UK

Fireuploader is a Firefox addon that gives you a nice GUI to upload files via your firefox browser. I have made a special version of the extensions to make it works with the RackSpace Cloud UK. Install the addon from here : http://www.chmouel.com/pub/firefox_universal_uploader__fireuploader_-0.4.5-fx+mz+ukcf.xpi Allow the website by clicking Allow in the yellow bar on the top as seen in this screenshot : Click on Install Now and restart Firefox. ...

February 7, 2011