blimp icon indicating copy to clipboard operation
blimp copied to clipboard

Add support for `docker-compose run`

Open Laski opened this issue 4 years ago • 3 comments

Is your feature request related to a problem? Please describe. We have many environment initialization routines implemented inside the docker image and run with compose (e.g. docker-compose run backend load_db). In order to completely replace docker-compose with blimp, it would be nice that blimp supports that syntax and behaviour.

Describe the solution you'd like Be able to blimp run backend load_db (with or without support for the other parameters).

Additional context

$ blimp run backend load_db
unknown command "run" for "blimp"

Did you mean this?
	up

PS: I just found this project and looks really promising. Thanks!

Laski avatar Nov 18 '20 23:11 Laski

Hi @Laski! We don't expect to add blimp run soon unfortunately since we're not working on it full time anymore.

However, we have had some teams simulate docker-compose run with blimp exec. The basic pattern is to create a dummy version of the container for blimp to boot, and then exec into it to run commands.

E.g.

services:
  backend:
    image: backend-image
    # This makes it so the container starts, making it available for `blimp exec`, but its command just makes it wait forever.
    command: tail -f /dev/null

Then once you blimp up, you can run blimp exec backend load_db.

Hope that helps!

kklin avatar Nov 18 '20 23:11 kklin

Thanks @kklin! Yeah, it seems the best workaround until this is implemented :sweat_smile: . Sad to hear the project is not being worked on, it seems so promising. Which dir/files do you think I can read in order to have an idea of how to implement this myself? If I find the time I'd love to help.

Laski avatar Nov 18 '20 23:11 Laski

You'd implement this modifying the RPC between the CLI, and the cluster component that deploys containers into the Kubernetes cluster: https://github.com/kelda/blimp/blob/master/_proto/blimp/cluster/v0/manager.proto

For example, the code for deploying pods when you run blimp up is here: https://github.com/kelda/blimp/blob/master/cluster-controller/main.go#L500

The thing I'm not sure about is what the UX would be of the containers created by blimp run. Should they get removed if you do blimp up after? If not, how would you remove them?

kklin avatar Nov 20 '20 01:11 kklin