2.0.1/Java on Heroku

79 views
Skip to first unread message

Sam Walker

unread,
May 31, 2012, 10:46:14 PM5/31/12
to play-fr...@googlegroups.com
Hi All,

I am testing my first play app on heroku as it was nice and easy to setup. I am just using a shared database right now. How do I ensure that the database persists across server restarts/updates?

Also, any gotcha on running the app on heroku? Any other feedback/suggestions welcome too.

Thanks a ton,
Sam

James Ward

unread,
Jun 1, 2012, 12:29:31 PM6/1/12
to play-fr...@googlegroups.com
The shared database is external and persistent.

-James

Sam Walker

unread,
Jun 1, 2012, 3:39:51 PM6/1/12
to play-fr...@googlegroups.com
Maybe I am doing something wrong then? Sorry, this is my first time deploying a play application on heroku, so might be something silly. I didn't make any changes to config files or anything, just used the standard settings and pushed to heroku as in the tutorial.

I noticed two things, do I need to do something special?

1. If my server is idle for a while, it's brought down and on the next restart, the database is flashed.
2. When I do a new push, using git push heroku master, the database refreshes.

Any help is appreciated, thanks a lot!!!

--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To view this discussion on the web visit https://groups.google.com/d/msg/play-framework/-/kBB5s16DiMAJ.
To post to this group, send email to play-fr...@googlegroups.com.
To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.

Tom Carchrae

unread,
Jun 2, 2012, 11:26:40 AM6/2/12
to play-fr...@googlegroups.com
Sounds like your app is using the local 'fs' database not postgres.  You need to set the database to use the shared database URL.  See:  https://devcenter.heroku.com/articles/database-driven-play-apps#run_your_app_locally 

I don't bother running/installing postgres locally, I will either use the Heroku shared DB from my local *or* use the H2 database.

You can find your Heroku DB URL by typing 'heroku config --app yourappname' - locally, you can copy the string (or set the environment variable) - when you run on Heroku, you use db=${DATABASE_URL}

Tom

John Simone

unread,
Jun 2, 2012, 10:41:58 AM6/2/12
to play-framework
Sounds like your app is using an in memory DB instead of postgres. Can
you post your application.conf?

James Ward

unread,
Jun 4, 2012, 9:02:18 AM6/4/12
to play-fr...@googlegroups.com
As others have mentioned, you probably aren't actually using the Postgres Database if you are losing your data when those things happen.  Use `heroku logs` to see what database connection is being used.

Here is an example Play 2 app that uses Postgres Database:

You really just need a Procfile that overrides the database connection info:

And make sure you add the Postgres driver dependency:

Hope that helps.

-James


On Friday, June 1, 2012 1:39:51 PM UTC-6, Sam Walker wrote:
Maybe I am doing something wrong then? Sorry, this is my first time deploying a play application on heroku, so might be something silly. I didn't make any changes to config files or anything, just used the standard settings and pushed to heroku as in the tutorial.

I noticed two things, do I need to do something special?

1. If my server is idle for a while, it's brought down and on the next restart, the database is flashed.
2. When I do a new push, using git push heroku master, the database refreshes.

Any help is appreciated, thanks a lot!!!
On Fri, Jun 1, 2012 at 9:29 AM, James Ward <ja...@jamesward.org> wrote:
The shared database is external and persistent.

-James


On Thursday, May 31, 2012 8:46:14 PM UTC-6, Sam Walker wrote:
Hi All,

I am testing my first play app on heroku as it was nice and easy to setup. I am just using a shared database right now. How do I ensure that the database persists across server restarts/updates?

Also, any gotcha on running the app on heroku? Any other feedback/suggestions welcome too.

Thanks a ton,
Sam

--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To view this discussion on the web visit https://groups.google.com/d/msg/play-framework/-/kBB5s16DiMAJ.
To post to this group, send email to play-framework@googlegroups.com.
To unsubscribe from this group, send email to play-framework+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages