community icon indicating copy to clipboard operation
community copied to clipboard

Buildpacks default port

Open collimarco opened this issue 3 years ago • 4 comments

Do buildpacks define any convention about the default port to use for the web server?

I mean, if I need to route the HTTP requests to a container built with pack (it can be any application built with any builder), is there a default port / convention?

By default, should I route the traffic to port 80, 3000, 8080 or something else?

collimarco avatar Nov 24 '21 21:11 collimarco

It's all dependant on the application and/or buildpacks configuration.

For example, here's some literature for:

jromero avatar Dec 06 '21 17:12 jromero

Finally we decided to set a PORT env variable where the buildpack is used (e.g. inside Kubernetes).

This seems the de facto standard (also confirmed by your links).

collimarco avatar Dec 06 '21 17:12 collimarco

Do you think that it would be useful to make the PORT env variable explicitly documented by Buildpacks? (writing for example that the application and any configurations generated automatically by pack must listen on PORT)

collimarco avatar Dec 06 '21 17:12 collimarco

This is a good idea. Although given that this isn't a defined contract in the spec, I think the best we can do for the time being would be to consider it a convention.

We have Conventions in the Platform Guide, this may want to go under Application Developer Guide -> Conventions AND Buildpack Author Guide -> Conventions.

jromero avatar Dec 07 '21 12:12 jromero