Skip to content

Instantly share code, notes, and snippets.

@pieterbreed
Created August 22, 2013 12:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pieterbreed/6306468 to your computer and use it in GitHub Desktop.
Save pieterbreed/6306468 to your computer and use it in GitHub Desktop.
files needed to run docker container pieterbreed/statsd
# job to start statsd in a container in docker
author "Pieter Breed <docker@pb.co.za>"
description "Looks at /etc/statsd/Dockerfile and builds in image based on pieterbreed/statsd, but ADDs the configuration file. Runs the statsd deamon inside the container"
start on started docker and runlevel [2345] and stopped networking and filesystem
stop on stopping docker or runlevel [!2345]
console log
respawn
pre-start script
if [ ! -d /etc/statsd/ -o ! -e /etc/statsd/Dockerfile -o ! -e /etc/statsd/statsd_config.js ]; then
logger -is -t "$UPSTART_JOB" "ERROR: Unable to find configuration files in /etc/statsd/"
exit 1
fi
start docker || true
sleep 5
end script
script
# docker build -t statsd_local /etc/statsd/
/root/dockrun/dockrun/dockrun -rm statsd_local
end script
# creating an image that can run statsd with supplied configuration
# assumes that statsd_config.js contains the effective statsd config
FROM pieterbreed/statsd
MAINTAINER Pieter Breed <docker@pb.co.za>
# copy the config file accross
ADD statsd_config.js /opt/statsd/localConfig.js
EXPOSE 8125:8125/udp
CMD ["/usr/bin/nodejs", "/opt/statsd/stats.js", "/opt/statsd/localConfig.js"]
# creating an image that can run statsd with supplied configuration
# assumes that statsd_config.js contains the effective statsd config
FROM pieterbreed/statsd
MAINTAINER Pieter Breed <docker@pb.co.za>
# copy the config file accross
ADD statsd_config.js /opt/statsd/localConfig.js
EXPOSE 8125:8125/udp
CMD ["/usr/bin/nodejs", "/opt/statsd/stats.js", "/opt/statsd/localConfig.js"]
  • create the file above in the paths with '_' replaced with '/'
  • edit /etc/statsd/statsd_conf.js to suit your environment
  • install golang, clone dockrun and build it
  • edit /etc/init/statsd.conf to point dockrun from where it was built in the previous step
  • run start statsd and afterwards docker ps which should show the statsd deamon running, and using port '8125/udp' on the host.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment