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 ...
随机推荐
- War包反编译过程
War包反编译过程 很多人可以将项目编译为war发布,可是有时候得到war确看不到源码.今天分享下war反编译的过程: 1.首先下载一个小工具,在http://jd.benow.ca/官网下载jd-g ...
- bzoj 4449: [Neerc2015]Distance on Triangulation
Description 给定一个凸n边形,以及它的三角剖分.再给定q个询问,每个询问是一对凸多边行上的顶点(a,b),问点a最少经过多少条边(可以是多边形上的边,也可以是剖分上的边)可以到达点b. I ...
- [转] AForge.NET 图像处理类
https://www.nuget.org/packages?q=AForge.NET https://baike.baidu.com/item/AForge.NET/114415?fr=aladdi ...
- mysql 不同事务隔离级别
repeatable read 在同一事务中,同一查询多次进行时候,由于其他插入操作(insert)的事务提交,导致每次返回不同的结果集. 标准的repeatable read是允许幻读的,因为这一级 ...
- 1019 General Palindromic Number (20 分)
1019 General Palindromic Number (20 分) A number that will be the same when it is written forwards or ...
- 怎样使用 css 的@media print控制打印
怎样使用 css 的@media print控制打印? <HTML> <HEAD> <TITLE> New Document </TITLE> < ...
- pandas的to_csv函数
分隔符 sep : Field delimiter for the output file (default ”,”) dt.to_csv('C:/Users/think/Desktop/Result ...
- Spark学习笔记1:Spark概览
Spark是一个用来实现快速而通用的集群计算的平台. Spark项目包含多个紧密集成的组件.Spark的核心是一个对由很多计算任务组成的,运行在多个工作机器或者是一个计算集群上的应用进行调度,分发以及 ...
- 6.27-JSTL、标签、分页
一.JSTL 条件标签: <c:if> if if(){ }else if(){ }else{ } <c:choose> <c:when></c:when&g ...
- dockers的容器删除
1.停用全部运行中的容器: docker stop $(docker ps -q) 2.删除全部容器: docker rm $(docker ps -aq) 3.一条命令实现停用并删除容器: dock ...