如何使用厨师客户端 - 服务器架构部署代码“按需”? [英] How can I deploy code 'on-demand' using chef client-server architecture?

查看:144
本文介绍了如何使用厨师客户端 - 服务器架构部署代码“按需”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是这种情况:



我可以SSH进入我的Chef-Server。但是,我不能 SSH到任何主厨客户端。所以这是我的工作方式:我有一个工作站来更改或创建角色。所有的厨师客户都以守护进程运行,所以当他们醒来时,他们注意到状态变化并开始更新。



现在,我需要在这些配置上配置代码部署客户。我在想我可以使用应用程序菜谱,并使用我的工作站添加配方到角色。但是每当厨师 - 客户醒来并发现修改更改时,这样的部署不会导致部署?我想要一种按需的部署方式:我只想在代码部署准备就绪时部署,而不是在任何其他任务之前部署。



如何实现这一点?

解决方案

几个问题



当您的代码部署准备就绪?你怎么知道的?如果这是一个可重复的过程,您是否可以将其编码为食谱?如果它不是一个可重复的过程,你需要使它成为一个,以便它可以自动化



IE运行黄瓜测试,如果他们都通过,然后部署其他只做什么? / p>

我们从Artifactory进货,并使用web api来检查可用的最新安装程序。如果它与以前安装的相同(通过检查/创建注册表项完成),我们对用户说,这个构建已经安装,所以我们正在跳过。如果不一样我们安装。现在我知道这不是完全一样的情况,但感觉到我喜欢这里需要一些自定义代码。



或者使用数据库值来说根据代码的状态,install = true或false。当您要部署时,您将更新项目a的数据库中的安装项目,并将其余时间设置为false。如果值为true,食谱才会进行?


Here's the scenario:

I can SSH into my Chef-Server . But I can't SSH into any of the Chef-Clients. So this is how I work : I have a workstation to change or create Roles . All the chef-clients are running as daemons , so when they wake up , they notice state changes and start updating themselves .

Now , I need to configure code deployments on these clients . I was thinking I could use application cookbook for that , and add recipes to the roles using my workstation . But won't that result in deployments every time the chef-clients wake up and find revision changes ? I want an On Demand kind of deployment : I want to deploy only when the code is deployment ready , not for any other commit till that point .

How do I achieve this ?

解决方案

Couple of questions

When id your code deployment ready? How would you know? If it's a repeatable process could you not code that into a recipe? if it's not a repeatable process you need to make it one so that it can be automated

IE run cucumber tests and if they all pass then deploy else just do nothing?

We feed from Artifactory and use the web api to check the latest installer available to us. If it's the same as previously installed (done by checking/creating a registry key) we say to the user, this build is already installed so we're skipping. If it's not the same we install. Now I know this isn't the exact same scenario but it feels to me like some custom code is going to be needed here.

Either that or leverage databag values to say install=true or false depending on the state of the code. You would update project a's install item in the databag when you want to deploy and the rest of the time it's set to false. The recipe would only proceed if the value was true?

这篇关于如何使用厨师客户端 - 服务器架构部署代码“按需”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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