3

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

很明显,我在 QuickStart 中做错了什么,这不起作用。但我看不出我做错了什么。我要么得到error 504要么an 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使用这个 repo 创建一个应用程序: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

不过,我仍然很想知道为什么一步到位会失败。

4

2 回答 2

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
于 2014-03-18T20:28:41.980 回答
0

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

于 2014-03-18T13:02:59.260 回答