OpenShift: Ease of PaaS with the Flexibility of IaaS
-
Author
evgeniy-khyst -
Category
Software
-
view
628 -
download
2
Embed Size (px)
Transcript of OpenShift: Ease of PaaS with the Flexibility of IaaS
-
OPENSHIFT: EASE OFOPENSHIFT: EASE OFPAAS WITH THE FLEXIPAAS WITH THE FLEXIBILITY OF IAASBILITY OF IAASAuthor Evgeniy Khist
-
OPENSHIFT: EASE OF PAAS WITH THE FLEXIOPENSHIFT: EASE OF PAAS WITH THE FLEXIBILITY OF IAASBILITY OF IAASOpenShift is a modern cloud platform which provides all required
tools for development, hosting and scaling your applications inpublic and private clouds.
Flexibility offered by OpenShift makes this platform unique.OpenShift builds a bridge between ease offered by PaaS layer
and flexibility of IaaS.
-
DIFFERENCE BETWEEN VPS AND CLOUDDIFFERENCE BETWEEN VPS AND CLOUDVPS - fixed resources of particular hardware server
Cloud - resources dynamically scalable as needed across a clusterof servers
-
IAAS, PAAS AND SAASIAAS, PAAS AND SAASInfrastructure as a Service (IaaS) - providing hardware resources
on demand with certain predefined virtual hardwareconfigurations (Amazon EC2, Rackspace). Targeted at DevOps and
system administrators.Platform as a Service (PaaS) - providing a ready to use
development environment with all server staff you need to runyour application. Configuration is made with a few commands in
a web console or CLI (OpenShift). Targeted at developers.Software as a Service (SaaS) - provides functionality with limited
customization capabilities. Provides one particular function(Mailgun, ElephantSQL - PostgreSQL as a service).
-
OPENSHIFT FLEXIBILITYOPENSHIFT FLEXIBILITYOpenShift is infrastructure agnostic. It can be deployed on any
infrastructure where you can host RHEL, CentOS or Fedora.Open architecture and the cartridge standards allow IT to build a
platform that suits the exact needs of organization. Developerscan have an application environments meeting their exact needs
instead architecting applications to overcome the restrictionsput by PaaS providers.
-
THE 3 VERSIONS OF OPENSHIFTTHE 3 VERSIONS OF OPENSHIFTOpenShift Origin - open source project under Apache Licencev2.0OpenShift Online - public cloud serviceOpenShift Enterprise - on-premise private cloud software
OpenShift covers all the server work. You are focused on yourapplication and its code.
OpenShift Online is hosted on AWS.
-
OPENSHIFT BASIC TERMINOLOGYOPENSHIFT BASIC TERMINOLOGYApplication - typical web application that will run on OpenShift.
Gear - a server, container with a set of resources that allows userto run their application.
Cartridge - plugin that hosts the framework or components thatcan be used to create and run an application. One cartridge can
run on many gears for clustering and scaling.Standalone cartridge - languages and application servers set up to
serve your web application (WildFly, JBoss EAP, Tomcat, DIY).Embedded cartridge - provides functionality to enhance your
application such as DB, cron, but can not be used on its own tocreate an application.
-
FOCUS ON WEB APPLICATIONSFOCUS ON WEB APPLICATIONSThe only ports exposed to incoming traffic are
HTTP (80), HTTPS (443)SSH (22)WebSoket HTTP (8000) and HTTPS (8443)
-
GEARS ISOLATIONGEARS ISOLATIONA single server may have multiple gears running at the same time,
each isolated from each other through SELinux protection. Eachgear is given a fair allocation of CPU, memory, disk, and network
bandwidth using Linux control groups.
-
JAVA CARTRIDGESJAVA CARTRIDGESJBoss Application Server 7 (Java EE 6)JBoss Enterprise Application Platform 6 (Java EE 6)Tomcat 6 (JBoss EWS 1.0)Tomcat 7 (JBoss EWS 2.0)Vert.x 2.1 ( )WildFly Application Server 8.1.0.Final (Java EE 7)CapeDwarf - implementation of the Google App Engine APIJBoss Business Process Management SuiteJBoss Business Rules Management SystemJBoss Fuse 6.1 - ESBDIY
http://vertx.io
-
GEAR SIZESGEAR SIZESSmall: 512 Mb RAM, max. 250 threadsMedium: 1 Gb RAMLarge: 2 Gb RAM
Gears of all sizes have 1 Gb disk space and 6 Gb on Silver plan.
-
CLIENT TOOLSCLIENT TOOLSYou can interact with the OpenShift platform via
RHC client command-line tools you install on your localmachineThe OpenShift Web ConsolePlugin in Eclipse
Client tools should be used for managing the infrastructure orcomponents of your application.
The rest of the work with application will happen through Git orSSH.
-
SCALABLE APPLICATION (1/3)SCALABLE APPLICATION (1/3)Application scaling enables your application to react to changesin traffic and automatically allocate the necessary resources to
handle your increased demand.The OpenShift infrastructure monitors incoming web traffic and
automatically brings up new gears with the appropriate webcartridge online to handle more requests.
When traffic decreases the platform retires the extra resources.
-
SCALABLE APPLICATION (2/3)SCALABLE APPLICATION (2/3)OpenShift provides autoscaling at the application tier.
HAProxy software-based load balancer will be added to the samegear as the application server.
All web traffic will be routed through HAProxy.If number of connections goes above 16 - HAProxy will trigger a
creation of another application gear.OpenShift will:
set up new application server gearrsync code over the new gearplug the gear into HAProxyuse it to serve connections
-
SCALABLE APPLICATION (3/3)SCALABLE APPLICATION (3/3)
-
APPLICATION IDLINGAPPLICATION IDLINGOn Free plan your application will idle if it does not receive anHTTP requests from outside of your gear in 24 hours. Entire
application will be serialized on disk.Application will be start up again when it receives its first HTTP
request thereafter.Application idling does not occur at the Bronze and Silver plan.
-
OPENSHIFT ARCHITECTURE (1/2)OPENSHIFT ARCHITECTURE (1/2)
-
OPENSHIFT ARCHITECTURE (2/2)OPENSHIFT ARCHITECTURE (2/2)When you push code changes to your application a build iscreated and deployed to all of the web gears.Each application has a set of environment variables that areshared across gears.WildFly gears serve incoming HTTP requests with the codeyou push.PostgreSQL sets environment variables so your applicationcode can easily connect.Jenkins detects incoming code pushes, runs your build andthen deploys your code to your web gears.
-
ACTION HOOKS (1/3)ACTION HOOKS (1/3)OpenShift provides developers entry points into various
application and platform lifecycle operations - action hooks, thathave special location within the application Git repository:
/.openshift/action_hooks
-
ACTION HOOKS (2/3)ACTION HOOKS (2/3)Cartridge action hooks:
pre_startpre_start_{cartridge_name}post_startpost_start_{cartridge_name}stopreloadrestarttidy
-
ACTION HOOKS (3/3)ACTION HOOKS (3/3)Build action hooks:
pre_buildbuilddeploypost_deploy
-
MARKERSMARKERSThe markers directory will allow the user to specify settings such
as enabling hot deployments or or which version of Java to use.
-
HOT DEPLOYHOT DEPLOYWhen JBoss AS, JBoss EAP, Tomcat 6 and Tomcat 7 applications
are hot deployed, the Maven build will be executed (either withJenkins or without), but the server does not restart.Following the build, the JBoss HDScanner notices any
modifications and redeploys them.If previously deployed artifacts are removed as part of the update
they undeployed automatically.
-
CRONCRONOpenShift allows to schedule jobs.
Any scripts or jobs added to the minutely, hourly, daily, weekly,monthly directories will be ran on a scheduled basis.
-
JENKINSJENKINSCommit and push new code to your repo1. Jenkins waits for this commit, runs tests2. With OpenShift, if the tests and build are successful, the newcode gets deployed. If it fails, the old code continues to runwith no downtime related to the push.
3.
Users can review the persistent build history maintained byJenkins.
4.
Jenkins slave and builder application will consume 1 gear and willbe automatically freed after 15 idle minutes.
-
ENVIRONMENT VARIABLES (1/4)ENVIRONMENT VARIABLES (1/4)OPENSHIFT__IP - The IP address theapplication listens on.OPENSHIFT__PORT - The port the applicationreceives requests from.
-
ENVIRONMENT VARIABLES (2/4)ENVIRONMENT VARIABLES (2/4)OPENSHIFT_HOMEDIR - The home directory of the application.OPENSHIFT_DATA_DIR - A persistent data directory.OPENSHIFT_REPO_DIR - Repository containing the currentlydeployed version of the application.OPENSHIFT_TMP_DIR - A temporary directory you can use;SELinux protects data in this directory from other users.OPENSHIFT_LOG_DIR - Where all cartridge logs are stored.
-
ENVIRONMENT VARIABLES (3/4)ENVIRONMENT VARIABLES (3/4)OPENSHIFT__DB_HOST - The host name or IPaddress used to connect to the database.OPENSHIFT__DB_PORT - The port the databaseserver is listening on.OPENSHIFT__DB_USERNAME - The databaseadministrative user name.OPENSHIFT__DB_PASSWORD - The databaseadministrative users password.OPENSHIFT__DB_URL - Database connectionURL.
-
ENVIRONMENT VARIABLES (4/4)ENVIRONMENT VARIABLES (4/4)String envVar = System.getenv("OPENSHIFT_ENV_VAR");rhc env set = -a AppNamerhc env list -a AppName
-
EXAMPLE (1/7)EXAMPLE (1/7)gem install rhcrhc app create example -s jboss-wildfly-8rhc cartridge add postgresql-9.2 -a example
-
EXAMPLE (2/7)EXAMPLE (2/7)rhc git-clone examplegit add .git commit -m "Initial commit"git push
-
EXAMPLE (3/7)EXAMPLE (3/7)rhc port-forward -a exampleChecking available ports ... doneForwarding ports ...To connect to a service running on OpenShift, use the Local addressService Local OpenShift---------- --------------- ---- ----------------------------------------------haproxy 127.0.0.1:8080 => 127.10.106.2:8080haproxy 127.0.0.1:8081 => 127.10.106.3:8080java 127.0.0.1:3528 => 127.10.106.1:3528java 127.0.0.1:8082 => 127.10.106.1:8080java 127.0.0.1:9990 => 127.10.106.1:9990postgresql 127.0.0.1:63101 => 546e5a994382ec9a4b00003e-evgeniykhist.rhcloud.Press CTRL-C to terminate port forwarding
-
EXAMPLE (4/7)EXAMPLE (4/7)rhc ssh exampleConnecting to [email protected] ......[example-evgeniykhist.rhcloud.com 546dedc2e0b8cdef00000008]\>
-
EXAMPLE (5/7)EXAMPLE (5/7)rhc tail -a example
-
EXAMPLE (6/7)EXAMPLE (6/7)
-
EXAMPLE (7/7)EXAMPLE (7/7)http://jbosswildfly-evgeniykhist.rhcloud.com/
https://github.com/evgeniy-khist/examples/tree/master/url-shortener-example
-
More slides