如何在DevOps阶段以编程方式重新配置可用性监控以进行蓝绿色部署? [英] How to programatically reconfigure Availability Monitoring in DevOps stage for Blue-Green deployment?

查看:99
本文介绍了如何在DevOps阶段以编程方式重新配置可用性监控以进行蓝绿色部署?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm using an IBM devops pipeline based on the Cloud Foundry template. The template gives you Blue-Green deployments.

我的舞台部署脚本如下:

My stage deploy script looks like this:

#!/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应用程序上进行了可用性监视设置.运行该阶段导致删除了我的可用性监视配置.

Before setting up and running the stage, I had availability monitoring setup on my cloud foundry app. Running the stage has caused my availability monitoring configuration to be deleted.

如何使用脚本在新的绿色"部署中自动重新配置可用性监视?

How can I automatically reconfigure the availability monitoring in the new 'green' deployment with the script?

我对Auto Scaling有类似的问题,但是似乎可以使用API​​/CLI重新配置该服务.但是,我遇到了

I had a similar question for Auto Scaling, but there appears to be an API/CLI that I can use to reconfigure that service. However, I ran into a problem using cf oauth-token

推荐答案

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

This is a current deficiency in the service that is actively being worked and should be available later this year. For now, the way to keep the configuration is to not delete the app but rather reuse 2 apps. This can become somewhat confusing as to which one has the tests even if you only bind the service to one app especially if you use the monitoring tab. What we do when selfmonitoring is create a dummy app in the space and bind the service to it (it doesn't need to even be running). We then use it to monitor the blue/green app(s). Here we also don't delete the app but just reuse the apps.

这篇关于如何在DevOps阶段以编程方式重新配置可用性监控以进行蓝绿色部署?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆