CloudBees: Deploying Applications
The article published in the October issue of OSFY covered the concept of Platform as a Service, the Java PaaS, an introduction 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 application, you need to create the database, use the CloudBees Eclipse plug-in to create a CloudBees project, run the application in the local and cloud environment, and understand the pauce iabs and ponarpource services offered by CloudBees.
Registration
Registration 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 registration is successfully completed, click Add Services on the Services menu in the Dashboard (Figure 1) to add services for your account. All information 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 application service
The on- demand option includes all the configuration features required for enterprise cloud applications. In the free plan, a maximum of R Tomcat or EE applications 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://grandcentral.cloudbees.com/services/plans/application.
In the subscribed services list (Figure P), click Applications WR GeSORy DQ exLVWLQJ :A5 fiOe RI DQ application. Click Add New Application, give the application name (e.g., timenexpense) and select JVM Web Application as the Application Core Runtime. Once the application is ready, yRu wLOO Ee QRWLfieG; yRuU Qew DSSOLFDWLRQ wLOO Ee DYDLODEOe DW http:// timenexpense.cleanclouds.cloudbees.net
Next, click CRQfiJuUH. do to the Deployments 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 application version. Click Browse; VeOeFW WKe DSSURSULDWe :A5 fiOe IURP yRuU VyVWeP, provide a description 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 distributed with Mypni. It provides Apache DBCP connection pool implementation, and supports external databases as well. To connect your application 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 cloudbeesweb.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 FRQfiJuUDWLRQ 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 > Preferences, select CloudBees from the left sidebar and click OK. Once validation is successful, it will try to synchronise the forge repository. Open the CloudBees Perspective ( Windows > Open Perspective > CloudBees) as seen in Figure S.
Create a new repository: in the CloudBees dashboard, click the Services menu > Repositories > Create new Code Repository. dive the Name, Permission Scheme, Repository Type (pubversion, Csp, etc) and description. You can provide ePDLO ,'V IRU ePDLO QRWLfiFDWLRQV IRU UeSRVLWRUy DFWLRQV (FRPPLW RU SuVK QRWLfiFDWLRQV LQ HT0L IRUPDW).
Create a new CloudBees Project in the Eclipse CloudBees perspective. 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 DuWRPDWLFDOOy. ,I WKe 691 UeSRVLWRUy LV QRW FRQfiJuUeG LQ (FOLSVe (JR WR Windows > Preferences > Verify to check if psN is available), install psN 1.8, select SVNKit, and restart Eclipse. Install Forge dIT integration and Forge psN Integration (pubclipse, pubversive). Again use Windows > Preferences > 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 Application (local). If you’re asked to unblock the program, do so. Access http:// localhost:8335/ to check local running.
Next, select Run as > CloudBees Application (Run @ Cloud) from the project context menu. pelect the account. Access http://timenexpense.cleanclouds.cloudbees.net/hello. Commit the revision (an psN commit will be done). Once the code is committed, you can compare using gava pource Compare functionality.
Application configuration and operations
rsers can enable application- specific New Relic RPM application monitoring, Papertrail application logging and AppDynamics monitoring. New Relic RPM provides monitoring, troubleshooting, root cause diagnosis, capacity planning, scalability analysis, database usage analysis, Apdex scoring, and deployment history. Papertrail provides consolidated logging for your applications to help detect, resolve, and avoid infrastructure problems. AppDynamics is the leading provider of application performance management for modern application architectures in the cloud.
All CloudBees Run@Cloud applications have an Operations page in the Console (Web-based) that provides insight into the health and activity of the application. You can get to these charts by logging into the Console, selecting one of your applications, 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 troubleshooting.
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 environment? 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 application 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 applications must Ee FRQfiJuUeG WR DFFeVV D FeQWUDOLVeG 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 subscription. Once enabled, your application management screen will show new options for scaling (Figure 8).
sertical scaling for the application is achieved through app-cells. Choose the appropriate size. One app-cell offers dedicated RAM and compute processing power for your application to use. The more the app-cells, the more memory and processing power will be available to improve the performance and scalability of the application. For horizontal scaling, the drop-down lets you choose the number of machines to add to scale horizontally. ASSOLFDWLRQV FDQ FKRRVe D VSeFLfiF QuPEeU RI LQVWDQFeV (uS to 10) and set this up statically.
The auto- scale service knows about your application's preferences, 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 application 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 application.
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 applications. You can develop a pelenium script that operates the website step-by-step within a browser you specify. After a genkins server builds the application, you can use Maven to run automated unit tests, and then run pelenium scripts to test the application from the user’s perspective, ensuring the build is valid. The entire process can be automated within CloudBees as your application is continuously 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 infrastructure 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.
SonarSource
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 documentation, no standards, potential bugs and a spaghetti design. ponar offers numerous services to uncover these sins: customisable 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 workstation that help to make the use of the CloudBees platform fast and light. Install it so you can build and test your application from your local workstation. 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 eQYLURQPeQW 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 Application 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)