product:shell

Introduction

product:shell opens a shell in your product’s main container, or runs one command there. It needs a selected product (SPLENT_APP) and Docker running.

splent product:shell

It opens bash, and sh when the container has no bash.


Running one command

splent product:shell --cmd "splent db:status"

--cmd runs the command with sh -c and exits with its exit code, so a script or a CI job sees a failure. Without a terminal, as in a pipe or CI, it runs without -t.


Opening another container

splent product:shell --service my_first_app_db

--service takes a Compose service of the product instead of the main container.


Opening a deployment

splent product:shell --prod

product:deploy runs its own project, <product>_deploy. With --prod, when <product>_prod has no web container running, the command opens the running <product>_web_deploy container.

--service has no such fallback. For another container of the deployment, run docker exec -it <container> bash.


How it finds the main container

It looks in the Compose project <product>_<env> for the service <product>_web (dev) or <product>_web_deploy (prod). In dev, a product whose web service has another name is found by the container that mounts /workspace.


Reference

Option Description
--dev Use the development Compose file
--prod Use the production Compose file
--service NAME Open the shell in this Compose service
--cmd CMD Run CMD with sh -c and exit with its code. Never retried with another shell

Without --dev or --prod it uses SPLENT_ENV, and dev when that is unset.

Error What to do
No docker-compose file found for <product> (<env>). The product has no docker-compose.<env>.yml or docker-compose.yml. Check its docker/ folder
No running containers found for <product> (<env>). Start it with splent product:up --<env>

Both exit 1.


Back to top

splent. Distributed by an LGPL license v3. Contact us: drorganvidez@us.es