环境:MAC OS X 10.12.3 + OpenShift Origin 1.4.1
注意,安装过程需要访问外网,且不要连接 VPN。
1. 下载镜像
docker pull fabric8/java-jboss-openjdk8-jdk:1.2.1
docker pull ryanj/centos7-nodejs:6.4.0
docker pull jboss/base-jdk:8
docker pull registry.access.redhat.com/openshift3/nodejs-010-rhel7
docker pull registry.access.redhat.com/jboss-eap-7/eap70-openshift
2. 确认每个应用能够构建成功
请参考《OpenShift_057:手动构建各个微服务及镜像》。
注意,Dockerfile 中的 FROM 基础镜像要在本地镜像中都存在。
2. 启动 OpenShift Origin
oc cluster up --host-data-dir=/Users/maping/mygit/redhat-helloworld-msa --use-existing-config
oc login -u system:admin https://127.0.0.1:8443
oc adm policy add-cluster-role-to-user admin admin
3. 安装
3.1 修改 helloworld-msa.yml 内容
由于之前修改了各个应用的 Dockerfile,并且重新构建了应用,因此我去掉了如下任务:
- name: Create Workdir
- name: Checkout source code from Github
- name: Compile Java Projects
- name: NPM install NodeJS Projects
3.2 修改 vars.yml 内容
根据我的环境,修改了以下条目:
ansible-playbook helloworld-msa.yml
需要等待 20 分钟左右,请耐心。
oc get pod | grep Running
输出如下:
aloha-2-teufc 1/1 Running 0 23m
api-gateway-1-crkct 1/1 Running 0 23m
bonjour-2-f7o8e 1/1 Running 0 23m
frontend-3-p8ord 1/1 Running 0 20m
hola-1-nn2gj 1/1 Running 0 23m
hystrix-dashboard-8xiz5 1/1 Running 0 18m
ola-2-s5q3c 1/1 Running 0 23m
turbine-server-ofboi 1/1 Running 0 23m
zipkin-mysql-owh4f 1/1 Running 0 23m
zipkin-query-sc6ln 1/1 Running 0 23m
发现 hystrix-dashboard-8xiz5 日志有错误,是权限问题
2017-02-21 13:34:20.325:WARN:oejuc.FileNoticeLifeCycleListener:main:
java.io.FileNotFoundException: /opt/jetty/jetty.state (Permission denied)
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(FileOutputStream.java:270)
at java.io.FileOutputStream.(FileOutputStream.java:213)
at java.io.FileOutputStream.(FileOutputStream.java:133)
at java.io.FileWriter.(FileWriter.java:78)
at org.eclipse.jetty.util.component.FileNoticeLifeCycleListener.writeState(FileNoticeLifeCycleListener.java:45)
at org.eclipse.jetty.util.component.FileNoticeLifeCycleListener.lifeCycleStarted(FileNoticeLifeCycleListener.java:62)
oc login -u system:admin https://127.0.0.1:8443
4. 运行
注意,安装过程需要访问外网,且不要连接 VPN。
1. 下载镜像
docker pull fabric8/java-jboss-openjdk8-jdk:1.2.1
docker pull ryanj/centos7-nodejs:6.4.0
docker pull jboss/base-jdk:8
docker pull registry.access.redhat.com/openshift3/nodejs-010-rhel7
docker pull registry.access.redhat.com/jboss-eap-7/eap70-openshift
2. 确认每个应用能够构建成功
请参考《OpenShift_057:手动构建各个微服务及镜像》。
注意,Dockerfile 中的 FROM 基础镜像要在本地镜像中都存在。
2. 启动 OpenShift Origin
oc cluster up --host-data-dir=/Users/maping/mygit/redhat-helloworld-msa --use-existing-config
oc login -u system:admin https://127.0.0.1:8443
oc adm policy add-cluster-role-to-user admin admin
3. 安装
3.1 修改 helloworld-msa.yml 内容
由于之前修改了各个应用的 Dockerfile,并且重新构建了应用,因此我去掉了如下任务:
- name: Create Workdir
- name: Checkout source code from Github
- name: Compile Java Projects
- name: NPM install NodeJS Projects
3.2 修改 vars.yml 内容
根据我的环境,修改了以下条目:
- workdir: /Users/maping/mygit/redhat-helloworld-msa
- openshift: 127.0.0.1:8443
- username: developer
- password: developer
- admin_username: admin
- admin_password: admin
- domain: 192.168.56.1.xip.io
- adjust_scc: false
- project_name: helloworld-msa
- clone_modules: true
- deploy_jenkins: false
- deploy_hystrix: true
- deploy_zipkin: true
- deploy_hawkular_apm: false
- deploy_keycloak: false
ansible-playbook helloworld-msa.yml
需要等待 20 分钟左右,请耐心。
oc get pod | grep Running
输出如下:
aloha-2-teufc 1/1 Running 0 23m
api-gateway-1-crkct 1/1 Running 0 23m
bonjour-2-f7o8e 1/1 Running 0 23m
frontend-3-p8ord 1/1 Running 0 20m
hola-1-nn2gj 1/1 Running 0 23m
hystrix-dashboard-8xiz5 1/1 Running 0 18m
ola-2-s5q3c 1/1 Running 0 23m
turbine-server-ofboi 1/1 Running 0 23m
zipkin-mysql-owh4f 1/1 Running 0 23m
zipkin-query-sc6ln 1/1 Running 0 23m
发现 hystrix-dashboard-8xiz5 日志有错误,是权限问题
2017-02-21 13:34:20.325:WARN:oejuc.FileNoticeLifeCycleListener:main:
java.io.FileNotFoundException: /opt/jetty/jetty.state (Permission denied)
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(FileOutputStream.java:270)
at java.io.FileOutputStream.
at java.io.FileOutputStream.
at java.io.FileWriter.
at org.eclipse.jetty.util.component.FileNoticeLifeCycleListener.writeState(FileNoticeLifeCycleListener.java:45)
at org.eclipse.jetty.util.component.FileNoticeLifeCycleListener.lifeCycleStarted(FileNoticeLifeCycleListener.java:62)
oc login -u system:admin https://127.0.0.1:8443
oc adm policy add-scc-to-user anyuid -z ribbon
删除 hystrix-dashboard pod,会自动创建一个新的,确认没有错误。
oc delete pod hystrix-dashboard-8xiz54. 运行
1 条评论:
针对业余爱好者的java编程示例
java上的数组数组示例
发表评论