cf-for-k8s icon indicating copy to clipboard operation
cf-for-k8s copied to clipboard

Buildpack apps with custom start commands don't have PATH set correctly

Open cwlbraa opened this issue 3 years ago • 3 comments

Describe the bug

If you push a buildpack app and set a custom start command, the resulting process won't have its path set correctly.

To Reproduce*

cf p dora -p ~/workspace/cf-acceptance-tests/assets/dora -c "bundle exec rackup config.ru -p $PORT"
   2020-10-02T10:17:48.27-0700 [APP/PROC/WEB/e7603b73-dfd2-439f-8bdc-5809c9729b3b] OUT /bin/sh: 1: bundle: not found

Expected behavior

The process should run with the same PATH and other env vars as processes defined in the Procfile.

Additional context

This is because Cloud Controller doesn't currently run custom start commands through the CNB launcher at /cnb/lifecycle/launcher.

This bug also occurs with custom start commands set via manifest.yml.

This bug also applies to the non-web processes of multiprocess apps.

This bug also applies to tasks run with cf run-task dora "command".

It does not occur with custom start commands set via Procfile.

WORKAROUND

Set your custom "web" command via Procfile:

$ cat ~/workspace/cf-acceptance-tests/assets/dora/Procfile
web: bundle exec rackup config.ru -p $PORT

However, this does not work for tasks or non-web processes.

You can also call the launcher directly, but this will break when this bug is fixed. If your command is bundle exec rackup config.ru -p $PORT, you can set your command like so:

cf p dora -p ~/workspace/cf-acceptance-tests/assets/dora -c '/cnb/lifecycle/launcher "bundle exec rackup config.ru -p $PORT"'

cwlbraa avatar Oct 02 '20 17:10 cwlbraa