简体   繁体   English

Spring Cloud Config Server + BitBucket

[英]Spring Cloud Config Server + BitBucket

I'm trying to get Spring Cloud's Config Server setup with a BitBucket private repository and haven't had any luck. 我正在尝试使用BitBucket私有存储库来安装Spring Cloud的Config Server并且没有任何运气。 No matter what configuration I use, I always seem to get a 404 returned when trying to load a configuration. 无论我使用什么配置,我总是在尝试加载配置时返回404。

I've also tried setting breakpoints in JGitEnvironmentRepository but it never seems to get called outside of afterPropertiesSet . 我也尝试在JGitEnvironmentRepository设置断点,但它似乎永远不会在JGitEnvironmentRepository之外afterPropertiesSet If I manually triggering the findOne(application,profile,label) while debugging, I get an error that Branch name <null> not allowed . 如果我在调试时手动触发findOne(application,profile,label) ,则会收到错误,即Branch name <null> not allowed If I specify "master" for label property, then I get the dreaded Ref master cannot be resolved error. 如果我为label属性指定“master”,那么我得到了可怕的Ref master cannot be resolved错误。

The app loads fine but no results. 该应用程序加载正常但没有结果。 From all the documentation I've read, it seems like this should work out of the box. 从我读过的所有文档中,看起来这应该是开箱即用的。 Any help would be appreciated. 任何帮助,将不胜感激。

bootstrap.yml bootstrap.yml

server:
  port: 8888

spring:
  application:
    name: config-service
  cloud:
    bus.amqp.enabled: false
    config:
      enabled: false
      failFast: true
      server:
        prefix: /configs
        git :
          uri: https://bitbucket.org/[team]/[repo].git
          username: [user]
          password: [pass]

Repo files 回购文件

- demo.app.yml

Attempted URL 尝试过的网址

http://localhost:8888/configs/demo.app HTTP://本地主机:8888 / CONFIGS / demo.app

  1. you need to add a profile name to the url. 您需要在网址中添加个人资料名称。 The default profile is 'default'. 默认配置文件是“默认”。 http://localhost:8888/configs/demo.app/default HTTP://本地主机:8888 / CONFIGS / demo.app /默认

  2. this only works with the 1.0.0.RELEASE version to me, but with the 1.0.1.RELEASE version I found a problem on Windows (there is a problem with the file separators so the config server didn't find the YAML files in the local cloned repository). 这仅适用于我的1.0.0.RELEASE版本,但是对于1.0.1.RELEASE版本我在Windows上发现了一个问题(文件分隔符存在问题,因此配置服务器未找到YAML文件本地克隆的存储库)。 Maybe this is the related issue: Spring Cloud Config | 也许这是相关的问题: Spring Cloud Config | Git Based | Git Based | Not working on windows machine 不在Windows机器上工作

If you still have any issues, you can refer to the below client configuration. 如果您仍有任何问题,可以参考以下客户端配置。 I have successfully configured the bitbucket repository. 我已经成功配置了bitbucket存储库。

Spring Boot Version: 1.4.1.RELEASE

<dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>Camden.RELEASE</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

-----------------------------------------------------------------------
bootstrap.yml

spring:
    application:
      name: client-config
    cloud:
      config:
        failFast: true
        label: master
        profile: default
        username: <username>
        password: <password>
        server:
          bootstrap: true
        uri: http://localhost:8888

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM