vCloud Private Hosting: Using the vCloud SDK for PHP: Part 1

4 篇文章 0 订阅
2 篇文章 0 订阅

vCloud Private Hosting: Using the vCloud SDK for PHP: Part 1

vcloud private hosting sdk with php

If you are looking to set up your own vCloud Private Hosting and are looking to use the vCloud SDK with a language you are familiar with such as PHP, this post should help shed some light on the process. At Cloudhelix we make use of the vCloud SDK for various automation and reporting tasks. The good news is that customers can use it with their own vCD login in the same way.

Why would you want to do that? There are various reasons:

  • You may wish to write your own PHP applications for deploying vApps on demand.
  • You may wish to keep on top of your resource usage in line with your company’s reporting policies.
  • You may wish to add custom metadata entries to your vApps or virtual machines – we regularly poll the vCloud private hosting environment to record these, so if you would like your internal PO number for a virtual machine to show up on your bill (for example) we could arrange to look for the metadata value and add this automatically.

Future blog posts will go into particular configuration requirements in more depth – first, let’s quickly get things up and running to test with, using XAMPP on a CentOS 6.5 virtual machine.

NB: the versions below are correct at the time of writing, however feel free to check for updates and amend accordingly, if some time has passed.

As always, while we are proceeding with simple settings for the sake of this demo, please review and choose settings in line with your organisation’s policies.

First, download and install XAMPP:

  
  
wget http://downloads.sourceforge.net/project/xampp/XAMPP%20Linux/1.8.3/xampp-linux-x64-1.8.3-4-installer.run
chmod +x xampp-linux-x64-1.8.3-4-installer.run
./xampp-linux-x64-1.8.3-4-installer.run

As shown, there is a simple setup wizard:

sdk-demo-1
  • Run /opt/lampp/lampp security to set passwords.
  • If you want to test any webpages from outside the local LAN, edit theLocationMatch section of /opt/lampp/etc/extra/httpd-xampp.conf (or comment it out).
  • Start the service

  
  
ln -s /opt/lampp/lampp /etc/init.d/lampp
chkconfig lampp on
service lampp stop
service lampp startapache

The following are required by the vCloud SDK:

  • HTTP_Request2
  • Net_URL2

These can be added as follows:

  
  
wget http://download.pear.php.net/package/HTTP_Request2-2.2.1.tgz; wget http://download.pear.php.net/package/Net_URL2-2.0.5.tgz
tar -xzf HTTP*.tgz;tar -xzf Net*.tgz
mv HTTP_Request2-2.2.1/HTTP/Request2* /opt/lampp/lib/php/HTTP
mv Net_URL2-2.0.5/Net/URL2.php /opt/lampp/lib/php/Net

Ensure that your path is correct: export PATH=$PATH:/opt/lampp/bin/ – the PATH entry in ~/.bash_profile can be also be amended for future use.

sdk-demo-2

Now, onto the reason we have done all this – download the vCloud SDK. The main page is here – the Download button should take you to a My VMware login page.

Once you have uploaded the file to your server:

  
  
tar -xzf vcloudPHP-*.tar.gz
mv vcloudPHP-5.5.0/library/VMware/ /opt/lampp/lib/php

You should now be ready to go! In this example, I am using the script inventory.php that is provided as a sample with the SDK download – because I am using a demo customer login, I have edited it and commented out the call to the provider resources function, which would require a system administrator login.

sdk-demo-3

  
  
cd vcloudPHP-5.5.0/samples/
php inventory.php -s https://vcloud.cloudhelix.net -u cloudhelix-demo@cloudhelix-demo -p <insert_password_here> -v 5.5

sdk-demo-4

As shown in the warning, certificate validation should be used in a production environment as a best practice – this has not been included for the purposes of this demo.

However, as a basic test it has been successful – we have retrieved a list of the four vApps in this demo customer Org – a couple used for demonstrating the performance gains with flash-accelerated storage, the Cloudhelix half of the failover demo previously detailed here, and finally the server we have built for the purposes of this SDK demo.

Future posts in this series will cover more configuration examples – check back again soon!


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值