3

I am trying to create an OpenShift application using the --from-code option to grab the application code from GitHub. I've created two different OpenShift QuickStarts -- with one, the --from-code option works, and with the other, it doesn't work.

So clearly I'm doing something wrong in the QuickStart that isn't working. But I can't see what I'm doing wrong. I either get error 504 or an error occurred, neither of which tells me what the problem is, and there doesn't seem to be a verbose flag to get more details on the error.

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$ 

That's creating an application with --from-code using this repo: https://github.com/citrusbyte/SONR . If I use this repo it works flawlessly: https://github.com/citrusbyte/openshift-sinatra-redis

The code itself seems to be good, as I can create an empty new application, merge the SONR code in, and it works flawlessly.

What am I doing wrong?

UPDATE: I've worked around this issue by creating the app in two stages instead of doing it in one stage:

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

I'd still love to know why doing it in one step was failing, though.

timo.rieber
  • 3,727
  • 3
  • 32
  • 47
Schof
  • 6,329
  • 5
  • 28
  • 38

2 Answers2

1

@developercorey had the right idea.

I tried with a ridiculous timeout of 99999, and then got a different timeout error that I don't think I can change:

$ 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

The fix I mentioned in my earlier update is working perfectly, and that's what I recommend anyone with a similar problem try -- I'm creating the app as empty without the --from-code option, and then merging in the code I wanted to use in a separate step:

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
Schof
  • 6,329
  • 5
  • 28
  • 38
  • Looking at `--debug` output it seems timeout would be in milliseconds, if so 99999ms is merely 1.67min, perhaps less than the default (I'm seeing 5min timeouts with [my scaling app](https://github.com/cben/mathdown/issues/115); but I also tried `--timeout 9999999` with no difference. I'm not seeing "The initial build for the application failed" errors on create but I do get them on scaling up to a 2nd gear (with "timeout of 200"). – Beni Cherniavsky-Paskin Sep 01 '15 at 11:21
0

It could be that the application takes to long to clone/setup, and the creation is timing out. Something you can try is to create the application without the --from-code, then clone it locally, and merge in your code from github, then do a git push. This operation has a much longer timeout period, and will also let you see what, if any, errors that you get since the application won't disappear if it doesn't succeed, unlike an app create.

  • Thanks, @developercorey. I actually did that, as indicated in the update above. I'll take your advice on the timeout and try the operation with a much longer timeout. – Schof Mar 18 '14 at 16:53
  • App creations get 2 minutes i believe, so if you are doing a big build process, it might be worth having the build already in the repository and have it just copied to the correct place, or maybe have it pre-compiled and install it as a cartridge instead of a quickstart. –  Mar 18 '14 at 17:41