Search This Blog

Friday, April 26, 2013

Challenge 10 script

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

Challenge 10 script

Below is the output and results from script #10 from the api-challenge.
The script shows more advance example how consume cloud resources like cloud servers, cloud load balances, cloud files and cloud dns. It does it by building a simple solution.

The script can be repeatedly run with the option -d otherwise it stops if any of the cloud objects it wants to create already exist.
Depending on the obligatory -n options it will create cloud objects with predictable names.
Below is an example what objects it creates and what the naming conversion is.

# python

    usage: [-h] [-v] [-d] [ -s ssh-key ] [ -e error-page ] [ -c container-name ] [ -i image-id ] [ -f flavor-id ] -n FQDN-name

    image-id -f flavor-id
        -h - usage help
        -v - verbose / debug output
        -d - delete objects if they existed in cloud before creating new one
        -n - FQDN name like
        -s - path to your ssh public key (not priv!)
        -e - path to a html file that will be served from the LB when all pool members are down
        -c - name of cloud files container-name to store the backup data
        -i - specify image-id or use the default for Ubuntu 10.04
        -f - specify flavor-id or use the default for the smallest cloud server

# python -d -n
[22:50:46] Checked your ssh public key /root/.ssh/, ok
[22:50:46] Checked your error page error.html, ok
[22:50:50] Deleted existing cloud server
[22:50:54] Deleted existing cloud server
[22:50:54] Checked your existing cloud server*, ok
[22:50:56] Deleting existing domain
[22:50:57] Checked your FQDN, ok
[22:50:57] Checked your DNS domains, there is none, ok
[22:50:57] Deleted container
[22:50:57] Checked your container where we are going to keep backup data, ok
[22:50:59] Checked your lb, there is none, ok
[22:51:01] Checked your image id d4c7b93d-9f18-45dc-aa7c-3e3b126e3792, ok
[22:51:01] Checked your flavor id 2, ok
[22:51:01] Building 2 cloud servers
[22:53:37] Building and configuring lb ...
[22:54:15] Building and configuring dns domain ...
[22:54:18] Backuping files to cloud files ...
[22:54:19] ----------------------------------------------------------------------
[22:54:19] vip name and ip
[22:54:19] cloud server added to pool as
[22:54:19] cloud server added to pool as
[22:54:19] Error page is stored in container under name error.html
[22:54:19] to check if the config works try to: curl -v

These are some steps to verify the config.
# dig +short @

# nova list | grep challenge10                                                                          23:03:28
| 35e831a5-cfc8-44a7-98ff-1a003cc30901 | | ACTIVE | public=2a00:1a48:7805:0113:8cfc:cf10:ff08:21ff,; private= |
| 06259b99-33d0-4537-94ab-e1be032337aa | | ACTIVE | public=2a00:1a48:7805:0113:8cfc:cf10:ff08:3c44,; private= |

# curl -v
* 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: Thu, 25 Apr 2013 23:26:45 GMT
< Connection: close
< Content-Type: text/html
<                                                                                                                                   23:28:27
* Closing connection #0
    <title>Challenge 10 - Default error page on LB</title>
  <body> Sorry but all pool members failing health checks. </body>


No comments:

Post a Comment