How does Heroku know how to execute the application?
Heroku knows how to execute the application by reading the instructions from a file named Procfile, located at the root of the project; the content is as follows:
web: server/target/universal/stage/bin/server -Dhttp.port=$PORT -Dconfig.file=server/conf/heroku.conf
The first indication in the line is the type of application. This can be anything. The web value is a special type, telling Heroku that this process only receives requests from HTTP.
The second part is the path to the executable. In fact, the SBT project creates this executable for us during the build process.
The last part is a list of properties for the Play application, namely
- -Dhttp.port, which sets the port to listen to by using the Heroku variable, $PORT
- -Dconfig.file, which set the configuration file path to be used by the application.