0

I'm trying to deploy a Playframework 2.0 application on dotCloud using a "custom type" script" from play2-on-dotcloud.

My dotcloud.yml looks like this:

play:
  type: custom
  buildscript: dotcloud/builder
  ports:
    www: http
  process: ~/run
  approot: .

My dotcloud/builder script:

#!/bin/bash
set -e
BUILDROOT="$(dirname "$0")"
VERSION=2.0.2

echo 'Checking if Play framework is already installed...'
if [ -d ~/play-${VERSION} ]
then
    echo 'Play framework found.'
else
    echo 'Play framework not found. Installing it...'
    echo '- Download Play framework'
    curl -O http://download.playframework.org/releases/play-${VERSION}.zip
    if [ -e play-${VERSION}.zip ]
    then
        echo '- Unzip downloaded file'
        unzip -q play-${VERSION}.zip
        if [ -d play-${VERSION} ]
        then
            echo '- Copy play installation'
            cp -R ./play-${VERSION} ~/play-${VERSION}
            echo 'Play installed.'
        else
            echo 'Unzip failed !'
        fi
    else
        echo 'Download failed !'
    fi
fi

echo 'Installing application'
rm -rf ~/application
cp -R  ./$SERVICE_APPROOT ~/application

echo 'Symlinking application logs to Supervisor area...'
rm -rf ~/application/logs
ln -s /var/log/supervisor ~/application/logs

echo  'Installing run script...'
cp "$BUILDROOT/run" ~

echo 'Building the Play application'
cd ~/application

echo ' -- Cleaning -- '
~/play-${VERSION}/play clean
echo ' -- Compiling -- '
~/play-${VERSION}/play compile
echo ' -- Staging -- '
~/play-${VERSION}/play stage

echo 'Build complete.'

But when I make a dotcloud push myapp, it fails randomly with the following message:

09:44:26 [play] Killed
-- Build failed: "SERVICE_POSTINSTALL='' SERVICE_APPROOT=. SERVICE_REQUIREMENTS='[]' SERVICE_BUILDSCRIPT=dotcloud/builder SERVICE_TYPE=custom SERVICE_PORTS_WWW=http SERVICE_PROCESS='~/run' ./dotcloud/builder" failed with return code 137
09:44:27 ---> Aborting due to some build failure

Either it fails at the beginning of the script, either not far from the end (compile time). But it fails every time with the same error message.

Also note that I was able to deploy a previous Play app on dotCloud (but a smaller one).

I tried for about 15 times, and I couldn't deploy my app :(

Is there any timeout with bob-the-builder ?

UPDATE:

Made more tests, and finally trying to build the app by login into the dotcloud server using ssh. When, I run play compile, it constantly fails on dependency resolution, it tries to solve dependencies, and them "something" kills the build process:

dotcloud@xxxxx-default-play-0:~/application$ play compile
[info] Loading project definition from /home/dotcloud/application/project
[info] Set current project to xxxxx (in build file:/home/dotcloud/application/
    [info] Compiling 26 Scala sources and 10 Java sources to /home/dotcloud/application/modules/securesocial/target/scala-2.9.1/classes...
    [info] Updating {file:/home/dotcloud/application/}xxxxx...
    Killed Resolving play#play-test_2.9.1;2.0.2 ...
ndeverge
  • 21,378
  • 4
  • 56
  • 85
  • What about the output of the build script? If dotCloud won't display what goes to stdout, just redirect everything to a file. – Kim Stebel Aug 03 '12 at 10:27
  • I made an update to show the output of the build script. – ndeverge Aug 03 '12 at 11:14
  • How much memory are you using in your service? You can find out with 'dotcloud info' command. You might be running out of memory and your process is killed. If you run out of memory and you are not in the sandbox you can scale up and add more memory to your service. – Ken Cochrane Aug 03 '12 at 11:27
  • You're definitely right ! I'll add more memory and I'll let you know. – ndeverge Aug 03 '12 at 12:03
  • I profiled the build process on my local machine (up to 312M memory used), so I upgraded the dotCloud memory to 512M but I get the same issue which occurs randomly :-( – ndeverge Aug 03 '12 at 12:10
  • Are you using 64bit on your local machine, dotcloud uses 64bit, so it will need more memory for the same process.. didn't think it would be more then 512M, maybe bump up to 1G for a run and see if that helps. – Ken Cochrane Aug 03 '12 at 18:08

1 Answers1

3

The problem comes from the memory usage during the compilation. Dotcloud platform limit the memory to use to 512 mb and by default play takes much more. I updated the script some times ago to fix the problem, see this commit for details.

mchv
  • 973
  • 8
  • 12
  • Thanks, it works now ! I also received an email from the dotCloud support which also explains that the builder have 512Mb of RAM. – ndeverge Aug 06 '12 at 07:17