- Task 1. Set up your Bluemix account
- Task 2: Create your starter application on Bluemix
- Task 3: Set up your DevOps account
- Task 4. Obtain the sample code
- Task 5: Add Data Cache service
- Task 6: Build, deploy and run your application
- Task 7: Add Monitoring and Analytics service
- What’s next?
IntroductionIn this introduction you’ll learn important concepts and architectural considerations for using Bluemix to host a web application on the cloud.
Why deploy your application on BluemixThere are many different types of web applications running on the Internet today. There are also just as many ways to manage and maintain the infrastructure powering those applications. IBM Bluemix delivers quick and easy cloud capabilities to deploy and maintain your web application, with minimal hassle and overhead. Applying industry-adopted standard architecture capabilities into our application deployments allow us to confidently advance and grow our infrastructure. Hosting applications on Bluemix provides users with a lot of advantages. Bluemix is an end to end offering that provides developers with a complete set of DevOps tools and integrated services to simplify development, test, build and deployment of applications. Moreover, Bluemix-hosted applications have access to the capabilities of the underlying cloud infrastructure. Such infrastructure provides the best support for non-functional requirements that are needed to support enterprise applications such as scalability, performance, availability, and security. Furthermore, Bluemix provides a rich set of services to extend your application through incorporation of sophisticated analytics, social and mobile capabilities. Finally, the Bluemix platform frees developers and organizations from worrying about infrastructure-related plumbing details and focus on what matters to their organizations – business scenarios that drive better values for their customers. The subsequent sections discuss the main considerations for deploying your web application with IBM Bluemix and provide an architecture overview. We suggest that you go through these sections first before starting on the ‘Liberty Series’ workshops.
Introduction to the Liberty web applicationIn the ‘Liberty Series’ workshops, you will deploy an existing web cache application, taking advantage of certain architecture elements of a web application hosting pattern, and extend it using some of the services available on Bluemix. The primary objective of extending this application’s capabilities is to showcase how a web application can scale significantly and easily by employing a set of easy to use services that are provided to you as part of Bluemix platform. We also showcase the use of third party services that are leveraged to load test the application and to showcase how scaling capabilities are reacting to load changes over time. The list of services that are used in the workshop are summarized below:
- Data Cache: An IBM Bluemix service that supports distributed caching scenarios for web and mobile applications. The caching service uses the technology of a data grid in which you can store key-value objects. Data Cache offers a business-ready, in-memory data grid (IMDG) that places the data close to the logic and keeps it there as the business scales up.
- Auto Scaling: In IBM Bluemix, you can automatically manage your application capacity depending on incoming loads and policies. The IBM Auto-Scaling for Bluemix service enables you to automatically increase or decrease the compute capacity of your application. The number of application instances are adjusted dynamically based on the Auto-Scaling policy you define. The service also provides metric statistics for the instances of your application. You can see the average statistics and select specific instance statistics.
- Monitoring and Analytics: An IBM Bluemix service that provides users with the visibility and control you need over your application. Determine the response time your users see, understand the performance and availability of the application components, and leverage analytics to keep your application up and performing well. The service also provides capabilities for diagnosing problems faster by quickly identifying the root cause of application problems with line of code diagnostics. It also provides the ability to intelligently search through logs and metrics data to find the answers to applications problems.
- Load Impact: A third party service that provides for unlimited testing, on-demand from multiple geographic locations where you can create sophisticated tests using our simple GUI or connect directly to Bluemix via our API.
Cloud architecture overview for web app hostingThrough this workshop series, we will incrementally grow our capabilities to adapt a standard web application into an architecture more in-line with an industry proven architecture for web application hosting. This web application hosting reference architecture (shown below) and documented at the Cloud Standards Customer Council Resource Hub, covers in detail everything from the user requesting the initial URL all the way through the backend data calls. The following explains the components of the web application hosting reference architecture:
- Inbound user requests are initially handled by Domain Name Services, which route your traffic to the proper infrastructure endpoints.
- Content Delivery Networks provide the least latency and the highest speed to create an exceptional end user experience for all your static application content.
- Firewalls provide a boundary to help keep intruders out while your web application operates smoothly.
- Load Balancers allows configurability and flexibility to manage the traffic and resource usage of server nodes in your environment so that no single device gets overwhelmed.
- The Web App Server component is the heart of your web application, serving up your core application to end users. Build your server infrastructure using high performance containers, virtual machines, or Cloud Foundry-based runtimes, all of which can be similarly integrated across the architecture.
- The User Registry Services enable authorization and authentication to secure resources across your application.
- Session and Data Caching ensure low latency data access and prevents data loss for a robust end-user experience. Additionally, Storage services allow you to customize and have total control over a SAN or NAS solution that fits your storage needs.
- Managed Database Services deliver high-performance database support, while allowing you to focus on your application and not database maintenance. These databases range from standard SQL databases to newer NoSQL databases to Big Data services.
Task 1. Set up your Bluemix accountIBM Bluemix is an open-standards, cloud-based platform for building, managing, and running all types of applications: mobile, smart devices, web, and big data. The Bluemix capabilities include Java™, mobile back-end development, application monitoring, and features from ecosystem partners and open source, all through an as-a-service model in the cloud. Before you can use the Bluemix capabilities, you must register for an account. Sign up at no charge at and you will have a 30-day free trial. After the 30-day free trial, you will need to provide a credit card to pay as you go for your resource usage. After you sign up, you can find helpful information in the overview section of the Bluemix Docs. Note: You can run the steps listed in this workshop on any operating system you like. All you need is access to a browser and having the right set of login information on Bluemix and IBM DevOps.
- Log in to Bluemix. The dashboard opens as shown: The dashboard shows an overview of the active Bluemix space for your organization. By default, the space is dev and the organization is the project creator’s user name. For example, if firstname.lastname@example.org logs in to Bluemix for the first time, the active space is dev and the organization is email@example.com. If you create more organizations or spaces in Bluemix, be sure to use the same ones as you follow the tutorials. Use the default selections.
Task 2: Create your starter application on BluemixGiven that we have a simple web application, we chose the Java Liberty profile application. The Java Liberty profile allows for runtimes that are typically built using a small footprint (< 54 MB) which provides for faster updates during builds. The Liberty profile also provides additional advantages for small memory overheads, startup times, instance creation, and easier migration for the cloud. Given that we are showcasing auto scaling that may require creating additional instances to handle potential new loads, the Liberty profile would provide great support for what we are trying to accomplish. To get started with this task, follow the next steps.
- Select CREATE AN APP to start your new application then select WEB.
- Select Liberty for Java and click CONTINUE.
- Name your application to Bluemix-Java-CacheLab, and click Finish . Tip: If you get an error saying “Someone already used that name”, just add your initials to this name. In that case, use this name in the instructions below instead of Bluemix-Java-CacheLab. Save this name we will be using this later.
- Go back to the dashboard by clicking on Back to Dashboard from the left navigation.
- Click on the your new application. The details window for the application opens. Notice that on the right side of the screen is the APP HEALTH section. If your application initially displays as stopped, it means that Bluemix is staging it (the status will show as Your application is staging). Wait for the status to change to Your app is running.
- Click on the Routes URL located just below your application name. Your shell application should now show this Hi World! screen in a new browser tab. You now have an empty Java application created in your workspace that creates a simple Hi World! message. Let’s do something interesting with it. Note: Do not close the Bluemix Dashboard tab. If you accidentally closed it, log in again to Bluemix and click on the Dashboard. Now we will need to import some code into our simple Java application that we created earlier and then use a service to make it more interesting. In order to import some code into our application, IBM uses JazzHub repository which is very similar to GitHub, but provides additional integration and build services for Bluemix. To get started with JazzHub, you need to register for a free account.
Task 3: Set up your DevOps accountIBM DevOps opens the door to a new way of working that offers faster development, without sacrificing quality or security. IBM Cloud DevOps solutions provides developers with access to all the services they need to develop and deliver innovative applications quickly. In this workshop, we will be using IBM’s DevOps services on the cloud to edit, build and deploy the code used for the sample test application. Therefore, you must have a user ID in order to access such services. To get started with this task, follow the next steps:
- Log into JazzHub.
- If you already have an IBM id click on LOG IN link on the top right. If you don’t have an IBM id click on Sign up for free and complete the required fields.
Task 4. Obtain the sample codeIn the previous step we created an empty Java Liberty Profile application that does nothing interesting. In order to make this application useful, we need to import our sample application code that is available publicly on IBM’s JazzHub repository. Since you have created an IBM DevOps login in the previous steps, you can use that in this step to get access to that code. In this step, you will create a replica of the code and copy it into your local domain in JazzHub. To get started with this task, follow the next steps:
- Go to the URL for the sample project.
- Select FORK PROJECT located in the upper right corner of the screen to create your own copy of the web cache data project.
- You need to use the same name you gave to your Bluemix Java Liberty application to the project you create in JazzHub: Bluemix-Java-CacheLab. The following lists the settings:
- Name your project: Bluemix-Java-CacheLab
- Make it private: Leave it unchecked
- Add features for Scrum development: Checked
- Deploy to Bluemix: Checked
- Region: Accept default
- Organization: Select your personal organization
- Space: Select dev
Task 5: Add Data Cache serviceThe application code that you forked in the previous step was mapped to the Java Liberty Profile starter application Bluemix-Java-CacheLab that you created earlier in See Task 2: Create your starter application on Bluemix. As part of that process, you specified the application name to be similar to the name of directory in your local domain on JazzHub. The application code that you forked assumes the use of a Data Cache service that is available from Bluemix. In this task, we will use the service catalog in Bluemix to search for the Data Cache service and bind it to our Java Liberty Profile application. Once you bind the Data Cache service, you can build and deploy the new code and you should see effect of importing the code into the Bluemix project. To get started with this task, follow the next steps:
- Go back to the Bluemix Dashboard tab and click on ADD A SERVICE OR API.
- Search for Data Cache by typing the name or parts of it in the search field.
- Click on the Data Cache service to open the details.
- Make sure that under App, you have the same Java application we created in this workshop selected: Bluemix-Java-CacheLab. Leave the other options as is and click CREATE. You will get a Restage Application popup. Click RESTAGE. You will get a temporary message Your application is restaging. Why restage?: Since you added a new service to a running application, you are prompted to restage the application to update it with the new service. Bluemix is trying to make sure that the application code is up to date with any changes that were applied. The Data Cache service is now created and bound to your application. The service is not ready for use yet. Each time you create a service, Bluemix creates a service name. In the application code that we imported from JazzHub, the code assumes a different service name. We need to fix that before we can put this service to good use.
- Go back to the Bluemix Dashboard. You should see the new Data Cache service that you created. You may have a different service name than what is showing in this document. Make a note of the service name since you will be using that to update a configuration file . In the context of this workshop, the service name is Data Cache-wo.
Task 6: Build, deploy and run your applicationWe now need to configure our code to use the Data Cache service we created in the the earlier task. The name of the service in the context of this workshop is Data Cache-wo. For you, this name will be different. In order to configure the build and deploy for the first time, follow the next steps:
- Go to the IBM DevOps browser tab where you created your new project earlier in the workshop. If that page is closed, login to your IBM DevOps account and select the project you created for this workshop.
- Click EDIT CODE.
- Click the dropdown and select CREATE NEW.
- Make sure that you select the name of the application you created in the Application Name and Host fields. Click on the drop down and select your values that map to your application.
- Click the NEXT> button. In the next step, we need to make sure that our Data Cache service that we created earlier is selected in the Bound Services column on the right. Follow the steps highlighted in red and click DEPLOY when you are done.
- Wait until the application deploys. Once it deploys successfully, click on the arrow and notice the binding to the region and the green circle for successful deployment. Tip: Application deployment may take a couple of minutes. You will know it’s done when the popup window disappears and the green circle shows up in the app name dropdown as shown in See Application deploying.
- Go to the Bluemix Dashboard and click on your application to view the details. Click on the Routes URL. You should see the application’s screen. Try to put a value and click Put. Tip: If you cannot see the screen below, remove the cached data from your browser since it could be caching the old version of the application (Hi World).
Task 7: Add Monitoring and Analytics serviceThe final task in this workshop is to add the Monitoring and Analytics service – an IBM Bluemix service that provides users with the visibility and control you need over your application. Determine the response time your users see, understand the performance and availability of the application components, and leverage analytics to keep your application up and performing well. The service also provides capabilities for diagnosing problems faster by quickly identifying the root cause of application problems with line of code diagnostics. It also provides the ability to intelligently search through logs and metrics data to find the answers to applications problems. Perform the following steps to add Monitoring and Analytics Service to your application:
- Go to your Bluemix Dashboard tab and click on ADD A SERVICE OR API.
- Search for Monitoring and Analytics by typing the name or parts of it in the search field.
- Click the Monitoring and Analytics service to open the details.
- Make sure that under App, you have the same Java application we created in this workshop selected: Bluemix-Java-CacheLab. Leave the other options as is and click CREATE.
- When the Restage Application popup appears, click RESTAGE.
- Click on the Bluemix Dashboard and then click on your application to see the latest application status.
- Look at the APP HEALTH. Once it shows running click on the Routes URL.
- Add some fields in the screen with encryption and without encryption. Tip: If you cannot see the screen below, remove the cached data from your browser since it could be caching the old version of the application (Hi World). Adding Monitoring and Analytics allows us to view runtime statistics about our application as we see in the subsequent steps.
- Return to your Bluemix Dashboard. Click the Monitoring and Analytics Service. You should see three tabs: The first tab, Availability, provides some information about the availability of the application. The second tab, Performance and Monitoring, provides information about performance of the application, and the third tab, Log Analysis, provides information about the application logs.
- Click on the Performance and Monitoring tab to see the performance of the application. Tip: Your results may differ from what’s shown here.
- Click on the Log Analysis tab to see the logs related with the application.