[FEATURE REQUEST] Implement poco run
hron84 opened this issue · 2 comments
It would be nice if poco would allow override a specified command to run in a service.
Real-world example is debugging a docker container. Currently - since Poco makes possible to collect environment variables from several files, there is no easy way to run and override command in the docker-compose command
section.
I want similar functionality how docker-compose run -f docker/dc-shiwa.yml shiwa bash -l
could work, but with the full support of substituting environment variables from the corresponding files.
CLI interface could be poco run PLAN CONTAINER command [args]
one of poco's main functions is to do the complicated docker-compose commands for you. if you want to do this manually, it loses its meaning. in that case you can use your compiled command directly from shell
Exactly. However, poco is a generic tool, and sometimes we need to run for example one-shot maintenance tasks or generating reports with the exactly same environment and setting that is used by the application.
For example, imagine a Ruby on Rails application, which has some built-in tasks for maintaining database or generated statics. It is as simple as running rake db:migrate
or rake assets:cleanup
, but these commands need the environment variables from the docker config.
If I use a 3 container setup (db, redis, app) and I want to run these maintenance tasks, with poco I can run
poco run myapp rake db:migrate
while, without poco, I have to do similar to this:
docker compose run -f docker/dc-db.yml -f docker/dc-redis.yml -f docker/dc-app.yml --env ??? run 'rake db:migrate'
Where the correct environment inclusion can be even more difficult, if I normally rely on poco to load environment files instead of loading them with docker-compose YAMLs.