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 ...
随机推荐
- IO测试工具之fio详解(转)
http://www.cnblogs.com/raykuan/p/6914748.html 目前主流的第三方IO测试工具有fio.iometer和Orion,这三种工具各有千秋. fio在Linux系 ...
- WPF Demo3
<Window x:Class="Demo3.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/ ...
- ALGO-1_蓝桥杯_算法训练_区间k大数查询
问题描述 给定一个序列,每次询问序列中第l个数到第r个数中第K大的数是哪个. 输入格式 第一行包含一个数n,表示序列长度. 第二行包含n个正整数,表示给定的序列. 第三个包含一个正整数m,表示询问个数 ...
- Javascript中的闭包(六)
一.什么是闭包 函数可以记住并访问所在词法作用域时,就产生了闭包,即使在词法作用域外调用函数. (也就是说如果一个函数在执行完之后,其中的内部包含的函数仍然对该函数的作用域持有着引用(函数执行完 ...
- 1006 Sign In and Sign Out (25 分)
1006 Sign In and Sign Out (25 分) At the beginning of every day, the first person who signs in the co ...
- [UE4]ue4 FString 中文乱码问题
使用FString出现乱码,最简单的情况,FString Str = "你好"; 这时候就会出现乱码,解决方法是改成这样 FString Str = TEXT("你好&q ...
- CA证书扫盲,https讲解
很多关于CA证书的讲解. 1.什么是CA证书. 看过一些博客,写的比较形象具体. ◇ 普通的介绍信 想必大伙儿都听说过介绍信的例子吧?假设 A 公司的张三先生要到 B 公司去拜访,但是 B 公司的所有 ...
- Windows7下搭建Eclipse+Python开发环境
机器: Windows7_x86_64 前提: 机器已成功安装Python2.7,并配置好环境变量. 步骤: 一.Eclipse的安装 Eclipse是基于java的一个应用程序,因此需要一个java ...
- PHP 算术运算符
PHP 算术运算符 运算符 名称 描述 实例 结果 x + y 加 x 和 y 的和 2 + 2 4 x - y 减 x 和 y 的差 5 - 2 3 x * y 乘 x 和 y 的积 5 * 2 1 ...
- python Web开发你要理解的WSGI & uwsgi详解
原文:https://www.jb51.net/article/144852.htm WSGI协议 首先弄清下面几个概念: WSGI:全称是Web Server Gateway Interface,W ...