티스토리 뷰
EAP64 CUSTOM BUILD For Modified JDK version (8 to 7)
EAP64 , EAP70은 JDK8버전을 기본으로 사용한다. JDK7을 사용하기 위해서는 eap docker image를 수정(비효율적)하거나 templates의 Deploy Configration Environment Variables의 항목을 통해 env를 수정 배포할 수 있다.
이 장에서는 2가지 방법을 모두 기술한다.
[Docker Image Custom Build]
1. 작업 순서
- eap docker image를 재빌드 하기 위해 dockerfile 생성
- custom build 수행
- 새로운 docker image를 docker registry에 push
- eap64 custom용 openshift template, imageStream 생성
- 서비스 구동
2. CUSTOM BUILD 수행
FROM eap64-jdk7:latest USER root RUN /usr/sbin/alternatives --install "/usr/bin/java" java "/usr/lib/jvm/java-1.7.0/bin/java" 1 RUN /usr/sbin/alternatives --set "java" "/usr/lib/jvm/java-1.7.0/bin/java" ENV JAVA_HOME="/usr/lib/jvm/java-1.7.0" \ JAVA_VENDOR="Oracle" \ JAVA_VERSION="1.7.0" USER 185 |
# Build docker
$ docker build -t eap64-jdk7:1.5 . Sending build context to Docker daemon 2.048 kB Step 1 : FROM eap64-jdk7:latest ---> 48d814a0aa99 Step 2 : USER root ---> Running in 1f353b4e1070 ---> 00b1a930f017 Removing intermediate container 1f353b4e1070 Step 3 : RUN /usr/sbin/alternatives --install "/usr/bin/java" java "/usr/lib/jvm/java-1.7.0/bin/java" 1 ---> Running in 9beb0012fae1 ---> 540a89fa3d11 Removing intermediate container 9beb0012fae1 Step 4 : RUN /usr/sbin/alternatives --set "java" "/usr/lib/jvm/java-1.7.0/bin/java" ---> Running in 98e1acc1b8fc ---> baf2b42feacf Removing intermediate container 98e1acc1b8fc Step 5 : ENV JAVA_HOME "/usr/lib/jvm/java-1.7.0" JAVA_VENDOR "Oracle" JAVA_VERSION "1.7.0" ---> Running in ab6a2557a149 ---> 7298e4d6fa04 Removing intermediate container ab6a2557a149 Step 6 : USER 185 ---> Running in 390ae7590f13 ---> 7ec73496a8c3 Removing intermediate container 390ae7590f13 Successfully built 7ec73496a8c3 |
# Push Docker Image
$ docker push eap64-jdk7:1.5 |
3. template & ImageStream 생성
# eap64-jdk7-stream.json : eap64용 이미지스트림 생성
{ "kind": "List", "apiVersion": "v1", "metadata": { "name": "eap64-jdk7-stream", "annotations": { "description": "ImageStream definitions for JBoss Middleware products." } }, "items": [ { "kind": "ImageStream", "apiVersion": "v1", "metadata": { "name": "eap64-jdk7-s2i" }, "spec": { "dockerImageRepository": "10.1.0.48:5000/eap64-jdk7", "tags": [ { "name": "1.5", "annotations": { "description": "JBoss EAP 6.4 JDK7 S2I images.", "iconClass": "icon-jboss", "tags": "builder,eap,javaee,java,jboss,xpaas", "supports":"eap:6.4,javaee:6,java:7,xpaas:1.1", "sampleRepo": "https://github.com/jboss-developer/jboss-eap-quickstarts.git", "sampleContextDir": "kitchensink", "sampleRef": "6.4.x", "version": "latest" } } ] } } ] } |
# eap64-jdk7-s2i.json : eap64용 템플릿 생성 (변경되는 부분만 표시)
~ 중략 ~ { "kind": "BuildConfig", "apiVersion": "v1", "metadata": { "name": "${APPLICATION_NAME}", "labels": { "application": "${APPLICATION_NAME}" } }, "spec": { "source": { "type": "Git", "git": { "uri": "${SOURCE_REPOSITORY_URL}", "ref": "${SOURCE_REPOSITORY_REF}" }, "contextDir": "${CONTEXT_DIR}" }, "strategy": { "type": "Source", "sourceStrategy": { "forcePull": true, "from": { "kind": "ImageStreamTag", "namespace": "${IMAGE_STREAM_NAMESPACE}", "name": "eap64-jdk7-s2i:latest" } } }, "output": { "to": { "kind": "ImageStreamTag", "name": "${APPLICATION_NAME}:latest" } }, ~중략 ~ |
위와 같이 imageStream과 templates를 준비후 다음 명령어 순서대로 진행한다. (create custom file -> import image)
$ oc create -f eap64-jdk7-s2i.json -n openshift $ oc create -f eap64-jdk7-stream.json -n openshift imagestream "eap64-jdk7-s2i" created $ oc import-image eap64-jdk7-s2i:latest -n openshift --insecure=true The import completed successfully. Name: eap64-jdk7-s2i Namespace: openshift Created: About a minute ago Labels: <none> Annotations: openshift.io/image.dockerRepositoryCheck=2017-03-07T01:35:24Z Docker Pull Spec: 172.30.119.166:5000/openshift/eap64-jdk7-s2i Unique Images: 1 Tags: 2 latest tagged from 10.1.0.48:5000/eap64-jdk7 will use insecure HTTPS or HTTP connections * 10.1.0.48:5000/eap64-jdk7:latest Less than a second ago 7ec73496a8c355c68af001d92cbf7475f82cb1263c4aafccc79faa0998b1fb21 1.5 pushed image JBoss EAP 6.4 JDK7 S2I images. Tags: builder, eap, javaee, java, jboss, xpaas Supports: eap:6.4, javaee:6, java:7, xpaas:1.1 Example Repo: https://github.com/jboss-developer/jboss-eap-quickstarts.git |
- The End -
[Custom Templates 생성]
1. 작업 순서
- custom templates 생성
- create templates
- JAVA 관련 변수 입력 후 서비스 기동 테스트
2. Custom templates 생성
{ "kind": "Template", "apiVersion": "v1", "metadata": { "annotations": { "iconClass": "icon-jboss", "description": "Application template for EAP 6 & JDK 7 applications built using S2I.", "tags": "eap,javaee,java,jboss,xpaas", "version": "1.3.2" }, "name": "eap64-custom-jdk7" }, "labels": { "template": "eap64-custom-jdk7", "xpaas": "1.3.2" }, "parameters": [ { "description": "The name for the application.", "name": "APPLICATION_NAME", "value": "eap-app", "required": true }, { "description": "Custom hostname for http service route. Leave blank for default hostname, e.g.: <application-name>-<project>.<default-domain-suffix>", "name": "HOSTNAME_HTTP", "value": "", "required": false }, { "description": "Git source URI for application", "name": "SOURCE_REPOSITORY_URL", "value": "https://github.com/jboss-developer/jboss-eap-quickstarts", "required": true }, { "description": "Git branch/tag reference", "name": "SOURCE_REPOSITORY_REF", "value": "6.4.x", "required": false }, { "description": "Path within Git project to build; empty for root project directory.", "name": "CONTEXT_DIR", "value": "kitchensink", "required": false }, { "description": "Queue names", "name": "HORNETQ_QUEUES", "value": "", "required": false }, { "description": "Topic names", "name": "HORNETQ_TOPICS", "value": "", "required": false }, { "description": "HornetQ cluster admin password", "name": "HORNETQ_CLUSTER_PASSWORD", "from": "[a-zA-Z0-9]{8}", "generate": "expression", "required": true }, { "description": "GitHub trigger secret", "name": "GITHUB_WEBHOOK_SECRET", "from": "[a-zA-Z0-9]{8}", "generate": "expression", "required": true }, { "description": "Generic build trigger secret", "name": "GENERIC_WEBHOOK_SECRET", "from": "[a-zA-Z0-9]{8}", "generate": "expression", "required": true }, { "description": "Namespace in which the ImageStreams for Red Hat Middleware images are installed. These ImageStreams are normally installed in the openshift namespace. You should only need to modify this if you've installed the ImageStreams in a different namespace/project.", "name": "IMAGE_STREAM_NAMESPACE", "value": "openshift", "required": true }, { "description": "JGroups cluster password", "name": "JGROUPS_CLUSTER_PASSWORD", "from": "[a-zA-Z0-9]{8}", "generate": "expression", "required": true }, { "description": "Controls whether exploded deployment content should be automatically deployed", "name": "AUTO_DEPLOY_EXPLODED", "value": "false", "required": false }, { "description": "Modify EAP64 JAVA_HOME", "name": "JAVA_HOME", "value": "/usr/lib/jvm/java-1.7.0", "required": true }, { "description": "Modify EAP64 JAVA VENDOR", "name": "JAVA_VENDOR", "value": "Oracle", "required": true }, { "description": "Modify EAP64 JAVA VERSION", "name": "JAVA_VERSION", "value": "1.7.0", "required": true } ], "objects": [ { "kind": "Service", "apiVersion": "v1", "spec": { "ports": [ { "port": 8080, "targetPort": 8080 } ], "selector": { "deploymentConfig": "${APPLICATION_NAME}" } }, "metadata": { "name": "${APPLICATION_NAME}", "labels": { "application": "${APPLICATION_NAME}" }, "annotations": { "description": "The web server's http port." } } }, { "kind": "Route", "apiVersion": "v1", "id": "${APPLICATION_NAME}-http", "metadata": { "name": "${APPLICATION_NAME}", "labels": { "application": "${APPLICATION_NAME}" }, "annotations": { "description": "Route for application's http service." } }, "spec": { "host": "${HOSTNAME_HTTP}", "to": { "name": "${APPLICATION_NAME}" } } }, { "kind": "ImageStream", "apiVersion": "v1", "metadata": { "name": "${APPLICATION_NAME}", "labels": { "application": "${APPLICATION_NAME}" } } }, { "kind": "BuildConfig", "apiVersion": "v1", "metadata": { "name": "${APPLICATION_NAME}", "labels": { "application": "${APPLICATION_NAME}" } }, "spec": { "source": { "type": "Git", "git": { "uri": "${SOURCE_REPOSITORY_URL}", "ref": "${SOURCE_REPOSITORY_REF}" }, "contextDir": "${CONTEXT_DIR}" }, "strategy": { "type": "Source", "sourceStrategy": { "forcePull": true, "from": { "kind": "ImageStreamTag", "namespace": "${IMAGE_STREAM_NAMESPACE}", "name": "jboss-eap64-openshift:1.4" } } }, "output": { "to": { "kind": "ImageStreamTag", "name": "${APPLICATION_NAME}:latest" } }, "triggers": [ { "type": "GitHub", "github": { "secret": "${GITHUB_WEBHOOK_SECRET}" } }, { "type": "Generic", "generic": { "secret": "${GENERIC_WEBHOOK_SECRET}" } }, { "type": "ImageChange", "imageChange": {} }, { "type": "ConfigChange" } ] } }, { "kind": "DeploymentConfig", "apiVersion": "v1", "metadata": { "name": "${APPLICATION_NAME}", "labels": { "application": "${APPLICATION_NAME}" } }, "spec": { "strategy": { "type": "Recreate" }, "triggers": [ { "type": "ImageChange", "imageChangeParams": { "automatic": true, "containerNames": [ "${APPLICATION_NAME}" ], "from": { "kind": "ImageStreamTag", "name": "${APPLICATION_NAME}:latest" } } }, { "type": "ConfigChange" } ], "replicas": 1, "selector": { "deploymentConfig": "${APPLICATION_NAME}" }, "template": { "metadata": { "name": "${APPLICATION_NAME}", "labels": { "deploymentConfig": "${APPLICATION_NAME}", "application": "${APPLICATION_NAME}" } }, "spec": { "terminationGracePeriodSeconds": 60, "containers": [ { "name": "${APPLICATION_NAME}", "image": "${APPLICATION_NAME}", "imagePullPolicy": "Always", "livenessProbe": { "exec": { "command": [ "/bin/bash", "-c", "/opt/eap/bin/livenessProbe.sh" ] } }, "readinessProbe": { "exec": { "command": [ "/bin/bash", "-c", "/opt/eap/bin/readinessProbe.sh" ] } }, "ports": [ { "name": "jolokia", "containerPort": 8778, "protocol": "TCP" }, { "name": "http", "containerPort": 8080, "protocol": "TCP" }, { "name": "ping", "containerPort": 8888, "protocol": "TCP" } ], "env": [ { "name": "OPENSHIFT_KUBE_PING_LABELS", "value": "application=${APPLICATION_NAME}" }, { "name": "OPENSHIFT_KUBE_PING_NAMESPACE", "valueFrom": { "fieldRef": { "fieldPath": "metadata.namespace" } } }, { "name": "HORNETQ_CLUSTER_PASSWORD", "value": "${HORNETQ_CLUSTER_PASSWORD}" }, { "name": "HORNETQ_QUEUES", "value": "${HORNETQ_QUEUES}" }, { "name": "HORNETQ_TOPICS", "value": "${HORNETQ_TOPICS}" }, { "name": "JGROUPS_CLUSTER_PASSWORD", "value": "${JGROUPS_CLUSTER_PASSWORD}" }, { "name": "AUTO_DEPLOY_EXPLODED", "value": "${AUTO_DEPLOY_EXPLODED}" }, { "name": "JAVA_HOME", "value": "${JAVA_HOME}" }, { "name": "JAVA_VENDOR", "value": "${JAVA_VENDOR}" }, { "name": "JAVA_VERSION", "value": "${JAVA_VERSION}" } ] } ] } } } } ] } |
3. Create Templates
|
4. EAP64 서비스 기동
========================================================================= JBoss Bootstrap Environment JBOSS_HOME: /opt/eap JAVA: /usr/lib/jvm/java-1.7.0/bin/java JAVA_OPTS: -server -XX:+UseCompressedOops -verbose:gc -Xloggc:"/opt/eap/standalone/log/gc.log" -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=3M -XX:-TraceClassUnloading -Xms1303m -Xmx1303m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.logmanager,jdk.nashorn.api -Djava.awt.headless=true -Djboss.modules.policy-permissions=true -Xbootclasspath/p:/opt/eap/jboss-modules.jar:/opt/eap/modules/system/layers/base/.overlays/layer-base-jboss-eap-6.4.12.CP/org/jboss/logmanager/main/jboss-logmanager-1.5.6.Final-redhat-1.jar:/opt/eap/modules/system/layers/base/org/jboss/logmanager/ext/main/jboss-logmanager-ext-1.0.0.Alpha2-redhat-1.jar -Djava.util.logging.manager=org.jboss.logmanager.LogManager -javaagent:/opt/eap/jolokia.jar=port=8778,protocol=https,caCert=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt,clientPrincipal=cn=system:master-proxy,useSslClientAuthentication=true,extraClientCheck=true,host=0.0.0.0,discoveryEnabled=false -Djava.security.egd=file:/dev/./urandom -XX:MaxPermSize=256m ========================================================================= Picked up JAVA_TOOL_OPTIONS: -Duser.home=/home/jboss -Duser.name=jboss I> No access restrictor found, access to all MBean is allowed Jolokia: Agent started with URL https://10.1.1.4:8778/jolokia/ 05:59:08,742 INFO [org.jboss.modules] (main) JBoss Modules version 1.3.7.Final-redhat-1 05:59:11,460 INFO [org.jboss.msc] (main) JBoss MSC version 1.1.6.Final-redhat-1 05:59:11,834 INFO [org.jboss.as] (MSC service thread 1-4) JBAS015899: JBoss EAP 6.4.12.GA (AS 7.5.12.Final-redhat-1) starting 05:59:11,854 DEBUG [org.jboss.as.config] (MSC service thread 1-4) Configured system properties: [Standalone] = awt.toolkit = sun.awt.X11.XToolkit file.encoding = ANSI_X3.4-1968 file.encoding.pkg = sun.io file.separator = / java.awt.graphicsenv = sun.awt.X11GraphicsEnvironment java.awt.headless = true java.awt.printerjob = sun.print.PSPrinterJob java.class.path = /opt/eap/jboss-modules.jar:/opt/eap/jolokia.jar java.class.version = 51.0 java.endorsed.dirs = /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.121-2.6.8.0.el7_3.x86_64/jre/lib/endorsed java.ext.dirs = /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.121-2.6.8.0.el7_3.x86_64/jre/lib/ext:/usr/java/packages/lib/ext java.home = /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.121-2.6.8.0.el7_3.x86_64/jre java.io.tmpdir = /tmp java.library.path = /usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib java.net.preferIPv4Stack = true java.runtime.name = OpenJDK Runtime Environment java.runtime.version = 1.7.0_121-mockbuild_2016_10_31_10_07-b00 java.security.egd = file:/dev/./urandom java.specification.name = Java Platform API Specification |
#프로세스 확인
sh-4.2$ ps -ef | grep java 1000060+ 224 1 2 08:08 ? 00:00:00 /usr/lib/jvm/java-1.7.0/bin/java -D[Standalone] -server -XX:+UseCompressedOops -v erbose:gc -Xloggc:/opt/eap/standalone/log/gc.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+UseGCLogFileRotation -XX:NumberOfG CLogFiles=5 -XX:GCLogFileSize=3M -XX:-TraceClassUnloading -Xms1303m -Xmx1303m -Djava.net.preferIPv4Stack=true -Djboss.modules.syste m.pkgs=org.jboss.logmanager,jdk.nashorn.api -Djava.awt.headless=true -Djboss.modules.policy-permissions=true -Xbootclasspath/p:/opt /eap/jboss-modules.jar:/opt/eap/modules/system/layers/base/.overlays/layer-base-jboss-eap-6.4.12.CP/org/jboss/logmanager/main/jboss -logmanager-1.5.6.Final-redhat-1.jar:/opt/eap/modules/system/layers/base/org/jboss/logmanager/ext/main/jboss-logmanager-ext-1.0.0.A lpha2-redhat-1.jar -Djava.util.logging.manager=org.jboss.logmanager.LogManager -javaagent:/opt/eap/jolokia.jar=port=8778,protocol=h ttps,caCert=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt,clientPrincipal=cn=system:master-proxy,useSslClientAuthentication= true,extraClientCheck=true,host=0.0.0.0,discoveryEnabled=false -Djava.security.egd=file:/dev/./urandom -XX:MaxPermSize=256m -Dorg.j boss.boot.log.file=/opt/eap/standalone/log/server.log -Dlogging.configuration=file:/opt/eap/standalone/configuration/logging.proper ties -jar /opt/eap/jboss-modules.jar -mp /opt/eap/modules -jaxpmodule javax.xml.jaxp-provider org.jboss.as.standalone -Djboss.home. dir=/opt/eap -Djboss.server.base.dir=/opt/eap/standalone -c standalone-openshift.xml -bmanagement 127.0.0.1 -b 10.1.2.2 -Djboss.nod e.name=eap-app-1-52646 -Djboss.messaging.cluster.password=wn68rY22 |
'RedHat OpenShift > 기술문서' 카테고리의 다른 글
[Workshop] openshift 1일차 (0) | 2017.04.05 |
---|---|
API Gateway 와 3scale (0) | 2017.03.08 |
[기능] OPENSHIFT PIPELINES (TECHNOLOGY PREVIEW) (0) | 2017.02.08 |
[Dockerfile] Oracle Client가 설치된 PHP docker 이미지 생성 (0) | 2017.02.07 |
[배포] 애플리케이션 PostgreSQL 배포(초간단버전) (0) | 2017.02.07 |
- Total
- Today
- Yesterday
- 황용식
- 캠핑
- xt3 #MMCA #국립현대미술관
- 매거진스탠딩
- 23mm
- 퍼플라떼
- XF23
- 전붙이기
- 보문호수
- XF23mm
- 야경
- m42 55mm
- velvia
- 필름시뮬레이션
- 55mm
- Classic Chrome
- 수지
- mf
- m42
- 브런치
- XF14
- xf14mm
- 논뷰
- SAVOR
- 손주등장
- 연대앞
- m42 135mm
- 예전사진
- 신촌
- XT3
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |