Search This Blog

Wednesday, April 24, 2013

Challenge 7 script

The full summary of all posts for API Rackspace challenge can be found here:
Rackspace api-challenge summary

Challenge 7 script

Below is the output and results from script #7 from the api-challenge.
The script first searches for an existing load balancer with a name of challenge7-vip. If it finds it stops. You have to delete the lb first.
If there is not lb with this name it start of creating 2 new cloud servers with names challenge7-0 and challenge7-1.
After the cloud servers are built it create a new LB and adds the servers as node.
At the end it prints some info what it did.
Neither the cloud servers or the lb are deleted after the script run.
root@manage2:~/api-challenge# python
[23:50:36] found lb challenge7-vip, please remove it before reruning the script

    usage: [-h] [-v]
        -h - usage help
        -v - verbose / debug output

$ python 
[23:39:31] Building 2 cloud servers
[23:43:13] Building and configuring lb ...
[23:43:39] lb name : challenge7-vip 
[23:43:39] lb status : ACTIVE 
[23:43:39] lb created : {u'time': u'2013-04-23T23:43:12Z'} 
[23:43:39] lb virtual_ips : [<VirtualIP type=PUBLIC, id=2525, address= version=IPV4>] 
[23:43:39] lb port : 80 
[23:43:39] lb protocol : HTTP 
[23:43:39] lb algorithm : RANDOM 
[23:43:39] lb nodeCount : 2 
[23:43:39] Node: {'port': 80, 'condition': 'ENABLED', 'address': u''}
[23:43:39] Node: {'port': 80, 'condition': 'ENABLED', 'address': u''}

With the default configuration we put in place we can run only a simple test. You can see that the lb VIP is responding to pings but not for HTTP requests. This is expected behavior as our cloud servers are not configured and there is not Apache listening on port 80.
# ping
PING ( 56(84) bytes of data.
64 bytes from icmp_req=2 ttl=61 time=0.657 ms

# curl -v                                                                                  23:57:09
* About to connect() to port 80 (#0)
*   Trying connected
> GET / HTTP/1.1
> User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/ libidn/1.23 librtmp/2.3
> Host:
> Accept: */*
< HTTP/1.1 500 Internal Server Error
< Date: Tue, 23 Apr 2013 23:55:36 GMT
< Connection: close
< Content-Type: text/html
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>Service Unavailable</title>
<style type="text/css">
body, p, h1 {
  font-family: Verdana, Arial, Helvetica, sans-serif;
h2 {
  font-family: Arial, Helvetica, sans-serif;
  color: #b10b29;
<h2>Service Unavailable</h2>
<p>The service is temporarily unavailable. Please try again later.</p>
* Closing connection #0


No comments:

Post a Comment