SftLayer Develpment Lab Phil Jacksn, Chief Evangelist, SftLayer pjacksn@sftlayer.cm @underscrephil Brad DesAulniers, Sftware Engineer, Advanced Clud Slutins IBM GTS bradd@us.ibm.cm @cb_brad Angel Tmala-Reyes, Senir Sftware Engineer, Advanced Clud Slutins IBM GTS aetmala@us.ibm.cm Jesus Arteche Gnzalez, Clud Slutins Architect IBM GTS jesus.arteche@ie.ibm.cm @chechuirnman Rahul Jain, Custmer Enablement Team Manager IBM GTS rahulj@us.ibm.cm Wissam Elriachy, Clud Slutins Engineer IBM GTS waelriac@us.ibm.cm This lab is designed t intrduce the develper t the capabilities f Sftlayer, its prtal and API. Each develper is given a temprary accunt in SftLayer, a simple PHP Drupal-based applicatin, and a smartphne-accessible web page. The develper gets a hands-n experience with SftLayer thrugh their wrk n the deplyment f the applicatin, making small cde changes in it, and perfrming end t end testing.
The web page will allw the develper t uplad a vide frm their smartphne. The PHP applicatin uses SftLayer Message Queues t pass the vide t the Transcding service and prepare it fr the SftLayer Object Stre where the cnverted vide will be available fr viewing. Prerequisites 1. A temprary accunt in SftLayer (prvided) 2. A laptp cmputer with an ssh and VNC clients 3. A smart phne 4. Basic familiarity with Linux and PHP Make sure that yur laptp has an ssh client installed (e.g. Putty if yu are using Windws), as well as a VNC client (e.g. TightVNC). Make sure yu get yur temprary SL credentials (user id and pass). Create a Virtual Machine in SftLayer Using the accunt credentials (userid and passwrd), lg int the SL prtal at https://manage.sftlayer.cm prvisin a Clud Cmputing Instance (a.k.a. Virtual Machine r CCI) Click n Virtual Image Templates Lk fr the Impact SftLayer Dem line item and click Order link n that line Chse the Hurly Virtual Server Chse a Data Center (DAL05 is best)
All ther values can be left at their default. At the bttm f the page click n Cntinue Yur Order On the summary page, chse a Hstname and Dmain. Smething like impact-dem.sftlayer.cm is a gd start. We recmmend adding a number r sme ther variable as part f the Hstname t differentiate yur instance. All ther values shuld be left at their default. Read and accept the Master Service Agreement Select Finalize Yur Order This CCI has a PHP develpment envirnnment (Eclipse), vnc server, and the surce cde fr all applicatins used in this lab. Find yur CCI In the Prtal, g t Virtual Cmputing Search fr yur Clud Cmputing Instance (CCI) Yu can find the infrmatin abut yur CCI by clicking n its name nce it is ready. Yur CCI is ready when the Transactin in prgress nte disappears (yu will need t refresh the page t see the ready state; it will nt aut-refresh)
In the Cmputing Instance Summary field, yu will find the IP address (bth public and private) as well as the rt passwrd: Retrieve yur Message Queue and Object Stre Accunts On the Prtal, g t Public Netwrk Message Queue Select the SLMQ307608-2 message queue accunt e.g see the capture belw. Select View Credentials t see yur user ID and API key. Make a nte f their values.
G t Public Netwrk Object Strage Select Object Strage and then select the Object Stre listed, e.g. Chse the Dallas 5 ptin Click n View Credentials t see yur Object Stre username and API key. Make a nte f their values.
Create tw new cntainers with unique names (add yur userid t the name f the cntainer). One will hld transcded bjects and the ther is a temprary space. Use the Add Cntainer link: Ensure that yur Cntainer fr transcded bjects has CDN enabled (n the right side f the screen):
At this pint, yu will need t ensure that the CCI cmpleted prvisining. This step takes abut 3-5 minutes n average. Yu shuld be able t click n the CCI details, as shwn in the sectin abve, and jt dwn its external IP address. Cnfiguring Settings Next, yu will need t ssh int the CCI using a client f yur chice. This culd be putty if yu are a Windws user, r the cmmand line ssh client if yu are n linux, e.g. ssh rt@yur.cci.ip (enter the passwrd when prmpted). The first step is t ensure Apache is running. Invking this cmmand will start it: service apache2 start When the CCI bts up, the PHP / Drupal applicatin will already be started. Hwever, yu will need t change the Drupal admin passwrd befre they can access it via the fllwing script: /rt/alter_pass.sh YOUR_PASSWORD If yu wish t cnnect via VNC, run su - develper and run vncpasswd t set the VNC passwrd. Yu can nw use VNC t access the CCI. If yu prefer the cmmand line, yu can skip this step.
Edit /var/www/uplad.php and set yur Message Queue infrmatin. The accunt variable is the accunt id f yur message queue accunt, 5yeju in the example. Ensure that yur $newqueue variable is unique. Fr instance, in the screen capture belw, it culd be set t pulse5a pulse5 being yur userid and a is the first queue. Alternately, yu can use Eclipse (via VNC) t edit the file in the wrkspace and use the Ant build file (prjectbuilder.xml) t deply t the web server. Nw yu will need t create all f the messaging queues, using the SftLayer CLI which is pre-installed n yur CCI. Befre yu can use it, yu need t cnfigure it as fllws: # sl cnfig setup It will prmpt yu fr yur userid, the API key and the Endpint (select private ). Once this step is cmpleted, yu shuld be able t explre and interact with the resurces in yur accunt. Fr instance # sl cci list Shuld give yu the list f all f yur CCIs and yu shuld see the CCI that yu re using in this list. #sl messaging accunts-list Shuld display the messaging accunts that yu have access t. T see the list f existing queues fr the messaging accunt, we d #sl messaging queue-list 5yeju Nw, let us create the fur required queues (replace with yur wn accunt id and queue name) # sl messaging queue-add 5yeju pulse5a # sl messaging queue-add 5yeju pulse5b # sl messaging queue-add 5yeju pulse5c # sl messaging queue-add 5yeju pulse5d
At this pint, yu can hit the Drupal web applicatin cnfiguratin page and lg in as 'admin' with the passwrd that yu specified as the parameter abve. http://yur.cci.ip.address/admin/settings/sftlayer_vide Here, yu can set yur SftLayer prperties fr the Message Queue and Object Stre. Ensure that yur queue names are exactly the same nes as yu previusly created.
Yu will need t enter the Surce and Cmplete Cntainer names yu created abve in the Object Stre. Nte that the OBJ_STOR_ID shuld include yur username as well, e.g. SLOS307608-2:pulse5 Please us the same New Jbs - $newqueue input queue name as yu used in uplad.php r the flw will nt wrk.
Click save cnfiguratin when dne.at this pint, the user is ready t test drive the applicatin Uplad a Vide G t the mbile vide uplad page, e.g. http://yur.cci.ip.address/uplad.html frm yur mbile device. Hld yur phne hrizntally (ps! ur transcder will nt wrk if the vide is vertical) and take a brief vide. Click uplad when yu're dne and wait fr the uplad t cmplete. At this pint, the user shuld be able t access the vide transcding dashbard: http://cci_ip/admin/reprts/sftlayer_vide This page lks like this:
This dashbard is tied t the status f fur messaging queues in yur SftLayer accunt and updates autmatically every five secnds. The freshly upladed vide shuld get int the first, New queue, tied t indicatr #1 and increment its cunter by 1. Give the number just a few secnds t update and yu shuld see it. Click the Lad New Vide buttn. In a few secnds, yu shuld see the secnd indicatr increment. The vide was just passed frm the New t ready t transcde queue. Nw click the send vide t transcder buttn. The vide is mved t the next queue and submitted t the SftLayer's Transcding service. This peratin may take a few minutes depending n the amunt f traffic that SftLayer's transcding srevice is experiencing at the mment. Please be patient. Yu culd click the Check Transcde Status buttn t see what's happening with yur vides. Als keep in mind that SftLayer's transcding service is free f charge and is limited t just three pending vides at a given pint in time. If yu attempt t add a furth vide t the pending state, yu'll receive a warning message in the GUI. Once a transcding jb is finished, the vide will be transferred t the cmpleted queue. The Publish number will increment. Click the publish buttn t transfer the vide frm the last queue t yur Object Strage accunt and t add the link t it t the cntent sectin f the Drupal installatin. Yu shuld be able t see all f yur transcded vides at the fllwing link: http://yur_cci_ip/admin/cntent Yu shuld be able t view the surce cde f this simple applicatin by either ssh'ing t the CCI and lking at
/var/www/sites/all/mdules/sftlayer_vide/sftlayer_vide.inc r by cnnecting t the CCI using VNC. Yu can launch Eclipse (using the shrtcut n the desktp) and view the cde under VideUplader sites all mdules sftlayer_vide sftlayer_vide.inc Cnclusin We explred SftLayer functinality thrugh the use and deplyment f a simple Drupalbased applicatin, which interacts with the SftLayer Object Strage and Messaging Queue APIs, as well as SftLayer's transcding service. We als explred the SftLayer Web Prtal and the Pythn CLI. Hpefully, this was nt t hard and illustrates just hw easy it is t get started with SftLayer!