Omnibus-ctl: What is it and what can it do for you?
转自:https://blog.chef.io/2015/05/26/omnibus-ctl-what-is-it-and-what-can-it-do-for-you/
Are you building software with Chef Omnibus? Do your packages need to run multiple runit services? Then Omnibus-ctl may be for you!
Omnibus-ctl is a massively useful tool you can use to run common commands in Chef Omnibus packages.
What is Chef Omnibus?
Chef Omnibus is a way to easily create full-stack installers for projects across a variety of platforms. A full-stack installer includes everything your customers need to install and configure in order to run your application.
For more information, check out this talk by Seth Chisamore and Christopher Maier called Eat the Whole Bowl: Building a Full-Stack Installer with Omnibus. If you like, you can also view just the slides here.
What is Omnibus-ctl?
Omnibus-ctl is a wrapper for several service commands which can be run on a server that has been configured with an Omnibus package (i.e. omnibus-supermarket). These commands are largely used to either query common runit services or to run Chef commands.
Installing Omnibus-ctl
Omnibus-ctl is usually built through the omnibus-software repo. You can pull this into an omnibus project of your own by requiring the omnibus-software gem in your project’s Gemfile. Check out how the omnibus-supermarket project does this.
Here are the steps to including Omnibus-ctl in your Omnibus project:
1) Include omnibus-software in your omnibus-project’s Gemfile
2) In your omnibus project, create a file config/software/#{project_name}-ctl.rb
3) In this file you just created, list omnibus-ctl as a dependency (omnibus-ctl is brought in as part of omnibus-software, but you still need to add it as a dependency).
config/software/#{project_name}-ctl.rb
dependency "omnibus-ctl"
4) In your build block, configure a file called something similar to #{install_dir}/bin/#{project.name}. Here, you will define the SVWAIT (the amount of time to wait for a command to take effect, the default is 7 seconds), add some Ruby environment handling, and finally it calls the base omnibus-ctl command with a set of project specific arguments (the project name and the path to the extra commands) and then it passes on any arguments the user gave ($@).
Take a look at this example from omnibus-supermarket to see it in action.
Note that we call a template to define the file at the install_directory/bin/supermarket-ctl.
omnibus-supermarket/config/software/supermarket-ctl.rb
And here is the template, which defines ruby environment handling, SVWAIT, and more.
config/templates/supermarket-ctl/supermarket-ctl.erb
With these files in place, when the supermarket-omnibus package is installed we can run commands like “supermarket-ctl restart” to restart all services on the server.
Using Omnibus-ctl
Once Omnibus-ctl is included in the omnibus package and the package is installed, you now have a variety of commands at your disposal.
These commands include:
General Commands:
cleanse
Delete all supermarket data, and start from scratch.
help
Print this help message.
reconfigure
Reconfigure the application.
show-config
Show the configuration that would be generated by reconfigure.
uninstall
Kill all processes and uninstall the process supervisor (data will be preserved).
Service Management Commands:
graceful-kill
Attempt a graceful stop, then SIGKILL the entire process group.
hup
Send the services a HUP.
int
Send the services an INT.
kill
Send the services a KILL.
once
Start the services if they are down. Do not restart them if they stop.
restart
Stop the services if they are running, then start them again.
service-list
List all the services (enabled services appear with a *.)
start
Start services if they are down, and restart them if they stop.
status
Show the status of all the services.
stop
Stop the services, and do not restart them.
tail
Watch the service logs of all enabled services.
term
Send the services a TERM.
You call one of these commands by prefixing it with #{project.name}-ctl. For example, to run the restart command from a server which has the omnibus-supermarket package installed, I would use:
$ supermarket-ctl restart
Extending Omnibus-ctl
Along with the included commands, you can also write and include your own ctl commands.
You create custom ctl subcommands using a lightweight DSL.
For examples, check out the install command from Chef Server or this test command from Omnibus Supermarket.
Generally, you include templates for your custom commands within a Chef recipe within your Omnibus package. The Chef recipe will take this template and make a file in the directory your specify. For example, take a look at this line from Omnibus Supermarket.
config/software/supermarket-ctl.rb
In Omnibus Supermarket, any custom commands are kept in omnibus-supermarket/cookbooks/omnibus-supermarket/files/default/ctl-commands. Our Chef recipes will take any template (such as the one at omnibus-supermarket/cookbooks/omnibus-supermarket/files/default/ctl-commands/test.rb) and use it to make a file and sync it in our install_directory/embedded/service/omnibus-ctl/ directory, which will make it available for use from the command line.
And that is an introduction to omnibus-ctl. Go forth and explore!
Omnibus-ctl: What is it and what can it do for you?的更多相关文章
- ctl 里面pdef解说
WRF 模式MM5 模式都是目前从网上可以下载的气象软件,因此在国内经常可以见到.但这两种模式的数据特点数据的水平网格都不是标准的经纬度网格.需要在ctl 文件中加入PDEF 定义说明把这种非标准的数 ...
- centos7 使用 omnibus包安装方式,安装 gitlab7.4
centos7 使用 omnibus包安装方式,安装 gitlab7.4 1: gitlab是一个开源的软件,类似于github.com那样的git代码管理仓库: 官网 https://about.g ...
- ORA-00214: controlfile '/u01/app/oracle/oradata/[sid]/control01.ctl' version inconsistent with file '/u01/app/oracle/oradata/[sid]/control03.ctl'
Sample error: SQL> startupORACLE instance started. Total System Global Area 285212672 bytesFixed ...
- omnibus方式部署gitlab
omnibus方式部署gitlab Posted on 2015 年 1 月 10 日 4233 Views 这几天折腾搭建git服务器,选择了比较流行的gitlab,一开始就直奔一键安装脚本去了 ...
- [20171124]手工使用Seed_Database.dfb和Seed_Database.ctl建库.txt
[20171124]手工使用Seed_Database.dfb和Seed_Database.ctl建库.txt --//昨天看yueli34的帖子,链接http://www.itpub.net/thr ...
- Omnibus test
sklearn实战-乳腺癌细胞数据挖掘(博客主亲自录制视频教程) https://study.163.com/course/introduction.htm?courseId=1005269003&a ...
- omnibus gitlab-ce安装
架构 关闭防火墙 [root@gitlab ~]# systemctl stop firewalld [root@gitlab ~]# systemctl disable firewalld 关闭SE ...
- 在dbgrid中如何多行选中记录(ctl与shift均可用)
在dbgrid中如何多行选中记录(ctl与shift均可用),设置dbgrid的dgmultiselect为true,只有ctl好用而shift不好用,如何使shift也好用 Dbgrid源代码:pr ...
- oracle sqldrl命令与以及ctl文件
具体操作如下: 第一步:先编辑好数据控制文件 xx.ctl,如test.ctl options(skip=1) --跳过第一行(看实际情况) load data infile 'C:\Users\ ...
- GEO(Gene Expression Omnibus):高通量基因表达数据库
Gene Expression Omnibus(GEO)是一个公共存储库,可以存档和自由分发由科学界提交的全套微阵列,新一代测序和其他形式的高通量功能基因组数据. 除数据存储外,还提供一系列基于Web ...
随机推荐
- 通过分析 WPF 的渲染脏区优化渲染性能
原文:通过分析 WPF 的渲染脏区优化渲染性能 本文介绍通过发现渲染脏区来提高渲染性能. 本文内容 脏区 Dirty Region WPF 性能套件 脏区监视 优化脏区重绘 脏区 Dirty Regi ...
- 自学Python编程的第六天(最后代码有更好的请告诉我)----------来自苦逼的转行人
2019-09-16-23:09:06 自学Python的第六天,也是写博客的第六天 今天学的内容是有关dict字典的用法 看视频加上练习,目前还没遇到有难点,但是感觉很不好的样子 没有难点以后突然出 ...
- Excel表格快速将公式运用到一整列
假设你的公式在B2单元格,需要复制公式到B3:B999,那么你先选择包含公式单元格的所有需要复制公式的单元格(B2:B999),然后按Ctrl+D即可全部填充.
- Java自学-数组 二维数组
Java 如何使用二维数组 这是一个一维数组, 里面的每一个元素,都是一个基本类型int int a[] =new int[]{1,2,3,4,5}; 这是一个二维数组,里面的每一个元素,都是一个一维 ...
- vue从零开始(二)指令
一.v-text和v-html <span v-text="msg"></span> <div v-html="html"> ...
- Apache Flink 零基础入门(转)
这是一份很好的 Apache Flink 零基础入门教程. Apache Flink 零基础入门(一&二):基础概念解析 Apache Flink 零基础入门(三):开发环境搭建和应用的配置. ...
- MySQL DDL--MySQL 5.7版本Online DDL操作
主键索引维护 1.新增主键索引 ## 可以使用ALGORITHM=INPLACE+LOCK=NONE方式,操作期间允许读写. ALTER TABLE tb001 ADD PRIMARY KEY (ID ...
- OAuth 2.0 的一个简单解释
OAuth 2.0 是目前最流行的授权机制,用来授权第三方应用,获取用户数据. 这个标准比较抽象,使用了很多术语,初学者不容易理解.其实说起来并不复杂,下面我就通过一个简单的类比,帮助大家轻松理解,O ...
- php审核流程详解
在公司运营中,人员的变动及请假.离职情况都很普遍,这就需要有一个管理系统来系统的做一套流程,可以提升工作效率节省时间.在流程中需要有顺序的进行提交审核,接下来我们做一套简单的新建流程以及提交审核的系统 ...
- 使用Xpath+多进程爬取诗词名句网的史书典籍类所有文章。update~
上次写了爬取这个网站的程序,有一些地方不完善,而且爬取速度较慢,今天完善一下并开启多进程爬取,速度就像坐火箭.. # 需要的库 from lxml import etree import reques ...