I am using Play! 2.0 Scala Edition on Heroku. Heroku doesn't seem to see / use all of my configuration variables in Procfile.
For example, in my application.conf application, I have the following variables (among others):
mongodb.default.db = "nyancat" mongodb.default.host = "localhost" mongodb.default.port = 27017
These should be the default values ββfor local development. However, I want the Heroku instance to use the MongoLabs instance. (Unfortunately, Salat is not configured with a URI, so I had to split it into a host, port, yada yada, i.e. MONGOLAB_URI is not used)
My Procfile now looks like this:
β cat Procfile web: target/start -Dsecurehostname="https://example.org" \ -Dhostname="http://example.org" -Dhttp.port=$PORT \ -DapplyEvolutions.default=true -Ddb.default.driver=org.postgresql.Driver \ -Ddb.default.url=$DATABASE_URL -Dredis=$REDISTOGO_URL \ -Dmailgun.apikey=$MAILGUN_API_KEY -Dmongodb.default.db="heroku_appXXXXXXX" \ -Dmongodb.default.host="dsXXXXXX.mongolab.com" -Dmongodb.default.port=XXXXX \ -Dmongodb.default.user="heroku_appXXXXXXX" \ -Dmongodb.default.password="foobared_not"
I click and restart, but the remote MongoDB connection still says that it connects to localhost: 27017
Redis and everything else works fine and dandy.
The remote log shows this at startup, and it obviously does not contain all the parameters in my Procfile:
2012-05-20T19:35:18+00:00 heroku[web.1]: Starting process with command \ `target/start -Dhostname="https://example.org" -Dhttp.port=XXXXX \ -DapplyEvolutions.default=true -Ddb.default.driver=org.postgresql.Driver \ -Ddb.default.url=<HIDDEN> -Dredis=<HIDDEN> -Dmailgun.apikey=<HIDDEN>`
those. no mongo.* anywhere in the magazines.
Please let me know if I am missing something, thanks guys.
UPDATE
I tried emulating Heroku locally using the sbt stage and running the application using foreman start . I set the environment variables that Heroku will install and run them as follows:
app git:(master) β DATABASE_URL="jdbc:h2:mem:mydatabase;MODE=PostgreSQL" \ REDISTOGO_URL="redis://ignored: foobared@localhost :6379/" \ foreman start 20:20:27 web.1 | started with pid 43382 20:20:27 web.1 | Play server process ID is 43382 20:20:29 web.1 | [info] play - database [default] connected at jdbc:h2:mem:mydatabase 20:20:29 web.1 | [info] play - mongodb [default] connected at "heroku_appXXXXXXX"@"dsXXXXXX.mongolab.com":XXXXX/"heroku_appXXXXXXX" 20:20:30 web.1 | [info] play - Application started (Prod) 20:20:30 web.1 | [info] play - Listening for HTTP on port 5000...
the foreman picks my values ββMongoDB PRODUCTION, as in Procfile, which confirms my argument that Heroku may be using the old version of my Procfile for some unknown reason.
In my Heroku instance, Procfile definitely does not have the immutable flag set:
~ $ lsattr Procfile ------------------- Procfile
UPDATE 2
I am using the MongoDB Salat plugin for Play Framework 2 (Scala only) .
Here is the template I selected:
Each click succeeded before I started implementing MongoDB support.
Then I turned on the Salat plugin , signed up for the MongoLabs account, and started to have fun. The plugin above does not support com.mongb.MongoURI and due to the way it analyzes the configuration, it will explode if you give it -Dmongodb.uri . It expects a key space, such as "default".
Which brings us back to the mongodb.default.* Switches that I used above.
Now my development cycle is as follows:
push, fail push (without changes), success, but seemingly with old Procfile <make change> push, fail push (without changes), success, but seemingly with old Procfile <make change> push, fail push (without changes), success, but seemingly with old Procfile ...
And most annoyingly, the failed push just logs this:
Heroku push rejected due to an unrecognized error.
... and the output of heroku logs -t shows this only:
2012-05-22T07:23:59+00:00 heroku[slugc]: Slug compilation failed: unrecognized error
It works locally, BTW.
I brought all this up, so Heroku maintains attention, as it may be that they swallow the errors thrown by Configafe Config , when it can just make things clearer from the start.
I also asked them not to let this second press succeed, but then use the old Procfile. Very misleading.
Needless to say, I now also support MongoURI support for the Salat plugin.
UPDATE 3
I implemented support for mongodb.default.uri on Play! The Salat plugin (and deployed it with lib /), but Heroku still throws an error whenever I click on something like mongo in my Procfile.
I asked Heroku to support the same question, and maybe someone here can answer: does Heroku make variables that you can use in Procfile?