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 ...
随机推荐
- Django url反向解析与路由分发名称空间
url反向解析 url.py from django.conf.urls import url from django.contrib import admin from app01 import v ...
- 开始转型学习java
什么编程语言这些都是一样的,编程思想都是一样的.只不过是表现形式. 标识符 每一个字符在ascll码表例都有对应的数字 所以字符和数字是可以相加的 'a'+1 也可以显示数字对应的字符 (ch ...
- Linux内核编译:很少有人提及的一些内容
1. 你可以使用O=参数将编译结果放到其他位置(非源代码目录),例如:make O=~/build ... 这样做的好处是你的源代码目录不会受到任何改变:你甚至可以在不同的体系结构间共享源代码. 注意 ...
- CAP原理和BASE思想--GLQ
分布式领域CAP理论,Consistency(一致性), 数据一致更新,所有数据变动都是同步的Availability(可用性), 好的响应性能Partition tolerance(分区容忍性) 可 ...
- XStream和Dom4j的区别
对于搞技术的人来说,xml文件的处理应该并不陌生吧,先总述下,个人感觉XStream在处理XML文件和JavaBean对象互转时比较好,dom4j对常用的xml配置文件操作比较好点:首先,Dom4j ...
- MySQL 日期类型及默认设置 (除timestamp类型外,系统不支持其它时间类型字段设置默认值)
MySQL 日期类型及默认设置 之前在用 MySQL 新建 table,创建日期类型列时遇到了一些问题,现在整理下来以供参考. MySQL 的日期类型如何设置当前时间为其默认值? 答:请使用 time ...
- GROUP BY关键字与WITH ROLLUP一起使用
1 GROUP_CONCAT mysql> SELECT student_name, -> GROUP_CONCAT(test_score) -> FROM stud ...
- RNN总结
RNN既可以表述为循环神 经网络(recurrent neural network),也可以表述为递归神经网络(recursive neural network),前者一般用于处理以时间序列为输入的问 ...
- VS2013下.Net Framework4配置FineUI4.14
配置步骤: 工具箱:空白处右键--选项卡--浏览,选择FineUI.dll配置web.config,管道模式设置为:传统 配置web.config 在form表单下添加: <f:PageMana ...
- 什么是最小可行性数据产品(MVP)?如何用它做机器学习?