环境:MAC OS X 10.12.3 + OpenShift 3.4 + Hawkular APM 0.14.0.Final
与《部署 Hawkular APM 到 OpenShift Origin》的区别是,本文是部署到 OpenShift 3.4 企业版上。
由于 OpenShift 是在内网,所以需要离线部署。
1. 下载基础镜像 (在 MAC 机器上操作)
docker pull jboss/base-jdk:8
docker save -o base-jdk.tar.gz jboss/base-jdk:8
scp base-jdk.tar.gz root@192.168.56.112:/opt/ose/images/
2. 加载基础镜像(在 Registry 机器上操作)
docker load -i base-jdk.tar.gz
docker tag jboss/base-jdk:8 registry.example.com:5000/jboss/base-jdk:8
docker push registry.example.com:5000/jboss/base-jdk:8
3. 克隆 hawkular-apm(在 MAC 机器上操作)
cd ~/mygit/redhat-helloworld-msa
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 .
4. 拷贝到 Registry 机器上(在 MAC 机器上操作)
cd ~/mygit/redhat-helloworld-msa
scp -r hawkular-apm/ root@registry.example.com:/opt/hawkular-apm-demo
5. 初始化 mybank git 仓库(在 Registry 机器上操作)mkdir -p /opt/git/repo/hawkular-apm.git;
cd /opt/git/repo/hawkular-apm.git;
git init --bare;
git update-server-info;
mv hooks/post-update.sample hooks/post-update;
6. 拷贝 hawkular-apm 代码,并提交(在 Registry 机器上操作)
cd /opt;
git clone file:///opt/git/repo/hawkular-apm.git/;
cp hawkular-apm-demo/* hawkular-apm -rf;
cp hawkular-apm-demo/.sti hawkular-apm -rf;
cp hawkular-apm-demo/.htaccess hawkular-apm -rf;
cp hawkular-apm-demo/.gitignore hawkular-apm -rf;
cd hawkular-apm;
git add .;
git commit -m 'initial upload';
git push origin master;
7. 验证 hawkular-apm git 仓库是否创建成功(在 Master 机器上操作)
cd /tmp;
git clone http://git.example.com/git/hawkular-apm.git/;
8. 部署 Hawkular APM (在 Master 机器上操作)
cd /tmp/hawkular-apm/hawkular-apm-server
oc new-build --binary --name=hawkular-apm-serveroc start-build hawkular-apm-server --from-dir=. --follow
oc new-app hawkular-apm-server
oc expose service hawkular-apm-server
9. 部署 Hawkular APM
oc get pod
输出如下:
NAME READY STATUS RESTARTS AGE
hawkular-apm-server-1-52jfr 1/1 Running 0 5m
hawkular-apm-server-1-build 0/1 Completed 0 9m
oc logs hawkular-apm-server-1-52jfr
查找到如下信息:
Username: adminCXhaeqO
Password: 6jRJI3zu8fF08Fc4X
oc get route
输出如下:
NAME HOST/PORT PATH SERVICES PORT TERMINATION
hawkular-apm-server hawkular-apm-server-applications.apps.example.com hawkular-apm-server 8080-tcp
10. 启动 JBoss EAP 7 (已经部署 jboss-helloworld 和 jboss-helloworld-mdb)
export HAWKULAR_APM_URI=hawkular-apm-server-applications.apps.example.com
export HAWKULAR_APM_USERNAME=adminCXhaeqO
export HAWKULAR_APM_PASSWORD=6jRJI3zu8fF08Fc4X
cd ~/Redhat/eap/demo/7.0/2017-02-04
. ~/setJdk8Env.sh
./jboss-eap-7.0/bin/standalone.sh -Djboss.server.base.dir=./myeap -c standalone-full.xml -Djboss.socket.binding.port-offset=10000
11. 访问 Hawkular APM
刷新 http://localhost:18080/jboss-helloworld/HelloWorld
刷新 http://localhost:18080/jboss-helloworld-mdb/HelloWorldMDBServletClient
刷新 http://hawkular-apm-server-applications.apps.example.com/
参考文献:
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/
与《部署 Hawkular APM 到 OpenShift Origin》的区别是,本文是部署到 OpenShift 3.4 企业版上。
由于 OpenShift 是在内网,所以需要离线部署。
1. 下载基础镜像 (在 MAC 机器上操作)
docker pull jboss/base-jdk:8
docker save -o base-jdk.tar.gz jboss/base-jdk:8
scp base-jdk.tar.gz root@192.168.56.112:/opt/ose/images/
2. 加载基础镜像(在 Registry 机器上操作)
docker load -i base-jdk.tar.gz
docker tag jboss/base-jdk:8 registry.example.com:5000/jboss/base-jdk:8
docker push registry.example.com:5000/jboss/base-jdk:8
3. 克隆 hawkular-apm(在 MAC 机器上操作)
cd ~/mygit/redhat-helloworld-msa
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 .
4. 拷贝到 Registry 机器上(在 MAC 机器上操作)
cd ~/mygit/redhat-helloworld-msa
scp -r hawkular-apm/ root@registry.example.com:/opt/hawkular-apm-demo
5. 初始化 mybank git 仓库(在 Registry 机器上操作)mkdir -p /opt/git/repo/hawkular-apm.git;
cd /opt/git/repo/hawkular-apm.git;
git init --bare;
git update-server-info;
mv hooks/post-update.sample hooks/post-update;
6. 拷贝 hawkular-apm 代码,并提交(在 Registry 机器上操作)
cd /opt;
git clone file:///opt/git/repo/hawkular-apm.git/;
cp hawkular-apm-demo/* hawkular-apm -rf;
cp hawkular-apm-demo/.sti hawkular-apm -rf;
cp hawkular-apm-demo/.htaccess hawkular-apm -rf;
cp hawkular-apm-demo/.gitignore hawkular-apm -rf;
cd hawkular-apm;
git add .;
git commit -m 'initial upload';
git push origin master;
7. 验证 hawkular-apm git 仓库是否创建成功(在 Master 机器上操作)
cd /tmp;
git clone http://git.example.com/git/hawkular-apm.git/;
8. 部署 Hawkular APM (在 Master 机器上操作)
cd /tmp/hawkular-apm/hawkular-apm-server
oc new-build --binary --name=hawkular-apm-serveroc start-build hawkular-apm-server --from-dir=. --follow
oc new-app hawkular-apm-server
oc expose service hawkular-apm-server
9. 部署 Hawkular APM
oc get pod
输出如下:
NAME READY STATUS RESTARTS AGE
hawkular-apm-server-1-52jfr 1/1 Running 0 5m
hawkular-apm-server-1-build 0/1 Completed 0 9m
oc logs hawkular-apm-server-1-52jfr
查找到如下信息:
Username: adminCXhaeqO
Password: 6jRJI3zu8fF08Fc4X
oc get route
输出如下:
NAME HOST/PORT PATH SERVICES PORT TERMINATION
hawkular-apm-server hawkular-apm-server-applications.apps.example.com hawkular-apm-server 8080-tcp
10. 启动 JBoss EAP 7 (已经部署 jboss-helloworld 和 jboss-helloworld-mdb)
export HAWKULAR_APM_URI=hawkular-apm-server-applications.apps.example.com
export HAWKULAR_APM_USERNAME=adminCXhaeqO
export HAWKULAR_APM_PASSWORD=6jRJI3zu8fF08Fc4X
cd ~/Redhat/eap/demo/7.0/2017-02-04
. ~/setJdk8Env.sh
./jboss-eap-7.0/bin/standalone.sh -Djboss.server.base.dir=./myeap -c standalone-full.xml -Djboss.socket.binding.port-offset=10000
11. 访问 Hawkular APM
刷新 http://localhost:18080/jboss-helloworld/HelloWorld
刷新 http://localhost:18080/jboss-helloworld-mdb/HelloWorldMDBServletClient
刷新 http://hawkular-apm-server-applications.apps.example.com/
参考文献:
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/
没有评论:
发表评论