Comments (9)
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.
awesome headed out tonight, but will try that tomorrow morning. Thanks
from ventriloquist.
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.
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.
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.
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.
Marking this closed as I think this solved the various issues I was having. Thanks
from ventriloquist.
Awesome :)
from ventriloquist.
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)
- Support Post-Up Hooks HOT 3
- Erlang fails to install when choosing elixir HOT 5
- Ability to set guest's timezone
- Ability to set git configs HOT 5
- Update services and platforms to latest versions HOT 1
- Ability to configure an X Frame buffer HOT 2
- Ability to install and configure heroku's CLI
- Ability to install and configure foreman HOT 2
- Use Docker trusted builds for services/platforms HOT 4
- Vagrant.require_plugin has been deprecated on 1.5+
- Remove hard coded latest platforms version from the plugin
- Set services version on image name instead of using tags
- Use exenv and elixir-build to install Elixir multiple versions HOT 1
- Trying to run on boot2docker HOT 2
- working with vagrant & docker in windows HOT 1
- Breaks on vagrant 1.6 becasue of the Docker provisioner class rename
- A box must be specified HOT 1
- Error on vagrant up: Docker client is not running (RuntimeError) HOT 4
- "address already in use" on starting PostgreSQL HOT 5
- Stepping Down (aka: new maintainer needed) HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ventriloquist.