community
community copied to clipboard
Buildpacks default port
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?
It's all dependant on the application and/or buildpacks configuration.
For example, here's some literature for:
- Paketo Buildpacks: Web Servers
- Heroku: Java Applications
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).
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)
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.