2017年2月19日星期日

OpenShift_058:部署 Hawkular APM 到 OpenShift Origin(Dockerfile 方式)

环境:MAC OS X 10.12.3 + OpenShift Origin 1.4.1 + Hawkular APM 0.14.0.Final

1. 下载基础镜像
docker pull jboss/base-jdk:8

2. 启动 OpenShift Origin
oc cluster up
oc login -u system:admin https://127.0.0.1:8443
oc adm policy add-cluster-role-to-user admin admin

3. 部署 Hawkular APM
git clone https://github.com/jboss-dockerfiles/hawkular-apm.git (已做)
cd hawkular-apm/hawkular-apm-server

修改 Dockerfile
  把 ENV HAWKULAR_APM_VERSION 0.14.1.Final
  改为 ENV HAWKULAR_APM_VERSION 0.14.0.Final
  把从网上下载 hawkular-apm-dist-0.14.0.Final.zip 改为从本地拷贝
  # Download Hawkular-APM from github
  COPY hawkular-apm-dist-$HAWKULAR_APM_VERSION.zip $HOME

  RUN cd $HOME \
  #    && curl -O -L https://github.com/hawkular/hawkular-apm/releases/download/$HAWKULAR_APM_VERSION/hawkular-apm-dist-$HAWKULAR_APM_VERSION.zip \
      && unzip -d $JBOSS_HOME hawkular-apm-dist-$HAWKULAR_APM_VERSION.zip \
      && rm hawkular-apm-dist-$HAWKULAR_APM_VERSION.zip

cp  ~/Tools/hawkular/apm/hawkular-apm-dist-0.14.0.Final.zip .

oc new-build --binary --name=hawkular-apm-server
oc start-build hawkular-apm-server --from-dir=. --follow
oc new-app hawkular-apm-server
oc expose service hawkular-apm-server

4. 部署 Hawkular APM
oc get pod
输出如下:
NAME                          READY     STATUS      RESTARTS   AGE
hawkular-apm-server-1-build   0/1       Completed   0          35m
hawkular-apm-server-1-so6c1   1/1       Running     0          34m
 

oc logs  hawkular-apm-server-1-so6c1
查找到如下信息:
Username: adminN77iFln
Password: ijbkLNCGbYI2b27cv

oc get route
输出如下:
NAME                  HOST/PORT                                            PATH      SERVICES              PORT       TERMINATION
hawkular-apm-server   hawkular-apm-server-myproject.192.168.1.109.xip.io             hawkular-apm-server   8080-tcp

5. 启动 JBoss EAP 7 (已经部署 jboss-helloworld 和 jboss-helloworld-mdb)
启动 JBoss EAP 7 前,要设置 Hawkular APM 环境变量,此步很重要!!!
. ~/Tools/hawkular/apm/dist/apm/setenv.sh 9411
 

export HAWKULAR_APM_URI=http://hawkular-apm-server-myproject.192.168.1.109.xip.io:80
export HAWKULAR_APM_USERNAME=adminN77iFln
export HAWKULAR_APM_PASSWORD=ijbkLNCGbYI2b27cv

cd /Users/maping/Redhat/eap/demo/7.0/2017-02-04
./jboss-eap-7.0/bin/standalone.sh -Djboss.server.base.dir=./myeap -c standalone-full.xml -Djboss.socket.binding.port-offset=10000

6. 访问 Hawkular APM
刷新 http://localhost:18080/jboss-helloworld/HelloWorld
刷新 http://localhost:18080/jboss-helloworld-mdb/HelloWorldMDBServletClient
刷新 http://hawkular-apm-server-myproject.192.168.1.109.xip.io/



参考文献:
1. http://www.hawkular.org/blog/2016/11/25/hawkular-apm-on-openshift.html
2. http://www.hawkular.org/blog/2016/07/14/hawkular-apm-openshift.html
3. https://hawkular.gitbooks.io/hawkular-apm-user-guide/content/quickstart/

没有评论: