What steps should I take to correctly deploy Playframework 2.1.1 website on production server? More specific questions:
1) Should I install Play on my production server?
2) Locally it is clear to use play run
but in production I need to run it 24/7 and restart it again if server has been restarted. How this works? Some outostart or something?
3) How to deploy it on Ubuntu 12.04(Apache2) server on mydomain.com(port 80)? 4) What configuration settings should I change/add for production to disable debug etc.?
I would really appreciate information about default deployment workflow for Playframework 2.1.1
First create a deployable version of your project using play clean compile dist
.
The documentation recommends play clean compile stage
but the dist
command generates a nice ZIP file and does basically the same things.
You then load that file onto your server and extract it to the desired folder. Now start the Play server with the start
file Play created for you.
Play defaults to TCP port 9000 as it does in debug mode but you can change that by using the option -Dhttp.port=80
. Listening on a specific IP address can be done via -Dhttp.address=127.0.0.1
.
But the thing I do is using an nginx as a reverse proxy to control things link GZIP compression and to listen on a specific hostname. Just search the web for more details about reverse proxies.
You should have an own configuration file for your production use because you need to turn off evolutions, change the database server, and maybe some other stuff you added during development. More about the production configuration can be found in the docs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With