Skip to content

Fail to build ruby-sample-app #1536

Closed
Closed

Description

@wangzhezhe

I was trying to build the images as the guide in the
https://github.com/openshift/origin/blob/master/examples/sample-app/README.md
by the container way , when i was trying to use the command:
osc start-build ruby-sample-build -n test
I could see the build process is started from the console , but it always fail to build at last ,could anyone give me some suggestions to solve this problem , thank you !
image

Activity

  1. soltysh commented on Apr 1, 2015

    @soltysh
    Contributor

    @wangzhezhe thx for comment. Could you please provide us with detailed build output using:
    osc build-logs your-build-name?

  2. wangzhezhe commented on Apr 1, 2015

    @wangzhezhe
    Author

    thanks for your suggestions!
    this is the log info when i use osc build-logs ruby-sample-build , it seems that i have not got the details:
    {
    "kind": "Status",
    "creationTimestamp": null,
    "apiVersion": "v1beta1",
    "status": "Failure",
    "message": "Build: not found 'ruby-sample-build'",
    "code": 500
    }

  3. soltysh commented on Apr 1, 2015

    @soltysh
    Contributor

    @wangzhezhe your build name is in the image from first comment, it's ruby-sampe-build-45a67... unfortunately you need to type it all to get the right build information.

  4. wangzhezhe commented on Apr 1, 2015

    @wangzhezhe
    Author

    It's still useless to get the full build info , was I got some place wrong?
    image

  5. soltysh commented on Apr 1, 2015

    @soltysh
    Contributor

    @wangzhezhe if you followed our sample-app tutorial then I'm pretty sure you've also used the test namespace, you need to pass that to osc build-logs as well. So your command should look like:

    osc build-logs -n test ruby-sample-build-456...
    
  6. wangzhezhe commented on Apr 1, 2015

    @wangzhezhe
    Author

    Thanks for your suggestions, it's maybe some problems with git clone?
    but it is ok to test git clone git://github.com/openshift/ruby-hello-world.git locally

    [root@ubuntu sample-app]# osc build-logs -n test ruby-sample-build-4ad642d8-d86e-11e4-ae37-001c42fd68ba
    2015-04-01T12:54:54.643900520Z I0401 12:54:54.643760 1 sti.go:52] Creating a new STI builder with build request: &api.Request{BaseImage:"openshift/ruby-20-centos7:latest", DockerSocket:"unix:///var/run/docker.sock", PreserveWorkingDir:false, Source:"git://github.com/openshift/ruby-hello-world.git", Ref:"", Tag:"172.30.17.185:5000/test/origin-ruby-sample", Incremental:true, RemovePreviousImage:false, Environment:map[string]string{"OPENSHIFT_BUILD_NAME":"ruby-sample-build-4ad642d8-d86e-11e4-ae37-001c42fd68ba", "OPENSHIFT_BUILD_NAMESPACE":"test", "OPENSHIFT_BUILD_SOURCE":"git://github.com/openshift/ruby-hello-world.git"}, CallbackURL:"", ScriptsURL:"", Location:"", ForcePull:false, WorkingDir:"", LayeredBuild:false, InstallDestination:"", ContextDir:""}
    2015-04-01T12:54:54.648514237Z I0401 12:54:54.648464 1 docker.go:157] Image openshift/ruby-20-centos7:latest available locally
    2015-04-01T12:54:54.652172981Z I0401 12:54:54.652120 1 sti.go:111] Building 172.30.17.185:5000/test/origin-ruby-sample
    2015-04-01T12:54:54.652488361Z I0401 12:54:54.652437 1 clone.go:26] Cloning into /tmp/sti423682459/upload/src
    2015-04-01T12:54:59.661672993Z fatal: Unable to look up github.com (port 9418) (Name or service not known)
    2015-04-01T12:54:59.667406474Z Cloning into '/tmp/sti423682459/upload/src'...
    2015-04-01T12:54:59.667563652Z E0401 12:54:59.662938 1 clone.go:28] Git clone failed: exit status 128
    2015-04-01T12:54:59.667563652Z I0401 12:54:59.663121 1 cleanup.go:24] Removing temporary directory /tmp/sti423682459
    2015-04-01T12:54:59.667563652Z I0401 12:54:59.663128 1 fs.go:98] Removing directory '/tmp/sti423682459'
    2015-04-01T12:54:59.671253892Z F0401 12:54:59.669323 1 builder.go:60] Build error: exit status 128

  7. soltysh commented on Apr 1, 2015

    @soltysh
    Contributor

    @wangzhezhe apparently your VM/machine running OpenShift does not have access to internet or at least DNS, per:

    2015-04-01T12:54:59.661672993Z fatal: Unable to look up github.com (port 9418) (Name or service not known)
    

    Check that first.

  8. wangzhezhe commented on Apr 1, 2015

    @wangzhezhe
    Author

    It's ok to use sti to build image on my VM directly , but it always fail when I use osc to build the image as I described above?
    sti build git://github.com/openshift/ruby-hello-world.git openshift/ruby-20-centos7:latest --forcePull=false --loglevel=5
    I0401 23:47:47.888894 26008 docker.go:157] Image openshift/ruby-20-centos7:latest available locally
    I0401 23:47:47.892424 26008 sti.go:111] Building
    I0401 23:47:47.892655 26008 clone.go:26] Cloning into /tmp/sti768940426/upload/src
    Cloning into '/tmp/sti768940426/upload/src'...
    remote: Counting objects: 219, done.
    remote: Total 219 (delta 0), reused 0 (delta 0), pack-reused 219
    Receiving objects: 100% (219/219), 32.06 KiB | 8.00 KiB/s, done.
    Resolving deltas: 100% (77/77), done.
    Checking connectivity... done.
    I0401 23:48:08.489651 26008 docker.go:157] Image openshift/ruby-20-centos7:latest available locally
    I0401 23:48:08.489757 26008 docker.go:205] Image contains STI_SCRIPTS_URL set to 'image:///usr/local/sti'
    I0401 23:48:08.489799 26008 download.go:55] Using image internal scripts from: image:///usr/local/sti/assemble
    I0401 23:48:08.489819 26008 download.go:55] Using image internal scripts from: image:///usr/local/sti/run
    I0401 23:48:08.493451 26008 docker.go:157] Image openshift/ruby-20-centos7:latest available locally
    I0401 23:48:08.493513 26008 docker.go:205] Image contains STI_SCRIPTS_URL set to 'image:///usr/local/sti'
    I0401 23:48:08.493536 26008 download.go:55] Using image internal scripts from: image:///usr/local/sti/save-artifacts
    I0401 23:48:08.493548 26008 sti.go:181] Using assemble from image:///usr/local/sti
    I0401 23:48:08.493565 26008 sti.go:181] Using run from image:///usr/local/sti
    I0401 23:48:08.493578 26008 sti.go:181] Using save-artifacts from image:///usr/local/sti
    I0401 23:48:08.493591 26008 sti.go:119] Clean build will be performed
    I0401 23:48:08.493599 26008 sti.go:122] Performing source build from git://github.com/openshift/ruby-hello-world.git
    I0401 23:48:08.493606 26008 sti.go:130] Building
    I0401 23:48:08.493612 26008 sti.go:309] Using image name openshift/ruby-20-centos7:latest
    I0401 23:48:08.493652 26008 environment.go:52] Setting 'RACK_ENV' to 'production'
    I0401 23:48:08.494908 26008 tar.go:133] Adding to tar: /tmp/sti768940426/upload/src/.gitignore as src/.gitignore
    I0401 23:48:08.495023 26008 tar.go:133] Adding to tar: /tmp/sti768940426/upload/src/.sti/bin/README as src/.sti/bin/README
    I0401 23:48:08.495096 26008 tar.go:133] Adding to tar: /tmp/sti768940426/upload/src/.sti/environment as src/.sti/environment
    I0401 23:48:08.495145 26008 tar.go:133] Adding to tar: /tmp/sti768940426/upload/src/Dockerfile as src/Dockerfile
    I0401 23:48:08.495197 26008 tar.go:133] Adding to tar: /tmp/sti768940426/upload/src/Gemfile as src/Gemfile
    I0401 23:48:08.495261 26008 tar.go:133] Adding to tar: /tmp/sti768940426/upload/src/Gemfile.lock as src/Gemfile.lock
    I0401 23:48:08.495310 26008 tar.go:133] Adding to tar: /tmp/sti768940426/upload/src/README.md as src/README.md
    I0401 23:48:08.495353 26008 tar.go:133] Adding to tar: /tmp/sti768940426/upload/src/Rakefile as src/Rakefile
    ......

  9. wangzhezhe commented on Apr 2, 2015

    @wangzhezhe
    Author

    was i got some place wrong? it is ok to user
    git clone git://github.com/openshift/ruby-hello-world.git locally , but the build log show there was some place wrong with clone?

  10. bparees commented on Apr 2, 2015

    @bparees
    Contributor

    I suspect your docker daemon itself has issues. try running a docker container directly and see if you can reach external sites, eg
    "docker run -it centos /bin/bash" and then try to ping github.com. I'm guessing you will not be able to reach it. If so, try restarting your docker daemon ("systemctl restart docker")

  11. wangzhezhe commented on Apr 5, 2015

    @wangzhezhe
    Author

    Thanks for your suggestions , I have already fixed that problem but i have got another new problem:
    I have already add the --insecure-registry 172.30.17.83:5000 (my private docker-registry service ) in /etc/sysconfig/docker and restart the docker deamon , it seems thart i can't connect the private docker registry?
    [vagrant@openshift-master sample-app]$ openshift cli build-logs -n test ruby-sample-build-1
    2015-04-05T02:33:08.682585396Z E0405 02:33:08.682300 1 cfg.go:50] /root/.dockercfg: stat /root/.dockercfg: no such file or directory
    2015-04-05T02:36:35.727243571Z I0405 02:36:35.726230 1 sti.go:111] Building 172.30.17.56:5000/test/origin-ruby-sample
    2015-04-05T02:36:37.382527344Z Cloning into '/tmp/sti531400077/upload/src'...
    2015-04-05T02:37:25.834925067Z I0405 02:37:25.834837 1 sti.go:231] Successfully built 172.30.17.56:5000/test/origin-ruby-sample
    2015-04-05T02:37:26.845724121Z E0405 02:37:26.845214 1 cfg.go:50] /root/.dockercfg: stat /root/.dockercfg: no such file or directory
    2015-04-05T02:37:26.845724121Z I0405 02:37:26.845582 1 dockerutil.go:22] Pushing 172.30.17.56:5000/test/origin-ruby-sample ...
    2015-04-05T02:37:27.464491271Z F0405 02:37:27.464160 1 builder.go:62] Build error: API error (500): v1 ping attempt failed with error: Get http://172.30.17.56:5000/v1/_ping: EOF

    after that , I change the --insecure-registry to my local regestry which could be connected from machine , it seems the builder process did not identify this change , it still use the old info just like this:
    2015-04-04T09:08:09.113297899Z E0404 09:08:09.112769 1 cfg.go:50] /root/.dockercfg: stat /root/.dockercfg: no such file or directory
    2015-04-04T09:26:08.065173576Z I0404 09:26:08.065112 1 sti.go:111] Building 172.30.17.83:5000/test/origin-ruby-sample
    2015-04-04T09:26:10.300835082Z Cloning into '/tmp/sti294929700/upload/src'...
    2015-04-04T09:30:35.807556461Z I0404 09:30:35.807076 1 sti.go:231] Successfully built 172.30.17.83:5000/test/origin-ruby-sample
    2015-04-04T09:30:36.821403325Z E0404 09:30:36.804833 1 cfg.go:50] /root/.dockercfg: stat /root/.dockercfg: no such file or directory
    2015-04-04T09:30:36.821403325Z I0404 09:30:36.805273 1 dockerutil.go:22] Pushing 172.30.17.83:5000/test/origin-ruby-sample ...

    but actually the config info in my /etc/sysconfig/docker in minion and master is: --insecure-registry 10.10.103.215:5000

    could you give me some suggestions? thank you!

  12. bparees commented on Apr 6, 2015

    @bparees
    Contributor

    the configuration in your /etc/sysconfig/docker just tells the docker daemon which registries should be trusted, it does not tell openshift where the registry is. This is why you should specify the entire subnet in your --insecure-registry argument: --insecure-registry 172.30.17.0/24 (172.30.17.* appears to be the subnet your openshift services are running on, which is the default)

    So first, fix that.

    Secondly, it looks like your registry (running at http://172.30.17.56:5000) was not even reachable during the build..when you see an error like that, the first thing to do is confirm the registry is in fact reachable via curl. You can also confirm it's running via:

    osc list services
    osc list pods

    and also use "docker ps" to confirm you have a container that's running the docker-registry image, and "docker logs" on that container to see if it ran into any issues starting up.

    I have been seeing an issue where sometimes the first build fails because it seems like the first request to the registry fails, so if the build fails, but the curl request succeeds, i suggest you submit another build request to see if that is the problem you are having.

  13. wangzhezhe commented on Apr 7, 2015

    @wangzhezhe
    Author

    Thans for your suggestions and patience , actrually , the registry service did not started properly last time , and everything is OK now !
    However , I got another problem to customize my own services , for example I want to use origrin to deploy a service which contains a Jboss . if I use sti directly , it may seems like:
    sti build /home/wangzhe/Downloads/test openshift/wildfly-8-centos test-jee-app --forcePull=true --loglevel=5
    or
    sti build git://github.com/bparees/openshift-jee-sample openshift/wildfly-8-centos test-jee-app
    to build a test-jee-app which contians my code and dependencies , after that , I can use:
    docker run --rm -i -p :8080 -t test-jee-app to start my container and access to my service.
    But in origin , what should I write in my .json file to execute the process described above ?
    I have regfer to the application-template-stibuild.json in sample-app and the .json file to create service and replication controller in kubernetes , it seems that I should customize the build process and trigger info in origin, I was a a little confused about that , could you give me some suggesions to create my .json config file and customize my own services ?

  14. bparees commented on Apr 7, 2015

    @bparees
    Contributor

    Starting from the BuildConfig section of the sample template json, you'd change:

    in the "source" section, change the "uri" to be your github repo for your application.

    in the "stiStrategy" section change the "image" to be "openshift/wildfly-8-centos"

    that's the minimal changes you need to make. Note that "image change triggers" won't work with just those changes, but you'll be able to manually trigger the build using "osc start-build" and you can also trigger the build using webhooks.

    For bonus points you should also update the "output" section of the buildconfig and change the "name" to something other than "origin-ruby-sample", but if you do that you will also need to update the DeploymentConfig where it currently refers to "origin-ruby-sample" to instead refer to your new output image name.

  15. wangzhezhe commented on Apr 7, 2015

    @wangzhezhe
    Author

    Thanks for your suggestions , but what should I set the "type" parameter in "source" if I want to upload a local war file ? Is there any tutorials to introduce how to create the customize .json config file?

  16. soltysh commented on Apr 7, 2015

    @soltysh
    Contributor
  17. bparees commented on Apr 7, 2015

    @bparees
    Contributor

    The best place to look to understand how to write a BuildConfig at this point is, unfortunately, the source...this file describes the BuildConfig type and fields pretty well:
    https://github.com/openshift/origin/blob/master/pkg/build/api/types.go

  18. wangzhezhe commented on Apr 8, 2015

    @wangzhezhe
    Author

    Thanks for your advices and information , hope the origin will be better in future !

  19. bparees commented on Apr 8, 2015

    @bparees
    Contributor

    you're welcome, can we close this issue? feel free to open more if you hit additional problems.

  20. wangzhezhe commented on Apr 8, 2015

    @wangzhezhe
    Author

    Ok, of course ! Thanks again for your help!

  21. bparees commented on Apr 8, 2015

    @bparees
    Contributor

    you're welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions