buildpacks / community

Community content for the Cloud Native Buildpacks (CNB) project
https://buildpacks.io
Creative Commons Attribution 4.0 International
43 stars 24 forks source link

Buildpacks default port #147

Open collimarco opened 2 years ago

collimarco commented 2 years ago

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?

jromero commented 2 years ago

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

For example, here's some literature for:

collimarco commented 2 years ago

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 commented 2 years ago

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)

jromero commented 2 years ago

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.