working effectively with openshift

25
© Xebia IT Architects Pvt Ltd. 2014. Confidential: Not for Reproduction & Distribution. www.xebia.in Who Am I? • Working at Xebia • Previously worked with Red Hat as OpenShift Evangelist • Software developer with experience in Java, Python, and JavaScript • Written a book on OpenShift http:// www.amazon.com /OpenShift-Cookbook-Shekhar- Gulati/ dp /1783981202/ • Active Blogger http://whyjava.wordpress.com/ • Twitter: shekhargulati

Upload: shekhar-gulati

Post on 08-Jul-2015

139 views

Category:

Technology


5 download

DESCRIPTION

Working effectively with OpenShift

TRANSCRIPT

Page 1: Working effectively with OpenShift

© Xebia IT Architects Pvt Ltd. 2014. Confidential: Not for Reproduction & Distribution. www.xebia.in

Who Am I? • Working at Xebia

• Previously worked with Red Hat as OpenShift Evangelist

• Software developer with experience in Java, Python, and JavaScript

• Written a book on OpenShift http://www.amazon.com/OpenShift-Cookbook-Shekhar-Gulati/dp/1783981202/

• Active Blogger http://whyjava.wordpress.com/

•  Twitter: shekhargulati

Page 2: Working effectively with OpenShift

© Xebia IT Architects Pvt Ltd. 2014. Confidential: Not for Reproduction & Distribution. www.xebia.in

How many of you have worked with any PaaS?

Page 3: Working effectively with OpenShift

© Xebia IT Architects Pvt Ltd. 2014. Confidential: Not for Reproduction & Distribution. www.xebia.in

Page 4: Working effectively with OpenShift

© Xebia IT Architects Pvt Ltd. 2014. Confidential: Not for Reproduction & Distribution. www.xebia.in

Page 5: Working effectively with OpenShift

© Xebia IT Architects Pvt Ltd. 2014. Confidential: Not for Reproduction & Distribution. www.xebia.in

PaaS is the most developer friendly cloud delivery model

Page 6: Working effectively with OpenShift

© Xebia IT Architects Pvt Ltd. 2014. Confidential: Not for Reproduction & Distribution. www.xebia.in

There are many PaaS providers • OpenShift • Cloud Foundry • Google App Engine • Heroku •  Jelastic

Page 7: Working effectively with OpenShift

© Xebia IT Architects Pvt Ltd. 2014. Confidential: Not for Reproduction & Distribution. www.xebia.in

Page 8: Working effectively with OpenShift

© Xebia IT Architects Pvt Ltd. 2014. Confidential: Not for Reproduction & Distribution. www.xebia.in

What OpenShift Offers

Page 9: Working effectively with OpenShift

© Xebia IT Architects Pvt Ltd. 2014. Confidential: Not for Reproduction & Distribution. www.xebia.in

What’s in the box?

Page 10: Working effectively with OpenShift

© Xebia IT Architects Pvt Ltd. 2014. Confidential: Not for Reproduction & Distribution. www.xebia.in

OpenShift in Action • Create an account on OpenShift Online

• It gives you 3 gears(like servers) – each 512 MB RAM and 1 GB disk

• Choose a client • Setup your account • Create an application

Page 11: Working effectively with OpenShift

© Xebia IT Architects Pvt Ltd. 2014. Confidential: Not for Reproduction & Distribution. www.xebia.in

Flavors of OpenShift

Page 12: Working effectively with OpenShift

© Xebia IT Architects Pvt Ltd. 2014. Confidential: Not for Reproduction & Distribution. www.xebia.in

What makes OpenShift Different?

Page 13: Working effectively with OpenShift

© Xebia IT Architects Pvt Ltd. 2014. Confidential: Not for Reproduction & Distribution. www.xebia.in

OpenShift Terminology • Node: A virtual or physical machine that acts as

container host. It provides a multi tenant environment for end user applications.

• Gear: A gear is a secure container that runs inside a

node and host end user applications. It is constrained by RAM, CPU, and Disk space.

• Cartridge: Adds functionality to a gear like programming language, database, etc.

• Broker: All clients interact with REST API exposed by

broker. It is responsible for all application management activities.

Page 14: Working effectively with OpenShift

© Xebia IT Architects Pvt Ltd. 2014. Confidential: Not for Reproduction & Distribution. www.xebia.in

What happens behind the scenes? •  Client makes a REST request •  Broker receives the request. It parse the request and

pushes a message on the queue •  Broker and node talk with each other using ActiveMQ • Node with capacity will reply back saying it can host the

application • A gear will be provisioned with the application stack • A private Git repository will be created for your

application • Your application DNS will be propagated to the outside

world • Application will be cloned on your local machine

Page 15: Working effectively with OpenShift

© Xebia IT Architects Pvt Ltd. 2014. Confidential: Not for Reproduction & Distribution. www.xebia.in

PaaS and DevOps Practices • Self service of standard development environment

• Provisioning of the application stack

• Automated deployment

• Version control and continuous integration

• Automated testing

•  Improved collaboration

• Monitor everything

Page 16: Working effectively with OpenShift

© Xebia IT Architects Pvt Ltd. 2014. Confidential: Not for Reproduction & Distribution. www.xebia.in

OpenShift Tips and Tricks

Page 17: Working effectively with OpenShift

© Xebia IT Architects Pvt Ltd. 2014. Confidential: Not for Reproduction & Distribution. www.xebia.in

RHC AutoComplete Run the rhc setup --autocomplete command Add ~/.openshift/bash_autocomplete to your .bashrc or .bash_profile file.

Page 18: Working effectively with OpenShift

© Xebia IT Architects Pvt Ltd. 2014. Confidential: Not for Reproduction & Distribution. www.xebia.in

Working as a Team Create a team using rhc create-team command Add members to the team using rhc add-member command A member can have viewer, editor, or admin role You can also add members to different domains

Page 19: Working effectively with OpenShift

© Xebia IT Architects Pvt Ltd. 2014. Confidential: Not for Reproduction & Distribution. www.xebia.in

Tracking and rollback deployments Configure the application to keep multiple deployments rhc configure-app --keep-deployments 5 Make a change to you application and push it to application gear You can view list of deployments using rhc deployment-list command To rollback a deployment use rhc deployment-activate command.

Page 20: Working effectively with OpenShift

© Xebia IT Architects Pvt Ltd. 2014. Confidential: Not for Reproduction & Distribution. www.xebia.in

Doing Manual Deployments Configure the application to disable auto deployments $ rhc configure-app –no-auto-deploy Make changes and push to application gear. Changes will not be deployed. To manually deploy the changes run the $ rhc deploy –ref master

Page 21: Working effectively with OpenShift

© Xebia IT Architects Pvt Ltd. 2014. Confidential: Not for Reproduction & Distribution. www.xebia.in

OpenShift Binary Deployments • Create an OpenShift application $ rhc create-app app jbosseap --no-git • Configure the app for binary deployment $ rhc configure-app –no-auto-deploy –deployment-type binary • Create a directory structure $ mkdir –p build-dependencies/.m2 repo/deployments dependencies/jbosseap/deployments • Create a tar file $ tar -czvf --app.tar.gz ./ • Deploy the application $ rhc deploy –ref app.tar.gz

Page 22: Working effectively with OpenShift

© Xebia IT Architects Pvt Ltd. 2014. Confidential: Not for Reproduction & Distribution. www.xebia.in

Using Hot Deployment Create a marker file with name hot_deploy in .openshift/markers directory Commit and push it to application gear

Page 23: Working effectively with OpenShift

© Xebia IT Architects Pvt Ltd. 2014. Confidential: Not for Reproduction & Distribution. www.xebia.in

Using Continuous Integration Server

1.  You can use OpenShift Jenkins cartridge to add CI to your application

2.  OpenShift uses Jenkins in master slave topology

3.  You can increase builder timeout

4.  Creating a Jenkins workflow

5.  Using external Jenkins with OpenShift deployer plugin

Page 24: Working effectively with OpenShift

© Xebia IT Architects Pvt Ltd. 2014. Confidential: Not for Reproduction & Distribution. www.xebia.in

Nonscalable to Scalable application Create a new application $ rhc create-app scalableapp –from-app nonscalableapp –scaling Look at haproxy.cfg Using different balance algorithm Disable auto scaling and then using manual scaling to trigger scaling events depending on your requirements

Page 25: Working effectively with OpenShift

© Xebia IT Architects Pvt Ltd. 2014. Confidential: Not for Reproduction & Distribution. www.xebia.in

Thanks