GithubHelp home page GithubHelp logo

Comments (9)

fgrehm avatar fgrehm commented on August 10, 2024

I can't test this right now but I think you should be able to provide a cmd parameter to the service hash in order to do that. I need to document this somewhere but Ventriloquist builds on top of Vocker and Vocker supports a cmd parameter as you can see on the README

Something along the lines of:

env.services << {
  graphite: { image: 'nickstenning/graphite' },
  statsd: { image: 'danmayer/statsd', cmd: 'YOUR_CMD -h my.hostname.net' }
  # OR this if you have an ENTRYPOINT set
  statsd: { image: 'danmayer/statsd', cmd: '-h my.hostname.net' }
}

Please LMK if it works :)

from ventriloquist.

danmayer avatar danmayer commented on August 10, 2024

awesome headed out tonight, but will try that tomorrow morning. Thanks

from ventriloquist.

danmayer avatar danmayer commented on August 10, 2024

thanks that does pass through unfortunately it looks like I am not grabbing and using the param correctly but this should let me pass in data.

4c56a14fa74a579e05b49586f7db0f11b05162a1cc9d84d96f8c7c05daee8398   danmayer/statsd:latest                      node /statsd-0.6.0/stats.js /data/config.js -h utils.mysite.com

I am going to explain what I am trying to do as you might have a better way. Opposed to actually passing in a pre known host name I want to pass in the hostname of the current host machine that this docker will be set up on. Basically this is because I was trying to make the statsd docker point to the graphite docker and it seems to fail when statsd uses a config with localhost (assuming that ends up at localhost inside that container which doesn't have graphite). It works if I change the config to point to the host machine's hostname. So I feel like I might be trying to solve this the wrong way.

For now I got it working but I did that by combining the graphite and statsd dockerfiles into a single dockerfile that does both as then the localhost hits the graphite setup in the same container.

from ventriloquist.

fgrehm avatar fgrehm commented on August 10, 2024

I'll try one thing before getting back to you but I'm thinking that this issue might be better suited on Vocker's issue tracker unless there is some additional logic you need to be performed when those services are configured (like installing additional packages on the guest vm similar to the postgres service)

If I got it right this is only related to provisioning VMs with docker images that is Vocker's job :)

WDYT?

from ventriloquist.

danmayer avatar danmayer commented on August 10, 2024

yeah I think at this point your right it is getting out of scope of that ventriloquist does. I figured you might know a bit better way to achieve what I am doing. I think since I can now pass args when starting up docker images that covers what ventriloquist should do. The only feature that might make sense if a way to collect information about the host machine after installing docker prior to running commands

env.ventriloquist_host = Ventriloquist.fetch_environment['host']

If it isn't clear, I am using ventriloquist with vagrant with AWS as a provider which is why I don't know the host name until the machine comes up.

That still might be out of scope for this tool though.

By the way thanks for the awesome tool really enjoying it.

from ventriloquist.

fgrehm avatar fgrehm commented on August 10, 2024

Tks for the kind words, I'm glad you liked the project :)

Just throwing in an idea: wouldn't you be able to use Vagrant to configure a pre-defined hostname with config.vm.hostname and use the same value when running the container? Something like:

HOSTNAME = 'my.hostname.net'
Vagrant.configure("2") do |config|
  config.vm.hostname = HOSTNAME
  config.vm.provision :ventriloquist do |env|
    env.services << {
      graphite: { image: 'nickstenning/graphite' },
      statsd: { image: 'danmayer/statsd', cmd: "CMD -h #{HOSTNAME}" }
    }
  end
end

Another option would be to "calculate" the argument during runtime:

Vagrant.configure("2") do |config|
  config.vm.provision :ventriloquist do |env|
    env.services << {
      graphite: { image: 'nickstenning/graphite' },
      statsd: { image: 'danmayer/statsd', cmd: "CMD -h $(hostname -f)" }
    }
  end
end

I just did some experimenting and as tricky as it might look like it works :P

vagrant@dev:~$ hostname
dev.ventriloquist.vagrant

vagrant@dev:~$ sudo docker run busybox hostname
c23df763f6f8

vagrant@dev:~$ sudo docker run busybox echo $(hostname -f)
dev.ventriloquist.vagrant

Not sure if it solves your problem but at least I learned something new :P

from ventriloquist.

danmayer avatar danmayer commented on August 10, 2024

Marking this closed as I think this solved the various issues I was having. Thanks

from ventriloquist.

fgrehm avatar fgrehm commented on August 10, 2024

Awesome :)

from ventriloquist.

danmayer avatar danmayer commented on August 10, 2024

I am sure you will see that I sent a related PR over to the vocker project. As I can now pass various args to the command, I think there is still cases where you want to pass args to docker itself. Anyways, I think it is different enough that I didn't tack it on to this thread ;)

from ventriloquist.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.