ileitch/rapns — Issue #27: How to keep rapns daemon working on heroku?
Author: gcerquant
Created: 2012-01-01 23:14:15+00:00
State: open

I used this gem - thank you for the nice work! -, and deployed an app to heroku .
My environnement: Rails 3.1.3 - heroku cedar stack.

On my machine, after having launched the daemon with `bundle exec rapns development`, everything works fine, and I receive the push notifications.

**Trying to deploy it on heroku:
When I launch the daemon with the option --foreground, everything works fine, and I receive the push notification.
When I let the process fork into a daemon, it only lives for a few seconds.**

Command used on heroku:
\# Works (but gets killed if I close my terminal window)
`heroku run bundle exec rapns production --foreground`

\# Without the --foreground: Process doesn't live:
`heroku run bundle exec rapns production`

For example:
$ `heroku run bundle exec rapns production`

Running bundle exec rapns production attached to terminal... up, run.24

$ `heroku ps`

Process State Command
------------ ------------------ ------------------------------
run.24 complete for 6s bundle exec rapns production
web.1 up for 49m bundle exec rails server -p $PORT

Output of the logs at the same time:

2012-01-01T23:00:57+00:00 app[run.24]: Starting process with command `bundle exec rapns production`
2012-01-01T23:01:04+00:00 heroku[run.24]: State changed from up to complete
2012-01-01T23:01:05+00:00 heroku[run.24]: Process exited

I'm not sure where the issue is.
Do I need to scale my heroku config (tried to up the workers), or is there a bug with rapns when forking into a daemon?