product:port

Introduction

product:port prints the URL where your product is running. It reads the port Docker actually published, so it is always the one to open.

splent product:port
  Product:  my_first_app
  Env:      dev
  Port:     5591 -> 5000

  URL: http://localhost:5591

It needs a selected product (SPLENT_APP) with docker/.env, running with published ports.


Asking for another environment

splent product:port --env prod

Without --env it reads SPLENT_ENV from <product>/docker/.env, and takes dev when it is unset. Both are normalised, so production is prod.


How it finds the port

It reads docker-compose.<env>.yml, or docker-compose.yml when there is none, and takes the web service, <product>_web or <product>_web_deploy. A product whose web service has another name falls back to the first service whose name contains the product name.

Then it reads docker ps for the container with exactly that name, so a deployment running next to the dev stack never answers for it. When the container publishes several ports, it takes the one mapped to 5000, the app port.

The host is 10.10.10.10 when the workspace has a .vagrant folder, and localhost otherwise.


Reference

Option Description
--env dev\|prod The environment to inspect
Error What to do
Missing <workspace>/<product>/docker/.env Generate it with splent product:env --generate --all --dev and --merge
Container '<name>' not running or has no published ports. Start the product with splent product:up
Container '<name>' publishes ... but none maps to the app port 5000. Publish the app port in the compose file

Back to top

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