Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to run the docker image? #715

Open
symbiont-ji opened this issue Dec 4, 2020 · 6 comments
Open

How to run the docker image? #715

symbiont-ji opened this issue Dec 4, 2020 · 6 comments

Comments

@symbiont-ji
Copy link

You provide a docker image, but no instructions on how to use it. Where is it going to find the configuration file? We are not really expected to rebuild the docker image, are we?

@lewismc
Copy link

lewismc commented Feb 11, 2021

I have the same query... I have absolutely no idea how to use the image... !

@callendorph
Copy link

I did this and it runs - but it doesn't override the config.js file so you are left with the default config which is kind of useless:

docker run --rm --name statsd -v $PWD/config.js:/usr/src/app/config.js -p 8125:8125/udp -p 8126:8126 statsd/statsd
12 Mar 01:06:13 - [1] reading config file: config.js
12 Mar 01:06:13 - server is up INFO

So then I created my own config config2.js and overrode the entrypoint:

docker run --rm --entrypoint /usr/local/bin/node --name statsd -v $PWD/config.js:/usr/src/app/config2.js -p 8125:8125/udp -p 8126:8126 statsd/statsd /usr/src/app/stats.js /usr/src/app/config2.js
12 Mar 00:57:17 - [1] reading config file: /usr/src/app/config2.js
12 Mar 00:57:17 - server is up INFO

This works and allows me to set the configurations how i want them. But is also ugly as sin. I'm planning to rebuild the DockerFile and use an argument for the config file. Perhaps I'm wrong though - maybe there is some clever way that allows you to overwrite the config.js file.

@BlueHatbRit
Copy link
Member

I'm working on enabling environment variable configuration for statsd, along with that I'll then throw in some instructions for using the docker image.

This is just maintained by me in my spare time, since the start of the pandemic time has been quite stretched for me so this sort of improvement hasn't been high on the list. If someone wants to submit a PR to speed things up then that would be very welcome.

@LiuQhahah
Copy link

I suggest that add "debug:true" in your config.js file which you can learn about how the process runs.
the config.js detail path is : https://github.com/statsd/statsd/blob/master/exampleConfig.js#L39

@AbhiSinha08
Copy link

This issue seems to be still relevant. Here's how I used a custom configuration file in a docker compose project

statsd:
        image: statsd/statsd
        ports:
        - "8125:8125/udp"
        - "8126:8126"
        volumes:
        - ./statsd_config.js:/usr/src/app/custom_config.js
        entrypoint: "node /usr/src/app/stats.js /usr/src/app/custom_config.js"

@AbhiSinha08
Copy link

If you're still actively maintaining this project, Can I work on this issue to get configuration from environment?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants