Вопрос

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.

Это было полезно?

Решение 2

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.

Другие советы

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.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top