Here is How to Upload Images, Java-scripts, CSS Files to HP Cloud CDN Using OpenStack Swift Python Client From OS X or GNU Linux Terminal. You basically can use this primitive method to upload static contents of WordPress to HP Cloud CDN. The PHP Binding for HP Cloud CDN is unusable with WordPress due to unknown reason. Not everyone can easily use OpenStack Swift Client – neither good guide is available for free anywhere, nor so detailed steps are written for the common users. We hope that, with this guide, users can feel better, as at least it can upload faster than HP Cloud web GUI.
OpenStack Python command-line client is very powerful tool. With this basic idea, you can actually create a script to sync the files. Python is better than PHP plus it is native OpenStack tool, making the basic thing to a WordPress plugin is not very difficult. The practical fact is that – the way the Vendor (read Rackspace, HP Cloud) install OpenStack, the way to authenticate changes with that, which makes the Plugins kind of vendor-locked. Otherwise there are lot of WordPress Plugins for Rackspace Cloud Files, modifying them will not make them working as WordPress HP Cloud CDN Plugin. Learn How to Upload to HP Cloud CDN Using OpenStack Swift Client From This Basic Guide. Your Server is also a computer. You have to filter out the PHP, HTML etc. files on Server’s Public Directory and Upload them to HP Cloud CDN. If you want to develop yourself, do slowly, else wait when we will develop a plugin. There are lot of tools like we wrote in the OpenStack Cloud Tools Python Packages guide.
Upload to HP Cloud CDN Using OpenStack Swift Client : Installing the Python Clients
We published a detailed guide on how to install this tools in HP Helion Public Cloud Getting Started guide. The title of the article possibly was a misnomer. Read that guide if you have not installed the Python Client.
---
We are using iTerm2-HomeBrew-ZSH on OSX, you have to change the method a bit for GNU Linux – only difference is the profile dot file. We are editing the .zshrc
file here.
Upload to HP Cloud CDN Using OpenStack Swift Client : How To Get the Ready Made Configuration File to Authenticate?
OpenStack RC File is actually present – you can find it in your in OpenStack Horizon control panel on HP Cloud. Then go into Access & Security panel, then into API Access tab. Finally, click on Download OpenStack RC File. You will see, under the Access and Security option, there API Access tab. You will get a button like link to Download OpenStack RC File. It will look like this :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | #!/bin/bash # To use an Openstack cloud you need to authenticate against keystone, which # returns a **Token** and **Service Catalog**. The catalog contains the # endpoint for all services the user/tenant has access to - including nova, # glance, keystone, swift. # # *NOTE*: Using the 2.0 *auth api* does not mean that compute api is 2.0. We # will use the 1.1 *compute api* export OS_AUTH_URL=https://region-a.geo-1.identity.hpcloudsvc.com:35357/v2.0/ # With the addition of Keystone we have standardized on the term **tenant** # as the entity that owns the resources. export OS_TENANT_ID=xxxxxxxxxxxxxxxxx export OS_TENANT_NAME="xxxxxxxxxxxx-Project" # In addition to the owning entity (tenant), openstack stores the entity # performing the action as the **user**. export OS_USERNAME="yourusername" # With Keystone you pass the keystone password. echo "Please enter your OpenStack Password: " read -sr OS_PASSWORD_INPUT export OS_PASSWORD=$OS_PASSWORD_INPUT # If your configuration has multiple regions, we set that information here. # OS_REGION_NAME is optional and only valid in certain environments. export OS_REGION_NAME="region-a.geo-1" # Don't leave a blank variable, unset it if it was empty if [ -z "$OS_REGION_NAME" ]; then unset OS_REGION_NAME; fi |
Clean it a bit and add the password thing too :
1 2 3 4 5 6 | export OS_AUTH_URL=https://region-a.geo-1.identity.hpcloudsvc.com:35357/v2.0/ export OS_TENANT_ID=xxxxxxxxxxxxxx export OS_TENANT_NAME="xxxxxxxxxxx-Project" export OS_USERNAME="yourusername" export OS_PASSWORD="yourpassword" export OS_REGION_NAME="region-a.geo-1" |
As we are using Oh-My-ZSH
/ ZSH
shell, we will simply open the file at $HOME
:
1 | nano .zshrc |
and add the thing on the bottom of the file. Then load the environment :
1 | source .zshrc |
You have to install the clients like written in the older Getting Started guide.
Upload to HP Cloud CDN Using OpenStack Swift Client
It is very easy to use. If you run swift
command, you will get a kind of user guide. That is what is written here :
1 | http://docs.openstack.org/cli-reference/content/swiftclient_commands.html |
To test your settings you can run :
1 | swift stat |
It will give you an output like this :
1 2 3 4 5 6 7 8 9 | Account: xxxxxxxxxxxx Containers: 7 Objects: 345 Bytes: 116969 Accept-Ranges: bytes Connection: keep-alive X-Timestamp: 1416220171.44924 X-Trans-Id: ttttttttttttttttttttttttt Content-Type: text/plain; charset=utf-8 |
If you run this command :
1 | swift list |
You will get the list of the containers. If you have a container named test, if you run :
1 | swift list test |
You will get the list of the stuffs inside the container. Suppose, you downloaded that pdf guide on OpenStack docs :
1 | wget http://docs.openstack.org/api/openstack-object-storage/1.0/os-objectstorage-devguide-1.0.pdf |
If you run this kind of command :
1 | swift upload test os-objectstorage-devguide-1.0.pdf |
It will upload the file in the test named container. In this way, you can change the metadata, add headers etc. We will get hacked if we show the real names, so we have shown you another example in the screenshot.
Tagged With paperuri:(0788ef4e94fdc08227dec5770ff19381)