Using AppDynamics with Red Hat OpenShift v3

As customers and partners are making the transition of their applications from monoliths to microservices using Platform as a Service (PaaS) providers such as RedHat OpenShift v3, AppDynamics has made a significant investment in providing first-class integrations with such providers.

OpenShift v3 has been significantly re-architected from its predecessor OpenShift v2 where cartridges have been replaced with docker images and gears with docker containers. The complete set of differences can be found here.

AppDynamics integrates its agents with RedHat OpenShift v3 using the Source-to-Image (S2I) methodology. S2I is a tool for building reproducible Docker images. It produces ready-to-run images by injecting application source into a Docker image and assembling a new Docker image. The new image incorporates the base image (the builder) and built source and is ready to use with the docker run command. S2I supports incremental builds, which re-use previously downloaded dependencies, previously built artifacts, etc.

Workflow

The overall workflow for using the AppDynamics with RedHat OpenShift v3 s shown below:

Step 1: is already provided for by RedHat.

To perform Steps 2 and 3, we have provided the S2I scripts in the following GitHub repository and instructions on how to build enhanced builder images for JBoss Wildfly and EAP servers.

https://github.com/Appdynamics/sti-wildfly

Let’s explore this with an actual example and use the sample https://github.com/jim-minter/ose3-ticket-monster

application.

Prerequisites:

–    Ensure OC is installed (https://docs.openshift.com/enterprise/3.0/cli_reference/get_started_cli.html#installing-the-cli)

–    Ensure sti is installed (https://github.com/openshift/source-to-image)

–    Ensure you have a dockerhub account (https://hub.docker.com/)

Step 2: Create an AppDynamics builder image

$ git clone https://github.com/Appdynamics/sti-wildfly.git

$ cd sti-wildfly

$ make build VERSION=eap6.4

Step 3: Create an Application image

$ s2i build  -e “APPDYNAMICS_APPLICATION_NAME=os3-ticketmonster,APPDYNAMICS_TIER_NAME=os3-ticketmonster-tier,APPDYNAMICS_ACCOUNT_NAME=customer1_xxxxxxxxxxxxxxxxxxf,APPDYNAMICS_ACCOUNT_ACCESS_KEY=xxxxxxxxxxxxxxxxxxxxx,APPDYNAMICS_CONTROLLER_HOST=xxxx.saas.appdynamics.com,APPDYNAMICS_CONTROLLER_PORT=443,APPDYNAMICS_CONTROLLER_SSL_ENABLED=true” https://github.com/jim-minter/ose3-ticket-monster appdynamics/sti-wildfly-eap64-centos7:latest pranta/appd-eap-ticketmonster

$ docker tag openshift-ticket-monster pranta/openshift-ticket-monster:latest

$ docker push pranta/openshift-ticket-monster

Step 4: Deploy the Application into OpenShift

$ oc login 10.0.32.128:8443

$ oc new-project wildfly

$ oc project wildfly

$ oc new-app –docker-image=pranta/appd-eap-ticketmonster:latest –name=ticketmonster-demo

Now you should be able to login to the controller and see the ticketmonster application on the application dashboard:

See a live demo of Red Hat OpenShift v3 with AppDynamics from AppSphere ’15 below.

If you’re already using RedHat OpenShift v3 but are new to AppDynamics, here’s where you can sign-up for a free trial: https://portal.appdynamics.com/account/signup/signupForm/

AppDynamics Partners with OpenShift by Red Hat to Empower DevOps

We’re proud to partner with OpenShift by Red Hat to help monitor their open-source platform-as-a-service (PaaS). Together we make it easier to scale into the cloud. The integration helps foster DevOps by increasing the visibility and collaboration between the typically fragmented development and operations teams throughout the product lifecycle. We caught up with Chris Morgan, Technical Director of Partner Ecosystem at Red Hat, to discuss all the ways Agile and rapid-release cycles have changed development and sped up innovation.

Morgan refers to these new DevOps tools as driving innovation and empowering developers by cultivating a constant feedback loop and proving end-to-end visibility while help scale applications.

 

“We have a great partner that’s able to provide [APM] to enhance the platform and make it more desirable to developers and for our customers. Ease of use and deployment is what everyone wants.”

“Using AppDynamics, we can monitor the existing application and understand how best it’s performing and then re-architect it so it can take advantage of the things that platform-as-a-service has to offer and you move to OpenShift.”

AppDynamics is excited to announce we are available in the OpenShift marketplace to make it easier than ever to add application performance monitoring to OpenShift based applications.

AppDynamics in the OpenShift Marketplace

AppDynamics in the OpenShift Marketplace

Bootstrapping DropWizard apps with AppDynamics on OpenShift by Red Hat

Getting started with DropWizard, OpenShift, and AppDynamics

In this blog post, I’ll show you how to deploy a Dropwizard-based application on OpenShift by Red Hat and monitor it with AppDynamics.

DropWizard is a high-performance Java framework for building RESTful web services. It is built by the smart folks at Yammer and is available as an open-source project on GitHub. The easiest way to get started with DropWizard is with the example application. The DropWizard example application was developed to, as its name implies, provide examples of some of the features present in DropWizard.

DropWizard

OpenShift can be used to deploy any kind of application with the DIY (do it yourself) cartridge. To get started, log in to OpenShift and create an application using the DIY cartridge.

With the official OpenShift quick start guide to AppDynamics getting started with AppDynamics on OpenShift couldn’t be easier.

1) Signup for an account on OpenShift by RedHat

2) Setup RedHat client tools on your local machine

$ gem install rhc
$ rhc setup

3) Create a Do It Yourself application on OpenShift

$ rhc app create appdynamicsdemo diy-0.1
 --from-code https://github.com/Appdynamics/dropwizard-sample-app.git

Getting started is as easy as creating an application from an existing git repository: https://github.com/Appdynamics/dropwizard-sample-app.git

DIY Cartridge


% rhc app create appdynamicsdemo diy-0.1 --from-code https://github.com/Appdynamics/dropwizard-sample-app.git

Application Options
——————-
Domain: appddemo
Cartridges: diy-0.1
Source Code: https://github.com/Appdynamics/dropwizard-sample-app.git
Gear Size: default
Scaling: no

Creating application ‘appdynamicsdemo’ … done
Waiting for your DNS name to be available … done

Cloning into ‘appdynamicsdemo’…
Your application ‘appdynamicsdemo’ is now available.

URL: http://appdynamicsdemo-appddemo.rhcloud.com/
SSH to: 52b8adc15973ca7e46000077@appdynamicsdemo-appddemo.rhcloud.com
Git remote: ssh://52b8adc15973ca7e46000077@appdynamicsdemo-appddemo.rhcloud.com/~/git/appdynamicsdemo.git/

Run ‘rhc show-app appdynamicsdemo’ for more details about your app.

With the OpenShift Do-It-Yourself container you can easily run any application by adding a few action hooks to your application. In order to make DropWizard work on OpenShift we need to create three action hooks for building, deploying, and starting the application. Action hooks are simply scripts that are run at different points during deployment. To get started simply create a .openshift/action_hooks directory:

mkdir -p .openshift/action_hooks

Here is the example for the above sample application:

When checking out the repository use Maven to download the project dependencies and package the project for production from source code:

.openshift/action_hooks/build

cd $OPENSHIFT_REPO_DIR

mvn -s $OPENSHIFT_REPO_DIR/.openshift/settings.xml -q package

When deploying the code you need to replace the IP address and port for the DIY container. The properties are made available as environment variables:

.openshift/action_hooks/deploy

cd $OPENSHIFT_REPO_DIR

sed -i 's/@OPENSHIFT_DIY_IP@/'"$OPENSHIFT_DIY_IP"'/g' example.yml
sed -i 's/@OPENSHIFT_DIY_PORT@/'"$OPENSHIFT_DIY_PORT"'/g' example.yml

Let’s recap some of the smart decisions we have made so far:

  • Leverage OpenShift platform as a service (PaaS) for managing the infrastructure
  • Use DropWizard as a solid foundation for our Java application
  • Monitor the application performance with AppDynamics Pro

With a solid Java foundation we are prepared to build our new application. Next, try adding another machine or dive into the DropWizard documentation.

Combining DropWizard, OpenShift, and AppDynamics

AppDynamics allows you to instrument any Java application with by simply adding the AppDynamics agent to the JVM. Sign up for a AppDynamics Pro self-service account. Log in using your account details in your email titled “Welcome to your AppDynamics Pro SaaS Trial” or the account details you have entered during On-Premise installation.

The last step to combine the power of OpenShift and DropWizard is to instrument the app with AppDynamics. Simply update your AppDynamics credentials in the Java agent’s AppServerAgent/conf/controller-info.xml configuration file.

Finally, to start the application we need to run any database migrations and add the AppDynamics Java agent to the startup commmand:

.openshift/action_hooks/deploy

cd $OPENSHIFT_REPO_DIR

java -jar target/dropwizard-example-0.7.0-SNAPSHOT.jar db migrate example.yml

java -javaagent:${OPENSHIFT_REPO_DIR}AppServerAgent/javaagent.jar
     -jar ${OPENSHIFT_REPO_DIR}target/dropwizard-example-0.7.0-SNAPSHOT.jar
     server example.yml > ${OPENSHIFT_DIY_LOG_DIR}/helloworld.log &

OpenShift App

Additional resources on running DropWizard on OpenShift:

Take five minutes to get complete visibility into the performance of your production applications with AppDynamics Pro today.

As always, please feel free to comment if you think I have missed something or if you have a request for content in an upcoming post.