无法使用--from-code选项创建OpenShift应用程序

时间:2014-03-18 04:47:07

标签: nginx sinatra openshift paas openshift-client-tools

我正在尝试使用--from-code选项创建一个OpenShift应用程序,以从GitHub中获取应用程序代码。我创建了两个不同的OpenShift快速入门 - 其中一个,--from-code选项有效,而另一个,它不起作用。

很明显,我在QuickStart中做错了,但是没有工作。但是,我无法看到我做错了什么。我得到error 504an error occurred,它们都没有告诉我问题是什么,并且似乎没有verbose标志来获取有关错误的更多详细信息。

Tests-Mac:~ testuser$ rhc app create sonr diy-0.1 http://cartreflect-claytondev.rhcloud.com/reflect?github=smarterclayton/openshift-redis-cart --from-code https://github.com/citrusbyte/SONR.git
The cartridge 'http://cartreflect-claytondev.rhcloud.com/reflect?github=smarterclayton/openshift-redis-cart' will be downloaded and installed

Application Options
-------------------
Domain:      schof
Cartridges:  diy-0.1, http://cartreflect-claytondev.rhcloud.com/reflect?github=smarterclayton/openshift-redis-cart
Source Code: https://github.com/citrusbyte/SONR.git
Gear Size:   default
Scaling:     no

Creating application 'sonr' ... Server returned an unexpected error code: 504
Tests-Mac:~ testuser$ rhc app create sonr diy-0.1 http://cartreflect-claytondev.rhcloud.com/reflect?github=smarterclayton/openshift-redis-cart --from-code https://github.com/citrusbyte/SONR.git
The cartridge 'http://cartreflect-claytondev.rhcloud.com/reflect?github=smarterclayton/openshift-redis-cart' will be downloaded and installed

Application Options
-------------------
Domain:      schof
Cartridges:  diy-0.1, http://cartreflect-claytondev.rhcloud.com/reflect?github=smarterclayton/openshift-redis-cart
Source Code: https://github.com/citrusbyte/SONR.git
Gear Size:   default
Scaling:     no

Creating application 'sonr' ... 
An error occurred while communicating with the server. This problem may only be temporary. Check that you have correctly specified your
OpenShift server 'https://openshift.redhat.com/broker/rest/domain/schof/applications'.
Tests-Mac:~ testuser$ 

使用此代理创建--from-code的应用程序:https://github.com/citrusbyte/SONR。如果我使用这个回购,它可以完美地运行:https://github.com/citrusbyte/openshift-sinatra-redis

代码本身似乎很好,因为我可以创建一个空的新应用程序,合并SONR代码,并且它可以完美地运行。

我做错了什么?

更新:我通过分两个阶段创建应用而不是在一个阶段中完成此问题来解决此问题:

rhc app create APPNAME diy-0.1 http://cartreflect-claytondev.rhcloud.com/reflect?github=smarterclayton/openshift-redis-cart
cd APPNAME
git remote add github -f https://github.com/citrusbyte/SONR.git
git merge github/master -s recursive -X theirs
git push origin master

我仍然很想知道为什么一步到位却失败了。

2 个答案:

答案 0 :(得分:1)

@developercorey有正确的想法。

我尝试了一个荒谬的超时99999,然后得到了一个不同的超时错误,我认为我不能改变:

$ rhc app create APPNAME diy-0.1 http://cartreflect-claytondev.rhcloud.com/reflect?github=smarterclayton/openshift-redis-cart --from-code https://github.com/citrusbyte/SONR.git --timeout 99999
...
Creating application 'APPNAME' ... 
The initial build for the application failed: Shell command '/sbin/runuser -s /bin/sh 5328a9385973ca70150002af -c "exec /usr/bin/runcon 'unconfined_u:system_r:openshift_t:s0:c5,c974' /bin/sh -c \"gear postreceive --init >> /tmp/initial-build.log 2>&1\""' exceeded timeout of 229

我在之前的更新中提到的修复工作非常完美,这就是我推荐有类似问题的人尝试 - 我在没有--from-code选项的情况下将应用创建为空,然后合并到代码我想在一个单独的步骤中使用:

rhc app create APPNAME diy-0.1 http://cartreflect-claytondev.rhcloud.com/reflect?github=smarterclayton/openshift-redis-cart
cd APPNAME
git remote add github -f https://github.com/citrusbyte/SONR.git
git merge github/master -s recursive -X theirs
git push origin master

答案 1 :(得分:0)

可能是应用程序需要很长时间来克隆/设置,并且创建是超时的。您可以尝试的是在没有--from-code的情况下创建应用程序,然后在本地克隆它,并从github合并代码,然后执行git push。此操作具有更长的超时时间,并且还可以让您查看由于应用程序如果不成功而不会消失的错误(如果有),与应用程序创建不同。