I try to create simple java App on Heroku.
I following step by step from http://samuelsharaf.wordpress.com/2011/11/06/create-a-simple-java-web-app-using-maven-and-upload-to-heroku/ to do it.
But when i try to deploy my app on heroku project i got error message like bellow when i try to view log
$ heroku logs -t
2012-07-10T02:15:14+00:00 heroku[slugc]: Slug compilation started
2012-07-10T02:15:27+00:00 heroku[api]: Add shared-database:5mb add-on by anwar#meruvian.org
2012-07-10T02:15:27+00:00 heroku[api]: Release v2 created by anwar#meruvian.org
2012-07-10T02:15:27+00:00 heroku[api]: Add MAVEN_OPTS, PATH, JAVA_OPTS config by anwar#meruvian.org
2012-07-10T02:15:27+00:00 heroku[api]: Release v3 created by anwar#meruvian.org
2012-07-10T02:15:28+00:00 heroku[api]: Release v4 created by anwar#meruvian.org
2012-07-10T02:15:28+00:00 heroku[api]: Deploy cb1cfa2 by anwar#meruvian.org
2012-07-10T02:15:28+00:00 heroku[web.1]: State changed from starting to down
2012-07-10T02:15:28+00:00 heroku[slugc]: Slug compilation finished
2012-07-10T02:16:51+00:00 heroku[router]: Error H14 (No web processes running) -> GET fierce-ocean-9944.herokuapp.com/ dyno= queue= wait= service= status=503 bytes=
This is my url on heroku :
http://fierce-ocean-9944.herokuapp.com/
What that error ?
How to solve this ?
Thanks
Have you tried scaling one of your process types? e.g. heroku ps:scale web=1
Or rather, check what's your current web count by using 'heroku ps'
See https://devcenter.heroku.com/articles/scaling
I kept running into the same problem. The sample python application ran fine, but mine did not. I logged into the dashboard and noticed that the web dyno count for my app showed zero. So I bumped it up on the web gui (i.e., strech the slider widget until you get a non-zero count.) and that worked. My dashboard also showed the heroku ps:scale web=1 dyno at zero, and I left it as zero.
You need to remove your ProcFile and add again
git rm ProcFile –f
Again add the ProcFile to project
Check the spellings
Content structure of the ProcFile
ProcFile should not contain any extensions.
After that do the normal git procedure,
git add .
git commit –m “add procfile”
git push heroku master
You will see,
Procfile declares types -> web
Instead of
Procfile declares types -> (none)
If you are using a container to build a web application, create a heroku.yaml file like this in your project's root:
build:
docker:
web: Dockerfile
run:
web: [PUT YOUR CMD COMMAND IN DOCKERFILE HERE]
Then add heroku.yaml to git repository. You can remove Procfile (optional). Finally deploy your repository as the following:
git add .
git commit -m "Add heroku.yml"
heroku stack:set container -a [YOUR APP NAME]
git push heroku master
If your are pushing to heroku for the first time, you should run heroku git:remote -a [YOUR APP NAME] before git push heroku master
Related
error H14 happen while deploying to heroku
this is my procfile:
web: gunicorn -w 4 -b 0.0.0.0:$PORT -k gevent main:app
log on heroku:
2017-01-23T10:42:58.904480+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=meetcapstone.herokuapp.com request_id=df88efb5-a81a-4ac0-86dc-4e03d71266bb fwd="81.218.117.137" dyno= connect= service= status=503 bytes=
2017-01-23T10:42:59.009135+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=meetcapstone.herokuapp.com request_id=21cea981-36b0-4410-891f-548bbc29f0ee fwd="81.218.117.137" dyno= connect= service= status=503 bytes=
requirements:
Flask==0.11.1
passlib==1.7.0
SQLAlchemy==1.1.5
Werkzeug==0.11.15
gunicorn==19.0.0
gevent==1.2.1
The issue here is that you're not running any web dynos. You can tell Heroku to do this via:
$ heroku ps:scale web=1
This will force Heroku to spin up a web dyno, thereby executing your gunicorn command.
After 3 hours of debugging, I've figured out why my app was causing this error:
My Procfile was incorrectly cased
gunicorn wasn't installed in my venv
IMO, this error should be raised on Heroku's end. As a beginner, this sort of error is difficult to trace.
Update:
To clarify, Procfile is correctly cased and procfile is not correctly cased. It should start with a capital "P".
More info on dyno configuration – more on initializing your heroku app.
I ran into the same problem but from a different cause. I had the hobby tier, but then canceled it and reverted back to the free tier. Doing this caused the error and how I fixed it was just re running the command from the cli:
heroku ps:scale web=1
Before this command:
heroku ps:scale web=1
I had to remove and add buildpacks again and empty commit it and redeploy it to heroku.
heroku buildpacks:clear
heroku buildpacks:add --index heroku/python
I was having an issue here too. My problem was that my Procfile was "Procfile.txt" .
What solved my issue was to remove the file extension from Procfile, then recommit
and push stuff to heroku
Login to your Heroku dashboard and open your projects.
Go to Settings.
Delete heroku/python from the list of buildpacks
Then click Add buildpack → Choose "Python" → Save Changes.
Activate your environment in your code.
Run heroku ps:scale web=1.
And you're done!
This isn't the problem with your code, but I've gotten this error message a couple of times now and the mistake that I've made that has caused it has been writing
web:gunicorn
instead of
web: gunicorn
That space can really cause a lot of issues.
My issue is that Heroku removed the free plans. To solve such an issue go to Heroku and select/change your free plan to for example "eco" plan.
I have a UAT version I only enable during client development.
I have a custom dyno script but it's turned to the free version. So the app was not starting as my script was not running. When I enabled the Dyno the toggle was still off :rolleyes:
I don't have the reputation to reply to the correct comment, but for me the issue was that I didn't have the run.gunicorn.sh file in my root directory, this resulted in the same "No web processes running" error.
If you don't have this file, create it with contents:
gunicorn -b :5000 --access-logfile - --error-logfile - build:app
Where 'build' is the name of your python file (build.py in this case) and app is the name of your app in the code.
Also make sure that gunicorn is included in requirements.txt, like others have already pointed out.
Yeah I was also using web heroku-php-apache2 dyno and reverted it back to free tier and that caused the dyno to sleep fortunately executing heroku ps:scale web=1 -a <app name> did the magic.
Change your Procfile file from
web:gunicorn to web gunicorn (remove the ':')
I fixed the issue by going to Configure Dynos and enabling the only dyno I had manually.
uff..that took some time,so the fixes i had to make were:
'Procfile' with upper case P.
web: gunicorn wsgi:app (with a space after web: in procfile)
Making sure the requirements.txt are in the root project folder.
I was missing dynos on the web gui. The cli command to scale did not work. I also may have had an incorrect run:web declaration with missing $PORT. To fix:
heroku.yml must have a web declaration using the $PORT var:
build:
docker:
web: Dockerfile
run:
web: uvicorn main:app --reload --host 0.0.0.0 --port $PORT
I then pushed to heroku.
After that it must have added the web dyno, I could then run:
heroku ps:scale web=1
And now the fastapi uvicorn runs.
Pay attention to the Procfile naming and location (https://devcenter.heroku.com/articles/procfile) The Procfile is always a "simple text file" that is named Procfile without a file extension.(Procfile.txt not acceptable!) The Procfile must live in your app's root directory. It does not function if placed anywhere else.
Faced the exact same problem turns out I had the Profile in .gitignore
I was placing my django Procfile in the directory with settings.py and not the root directory and that gave me the H14 error. I fixed the error with this and I didn't need to do anything else they say.
Procfile
web: gunicorn <django-root-name(containing wsgi)>.wsgi
There are many things that can go wrong here. Its a combination of poor shepherding by heroku and ambiguous use between flask & gunicorn.
Here is a good guide that will get you up and running:
To anyone who may come across this...
delete your Procfile
create 'Procfile' with upper case P.
in your Procfile type: web: gunicorn <nameOfRootFile>:app (with a space after web: in procfile) mine for example was web: gunicorn app:app another way I wrote it that worked was this: web: gunicorn -w 4 "app:create_app()" -t 120
Making sure the requirements.txt are in the root project folder. (you can run pip freeze > requirements.txt if you do not have the file created
deploy to heroku
heroku ps:scale web=1 (you can specify app name to like this heroku ps:scale web=1 -a appname
finally in terminal run heroku restart
heroku open
these are all the steps i took to get mine to work
web: gunicorn weather.wsgi --log-file -
this worked for me, just make sure your Procfile is in the right format, and specify the app you are connecting to, in my case it's the weather app. Enjoy
What worked for me was adding on the second line of the procfile:
heroku ps:scale web=1
The first line must contain:
web: gunicorn "filename":"main method name"
error H14 happen while deploying to heroku
this is my procfile:
web: gunicorn -w 4 -b 0.0.0.0:$PORT -k gevent main:app
log on heroku:
2017-01-23T10:42:58.904480+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=meetcapstone.herokuapp.com request_id=df88efb5-a81a-4ac0-86dc-4e03d71266bb fwd="81.218.117.137" dyno= connect= service= status=503 bytes=
2017-01-23T10:42:59.009135+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=meetcapstone.herokuapp.com request_id=21cea981-36b0-4410-891f-548bbc29f0ee fwd="81.218.117.137" dyno= connect= service= status=503 bytes=
requirements:
Flask==0.11.1
passlib==1.7.0
SQLAlchemy==1.1.5
Werkzeug==0.11.15
gunicorn==19.0.0
gevent==1.2.1
The issue here is that you're not running any web dynos. You can tell Heroku to do this via:
$ heroku ps:scale web=1
This will force Heroku to spin up a web dyno, thereby executing your gunicorn command.
After 3 hours of debugging, I've figured out why my app was causing this error:
My Procfile was incorrectly cased
gunicorn wasn't installed in my venv
IMO, this error should be raised on Heroku's end. As a beginner, this sort of error is difficult to trace.
Update:
To clarify, Procfile is correctly cased and procfile is not correctly cased. It should start with a capital "P".
More info on dyno configuration – more on initializing your heroku app.
I ran into the same problem but from a different cause. I had the hobby tier, but then canceled it and reverted back to the free tier. Doing this caused the error and how I fixed it was just re running the command from the cli:
heroku ps:scale web=1
Before this command:
heroku ps:scale web=1
I had to remove and add buildpacks again and empty commit it and redeploy it to heroku.
heroku buildpacks:clear
heroku buildpacks:add --index heroku/python
I was having an issue here too. My problem was that my Procfile was "Procfile.txt" .
What solved my issue was to remove the file extension from Procfile, then recommit
and push stuff to heroku
Login to your Heroku dashboard and open your projects.
Go to Settings.
Delete heroku/python from the list of buildpacks
Then click Add buildpack → Choose "Python" → Save Changes.
Activate your environment in your code.
Run heroku ps:scale web=1.
And you're done!
This isn't the problem with your code, but I've gotten this error message a couple of times now and the mistake that I've made that has caused it has been writing
web:gunicorn
instead of
web: gunicorn
That space can really cause a lot of issues.
My issue is that Heroku removed the free plans. To solve such an issue go to Heroku and select/change your free plan to for example "eco" plan.
I have a UAT version I only enable during client development.
I have a custom dyno script but it's turned to the free version. So the app was not starting as my script was not running. When I enabled the Dyno the toggle was still off :rolleyes:
I don't have the reputation to reply to the correct comment, but for me the issue was that I didn't have the run.gunicorn.sh file in my root directory, this resulted in the same "No web processes running" error.
If you don't have this file, create it with contents:
gunicorn -b :5000 --access-logfile - --error-logfile - build:app
Where 'build' is the name of your python file (build.py in this case) and app is the name of your app in the code.
Also make sure that gunicorn is included in requirements.txt, like others have already pointed out.
Yeah I was also using web heroku-php-apache2 dyno and reverted it back to free tier and that caused the dyno to sleep fortunately executing heroku ps:scale web=1 -a <app name> did the magic.
Change your Procfile file from
web:gunicorn to web gunicorn (remove the ':')
I fixed the issue by going to Configure Dynos and enabling the only dyno I had manually.
uff..that took some time,so the fixes i had to make were:
'Procfile' with upper case P.
web: gunicorn wsgi:app (with a space after web: in procfile)
Making sure the requirements.txt are in the root project folder.
I was missing dynos on the web gui. The cli command to scale did not work. I also may have had an incorrect run:web declaration with missing $PORT. To fix:
heroku.yml must have a web declaration using the $PORT var:
build:
docker:
web: Dockerfile
run:
web: uvicorn main:app --reload --host 0.0.0.0 --port $PORT
I then pushed to heroku.
After that it must have added the web dyno, I could then run:
heroku ps:scale web=1
And now the fastapi uvicorn runs.
Pay attention to the Procfile naming and location (https://devcenter.heroku.com/articles/procfile) The Procfile is always a "simple text file" that is named Procfile without a file extension.(Procfile.txt not acceptable!) The Procfile must live in your app's root directory. It does not function if placed anywhere else.
Faced the exact same problem turns out I had the Profile in .gitignore
I was placing my django Procfile in the directory with settings.py and not the root directory and that gave me the H14 error. I fixed the error with this and I didn't need to do anything else they say.
Procfile
web: gunicorn <django-root-name(containing wsgi)>.wsgi
There are many things that can go wrong here. Its a combination of poor shepherding by heroku and ambiguous use between flask & gunicorn.
Here is a good guide that will get you up and running:
To anyone who may come across this...
delete your Procfile
create 'Procfile' with upper case P.
in your Procfile type: web: gunicorn <nameOfRootFile>:app (with a space after web: in procfile) mine for example was web: gunicorn app:app another way I wrote it that worked was this: web: gunicorn -w 4 "app:create_app()" -t 120
Making sure the requirements.txt are in the root project folder. (you can run pip freeze > requirements.txt if you do not have the file created
deploy to heroku
heroku ps:scale web=1 (you can specify app name to like this heroku ps:scale web=1 -a appname
finally in terminal run heroku restart
heroku open
these are all the steps i took to get mine to work
web: gunicorn weather.wsgi --log-file -
this worked for me, just make sure your Procfile is in the right format, and specify the app you are connecting to, in my case it's the weather app. Enjoy
What worked for me was adding on the second line of the procfile:
heroku ps:scale web=1
The first line must contain:
web: gunicorn "filename":"main method name"
After many research and tried, I still cannot resolved the problem. I use Vapor Toolbox: 3.1.2 & Vapor Framework: 2.3.0 and Swift 4.0.3(Xcode 9.2 on macos-high-sierra) to build a simple website(without database). But after run vapor heroku push successful, I try goto heroku dashboard to open my website, but it didn't work. I try to run heroku logs and got the result with crashed:
2017-12-26T09:04:10.000000+00:00 app[api]: Build succeeded
2017-12-26T09:10:00.192686+00:00 heroku[web.1]: Process exited with status 127
2017-12-26T09:10:00.207462+00:00 heroku[web.1]: State changed from starting to crashed
2017-12-26T09:10:00.210981+00:00 heroku[web.1]: State changed from crashed to starting
2017-12-26T09:10:03.369454+00:00 heroku[web.1]: Starting process with command `leeswift --env=production --port=19489`
2017-12-26T09:10:00.072884+00:00 app[web.1]: bash: leeswift: command not found
2017-12-26T09:10:05.460027+00:00 app[web.1]: bash: leeswift: command not found
2017-12-26T09:10:05.560609+00:00 heroku[web.1]: Process exited with status 127
2017-12-26T09:10:05.594754+00:00 heroku[web.1]: State changed from starting to crashed
2017-12-26T09:11:28.858638+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=leeswift.herokuapp.com request_id=0eab887e-dba0-488e-b3f6-899de07898d6 fwd="118.69.108.38" dyno= connect= service= status=503 bytes= protocol=https
Please help me to fix it.
bash: leeswift: command not found
Your heroku buildpack cannot find the produced executable for the vapor app. This is likely an issue with the name/path to the application. I haven't used heroku yet, but Swift produces it's executbles in .build/release/<my-app> or .build/debug/<my-app> depending on your compilation mode.
I think you have an error in the 'Procfile' file. for example, this is mine:
web: Run --env=production --workdir=./ --config:servers.default.port=$PORT
Please follow the below steps to solve your issue.
How to create swift backend API with the help of Vapor framework. Another framework is also available in the market. But we are choosing swift vapor.
Let’s start.
Install vapor in your system.
Step 1. Run below command to install vapor
brew install vapor/tap/vapor-beta
Check whether vapor installs or not run below command.
vapor-beta --help
These will be useful command of vapor.
Command only when you are in project directory.
You can
# Created vapor project
vapor new myProjectName
# Build vapor project
vapor build
# Run vapor project
vapor run
# You can configure Xcode. You should be inside created project directory.
vapor Xcode
When you have made changes in project file or add new feature for update you have below command.
vapor Xcode
You can run thru local server test API. Out will be “Hello World”
curl http://localhost:8080/hello
===========================================PostgreSQL Setup================================================
Setting Up for local PrortgeSQL. Run below command.
brew install postgresql
Start local database server. Run below command
pg_ctl -D /usr/local/var/postgres start
Stop the local database server. Run below command.
pg_ctl -D /usr/local/var/postgres stop
When yow wish to run PostgreSQL as background service with launch you can use brew server. Run below command.
brew services start postgresql
Let start Postgres the by this.
psql -d postgres
Create data base by running below command:
create databas databaseName
create databas ashi-app # Actual command
create user by running below command:- Grant that user the privileges it need with by running below command.
create user username
create user ashi-app-user # Actual command
grant all privileges on database databaseName to userName
# Actual command
grant all privileges on database ashi-app to ashi-app-user
===========================================PostgreSQL Setup================================================
===========================================Deploy fresh app on Heroku================================================
Deploy new swift vapor app on Heroku without database.
Consider you already created Vapor project without database.
Step 1. Navigate on cd MyApp.
cd myApp
# Actual command
cd ashi-api
Step 2. Create swift version file inside your root project directory.Run below on terminal.
echo 5.1.3 > .swift-version
Step 3. Create Procfile file inside your root project directory.Run below on terminal.
echo web: Run serve --env production --hostname 0.0.0.0 --port $PORT > Procfile
Step 4. Add file git and commit by below command
git add .
git commit -m ‘App Setup’
Step 5. You should generate linux tests file by below command.
swift test --generate-linuxmain
Step 6. Add again modified in git by below command.
git add .
git commit -m ‘Tests setup’
Step 7. Login on Heroku. Required to create app on heroku for deployment. So we have login on heruko. By running below command we can login.
heroku login
Step 8. Once login done create heroku app. Name must we unique most prefer is app-appname.
heroku apps: create myAppName
heroku apps: create ashi-api # Actual command
Step 9. Add swift build pack with app. For compiling on hereto we have to add buildback. Heroku doesn’t support inbuild pack for swift.
heroku buildpacks:set https://github.com/vapor-community/heroku-buildpack -a myproject
# Actual command
heroku buildpacks:set https://github.com/vapor-community/heroku-buildpack -a ashi-api
Step 10. Find command push changes on sever.
git push heroku master
Now you app and API will available for testing…
===========================================Deploy fresh app on Heroku================================================
======================Set data base with deployed app and next version of deployment==================================
Step 1. Do database configuration. Replace sqlite database with postgreSQL. Because Heroku is not supporting sqlite.
Replace in App->configure.swift. and import in Todo.h TodoController.h
import FluentPostgreSQL
// Configure a PostgreSQL database
let postgreSQLConfig: PostgreSQLDatabaseConfig
if let url = Environment.get("DATABASE_URL") {
postgreSQLConfig = PostgreSQLDatabaseConfig(url: url)!
} else {
postgreSQLConfig = PostgreSQLDatabaseConfig(hostname: "localhost", username: "app_test")
}
let postgreSQL = PostgreSQLDatabase(config: postgreSQLConfig)
// Register the configured PostreSQL database to the database config.
var databases = DatabasesConfig()
databases.add(database: postgreSQL, as: .psql)
services.register(databases)
Step 2. Install the heroku command with home-brew by running.
brew tap heroic/brew && brew install heroku
Step 3. We can add postgreSQL in app by running command.
heroic addons:create heroic-postgresql:hobby-dev
Step 4. Add update file in git by running below command.
git add .
git commit -m ‘Added PostgreSQL file’
Step 5. Find command push changes on sever.
git push heroku master
The second version will be available for testing with postgreSQL.
======================Set data base with deployed app and next version of deployment==================================
I am following this blog to upload a Dart app to Heroku and run it. I have gotten to the point where the app is successfully deployed to Heroku, but the app is not running. The following is from the Heroku logs:
2012-12-20T18:04:57+00:00 heroku[web.1]: Starting process with command `dart TestApp.dart`
2012-12-20T18:04:57+00:00 app[web.1]: bash: dart: command not found
2012-12-20T18:04:58+00:00 heroku[web.1]: Process exited with status 127
2012-12-20T18:04:58+00:00 heroku[web.1]: State changed from starting to crashed
The following is the contents of my Procfile
web: dart TestApp.dart
Can anyone point me towards a solution to this error?
You should have forgotten to add the buildpack to the config. See the getting started of Heroku Buildpack for Dart.
Basically, you have to use the following commands :
$> heroku create myapp_name -s cedar
$> heroku config:add BUILDPACK_URL=https://github.com/igrigorik/heroku-buildpack-dart.git
WARNING : With the last version of buildpack it seems dart command is no more in the PATH. A workaround is to use the full path in Procfile:
web: ./dart-sdk/bin/dart TestApp.dart
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