Skip to content

Instantly share code, notes, and snippets.

@ybogdanov
Last active November 28, 2016 00:26
Show Gist options
  • Save ybogdanov/e12e2a7d2099de9a41ec to your computer and use it in GitHub Desktop.
Save ybogdanov/e12e2a7d2099de9a41ec to your computer and use it in GitHub Desktop.
An example of a high-level application (service) manifest. See http://tech.grammarly.com/blog/posts/How-We-Deploy-Containers-at-Grammarly.html
# This is an example of a high-level application (service) that can run along with
# platform agents, write metrics and logs to them.
namespace: example
containers:
app:
image: alpine:3.2
# We wrote a simple program that on every tick prints the iterator,
# increments a metric in StatsD and writes a line to the log file
cmd: |-
i=0
while [ $i -lt 10000000 ]
do
echo "tick $i"
echo "ticks:1|c" | nc -u -w0 statsd 8125
echo "{\"msg\":\"tick $i\"}" >> /mnt/log/platform_common_app.json
i=`expr $i + 1`
sleep 1
done
labels:
# This label lets logstash-forwarder from the platform toolkit discover
# this log file and start delivering it to our log storage facility
logs: /mnt/log/platform_common_app.json
add_host:
# Here we add /etc/hosts entry to this container and assign "statsd" host to the bridge
# ip address. This allows our "app" container to not depend on the StatsD container
# from the platform toolkit but be able to write to it when it is available
- statsd:{{ bridgeIp }}
volumes:
# We write logs to /mnt/log on the host machine so logstash-forwarder is able to read them
- /mnt/log:/mnt/log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment