Comments (5)
Interesting ideas. I mentioned this to @solidsnack a while back since it's something I was interested in using. The third option would get a +1 from me... or even just a set of pluggable modules that a user could chose between, rather than choosing a specific way of announcing.
I think this would work pretty well given the kill
/rm
invocation of deimos.
from deimos.
(3) has a lot going for it, in terms of flexibility. What arguments do you think the script should receive?
from deimos.
I was picturing something like cli flags --start-hook-path and --decommission-hook-path, and deimos would make the whole TaskInfo available to those scripts.
from deimos.
So I've tried to implement this myself...
My original thought was that I could add arbitrary fields to the marathon task like so
{
"container": {
"image": "docker:///myregistry/runner",
"options": ["-v", "/mnt/log/containers/:/mnt/log/containers/", "//", "start", "web"],
"exec": {
"prelaunch": ["/bin/sh", "-c", "/usr/bin/touch", "/var/notify"],
"postdestroy": ["/bin/sh", "-c", "/usr/bin/touch", "/var/destroy"]
}
},
"cmd": "",
"env": {"NODE_ENV":"myenv", "STATSD":"my.graphite.host", "SLUG_URL":"http://example.com:8080/my.api/######.tar.gz"},
"cpus": 0.16,
"mem": 256.0,
"instances": 1
}
And then parse the new fields in containerizer/docker.py
But unfortunately, the Marathon API strips arbitrary fields.
My next thought was that I could add it to the deimos config, but that's much less generic on a container basis.
Something like:
[hooks]
prelaunch: ["/bin/sh", "-c", "/usr/bin/touch", "/var/notify"]
postdestroy: ["/bin/sh", "-c", "/usr/bin/touch", "/var/destroy"]
As far as script arguments, the easiest way to handle that in a generic way would be to use subprocess.Popen(command, env=hook_env), where hook_env could contain the docker container port, uuid, et cetera.
Then it's up to the user to do what they will with that information.
Any thoughts or ideas on my approach(es)?
from deimos.
This is quite interesting. The reason you won't see any additional fields go through when defining things inside container
is because that dictionary maps directly onto the ContainerInfo
protobuf message, which is a static structure.
I'd vote for the second one, not only because the former would be difficult to implement, but the use case I had in mind would probably be something quite generic and a feature of the slave rather than a feature of the container itself. If you're doing something specific for a certain type of container when it launches and terminates, you're probably better off doing that elsewhere, perhaps inside the executor even. A good example of the former could be something like registering DNS entries automatically.
from deimos.
Related Issues (20)
- deimos not picking up additional options for the run command from config HOT 1
- TypeError exception during launch HOT 3
- How to map service port to the random port? HOT 6
- Possible to run any docker container? HOT 3
- Status code not being returned by conteinerizer
- Not sure how to login to private registry HOT 15
- Support Images with Entrypoint defined HOT 17
- Error when trying to start mesos-slave with bad path for containerizer_path HOT 1
- Mesos with Spark trying to download non-existent libmesos/ubuntu:14.04 HOT 21
- Use Deimos for only Marathon HOT 2
- Container info in /cgroups on CentOS 6.5 HOT 4
- -p option doesn't work as documented HOT 1
- Mesos environment variables not set when task_info specified
- More than just docker? HOT 3
- Container flaps between 'Staging' and 'Running' => can't download a package HOT 4
- Question: How does port pairing work? HOT 1
- Deimos should not override workdir HOT 1
- Customize docker run arguments HOT 2
- Deimos insists on ate least one pull per image
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 deimos.