Duration: 10:00
Here are some ideas for next steps.
OpenShift allows you to get an Source code and transform it in a container image. This is very useful for people who don’t know how to create your own image. OpenShift automatically detects the language and uses an appropriate "builder" to convert that in a functional container image. Actually the following languages are supported: Ruby, JavaEE, NodeJS, PHP, Pytho and Perl.
Let’s see how it works using the frontend sources as an example:
First, let’s delete the existing frontend Route, Service and ReplicationController
[vagrant@rhel-cdk kubernetes]$ oc delete rc,svc,route frontend-ui
replicationcontroller "frontend-ui" deleted
service "frontend-ui" deleted
route "frontend-ui" deleted
[vagrant@rhel-cdk kubernetes]$ oc new-app --name=frontend-ui \
https://github.com/redhat-developer-demos/kubernetes-lab \
--strategy=source --context-dir=frontend
-→ Found image 78a38d1 (2 weeks old) in image stream "nodejs" in project "openshift" under tag "0.10" for "nodejs"
Node.js 0.10
------------
Platform for building and running Node.js 0.10 applications
Tags: builder, nodejs, nodejs010
* The source repository appears to match: nodejs
* A source build using source code from https://github.com/redhat-developer-demos/kubernetes-lab will be created
* The resulting image will be pushed to image stream "frontend-ui:latest"
* This image will be deployed in deployment config "frontend-ui"
* Port 8080/tcp will be load balanced by service "frontend-ui"
* Other containers can access this service through the hostname "frontend-ui"
-→ Creating resources with label app=frontend-ui …
imagestream "frontend-ui" created
buildconfig "frontend-ui" created
deploymentconfig "frontend-ui" created
service "frontend-ui" created
-→ Success
Build scheduled, use 'oc logs -f bc/frontend-ui' to track its progress.
Run 'oc status' to view your app.
This will trigger the build inside OpenShift. You can explore it using the following commands:
[vagrant@rhel-cdk kubernetes]$ oc get builds
NAME TYPE FROM STATUS STARTED DURATION
frontend-ui-1 Source Git@e09f71e Running About a minute ago 1m23s
[vagrant@rhel-cdk kubernetes]$ oc logs -f bc/frontend-ui
You can also see the build happening in the OpenShift console:
Don’t forget to expose the Route and try the application. Do you remember how to it, right?
When OpenShift is installed in a public address, you can enable Github webhooks that triggers a new OpenShift build each commit. This is useful for Continuous Integration environments. You can read more about it in the following guide.
You can also trigger a new build using oc start-build <buildname> command. It allows you to specify different location for the sources. Try it yourself! Clone the repository or make a local change and run the command.
Some examples that you can try.
[vagrant@rhel-cdk kubernetes]$ oc start-build frontend-ui \
--from-dir=$HOME/kubernetes-lab \
--follow
Uploading "/home/vagrant/kubernetes-lab" at commit "HEAD" as binary input for the build …
Uploading directory "/home/vagrant/kubernetes-lab" as binary input for the build …
frontend-ui-?
[vagrant@rhel-cdk kubernetes]$ oc start-build frontend-ui \
--git-repository=https://github.com/rafabene/kubernetes-lab \
--follow
frontend-ui-?
I0804 08:03:45.260863 1 source.go:197] Downloading "https://github.com/redhat-developer-demos/kubernetes-lab" …
Red Hat Developers has worked intensively to integrate different opensource technologies and create a showcase of how cloud-native apps can interact in a microservices architecture: The Helloworld-MSA playground!
This distinct demo allows developers execute some “helloworld” microservices, built using different technologies, and explore the following features:
-
Different implementations: WildFly Swarm, Spring Boot, Vert.X and NodeJS.
-
3 invocation patterns: Browser as a client, API-Gateway, Chained invocation;
-
Service-registry, Self-healing, Load-balancing and Blue/Green deployments – Provided by OpenShift;
-
JVM Monitoring – Provided by Jolokia;
-
Service Monitoring – Provided by Hystrix Dashboard via Kubeflix;
-
Service Tracing – Provided by Zipkin via Fabric8’s Kubernetes Zipkin;
-
Circuit breaker and Fallback – Provided by Hystrix;
-
REST invocation – Provided by Feign via HystrixFeign;
-
REST API specification – Provided by Swagger;