Deploy a Play Application on Gandi Cloud

Published on 23 February 2010

Gandi Cloud is a cloud hosting service, similar to Amazon’s EC2. Since you get full access to a Linux installation, deployment is similar to using a dedicated server. They have prepackaged solutions for various frameworks but not for Play. Fortunately deploying Play in general is pretty straight-forward.

Note that, just like EC2, it’s not free hosting - you have to pay for it. But they have fairly reasonable prices.

1. Create a server on Gandi

Make sure you choose a solution that gives you root access to the machine, “expert mode”. In the rest I’ll assume you choose Ubuntu, but any distribution would work.

2. Install the Requirements

ssh to your server, and su to get root access. Now:

apt-get install openjdk-6-jre unzip</pre>

See how fast is the download, I bet they have a local proxy!

3. Download Play

exit to get back to regular user mode, then:

wget http://download.playframework.org/releases/play-1.0.1.zip
unzip play-1.0.1

4. Run It!

Now you’re ready to run your app! Copy your app to your server by using scp for example, switch to to prod mode and you can run:

play start yourAppFolder

That’s it, your application is running on your Gandi cloud server.

5. HTTP Port, database

Since it’s a Cloud environment, you can easily create one server for each app. In this case, just configure Play to run on port 80 and you’re done. But if one Gandi server part is too big for one application and you can’t afford buying too many parts, you can run a web front-end to host several Play apps on the same server.

See the Play documentation about running in production for instructions on how to do it.

For the database, you could configure one manually on the same server, but it’s much easier to create a separate MySQL server. You can create a server in “Gandi AI” mode, where the server is managed by Gandi and you don’t have direct access to it. That way, you can create a MySQL servers in a few clicks and point your Play app(s) to that separate server.

TAGS: cloud  gandi  play framework  tech  web