{ consul: 'localhost:8500', jobs: [ { name: 'setup-config', exec: '/bin/prestart.sh' }, { name: 'consul-agent', exec: ['/usr/local/bin/consul', 'agent', '-data-dir=/data', '-config-dir=/config', '-log-level=err', '-rejoin', '-retry-join', '{{ .CONSUL | default "consul" }}', '-retry-max', '20', '-retry-interval', '5s'], restarts: 'unlimited', "health": { "exec": "curl -so /dev/null http://localhost:8500", "interval": 10, "ttl": 25 }, when: { source: 'setup-config', once: 'exitSuccess' } }, { name: 'bootstrap', exec: 'node bootstrap-data.js', when: { source: 'consul-agent', once: 'healthy' } }, { name: 'api', port: {{.PORT}}, exec: 'node server.js', health: { exec: '/usr/bin/curl -o /dev/null --fail -s http://localhost:{{.PORT}}/check-it-out', interval: 5, ttl: 5 }, when: { source: 'bootstrap', once: 'exitSuccess' }, restarts: 'unlimited' }, { name: 'sensor_memory_usage', exec: '/bin/sensors.sh memory', timeout: '5s', when: { interval: '5s' }, restarts: 'unlimited' }, { name: 'sensor_cpu_load', exec: '/bin/sensors.sh cpu', timeout: '5s', when: { interval: '5s' }, restarts: 'unlimited' }, { name: 'sensor_disk_capacity', exec: '/bin/sensors.sh diskcapacity', timeout: '5s', when: { interval: '60s' }, restarts: 'unlimited' }, { name: 'sensor_disk_usage', exec: '/bin/sensors.sh diskusage', timeout: '5s', when: { interval: '60s' }, restarts: 'unlimited' }, { name: 'onchange-compose-api', exec: 'pkill -SIGHUP node', when: { source: 'watch.docker-compose-api', each: 'changed' } }, { name: 'onchange-rethinkdb', exec: 'pkill -SIGHUP node', when: { source: 'watch.rethinkdb', each: 'changed' } } ], watches: [ { name: 'docker-compose-api', interval: 3 }, { name: 'rethinkdb', interval: 3 } ], telemetry: { port: 9090, tags: ['op'], metrics: [ { namespace: 'api', subsystem: 'memory', name: 'percent', help: 'Percentage of memory used', type: 'gauge' }, { namespace: 'api', subsystem: 'cpu', name: 'load', help: 'CPU load', type: 'gauge' }, { namespace: 'api', subsystem: 'disk', name: 'capacity', help: 'Disk capacity', type: 'gauge' }, { namespace: 'api', subsystem: 'disk', name: 'usage', help: 'Disk usage', type: 'gauge' }, { namespace: 'api', subsystem: 'request', name: 'concurrent', help: 'Number of concurrent requests', type: 'gauge' }, { namespace: 'api', subsystem: 'process', name: 'up_time', help: 'Process up time', type: 'counter' }, { namespace: 'api', subsystem: 'process', name: 'mem_rss', help: 'Process memory RSS usage', type: 'gauge' }, { namespace: 'api', subsystem: 'process', name: 'heap_used', help: 'Process heap usage', type: 'gauge' } ] } }