Play Framework 1.x (Scala)
Overview
Clever Cloud supports Play 1.x applications natively. The present guide explains how to set up your application to run on Clever Cloud.
Configure your Scala + Play! 1 application
Select Play! 1.x version
Clever Cloud supports Play! 1.2 to 1.11, and uses Play! 1.7 by default. You can select the Play! version for your application by setting the CC_PLAY1_VERSION environment variable. The former PLAY1_VERSION name remains supported as an alias. A clevercloud/play1_version file containing the version also works, but it’s deprecated and ignored when CC_PLAY1_VERSION is set.
The CC_PLAY1_VERSION environment variable can contain one of the following values:
1.2or12for Play! 1.21.3or13for Play! 1.31.4or14for Play! 1.41.5or15for Play! 1.51.6or16for Play! 1.61.7or17for Play! 1.71.8or18for Play! 1.81.9or19for Play! 1.91.10or110for Play! 1.101.11or111for Play! 1.11
Play! configuration with application.conf
By default, your application will run on Clever Cloud with the option --%clevercloud.
It means that you can define special keys in your application.conf file that will be used only on Clever Cloud.
You can for example:
set production mode so the files are compiled at startup time and the errors are logged in a file:
%clevercloud.application.mode=prodset up a mysql database (using environment variables)
%clevercloud.db.url="jdbc:mysql://"${MYSQL_ADDON_HOST}"/"${MYSQL_ADDON_DB} %clevercloud.db.driver=com.mysql.jdbc.Driver %clevercloud.db.user=${MYSQL_ADDON_USER} %clevercloud.db.pass=${MYSQL_ADDON_PASSWORD}
More information on playframework.com.
HTTPS support
HTTPS is handled by Clever Cloud ahead of your application, your application retrieves the traffic in plain http. To be able to use request.secure, you have to add XForwardedSupport=all in application.conf.
Monitor your application with New Relic
You can use New Relic to monitor your application on Clever Cloud.
Please refer to our New Relic documentation to configure it for your application.
Environment injection
Clever Cloud injects the environment variables of your application into its environment, along with those of its linked add-ons.
Custom build configurations
On Clever Cloud you can define some build configuration: like the app folder to deploy or the path to validate your application deployment is ready To do that follow the documentation here and add the environment variable you need.
To access the environment variables from your code, you need to add my.option=${MY_VARIABLE} in your application.conf file, and then use the configuration item my.option in your application. e.g %clevercloud.db.url="jdbc:mysql://"${MYSQL_ADDON_HOST}"/"${MYSQL_ADDON_DB}