ansible代码发布工具_使用Ansible进行Opbeat发布跟踪

ansible代码发布工具

I recently discovered Opbeat. It seems to be a simple (and free/cheap) alternative to Newrelic, at least if you’re using Django.

我最近发现了Opbeat 。 至少在使用Django的情况下,它似乎是Newrelic的一种简单(免费/便宜)的替代方案。

Opbeat Screenshot

Ansible配置 (Ansible Configuration)

If you use Ansible for deployment, you can implement the release tracking with a handler for the git checkout module.

如果使用Ansible进行部署,则可以使用git checkout模块的处理程序来实现发布跟踪。

First of all, define some useful Ansible variables:

首先,定义一些有用的Ansible变量:

git_targetgit_target : : 'master'
'master'
opbeat_org_idopbeat_org_id : : '...'
'...'
opbeat_app_idopbeat_app_id : : '...'
'...'
opbeat_secret_tokenopbeat_secret_token : : '...'
'...'

Then, change your git checkout command to look similar to this:

然后,将您的git checkout命令更改为类似于以下内容:

There are three important things to note:

有三件事要注意:

  1. The git version is specified as a variable. That variable can then be used in the handler as well. Usually this is the master branch.
  2. The return value by this command is registered in the git_status variable.
  3. The register opbeat release handler is called when changes are pulled from your git repository server.
  1. git版本被指定为变量。 然后,该变量也可以在处理程序中使用。 通常这是分支。
  2. 该命令的返回值注册在git_status变量中。
  3. 从git存储库服务器中提取更改时,将调用register opbeat release处理程序。

The handler looks like this:

该处理程序如下所示:

- - namename : : register opbeat release
  register opbeat release
  uriuri :
    :
    urlurl : : 'https://intake.opbeat.com/api/v1/organizations/{{'https://intake.opbeat.com/api/v1/organizations/{{    opbeat_org_idopbeat_org_id    }}/apps/{{}}/apps/{{    opbeat_app_idopbeat_app_id    }}/releases/'
    }}/releases/'
    methodmethod : : POST
    POST
    status_codestatus_code : : 202
    202
    HEADER_AuthorizationHEADER_Authorization : : 'Bearer'Bearer    {{{{    opbeat_secret_tokenopbeat_secret_token    }}'
    }}'
    HEADER_Content-TypeHEADER_Content-Type : : 'application/x-www-form-urlencoded'
    'application/x-www-form-urlencoded'
    bodybody : : 'rev={{'rev={{    git_status.aftergit_status.after    }}&branch={{}}&branch={{    git_targetgit_target    }}&status=completed'
}}&status=completed'

That’s it, all deployments should now be registered as a new release.

就是这样,所有部署现在都应该注册为新版本。

翻译自: https://www.pybloggers.com/2015/03/opbeat-release-tracking-with-ansible/

ansible代码发布工具

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值