6

So, I'm trying to deploy my very simple Play Framework 2.1.1 app but whenever I pass flags through the command line for port and to apply database evolutions, they are ignored.

For example:

sudo play start -Dhttp.port=80 -DapplyEvolutions.default=true

Using this command, the server will not start. Both the port and applyEvolutions=true flags are ignored completely and it throws this error:

[warn] play - Your production database [default] needs evolutions! [warn] play - Run with -DapplyEvolutions.default=true if you want to run them automatically (be careful) Oops, cannot start the server. @6elhl9mca: Database 'default' needs evolution!

I've tried everything I can think of to no avail. Using Play Run on my local machine works fine, no issues. The server is running Ubuntu 12.04. All the proper drivers and connection strings are present and tested, database is running, everything is working without issue except the Play Framework.

Michael Hawkins
  • 2,793
  • 1
  • 19
  • 33
  • Update: I can "hard-code" the applyEvolutions.default=true into the application.conf, and that works, but setting http.port does not likewise work in that same fashion. Any tips on setting HTTP port? – Michael Hawkins Jun 24 '13 at 22:36

2 Answers2

10

Either

play "start -Dhttp.port=80 -DapplyEvolutions.default=true"

or

play dist

then, unzipping and running the generated start script,

./start -Dhttp.port=80 -DapplyEvolutions.default=true

will work.

James Roper
  • 12,695
  • 46
  • 45
  • 2
    This is great, thank you. My biggest issue is that very little of this level of detail is in the documentation. Thank you though. – Michael Hawkins Jun 27 '13 at 18:24
6

Ok, so I didn't really find a solution for this, but I found a workaround. This isn't anywhere in the Play Framework 2.x documentation (yet), so I figure I'll put it here in case someone else gets stuck:

Putting applyEvolutions.default=true into application.conf DOES work, and will make database evolutions apply automatically. The command line argument -DapplyEvolutions.default=true DOES NOT work and is ignored for reasons unknown.

Putting http.port=80 into application.conf DOES NOT work. The command line argument -Dhttp.port=80 also DOES NOT work for setting the port number to run on.

So, to set the port number use this command instead:

play "start 80" or play "run 80" (use double quotes exactly as shown).

For some reason when the port command is written exactly as above in double quotes, the port number to run on is set properly.

This is not found in the framework documentation anywhere. I'd create another pull request to add it, but the last issue I solved for this framework (database encryption) was denigrated as being a "limited, niche use case" only and the documentation update was thus denied. I may still try anyway.

Hope this helps someone.

Michael Hawkins
  • 2,793
  • 1
  • 19
  • 33
  • Those commands do work but you have to put them in quotes. Ex: play "run 8080" check out James' answer. – damian Jun 24 '13 at 23:20
  • Yeah, I see that now. Problem is, the documentation doesn't say that anywhere and actually gives examples to the contrary. – Michael Hawkins Jun 27 '13 at 18:24
  • 1
    It assumes that you're using the play console in which case the quotes aren't necessary. You could always [let them know](https://github.com/playframework/play20/issues?state=open) if it seems incorrect ;) – damian Jun 27 '13 at 18:45
  • I have, and I will continue to. Thank you for that - I wasn't aware of that assumption in the documentation. – Michael Hawkins Jun 27 '13 at 18:46