【问题标题】:Spring cloud-config-server Git-Backend on AWS ECSAWS ECS 上的 Spring cloud-config-server Git-Backend
【发布时间】:2020-07-02 23:34:16
【问题描述】:

到目前为止,我可以在本地系统中使用简单的用户名/密码从 gitlab 中提取 config-repo 文件,并且效果很好。现在我正在将东西转移到 AWS-ECS(Fargate)。

native 配置文件运行良好,但我想使用 git-uri,为此我必须提供连接凭据。

    spring:
      profiles: dev
      cloud:
        config:
          server:
              git:
                uri: https://gitlab.com/<group>/<project>.git
                clone-on-start: true
                default-label: gitlabci-test
                searchPaths: '{profile}'
                username: ${gitlab-username}
                password: ${gitlab-password}

如何配置 config-server 以从 AWS Parameter store 或 secret-manager 中提取凭证?任何帮助将不胜感激。

【问题讨论】:

    标签: spring-cloud amazon-ecs aws-secrets-manager aws-parameter-store spring-cloud-config-server


    【解决方案1】:
    1. 创建一个名为 GetParameters 的新策略并将其附加到当前任务角色。

    IAM -> 创建策略 -> 选择“系统管理器”作为服务 -> 'GetParameters' 作为操作(只读类型)-> 所有资源并创建策略。

    1. 转到 Systems Manager -> Parameter Store 将敏感详细信息存储为 SecureString

    2. 转到任务 -> 容器定义 -> 环境变量: 提供

    3. 该值应采用arn:aws:ssm:&lt;your-aws-acccount-region&gt;:&lt;aws-user-id&gt;:parameter/name 的形式

    • GITLAB_USERNAME, ValueFrom , arn:aws:ssm:::parameter/dev/my-config-server/GITLAB_USERNAME
    • GITLAB_PASSWORD、ValueFrom、arn:aws:ssm:::parameter/dev/my-config-server/GITLAB_PASSWORD

    按照惯例,Name 的格式应为/&lt;environment&gt;/&lt;service&gt;/&lt;attribute-name&gt;

    就是这样。你完成了。等待任务被配置,config-server 将能够连接到您的远程仓库。

            spring:
              profiles: dev
              cloud:
                config:
                  server:
                      git:
                        uri: https://gitlab.com/<group>/<project>.git
                        clone-on-start: true
                        default-label: gitlabci-test
                        searchPaths: '{profile}'
                        username: ${GITLAB_USERNAME}
                        password: ${GITLAB_PASSWORD}
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-05-25
      • 2016-07-06
      • 1970-01-01
      • 2020-04-22
      • 2023-01-27
      • 1970-01-01
      • 1970-01-01
      • 2018-08-01
      相关资源
      最近更新 更多