This is an additional update to my previous blog post about binary deployments with OpenShift 3.
OpenShift 3.2 has introduced a new way to do deal with binary input sources where your artifact (eg: a war file) is locally available. I have been getting several inquiries about this feature and I am posting this update.
Step 1: Create a war file and place it in deployments directory under a folder of your choice
As an example here is my previous example of petstore.war that I renamed to ROOT.war and placed in the deployments folder
$ ls -lR
total 0
drwxr-xr-x 3 veer staff 102 Jul 5 2015 deployments
./deployments:
total 12024
-rwxr-xr-x 1 veer staff 6155452 Jul 5 2015 ROOT.war
Step 2: Create a new build using the builder image of your choice. Here I am using JBoss EWS (tomcat 8) image. The flag binary=true
indicates that this build will use the binary content instead of the url to the source code.
Here I am naming my application as "myapp". So all the artifacts will get the name "myapp"
$ oc new-build --image-stream=jboss-webserver30-tomcat8-openshift --binary=true --name=myapp
--> Found image 298446b (4 weeks old) in image stream "jboss-webserver30-tomcat8-openshift" in project "openshift" under tag "latest" for "jboss-webserver30-tomcat8-openshift"
JBoss Web Server 3.0
--------------------
Platform for building and running web applications on JBoss Web Server 3.0 - Tomcat v8
Tags: builder, java, tomcat8
* A source build using binary input will be created
* The resulting image will be pushed to image stream "myapp:latest"
--> Creating resources with label build=myapp ...
imagestream "myapp" created
buildconfig "myapp" created
--> Success
Step 3: Start the build by uploading the contents of your current directory. Remember the war file is in the deployments folder. The jboss-ews builder image knows to copy the contents of the deployments folder to the deployments directory and then builds the application image.
$ oc start-build myapp --from-dir=.
Uploading "." at commit "HEAD" as binary input for the build ...
Uploading directory "." as binary input for the build ...
myapp-1
Step 4: Now create the application with the same name as what you gave for the build. Also expose the service as a route to be able to use it from the browser.
Here again I am using the name "myapp", so that the rest of the objects such as deployment configuration and service are created with the same name and refer to the image-stream created earlier.
$ oc new-app myapp
--> Found image ed346c5 (35 seconds old) in image stream myapp under tag "latest" for "myapp"
bin-test/myapp-1:aa174140
-------------------------
Platform for building and running web applications on JBoss Web Server 3.0 - Tomcat v8
Tags: builder, java, tomcat8
* This image will be deployed in deployment config "myapp"
* Ports 8080/tcp, 8443/tcp, 8778/tcp will be load balanced by service "myapp"
* Other containers can access this service through the hostname "myapp"
--> Creating resources with label app=myapp ...
deploymentconfig "myapp" created
service "myapp" created
--> Success
Run 'oc status' to view your app.
$ oc expose svc myapp
route "myapp" exposed
Now you can get the route and access the application using the URL.
Keeping the promise of providing best experience for the users, OpenShift is always adding such cool features. Thanks for reading!!!
Acknowledgements: Thanks to Ben Parees for helping me figure out how to do this easily.
저자 소개
채널별 검색
오토메이션
기술, 팀, 인프라를 위한 IT 자동화 최신 동향
인공지능
고객이 어디서나 AI 워크로드를 실행할 수 있도록 지원하는 플랫폼 업데이트
오픈 하이브리드 클라우드
하이브리드 클라우드로 더욱 유연한 미래를 구축하는 방법을 알아보세요
보안
환경과 기술 전반에 걸쳐 리스크를 감소하는 방법에 대한 최신 정보
엣지 컴퓨팅
엣지에서의 운영을 단순화하는 플랫폼 업데이트
인프라
세계적으로 인정받은 기업용 Linux 플랫폼에 대한 최신 정보
애플리케이션
복잡한 애플리케이션에 대한 솔루션 더 보기
오리지널 쇼
엔터프라이즈 기술 분야의 제작자와 리더가 전하는 흥미로운 스토리
제품
- Red Hat Enterprise Linux
- Red Hat OpenShift Enterprise
- Red Hat Ansible Automation Platform
- 클라우드 서비스
- 모든 제품 보기
툴
체험, 구매 & 영업
커뮤니케이션
Red Hat 소개
Red Hat은 Linux, 클라우드, 컨테이너, 쿠버네티스 등을 포함한 글로벌 엔터프라이즈 오픈소스 솔루션 공급업체입니다. Red Hat은 코어 데이터센터에서 네트워크 엣지에 이르기까지 다양한 플랫폼과 환경에서 기업의 업무 편의성을 높여 주는 강화된 기능의 솔루션을 제공합니다.