- 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 pointdockrun
from where it was built in the previous step - run
start statsd
and afterwardsdocker ps
which should show the statsd deamon running, and using port '8125/udp' on the host.
Created
August 22, 2013 12:20
-
-
Save pieterbreed/6306468 to your computer and use it in GitHub Desktop.
files needed to run docker container pieterbreed/statsd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment