You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by pq...@apache.org on 2010/05/05 04:12:42 UTC

svn commit: r941134 - /incubator/libcloud/site/getting-started.html

Author: pquerna
Date: Wed May  5 02:12:42 2010
New Revision: 941134

URL: http://svn.apache.org/viewvc?rev=941134&view=rev
Log:
Add example of using deploy_node

Modified:
    incubator/libcloud/site/getting-started.html

Modified: incubator/libcloud/site/getting-started.html
URL: http://svn.apache.org/viewvc/incubator/libcloud/site/getting-started.html?rev=941134&r1=941133&r2=941134&view=diff
==============================================================================
--- incubator/libcloud/site/getting-started.html (original)
+++ incubator/libcloud/site/getting-started.html Wed May  5 02:12:42 2010
@@ -33,6 +33,12 @@
     </div><!--/#sidebar-->
     <div id="main" class="span-16 last">
 
+      <h2>Installation</h2>
+      <p>libcloud's current release is 0.2.0, and can be downloaded:</p>
+      <code>wget http://www.apache.org/dist/incubator/libcloud/apache-libcloud-incubating-0.2.0.tar.bz2</code>
+      <p>To install, cd into the libcloud directory, then run:</p>
+      <code>tar -xvjf apache-libcloud-0.2.0.tar.bz2<br/>cd apache-libcloud-incubating-0.2.0<br/>sudo python setup.py install</code>
+
       <h2>Example: Connecting with a Driver</h2>
       <code class="python">from libcloud.types import Provider
 from libcloud.providers import get_driver
@@ -94,12 +100,39 @@ print nodes
 
 # Reboot all nodes named 'test'
 [node.reboot() for node in nodes if node.name == 'test']</code>
-      <h2>installation</h2>
-      <p>Currently libcloud is only available via SVN. To pull the repository please run:</p>
-      <code>svn co https://svn.apache.org/repos/asf/incubator/libcloud/trunk/ libcloud</code>
-      <p>To install, cd into the libcloud directory, then run:</p>
-      <code>python setup.py install</code>
-    
+
+      <h2>Example: Bootstrapping Puppet on a Node</h2>
+      <p>Just creating a node isn't that helpful because each cloud gives you
+      back nodes in different states. The deploy_node API lets 
+      you do more complex actions in cross-cloud portaible manner. It works by 
+      calling create_node, and then SSHing into the node to run a script 
+      or install an SSH Key.</p>
+      <code class="python">from libcloud.types import Provider
+from libcloud.providers import get_driver
+from libcloud.deployment import MultiStepDeployment, ScriptDeployment, SSHKeyDeployment
+
+RACKSPACE_USER = 'your username'
+RACKSPACE_KEY = 'your key'
+
+Driver = get_driver(Provider.RACKSPACE)
+conn = Driver(RACKSPACE_USER, RACKSPACE_KEY)
+
+# read your public key in
+sd = SSHKeyDeployment(open("~/.ssh/id_dsa.pub").read())
+# a simple script to install puppet post boot, can be much more complicated.
+script = ScriptDeployment("apt-get install puppet")
+# a task that first installs the ssh key, and then runs the script
+msd = MultiStepDeployment([sd, script])
+
+images = conn.list_images()
+sizes = conn.list_sizes()
+
+# deploy_node takes the same base keyword arguments as create_node.
+node = conn.deploy_node(name='test', image=images[0], size=size[0], deploy=msd)
+# &lt;Node: uuid=..., name=test, state=3, public_ip=['1.1.1.1'], provider=Rackspace ...&gt;
+# the node is now booted, with your ssh key and puppet installed.
+</code>
+
     </div><!--/#main-->
     <div id="footer" class="span-24">
     </div><!--/#footer-->