在PCF中部署eureka服务器:在cf push to Cloud foundry之后获得404

时间:2017-10-30 11:16:08

标签: spring

我的manifest.yml文件如下

--- applications: - name: eureka-test-service memory: 1024M instances: 1 host: eureka-test-service path: target/test-eureka-service-0.0.1-SNAPSHOT.jar buildpack: https://github.com/cloudfoundry/java-buildpack env: SPRING_PROFILES_ACTIVE : cloud

我的application.properties

`server.port=8761
eureka.instance.hostname=localhost
eureka.client.register-with-eureka=false
eureka.client.fetchRegistry=false
eureka.client.serviceUrl.defaultZone=http://${eureka.instance.hostname}:${server.port}/eureka/`

当我通过cf push将Eureka服务器推送到PCF时,我在PCF空间中使用URL成功运行应用程序。但是在点击URL我得到一个XML和https:/ eureka给出了404

1 个答案:

答案 0 :(得分:1)

在我提供适当的财产之后,它起作用了

eureka.instance.hostname=${vcap.application.uris[0]}
eureka.instance.non-secure-port=80
eureka.instance.metadata-map.instanceId=${vcap.application.instance_id}
eureka.instance.leaseRenewalIntervalInSeconds = 5
eureka.client.registryFetchIntervalSeconds = 5
#eureka.client.serviceUrl.defaultZone=${vcap.services.eureka-service.credentials.uri}/eureka/
eureka.client.service-url.defaultZone=${vcap.services.eureka-service.credentials.uri:http://localhost:8761}/eureka/

此链接https://github.com/making/cf-eureka-server非常有用!