Procfile is Kato’s strategy for specifying how the service runs based on code. It itself is an ordinary text file, which needs to be placed in the root directory of the code. Its content is to define the startup command for the service built by source code to run. Usually it only contains one line of information, please see the following example:
Java Language Type (define startup command to run War package)
web: java -jar /opt/webapp-runner.jar --port $PORT --session-store redis ./*.war
Direct Execution of Binary Files (such as nginx)
Execute Startup Scripts (such as executing Tomcat Java Server scripts generated by Maven)
web: sh target/bin/webapp
Start Ruby Project
bundle exec bin/rails server -p $PORT -e $RAILS_ENV
You may have noticed the
$PORTenvironment variable, which specifies the listening port of the service. Kato will automatically inject this environment variable through the port information set by the user when running the service. Through the above-mentioned start commands, flexible configuration of service monitoring ports is realized. A similar mechanism can also be used in almost all language service types such as Tomcat startup.
Procfile Format Description
<service type>: <command>
Service Type: currently only supports
Command: The command line to start the program. The executed command must be running in the foreground.