TritonDataCenter / containerpilot

A service for autodiscovery and configuration of applications running in containers
Mozilla Public License 2.0
1.13k stars 135 forks source link

Start main process like V2 #514

Closed tviaud closed 7 years ago

tviaud commented 7 years ago

Hi, is it possible to start a process in containerpilot like in v2 when we pass the arguments to the CMD in the docker run ?

Like that in the dockerfile: CMD ["/usr/local/bin/containerpilot","java" ,"-jar","app.jar"]

The reason for this is that we want to launch the container with different arguments, and passing them via the docker run command as an append. docker run -d containerpilotImage --config-file=/etc/config.yml --another-option=option

If not possible we are in the obligation to pass arguments to containerPilot via env variables, and have it rendered via the templating at runtime ? Like this: jobs: [ { name: "app", exec: "/usr/local/bin/app ${ARGUMENTS}", restarts: "unlimited", port: 9093, } ]

Thanks for any response.

jwreagor commented 7 years ago

You no longer "shim" a main process when executing ContainerPilot V3.

A fundamental change in V3 (worth the read) is the divergence from the original notion that ContainerPilot is a shim or wrapper around a main process/service. It became apparent while implementing the Autopilot Pattern that a lightweight init system was required, not just callbacks wrapping a single process. Many configuration objects of V2 have been distilled into what V3 is today, hopefully for the better.

As you mentioned, you can pass any environment variables you want into either your configuration file or a shell script wrapping another process. ContainerPilot also has template rendering which helps use environment variables and strings in various ways.

tviaud commented 7 years ago

Thanks for the response !

jwreagor commented 7 years ago

@tviaud Not a problem, let us know if you have any questions or suggestions regarding anything else you find.