How to deploy Play Framework based apps
Asked Answered
F

4

5

I am new to Play Framework (2.0.4). I have developed a little app and ran it locally on built-in play framework web server. Now I want to deploy it on remote server (APPFOG.COM or any other web server). Can some one guide me how deploy it remotely.

Whether I have to create war file, if so, then guide me how to create it and deploy it on remote server.

If there is some other way, please guide me in this regards.

Thanks in advance

Farad answered 11/11, 2012 at 14:8 Comment(0)
D
6

The best place to look at is the Play documentation on Github: https://github.com/playframework/Play20/wiki/Production

In this doc, you'll find several ways to deploy your app on several providers:

But if you want to deploy your Play2 app in a servlet container (ie as a war), take a look at the play2-war-plugin.

Dexterous answered 11/11, 2012 at 14:14 Comment(0)
Z
3

You don't need to deploy your play app on an application server like tomcat or using a WAR file format. Play already comes with its own bundled server.

For Play version 2.6: "Play now uses the Akka-HTTP server engine as the default backend."

Past versions were using Netty as default. It is still supported but must be explicitly configured.

For deploying your app you need to create a distribution package to do that run on your project home folder:

sbt dist

A binary distribution is created: "This produces a ZIP file containing all JAR files needed to run your application in the target/universal folder of your application.

To run the application, unzip the file on the target server, and then run the script in the bin directory. The name of the script is your application name, and it comes in two versions, a bash shell script, and a windows .bat script."

These are the steps to deploy your app:

  1. Create a distribution package sbt dist
  2. Generate your application secret run: playGenerateSecret
  3. Copy and Unzip the package in your server and Run the app's binary start script and pass the secret as a param:

unzip my-first-app-1.0.zip

my-first-app-1.0/bin/my-first-app -Dplay.http.secret.key=abcdefghijk

Check more details about deployment instructions here.

You may also want to investigate other deployment formats using SBT Native Packager as it provides artifact generating capabilities for various formats including:

  • OS X disk images
  • Microsoft Installer (MSI)
  • RPMs
  • Debian packages
  • System V / init.d and Upstart services in RPM/Debian packages
Ziegfeld answered 9/5, 2018 at 4:38 Comment(0)
P
0

Take a look at this , might be helpful if you are looking to automate your Play app deployment

http://community.opscode.com/cookbooks/deploy-play

Prudenceprudent answered 4/3, 2014 at 9:27 Comment(0)
L
0

Recently wrote a post showing steps for deploying a full proof self-reloadable play-application using supervisor and monit.

I wrote this because the play deploying documentation doesn't have solutions to problems, like failures due to tun time exceptions or application hang due to memory leakage, at the point of writing. Monit is a great tool for monitoring processes running in background. http://www.ravinderpayal.com/Deploying-Play-Scala-application-into-production-by-Ravinder-Payal/

Langley answered 15/11, 2017 at 7:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.