I have a simple Ruby application that works fine inside of the Heroku console (heroku run ruby myapp.rb). How can I have it running fully autonomously?
It's not a web based application, it basically reads some information from a website and sends out an email.
I created a Procfile
worker: ruby myapp.rb
Log says "config.ru not found", what should I put in my config.ru?
Update
Still not working...
Procfile:
worker: bundle exec ruby parse_reg.rb
config.ru:
require './parse_reg'
Heroku log:
2014-09-17T03:27:39+00:00 heroku[slug-compiler]: Slug compilation
started 2014-09-17T03:27:47+00:00 heroku[slug-compiler]: Slug
compilation finished 2014-09-17T03:27:47.743136+00:00 heroku[api]:
Release v16 created by xyz#xyz.com
2014-09-17T03:27:47.743136+00:00 heroku[api]: Deploy d4e3e5f by
xyz#xyz.com 2014-09-17T03:27:48.989789+00:00 heroku[web.1]:
State changed from crashed to starting
2014-09-17T03:27:50.837609+00:00 heroku[web.1]: Starting process with
command bundle exec rackup config.ru -p 44532
2014-09-17T03:28:51.121035+00:00 heroku[web.1]: Error R10 (Boot
timeout) -> Web process failed to bind to $PORT within 60 seconds of
launch 2014-09-17T03:28:51.121241+00:00 heroku[web.1]: Stopping
process with SIGKILL
seems like my Procfile is not being read??? this is really strange!
Just make a config.ru in your project root and add
require './myapp'
Making sure that the myapp.rb file is a script that will run by just requiring it, which it looks like since it works by calling ruby myapp.rb.
OK. I figured out the issue
I had to run the following to start the worker job
heroku ps:scale worker=1
reference: https://devcenter.heroku.com/articles/run-non-web-java-processes-on-heroku
Related
I'm following through this tutorial when finally deploying to Heroku via git push heroku master, and visiting the webpage, it fails with an Application Error. heroku logs has the following:
2013-12-18T18:27:30.109623+00:00 heroku[web.1]: Starting process with command `target/start -Dhttp.port=${PORT} -DapplyEvolutions.default=true -Ddb.default.url=${DATABASE_URL} -Ddb.default.driver=org.postgresql.Driver`
2013-12-18T18:27:31.051319+00:00 app[web.1]: bash: target/start: No such file or directory
Indeed, there's no target/start file at all. How do I fix this?
Change Procfile to:
web: target/universal/stage/bin/play ...
The location of play has changed
I am trying to run an application on heroku.
Although, as soon as it starts, the app crashes. The log shows this:
2013-07-20T20:06:20.086425+00:00 heroku[web.1]: State changed from crashed to starting
2013-07-20T20:06:27.769210+00:00 heroku[web.1]: Starting process with command `serveup ./public`
2013-07-20T20:06:28.888722+00:00 app[web.1]: bash: serveup: command not found
2013-07-20T20:06:30.942655+00:00 heroku[web.1]: Process exited with status 127
2013-07-20T20:06:30.973063+00:00 heroku[web.1]: State changed from starting to crashed
My Procfile contains this: web: serveup ./public
This command should be working, as its provided by a person that is already running this app on heroku. Any suggestions as to what might be causing this?
Edit
serveup exists within node_modules/serveup and is installed by npm install .
Update
I had to add the following command before deploying the application:
heroku config:set BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-nodejs
I believe it was fixed because of this.
It appears that serveup doesn't exist on the PATH you've got set for your heroku configuration. Assuming it has been installed, you need to either modify your PATH variable to include it's location or you need include an explicit path to serveup in your Procfile.
So I'm following the tutorial in this link: https://devcenter.heroku.com/articles/django#deploy-to-heroku
once i do "heroku ps" i get:
=== web: `python manage.py runserver 0.0.0.0:$PORT --noreload`
web.1: crashed 2013/02/18 20:22:37 (~ 8m ago)
I don't exactly understand what is the problem here, can someone help? am i suppose to have my Procfile where manage.py is? I tried to move it over to there, but the same error still shows up.
btw my logs are:
2013-02-19T04:36:22+00:00 heroku[api]: Scale to web=1 by deathlordx87#yahoo.com
2013-02-19T04:41:14+00:00 heroku[api]: Scale to web=1 by deathlordx87#yahoo.com
2013-02-19T04:43:10+00:00 heroku[web.1]: State changed from crashed to starting
2013-02-19T04:43:17+00:00 heroku[web.1]: Starting process with command `python manage.py runserver 0.0.0.0:31831 --noreload`
2013-02-19T04:43:18+00:00 app[web.1]: python: can't open file 'manage.py': [Errno 2] No such file or directory
2013-02-19T04:43:19+00:00 heroku[web.1]: Process exited with status 2
2013-02-19T04:43:19+00:00 heroku[web.1]: State changed from starting to crashed
2013-02-19T04:44:05+00:00 heroku[api]: Scale to web=1 by deathlordx87#yahoo.com
I faced the same problem once. You need to configure your settings.py file properly. Since Heroku doesn't support sqlite3 databases so you should check that the database portion of the settings.py file is configured correctly.
Check my minimal sample app successfully deployed to Heroku https://github.com/shinigamiryuk/Django-Heroku-Sample-Application
The log line can't open file 'manage.py' suggests that the file is missing or can't be found. Did you add manage.py to your git depo before deploying to heroku? Is manage.py stored in a different directory from your Procfile/where the program runs?
I suspect your project (if it follows the Two Scoops layout) has manage.py inside a project directory and not in your repository root.
To keep this layout, create a Procfile and within it script a directory change before running gunicorn.
See this answer for an example.
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 have some miniapp that use delayed_job. On my localhost everything works fine, but when I deploy my app to Heroku and click on the link that should be executed by delayed_job, so nothing happen, the "task" is just saved into the table delayed_job.
In this article on heroku blog is written, that the task from delayed_job table is executed, when is run this command rake jobs:work.
But how can I run this command? Where should be the command placed? In the code, or from terminal console?
If you are running the Cedar stack, run the following from the terminal console:
heroku run rake jobs:work
If you are running the older stacks (Bamboo, Aspen, etc.):
heroku rake jobs:work
see: https://devcenter.heroku.com/articles/rake
According to the delayed_job documentation, you can also start a worker programmatically:
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/environment'
Delayed::Worker.new.start
You should use a Procfile to scpecify the commands for your dynos.
For example you would have something like this in your Procfile:
appDir/Procfile
web: bundle exec rails server -p $PORT
worker: bundle exec rake jobs:work
To use this on your development machine, you should use Foreman, it's all explained at the docs.
https://devcenter.heroku.com/articles/procfile
In our case we're only running a delayed job once a month, so didn't want to have a worker dyno running constantly.
To solve this we queue up the job (with .delayed) and then use the Heroku platform API to spawn rake jobs:workoff in a one-off worker. The API call returns relatively quickly.
PlatformAPI.connect_oauth(ENV["YOUR_HEROKU_KEY"]).dyno.create(ENV["YOUR_HEROKU_APP_NAME"],{command: 'rake jobs:workoff'})