Containerpilot 配置文件示例
{
consul: "localhost:8500",
logging: {
level: "INFO",
format: "default",
output: "stdout"
},
jobs: [
{
name: "app",
exec: "/bin/app",
restarts: "unlimited",
port: 80,
when: {
// we want to start this job when the "setup" job has exited
// with success but give up after 60 sec
source: "setup",
once: "exitSuccess",
timeout: "60s"
},
health: {
exec: "/usr/bin/curl --fail -s -o /dev/null http://localhost/app",
interval: 5,
tll: 10,
timeout: "5s",
},
tags: [
"app",
"prod"
],
interfaces: [
"eth0",
"eth1[1]",
"192.168.0.0/16",
"2001:db8::/64",
"eth2:inet",
"eth2:inet6",
"inet",
"inet6",
"static:192.168.1.100", // a trailing comma isn't an error!
]
},
{
// we can create a chain of "setup" events by having
// jobs wait for other jobs to become healthy
name: "setup",
when: {
source: "consul-agent",
once: "healthy"
},
exec: "/usr/local/bin/preStart-script.sh",
restart: "never"
},
{
name: "preStop",
when: {
source: "app",
once: "stopping"
},
exec: "/usr/local/bin/preStop-script.sh",
restart: "never",
},
{
name: "postStop",
when: {
source: "app",
once: "stopped"
},
exec: "/usr/local/bin/postStop-script.sh",
},
{
// a service that doesn't have a "when" field starts up on the
// global "startup" event by default
name: "consul-agent",
// note we don't have a port here because we don't intend to
// advertise one to the service discovery backend
exec: "consul -agent -join consul",
restart: "always"
},
{
name: "consul-template",
exec: ["consul-template", "-consul", "consul",
"-template", "/tmp/template.ctmpl:/tmp/result"],
restart: "always",
},
{
name: "periodic-task1",
exec: "/usr/local/bin/task.sh arg1",
timeout: "100ms",
when: {
interval: "1500ms"
}
},
{
name: "reload-app",
when: {
source: "watch.app",
each: "changed"
},
exec: "/usr/local/bin/reload-app.sh",
timeout: "10s"
},
{
name: "reload-nginx",
when: {
source: "watch.nginx",
each: "changed"
},
exec: "/usr/local/bin/reload-nginx.sh",
timeout: "30s"
},
{
// this job will write metrics to our telemetry collector
name: "sensor",
exec: "/usr/local/bin/sensor.sh"
when: {
interval: "5s"
}
}
],
watches: {
{
name: "app",
interval: 10
},
{
name: "nginx",
interval: 30
}
},
control: {
socket: "/var/run/containerpilot.socket"
},
telemetry: {
port: 9090,
interfaces: "eth0"
metrics: [
{
name: "metric_id"
help: "help text"
type: "counter"
}
]
}
}
==========================================================================================
{
consul: '{{ if .CONSUL_AGENT }}localhost{{ else }}{{ .CONSUL | default "consul"}}{{ end }}:8500',
logging: {
level: '{{ .LOG_LEVEL | default "INFO" }}'
},
jobs: [
{
name: "preStart",
exec: "python /usr/local/bin/manage.py",
{{ if .CONSUL_AGENT }}when: {
source: "consul-agent",
once: "healthy"
}{{ end }}
},
{
name: '{{ .SERVICE_NAME | default "mysql" }}',
exec: [
"mysqld",
"--console",
"--log-bin=mysql-bin",
"--log_slave_updates=ON",
"--gtid-mode=ON",
"--enforce-gtid-consistency=ON"
],
port: 3306,
when: {
source: "preStart",
once: "exitSuccess"
},
health: {
exec: "python /usr/local/bin/manage.py health",
interval: 5,
ttl: 25
}
},
{
name: "onChange",
exec: "python /usr/local/bin/manage.py on_change",
when: {
source:'watch.{{ .SERVICE_NAME | default "mysql" }}-primary' ,
each: "changed"
}
},
{
name: "snapshot-check",
exec: "python /usr/local/bin/manage.py snapshot_task",
timeout: "10m",
when: {
interval: "5m"
},
},
{{ if .CONSUL_AGENT }}{
name: "consul-agent",
restarts: "unlimited",
exec: [
"/usr/local/bin/consul", "agent",
"-data-dir=/data",
"-config-dir=/config"
],
health: {
exec: 'consul join {{ .CONSUL | default "consul"}}',
interval: 5,
ttl: 10
}
}{{ end }}
],
watches: [
{
name: '{{ .SERVICE_NAME | default "mysql" }}-primary',
interval: 10
}
]
}
Containerpilot 配置文件示例的更多相关文章
- redis 配置文件示例
# redis 配置文件示例 # 当你需要为某个配置项指定内存大小的时候,必须要带上单位,# 通常的格式就是 1k 5gb 4m 等酱紫:## 1k => 1000 bytes# 1kb =& ...
- Containerpilot 配置文件 之 consul
Consul ContainerPilot使用Hashicorp的consul在作为服务的容器中注册工作. Watches查询consul找出其他服务的状态. Client configuration ...
- Nginx配置文件示例
Nginx的配置文件示例:(仅供参考) 强烈建议先将默认的配置文件备份再进行操作! 请根据自己项目的实际路径来配置相关路径! uwsgi配置文件请参考:uwsgi配置文件示例 # For more i ...
- uwsgi配置文件示例
uwsgi配置文件参考 相关路径请根据自己项目的实际路径配置 在进行Nginx+uwsgi部署Django项目的时候,需要Nginx的配置中包含uwsgi的配置项,具体请查看另一篇:Nginx配置文件 ...
- Log4j2 + Maven的配置文件示例详解
一.配置Maven:pom.xml <properties> <project.build.sourceEncoding>UTF-8</project.build.sou ...
- Containerpilot 配置文件reload
containerpilot -reload -config ./containerpilot.json 进程号不变,重新加载配置文件
- Containerpilot 配置文件 之 Telemetry
如果提供telemetry选项,ContainerPilot将公开可用于刮擦性能telemetry的Prometheus HTTP客户端界面. telemetry接口被公告为consul服务. tel ...
- Containerpilot 配置文件 之 Watches
watch是在consul进行监视的服务配置. watch轮询服务的状态,并在服务变得健康,变得不健康或者实例数量发生变化时发出事件. 请注意,watch不包括行为; watch只发出事件,以便job ...
- Containerpilot 配置文件 之 Jobs
ContainerPilot job是用户定义的进程和规则,用于何时执行它,如何进行健康检查,以及如何向Consul做广告. 这些规则旨在允许灵活性覆盖几乎可能要运行的任何类型的进程. 一些可能的jo ...
随机推荐
- Android画图之抗锯齿 paint 和 Canvas 两种方式
在画图的时候,图片如果旋转或缩放之后,总是会出现那些华丽的锯齿.其实Android自带了解决方式. 方法一:给Paint加上抗锯齿标志.然后将Paint对象作为参数传给canvas的绘制方法. ...
- 设计模式初学者笔记:Abstract Factory模式
首先啰嗦下创建迷宫所用的Room类.这个类并不直接保存Room四周的构造,而是通过MapSite* _sides[4]这个私有数组成员指向Room四周的构造.那么什么时候将四周构造直接放在Room中, ...
- ALGO-3_蓝桥杯_算法训练_K好数(DP)
问题描述 如果一个自然数N的K进制表示中任意的相邻的两位都不是相邻的数字,那么我们就说这个数是K好数.求L位K进制数中K好数的数目.例如K = ,L = 2的时候,所有K好数为11...... 共7个 ...
- VBA注释临时
Sub shishi() '按ABCDE为多选题定义答案; 'A.沙利度胺 B.异烟肼 C.利福平 'd.氯法齐明 E.氨苯砜 '46.各型麻风病的首选药物为(D) 'A.沙利度胺 B.异烟肼 C.利 ...
- 【Spring学习笔记-MVC-2】spring导出Excel
说明: 1.结合Spring MVC实现Excel导出功能: 2. 在MVC配置文件中配置Excel视图解析器: 需要的jar包 以poi开头的jar包都是必须的 web.xml <?xml v ...
- appium--每次启动会重新安装的问题(没试过)
有人说加这个 最后 大神说 在appium哪里就可以设置了 对,第一个不勾选就不会安装了[经理][Java]大连●Messi_Z(726862194) 15:54:10把这些东西全去掉就好了
- Game of War - Fire Age 有何特别之处?
作者:福克斯007 链接:https://www.zhihu.com/question/21611550/answer/52458767来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非商业转 ...
- javascript创建对象之工厂模式(一)
工厂模式在软件工程里面是一种比较常见的设计模式了.这种模式抽象了创建具体对象的过程. 上代码: function createHuman(name,sex) { var obj = new Objec ...
- unity3d动态加载dll的API以及限制
Unity3D的坑系列:动态加载dll 一.使用限制 现在参与的项目是做MMO手游,目标平台是Android和iOS,iOS平台不能动态加载dll(什么原因找乔布斯去),可以直接忽略,而在Androi ...
- ubuntu18.04 安装hadoop 2.7.3+hive 2.3.4
1. 安装hadoop 详细请参见本人的另外一片博文<Hadoop 2.7.3 分布式集群安装> 2. 下载hive 2.3.4 解压文件到/opt/software -bin.tar.g ...