Procfile in Heroku - ruby

Can somebody help me regarding on how can i solve my problem on Heroku. Im new to Heroku.
This warning always appear. WARNING:No Procfile detected, using the default web server (webrick). Im using Rails 4. Thank in advance

The error itself is pretty self-explanatory. No Procfile is detected, so in your root directory create a file called Procfile.
As you stated in your comment you are using the Unicorn server so inside the Procfile put this code.
web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb
I am assuming you created a unicorn.rb file
push to github, push to heroku and see if that works.
The Procfile holds the command for starting the server, and any options you need to pass to that. Your app was crashing because the command to start the server was not there at all.

Related

Heroku won't recognize Procfile in dynos at dashboard

Im trying to host my object detection api on heroku but i can't due to it not recognizing my
Procfile, which is a file and not a text file. the way its spelled is Procfile, its contents are
web:gunicorn app:app
the way i know that its the Procfile thats the problem is because when i run bash and look at the root directory of the heroku git i see Procfile but when i look at the logs i see that no web process is running and on the dashboard the dynos is completely empty.
i've tried doing
web: gunicorn app: app instead of web:gunicorn app:app
to no avail, i've made sure that gunicorn is in the requirements.txt and know that its pip installing the requirements.txt as the cmd tells me that it is when i do git push heroku master. i've tried doing echo>Procfile and then modifying the contents of the file. i've tried both echo "web:gunicorn app:app"> Procfile and echo web:gunicorn app:app>Procfile i tried doing heroku ps:scale web=1 and get Scaling web dynos... failed ! No such process type web defined in Procfile. and when i do heroku ps i get nothing

How does Heroku knows which file use to deploy?

I always create a file called server.js as entry point of my Node.js app and I always deploy to Heroku with that file but... How does Heroku know that server.js the file that it should to execute?
What if my server file is called anotherName.js? How can I tell to Heroku to deploy anotherName.js?
If you have a Procfile, Heroku will look there first.
If no Procfile exists, Heroku will try to run the start sript defined in your package.json.
What if my server file is called anotherName.js? How can I tell to Heroku to deploy anotherName.js?
Either by modifying (or creating) your Procfile or by changing the start script in your package.json.

HEROKU: ps:scale web=1 no such process type web defined in Procfile

I have seen very similar posts, that however did not help me to find a solution to my problem.
I am following step by step the guide to upload a project on heroku.
However when I type the command:
ps:scale web=1
The result is:
no such process type web defined in Procfile
I have created a file "Procfile" being careful at the capitalization. but nothing.
What else can I do to solve this problem??
Thanks in advance.
Follow on this heroku procfile
:
We have to define web process type in your Procfile and make sure name Procfile exactly, and not anything else. For example, Procfile.txt is not valid.
Example:
a: Python:
web: gunicorn gettingstarted.wsgi --log-file -
b: String MVC Hibernate
web: java $JAVA_OPTS -jar target/dependency/jetty-runner.jar --port $PORT target/*.war
This declares a single process type, web, and the command needed to run it. The name web is important here. It declares that this process type will be attached to the HTTP routing stack of Heroku, and receive web traffic when deployed.
Procfiles can contain additional process types.
worker: bundle exec rake jobs:work
Hopefully you've fixed your problem after all this time, but just in case you haven't...
I've run into this problem when my Procfile doesn't exist (a web app that I'm porting to Heroku) or doesn't match the dyno type that I'm trying to deploy (see Heroku No such process type web defined in procfile for an example of that).
You've created your Procfile, but what did you put in there? For a website Node.js app, you'll need to put in:
web: node app.js
(Obviously you'll replace app.js with index.js or wherever your app starts)
For more about Procfiles (or for other languages than Node.js), see https://devcenter.heroku.com/articles/procfile

Heroku procfile "No such process type web defined in Procfile" error

This is the first time I've used Heroku, and the fact that I can't find anyone in Google with a similar error to this means I'm likely doing something way wrong:
I'm following the basic Heroku setup guide here to get my NodeJS application deployed to the web. I'm deployed and trying to check my dynos with:
heroku ps:scale web=1
However, when I do this I get the error:
Scaling web dynos... failed
! No such process type web defined in Procfile.
When I run heroku ps I get nothing returned.
In my app's root directory, I have a file named Procfile (with no extension) which contains:
web: node app.js
The app runs locally without any issues (using foreman start).
Question is why is this occurring, how do I remedy it, should I even care?
Processes to be run on Heroku are defined in a simple text file called: Procfile
The Profile contains a line that defines how each of the processes in your application will run. This will be language specific and examples can be seen on the Heroku Devcenter Procfile article
Please note that the Procfile must be spelt exactly, with the first letter capitalized an all others lower case. There is no file extension for the Procfile. This Procfile should be placed in the root of your project and committed to your local git repository before doing a git push heroku master.
Should you mis-type the filename after it has been added to git, you can rename it using git with the command
git mv ProcFile Procfile
The renamed file will be staged so you can commit the changed file with the command
git commit -m "corrected name of Procfile"
I found the solution myself, from here: https://stackoverflow.com/a/7641259/556006
I had the same problem and I just now I found what was wrong. I first
accidently called the file ProcFile instead of Procfile. Simply
renaming that file did not get picked up by git. I had to do a git rm
ProcFile -f first and then add a new (correctly named) Procfile. After
that, it got pushed correctly by git and got picked up correctly by
Heroku.
I just had this issue myself, but in my case, I was missing a space between web: and the starting command in the Procfile.
For example, I had it wrong this way:
web:gunicorn run:app
Fixed it by adding a space after the colon:
web: gunicorn run:app
I am guessing you've never done git push heroku master -- that is, Heroku has never seen your code.

Where's Procfile?

I'm trying to install New Relic, but it says I'll need to make changes to Procfile. I can't seem to find it at the root of the local copy of my app though. I'm using Django.
Thanks
This page on Heroku gives a lot more information on what the procfile is:
https://devcenter.heroku.com/articles/procfile
You don't have to have one to deploy to Heroku, but you can manually create one to take more control over how Heroku runs your apps. As per this excerpt from the link above:
A Procfile is not necessary to deploy apps written in most languages supported by Heroku. The platform automatically detects the language, and creates a default web process type to boot the application server.
Creating an explicit Procfile is recommended for greater control and flexibility over your app.
For Heroku to use your Procfile, add the Procfile to the root of your application push to Heroku:
$ git add .
$ git commit -m "Procfile"
$ git push heroku
...
-----> Procfile declares process types: web, worker
Compiled slug size is 10.4MB
-----> Launching... done
http://strong-stone-297.herokuapp.com deployed to Heroku
To git#heroku.com:strong-stone-297.git
* [new branch] master -> master
For New Relic support, you have to explicitly tell Heroku to run a gunicorn instance within New Relic. So your Procfile would look something like this:
newrelic-admin run-program gunicorn --workers 4 --worker-class gevent --timeout 60 mysite.wsgi
You can turn this on or off without changing your Procfile by conditionally looking for your New Relic licence in the Heroku environment variables:
Procfile:
web: bash scripts/heroku_run
scripts/heroku_run:
#!/bin/bash
run_command="gunicorn --workers 4 --worker-class gevent --timeout 60 mysite.wsgi"
# Run through New Relic monitoring if add-on installed
if [[ $NEW_RELIC_LICENSE_KEY != '' ]]; then
newrelic-admin run-program $run_command
else
$run_command
fi

Resources