Book Image

DevOps for Web Development

By : Mitesh Soni
Book Image

DevOps for Web Development

By: Mitesh Soni

Overview of this book

The DevOps culture is growing at a massive rate, as many organizations are adopting it. However, implementing it for web applications is one of the biggest challenges experienced by many developers and admins, which this book will help you overcome using various tools, such as Chef, Docker, and Jenkins. On the basis of the functionality of these tools, the book is divided into three parts. The first part shows you how to use Jenkins 2.0 for Continuous Integration of a sample JEE application. The second part explains the Chef configuration management tool, and provides an overview of Docker containers, resource provisioning in cloud environments using Chef, and Configuration Management in a cloud environment. The third part explores Continuous Delivery and Continuous Deployment in AWS, Microsoft Azure, and Docker, all using Jenkins 2.0. This book combines the skills of both web application deployment and system configuration as each chapter contains one or more practical hands-on projects. You will be exposed to real-world project scenarios that are progressively presented from easy to complex solutions. We will teach you concepts such as hosting web applications, configuring a runtime environment, monitoring and hosting on various cloud platforms, and managing them. This book will show you how to essentially host and manage web applications along with Continuous Integration, Cloud Computing, Configuration Management, Continuous Monitoring, Continuous Delivery, and Deployment.
Table of Contents (16 chapters)
DevOps for Web Development
Credits
About the Author
Acknowledgments
About the Reviewer
www.PacktPub.com
Preface

Preface

DevOps is part of almost every discussion in the project team, sales team, customer engagements, and so on. Yes, it is a Culture but customers are asking for Proof of Concepts of automation that can be utilized in the Application Life Cycle Management. Even though DevOps is in early stage and it is about changing the existing culture that invites resistance, still it is wise to follow what Socrates said:

"The secret of change is to focus all your energy not on fighting the old, but on building the new."

The reason behind the culture shift is to keep pace with evolution with ongoing revolution, innovations, and business demands in the highly dynamic and competitive market.

Main objective is to manage frequent releases effectively. The faster you fail, the faster you recover. To fail early is far better than to fail at the end of the phase where roll back is very difficult. By automating repetitive processes, you standardized the management of application lifecycle and avoid error prone manual processes.

In this book, we will cover all the key components of DevOps such as Continuous Integration, Cloud Computing, Configuration Management, Continuous Delivery, and Continuous Deployment; how to automate build integration, provision resources in cloud environment such as AWS and Microsoft Azure, use containers for application deployment, use Chef configuration management tool to set up runtime environment for application deployment; deploying web application into virtual machines configured with Chef, AWS Elastic Beanstalk, Microsoft Azure Web Apps, and Docker containers; application monitoring with Nagios, New Relic, and Native Cloud Monitoring features as well.

For Continuous Integration, we have used Jenkins 2. Orchestration of end to end automation is managed by Pipeline.

Jenkins 2 is aimed to claim Continuous Delivery space also. It brings a new setup experience and interesting UI improvements, and Pipeline as code while maintaining backward compatibility with existing Jenkins installations.

What this book covers

Chapter 1, Getting Started–DevOps Concepts, Tools, and Technologies, gives insights into DevOps movement, challenges for developers team, challenges for operations team, challenges faced by organizations, waterfall and agile model, importance of collaboration, cloud computing, reason to go for DevOps, benefits of DevOps, DevOps lifecycle, build automation, continuous integration and its best practices, configuration management, continuous delivery and continuous deployment and its best practices, continuous monitoring, and continuous feedback. It also covers an overview of code repositories, Maven, Jenkins 2.0, Chef, AWS, Microsoft Azure, Docker, Nagios, Hygieia DevOps Dashboard, overview of Sample JEE application.

Chapter 2, Continuous Integration with Jenkins 2, describes in details on overview of continuous integration, Jenkins 2.0 installation, Java and Maven configuration in Jenkins, creating and configuring build job for Java application with Maven, Dashboard View plugin, managing nodes, email notifications based on build status, and Jenkins and Sonar integration

Chapter 3, Building the Code and Configuring the Build Pipeline, covers built-in delivery pipelines using a domain-specific language (DSL), Build Pipeline plugin, deploying a WAR file in the web server.

Chapter 4, Installing and Configuring Chef, gives insight on Chef configuration management tool, hosted Chef, installing and configuring Chef workstation, and converging Chef node using Chef workstation.

Chapter 5, Installing and Configuring Docker, covers overview of Docker container, understanding difference between virtual machines and containers, installation and configuration of Docker on CentOS, creating the first Docker container, and managing containers.

Chapter 6, Cloud Provisioning and Configuration Management with Chef, gives insight into Chef and cloud provisioning, installing knife plugins for Amazon Web Services and Microsoft Azure, and creating and configuring virtual machine in Amazon Web Services and Microsoft Azure.

Chapter 7, Deploying Application in AWS, Azure, and Docker, covers prerequisites—to deploy application on Remote Server, use tomcat manager app, deploying application in Tomcat Docker container, deploying application in AWS Elastic Beanstalk, and deploying application in Microsoft Azure web apps.

Chapter 8, Monitoring Infrastructure and Applications, provides overview of monitoring, Nagios monitoring tool and quick start on it, installation of Nagios, configuring monitoring of AWS EC2 instance, AWS Elastic Beanstalk monitoring, Microsoft Azure web app service monitoring, Microsoft Azure application insights, and monitoring web application and Tomcat server with New Relic.

Chapter 9, Orchestrating Application Deployment, describes in detail how to orchestrate different build jobs for continuous integration, configuration management, continuous delivery and so on. It will cover creating parameterized build jobs for end to end automation, configuring Build Pipeline for Orchestration of Build Job, executing Build Pipeline for Application Deployment Automation, Steps for Deployment in Amazon Elastic Beanstalk (Platform as a Service), Steps for Deployment in Microsoft Azure Web Apps (Platform as a Service), steps to implement end to end automation in Visual Studio Team Server and TFS online for Continuous Integration, Continuous Delivery and Continuous  Deployment, and Steps for Deployment in Docker containers. It also gives a brief introduction on Hygieia—DevOps Dashboard and how to run it.

What you need for this book

This book assumes that you are familiar with at least java programming language. Knowledge of core java and JEE is essential considering this book to gain better insight. Having a strong understanding of deployment of a web application in application server such as tomcat will help you to understand the flow quickly.

As application development lifecycle will cover lot of tools in general; it is essential to have some knowledge of repositories such as svn, git and so on. IDE tools such as Eclipse; build tools such as ant and maven. Knowledge of code analysis tools will make job easier in configuration and integration, however it is not extremely vital to perform exercises given in the book. Most of the configuration steps are mentioned clearly.

You will be walked through the steps required to install Jenkins 2, Chef Configuration Management tool. In order to be immediately successful, you will need administrative access to a host that runs a modern version of Linux; CentOS 6.x is what will be used for demonstration purposes. If you are a more experienced reader, then a recent release of almost any distribution will work just as well (but you may be required to do a little bit of extra work that is not outlined in the book). If you do not have access to a dedicated Linux host, a virtual host (or hosts) running inside of virtualization software such as VirtualBox or VMware workstation will work.

For AWS and Microsoft Azure, you can use the free trial and one-month free access respectively. Additionally, you will need access to the Internet to download plugins that you do not already have, as well as an installation of the Jenkins 2.

Who this book is for

This book is especially aimed at technical readers. No prior experience with Continuous Integration, Cloud Computing, Configuration Management, Continuous Delivery, and Continuous Deployment is assumed. You may be novice or experienced with Continuous Integration tools such as Jenkins, Atlassian Bamboo, and so on. In any case, if you may want to bring the visualization of end to end automation to the reality and actually see:

  • How to can you extend Continuous Integration to integrate with Configuration Management tools

  • How to provision resources in AWS and Microsoft Azure Environment

  • How to deploy Web Application in the different Cloud Environments

This book covers Continuous Integration, Cloud Computing, Configuration Management, Continuous Delivery, and Continuous Deployment for Sample Spring based application. The main objective is to see end to end automation and implement it one technology stack that can be extended further based on the understanding.

Additionally, different Cloud service models such as PaaS and IaaS of different Cloud Service Providers such as AWS and Microsoft Azure has been used. Docker containers are also used for application deployment. Infrastructure Monitoring with Nagios, Application Monitoring with New Relic, and native Monitoring features provided by AWS and Microsoft Azure are also covered.

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "Now let's edit the pom.xml file."

A block of code is set as follows:

  echo 'Hello from Pipeline Demo'
   stage 'Compile'
   node {
     git url: 'https://github.com/mitesh51/spring-petclinic.git'
     def mvnHome = tool 'Maven3.3.1'
     sh "${mvnHome}/bin/mvn -B compile"
   }

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<user username="admin" password="cloud@123" roles="manager-script" />

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "Go to Advanced Project Options."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of. To send us general feedback, simply e-mail [email protected], and mention the book's title in the subject of your message. If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for this book from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

You can download the code files by following these steps:

  1. Log in or register to our website using your e-mail address and password.

  2. Hover the mouse pointer on the SUPPORT tab at the top.

  3. Click on Code Downloads & Errata.

  4. Enter the name of the book in the Search box.

  5. Select the book for which you're looking to download the code files.

  6. Choose from the drop-down menu where you purchased this book from.

  7. Click on Code Download.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR / 7-Zip for Windows

  • Zipeg / iZip / UnRarX for Mac

  • 7-Zip / PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/DevOps-for-Web-Development. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Downloading the color images of this book

We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from https://www.packtpub.com/sites/default/files/downloads/DevOpsforWebDevelopment_ColorImages.pdf.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at [email protected] with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at [email protected], and we will do our best to address the problem.