我正在尝试使用“来自Playframework 2.0的”自定义类型“脚本在dotCloud上部署play2-on-dotcloud应用程序。
我的dotcloud.yml
看起来像这样:
play:
type: custom
buildscript: dotcloud/builder
ports:
www: http
process: ~/run
approot: .
我的dotcloud/builder
脚本:
#!/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.'
但是当我制作dotcloud push myapp
时,它会随机发生以下消息:
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
要么在脚本开头失败,要么离结束不远(编译时)。但是每次都会出现相同的错误消息。
另请注意,我可以在dotCloud上部署之前的Play应用程序(但是较小的应用程序)。
我尝试了大约15次,但我无法部署我的应用:(
bob-the-builder是否有超时?
更新
进行更多测试,最后尝试使用ssh登录dotcloud服务器来构建应用程序。什么时候,我运行play compile
,它一直在依赖解析失败,它试图解决依赖关系,他们“某事”杀死了构建过程:
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 ...
答案 0 :(得分:3)
问题来自编译期间的内存使用情况。 Dotcloud平台将内存限制为512 MB,默认情况下播放需要更多。我之前更新了脚本以解决问题,有关详细信息,请参阅this commit。