Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a Procfile-based application

I have seen enough of its appearance that I have to understand more about it. I see that Heroku has a procfile and I assume it's about running this procfile after it deployed to heroku.

I also see the term procfiled-based application. So actually is Procfile specific to Heroku or is it something else?

like image 321
Chris Yeung Avatar asked Apr 13 '15 16:04

Chris Yeung


People also ask

Why is Procfile used?

You can use a Procfile to declare a variety of process types, including: Your app's web server. Multiple types of worker processes. A singleton process, such as a clock.

What should be in Procfile?

The Procfile specifies the commands that are executed by the app upon startup. You can use the Procfile to declare a variety of process types, including: Your application's web server. Multiple types of worker processes.

What is Python Procfile?

A Procfile is a file which describes how to run your application. If you need to run a simple web application, you might have a Procfile that looks like this: web: python myapp. py.


1 Answers

Procfile and the Foreman Gem

A Procfile is used by the foreman gem to run services with a user-defined name and options. Heroku uses it to configure services to run in the dyno, but it can be used by anyone who is willing to invoke things with foreman start <named_process> instead of however they were doing it before.

Example

I often use it in development to choose between unicorn and thin for my Rails server. For example:

thin: bundle exec thin start -e development -p 8080
unicorn: bundle exec unicorn -c config/unicorn.vagrant.rb

With this configuration, I can start thin with foreman start thin or unicorn with foreman start unicorn. Your mileage, and the usefulness of the gem, will certainly vary.

like image 159
Todd A. Jacobs Avatar answered Sep 30 '22 19:09

Todd A. Jacobs