【问题标题】:How to programatically reconfigure Availability Monitoring in DevOps stage for Blue-Green deployment?如何在 DevOps 阶段以编程方式配置可用性监控以进行蓝绿部署?
【发布时间】:2017-06-21 04:57:03
【问题描述】:

我正在使用基于 Cloud Foundry 模板的 IBM devops 管道。该模板为您提供蓝绿部署。

我的阶段部署脚本如下所示:

#!/bin/bash

cat << EOF > ${WORKSPACE}/manifest.yml
declared-services:
    my_cloudant:
        label: cloudantNoSQLDB
        plan: Lite

    my_messagehub:
       label: messagehub
       plan: standard

    my_autoscaling:
       label: Auto-Scaling
       plan: free

    my_availability_monitoring:
       label: AvailabilityMonitoring
       plan: Lite

applications:
- name: movie-recommend-demo
  host: movie-recommend-demo
  buildpack: https://github.com/cloudfoundry/python-buildpack.git#v1.5.18
  memory: 128M
  instances: 2
  path: web_app
  services:
  - my_cloudant
  - my_messagehub
  - my_autoscaling
  - my_availability_monitoring
  timeout: 180
env:
  # these are set in the devops stage ENVIRONMENT PROPERTIES
  BI_HIVE_USERNAME: ${BI_HIVE_USERNAME}
  BI_HIVE_PASSWORD: ${BI_HIVE_PASSWORD}
  BI_HIVE_HOSTNAME: ${BI_HIVE_HOSTNAME}
EOF

# Push app
if ! cf app $CF_APP; then  
  cf push $CF_APP
else
  OLD_CF_APP=${CF_APP}-OLD-$(date +"%s")
  rollback() {
    set +e  
    if cf app $OLD_CF_APP; then
      cf logs $CF_APP --recent
      cf delete $CF_APP -f
      cf rename $OLD_CF_APP $CF_APP
    fi
    exit 1
  }
  set -e
  trap rollback ERR
  cf rename $CF_APP $OLD_CF_APP
  cf push $CF_APP
  cf delete $OLD_CF_APP -f
fi

# TODO:
# - Reconfigure Availability Monitoring on Green deployment
# - Reconfigure Autoscaling on Green deployment (https://console.bluemix.net/docs/cli/plugins/auto-scaling/index.html)

# Export app name and URL for use in later Pipeline jobs
export CF_APP_NAME="$CF_APP"
export APP_URL=http://$(cf app $CF_APP_NAME | grep urls: | awk '{print $2}')

# View logs
#cf logs "${CF_APP}" --recent

在设置和运行舞台之前,我在我的 Cloud Foundry 应用上设置了可用性监控。运行阶段导致我的可用性监控配置被删除。

如何使用脚本自动重新配置新“绿色”部署中的可用性监控?

我有一个关于 Auto Scaling 的类似问题,但似乎有一个 API/CLI 可以用来重新配置该服务。但是,我使用cf oauth-token 遇到了a problem

【问题讨论】:

    标签: ibm-cloud monitoring cloud-foundry devops-services availability-monitoring


    【解决方案1】:

    这是目前正在积极工作的服务中的一个缺陷,应该会在今年晚些时候推出。 目前,保留配置的方法是不删除应用程序,而是重用 2 个应用程序。即使您只将服务绑定到一个应用程序,尤其是在您使用监控选项卡的情况下,这对于哪个有测试也可能会变得有些混乱。 当自我监控时,我们所做的是在空间中创建一个虚拟应用程序并将服务绑定到它(它甚至不需要运行)。然后我们用它来监控蓝/绿应用。在这里,我们也没有删除应用程序,而是重复使用这些应用程序。

    【讨论】:

    猜你喜欢
    • 2019-01-30
    • 2013-05-28
    • 2018-10-02
    • 2019-06-11
    • 1970-01-01
    • 2011-09-22
    • 2022-11-11
    • 1970-01-01
    • 2020-06-28
    相关资源
    最近更新 更多