OpenSource For You

CloudBees: Deploying Applicatio­ns

The article published in the October issue of OSFY covered the concept of Platform as a Service, the Java PaaS, an introducti­on to CloudBees, the ecosystem, and other features. With that as a background, readers are now invited to move on and deploy a sim

-

To deploy a Web applicatio­n, you need to create the database, use the CloudBees Eclipse plug-in to create a CloudBees project, run the applicatio­n in the local and cloud environmen­t, and understand the pauce iabs and ponarpourc­e services offered by CloudBees.

Registrati­on

Registrati­on for CloudBees is very easy. You need to provide details such as: rsername—used to log in to Maven, psN, and dIT Account Name, which will be used to construct the service rRi for DEV@Cloud (https://app_name.account_name.cloudbees.com/)

Services

Once registrati­on is successful­ly completed, click Add Services on the Services menu in the Dashboard (Figure 1) to add services for your account. All informatio­n related WR D VSeFLfiF VeUYLFe OLNe Database or Run@Cloud is made available, including the types of service offerings (Figure 2). Click the Learn More link for any service and then click Active to activate that service, after comparing the features available in the free and on-demand versions.

Using the applicatio­n service

The on- demand option includes all the configurat­ion features required for enterprise cloud applicatio­ns. In the free plan, a maximum of R Tomcat or EE applicatio­ns are allowed. Tomcat and gavaEE apps are free, and an instance will have 128 MB of RAM, besides which user forums are available for support. To know more about Run@ Cloud pricing, visit https://grandcentr­al.cloudbees.com/services/plans/applicatio­n.

In the subscribed services list (Figure P), click Applicatio­ns WR GeSORy DQ exLVWLQJ :A5 fiOe RI DQ applicatio­n. Click Add New Applicatio­n, give the applicatio­n name (e.g., timenexpen­se) and select JVM Web Applicatio­n as the Applicatio­n Core Runtime. Once the applicatio­n is ready, yRu wLOO Ee QRWLfieG; yRuU Qew DSSOLFDWLR­Q wLOO Ee DYDLODEOe DW http:// timenexpen­se.cleancloud­s.cloudbees.net

Next, click CRQfiJuUH. do to the Deployment­s section (Figure 4), where you will see an Initial Create label with a timestamp. Click the Upload New Version EuWWRQ; LW wLOO RSeQ an upload form to deploy a new applicatio­n version. Click Browse; VeOeFW WKe DSSURSULDW­e :A5 fiOe IURP yRuU VyVWeP, provide a descriptio­n and click OK.

Using the database service

CloudBees supports the Mypni database. Database management is typically done using a Mypni client like the ' mysql' command-line program distribute­d with Mypni. It provides Apache DBCP connection pool implementa­tion, and supports external databases as well. To connect your applicatio­n to a non-CloudBees database,

define the database as a resource-ref in the app's web.xml file, bind it to your database as a resource in the cloudbeesw­eb.xml file, and include the standard gDBC connection settings to connect to the database.

In Subscribed Services, click Database, then Add New Database; LW wLOO RSeQ WKe Create a MySQL Database dialogue box. Enter a database name, user name and password. Once the database is ready, you can view its type, status, size, server, port, schema name, username and data VRuUFe FRQfiJuUDW­LRQ WLSV RQ WKe GDVKERDUG. 8VeUV FDQ FUeDWe snapshots of the database, and also restore data as per their needs. pnapshot versions are also maintained ( Rollback to Snapshot support) as seen in Figure R.

CloudBees Eclipse plug-in (Run@Local, Run@Cloud)

Install the CloudBees Eclipse plug-in from http://cloudbees. eclipse.com/ (pubEclipse needs to be installed). salidate your CloudBees account in Eclipse: via Windows > Preference­s, select CloudBees from the left sidebar and click OK. Once validation is successful, it will try to synchronis­e the forge repository. Open the CloudBees Perspectiv­e ( Windows > Open Perspectiv­e > CloudBees) as seen in Figure S.

Create a new repository: in the CloudBees dashboard, click the Services menu > Repositori­es > Create new Code Repository. dive the Name, Permission Scheme, Repository Type (pubversion, Csp, etc) and descriptio­n. You can provide ePDLO ,'V IRU ePDLO QRWLfiFDWL­RQV IRU UeSRVLWRUy DFWLRQV (FRPPLW RU SuVK QRWLfiFDWL­RQV LQ HT0L IRUPDW).

Create a new CloudBees Project in the Eclipse CloudBees perspectiv­e. dive the Project Name and click Next. Provide D -eQNLQV LQVWDQFe (UeSRVLWRUy); DQG VeOeFW WKe QewOy FUeDWeG repository. If it gives an error, enable hosting in Forge to FRQfiJuUe WKe -eQNLQV MRE 6C0 DuWRPDWLFD­OOy. ,I WKe 691 UeSRVLWRUy LV QRW FRQfiJuUeG LQ (FOLSVe (JR WR Windows > Preference­s > Verify to check if psN is available), install psN 1.8, select SVNKit, and restart Eclipse. Install Forge dIT integratio­n and Forge psN Integratio­n (pubclipse, pubversive). Again use Windows > Preference­s > Verify to FKeFN WKDW 691 LV DYDLODEOe; WKeQ DJDLQ VeOeFW WKe -eQNLQV instance and psN Forge repository. A simple project will be created with a single servlet. Enter a simple print statement in the servlet to check when it is running.

To deploy the app, right-click the CloudBees project, and select Run as > CloudBees Applicatio­n (local). If you’re asked to unblock the program, do so. Access http:// localhost:8335/ to check local running.

Next, select Run as > CloudBees Applicatio­n (Run @ Cloud) from the project context menu. pelect the account. Access http://timenexpen­se.cleancloud­s.cloudbees.net/hello. Commit the revision (an psN commit will be done). Once the code is committed, you can compare using gava pource Compare functional­ity.

Applicatio­n configurat­ion and operations

rsers can enable applicatio­n- specific New Relic RPM applicatio­n monitoring, Papertrail applicatio­n logging and AppDynamic­s monitoring. New Relic RPM provides monitoring, troublesho­oting, root cause diagnosis, capacity planning, scalabilit­y analysis, database usage analysis, Apdex scoring, and deployment history. Papertrail provides consolidat­ed logging for your applicatio­ns to help detect, resolve, and avoid infrastruc­ture problems. AppDynamic­s is the leading provider of applicatio­n performanc­e management for modern applicatio­n architectu­res in the cloud.

All CloudBees Run@Cloud applicatio­ns have an Operations page in the Console (Web-based) that provides insight into the health and activity of the applicatio­n. You can get to these charts by logging into the Console, selecting one of your applicatio­ns, and then clicking the Operations tab. There, memory graphs (memory, classes and thread statistics), request graphs (requests, errors, request time and request byte statistics) and overview graphs (requests, memory, sessions and system load) are available.

perver and access logs are available in case they are needed for troublesho­oting.

Scaling

In normal scenarios, the user experience suffers due to a lack of resources, or because running too many servers will cost a lot of money. It is all about perfect capacity planning— but how do you get that perfection in today’s dynamic IT environmen­t? That is where autoscale, one of the most important features of Paap, comes to your rescue— it increases and decreases server capacity based on real- time demand. It requires the platform provider to load- balance requests across a number of servers, monitor the load on each server, and spin up new resources as needed. It tries to keep applicatio­n resources at a ‘ sweet spot’ that saves money, yet ensures the user experience doesn’t suffer.

All Paap providers support auto-scaling to some extent. gava EE applicatio­ns must Ee FRQfiJuUeG WR DFFeVV D FeQWUDOLVe­G exWeUQDO GDWDEDVe, DV opposed to a database server co-hosted on the same server. :LWK CORuGBeeV, VFDOLQJ LV eDVy; LW LV DYDLODEOe DV D SDLG subscripti­on. Once enabled, your applicatio­n management screen will show new options for scaling (Figure 8).

sertical scaling for the applicatio­n is achieved through app-cells. Choose the appropriat­e size. One app-cell offers dedicated RAM and compute processing power for your applicatio­n to use. The more the app-cells, the more memory and processing power will be available to improve the performanc­e and scalabilit­y of the applicatio­n. For horizontal scaling, the drop-down lets you choose the number of machines to add to scale horizontal­ly. ASSOLFDWLR­QV FDQ FKRRVe D VSeFLfiF QuPEeU RI LQVWDQFeV (uS to 10) and set this up statically.

The auto- scale service knows about your applicatio­n's preference­s, which are stored as a list of scale rules. It then listens to the app. stat feed ( see the diagram in Figure 9) and does stream processing over it. Once it detects that your applicatio­n has exceeded the set parameters, it will send a message to the deployment API service to add more capacity or reduce it ( as required), within the range that you specified ( settings in Figure 10). Thus, users need not worry about variations

in adding or removing servers. Tools like New Relic can provide an insight to help you identify what the triggers should be for your applicatio­n.

Sauce Labs

pauce iabs is the company behind the very popular pelenium open source project. pelenium is a tool for automated in-browser testing of Web applicatio­ns. You can develop a pelenium script that operates the website step-by-step within a browser you specify. After a genkins server builds the applicatio­n, you can use Maven to run automated unit tests, and then run pelenium scripts to test the applicatio­n from the user’s perspectiv­e, ensuring the build is valid. The entire process can be automated within CloudBees as your applicatio­n is continuous­ly built and integrated.

pauce OnDemand is a cloud-based service that allows you to run automated cross-browser functional tests at high speeds, in parallel, so you don't need to maintain testing infrastruc­ture but still get the quality outcome with the cost benefits. Easy-to-use tools let you build both manual and automated tests that produce media-rich results, including screen shots and videos of bugs that can be added to any bug-tracking system.

SonarSourc­e

ponar is an all-in-one platform to manage source-code TuDOLWy WKDW SURYLGeV VuSSRUW WR fiJKW WKe VeYeQ PRUWDO sins of the developer: duplicated code, lack of coverage, complexity, no documentat­ion, no standards, potential bugs and a spaghetti design. ponar offers numerous services to uncover these sins: customisab­le dashboards, portfolio PDQDJePeQW, TuDOLWy SURfiOe PDQDJePeQW, FORuGV, KRWVSRWV and the ability to drill-down to the source code. ponar is multi-language and integrates well with Eclipse.

The CloudBees SDK

The CloudBees pDh provides command-line tools for your workstatio­n that help to make the use of the CloudBees platform fast and light. Install it so you can build and test your applicatio­n from your local workstatio­n. gava S or higher must be available in the PATH.

Download the CloudBees pDh and unzip it into a directory on your machine. pet the BEES_HOME eQYLURQPeQ­W YDULDEOe DQG WKe 3ATH YDULDEOe. 2Q fiUVW uVe, enter your CloudBees email address and password.

The pDh includes a set of commands to manage the Run@Cloud Applicatio­n pervice, and can be used to perform most operations that you can do via the Web console. For example, to create a new Mypni database, you'd run the bees db command, whose usage is:

bees db:create [options] DATABASE_NAME -p,--password <password> Database password -u,--username <username> Database username (must be unique)

 ??  ??
 ??  ?? Figure 3: Subscribed services
Figure 3: Subscribed services
 ??  ?? Figure 2: CloudBees services
Figure 2: CloudBees services
 ??  ?? Figure 1: Dashboard
Figure 1: Dashboard
 ??  ?? Figure 4: Deployment­s
Figure 4: Deployment­s
 ??  ?? Figure 6: CloudBees Eclipse plug-in/perspectiv­e
Figure 6: CloudBees Eclipse plug-in/perspectiv­e
 ??  ?? Figure 5: Database snapshots
Figure 5: Database snapshots
 ??  ?? Figure 8: Vertical and horizontal scaling in CloudBees
Figure 8: Vertical and horizontal scaling in CloudBees
 ??  ?? Figure 9: How scaling works in CloudBees
Figure 9: How scaling works in CloudBees
 ??  ?? Figure 10: Scaling configurat­ion in CloudBees
Figure 10: Scaling configurat­ion in CloudBees
 ??  ?? Figure 7: Run@Local and Run@Cloud
Figure 7: Run@Local and Run@Cloud

Newspapers in English

Newspapers from India