App staging failed in the buildpack compile phase

1,530 views
Skip to first unread message

arbi....@gmail.com

unread,
Apr 3, 2015, 1:52:10 PM4/3/15
to vcap...@cloudfoundry.org
I'm trying custom buildpack, but i looks like the 'compile' step fails.
My app is a simple directory with one file 'hello.txt' that contains a one line string with the following manifest:
---
applications:
- name: hello
  host: hello-${random-word}

When I push my app to http://run.pivotal.io/, I get the following error: Status Code: 400, Error code: 170004, message: App staging failed in the buildpack compile phase

When I check the app logs, I can't see what is causing the problem:
2015-04-03T10:25:39.34+0200 [API]     OUT Created app with guid bc8aba44-80ae-4ffd-8adf-e4231c79c35b
2015-04-03T10:43:51.42+0200 [API]     OUT Updated app with guid bc8aba44-80ae-4ffd-8adf-e4231c79c35b ({"name"=>"hello", "buildpack"=>"https://bitbucket.org/dzlab/custom-buildpack", "environment_json"=>"PRIVATE DATA HIDDEN"})
2015-04-03T10:43:53.60+0200 [API]     OUT Updated app with guid bc8aba44-80ae-4ffd-8adf-e4231c79c35b ({"route"=>"2d0f989d-19a3-444a-adf3-e4e1212146b3"})
2015-04-03T10:44:02.24+0200 [DEA]     OUT Got staging request for app with id bc8aba44-80ae-4ffd-8adf-e4231c79c35b
2015-04-03T10:44:03.63+0200 [API]     OUT Updated app with guid bc8aba44-80ae-4ffd-8adf-e4231c79c35b ({"state"=>"STARTED"})
2015-04-03T10:44:03.82+0200 [STG]     OUT -----> Downloaded app package (4.0K)
2015-04-03T10:44:03.92+0200 [STG]     ERR Cloning into '/tmp/buildpacks/custom-buildpack'...
2015-04-03T10:44:05.24+0200 [STG]     OUT Staging failed: Buildpack compilation step failed
2015-04-03T10:44:05.71+0200 [API]     ERR encountered error: App staging failed in the buildpack compile phase

I tried to chmod the bin folder, and after that I'm seeing following error:
2015-04-03T18:37:37.06+0200 [LGR]     ERR proxy: error connecting to 10.10.16.255:8081: dial tcp 10.10.16.255:8081: no route to host
2015-04-03T18:37:37.06+0200 [LGR]     ERR proxy: error connecting to 10.10.17.0:8081: dial tcp 10.10.17.0:8081: no route to host

I tried also to add an echo at the beginning of each file but I can't see the messages!!

Any idea what is wrong in my buildpack or app?

Daniel Mikusa

unread,
Apr 3, 2015, 2:05:39 PM4/3/15
to vcap...@cloudfoundry.org
This [1] doesn't look right.

You're returning the command of "cat hello.txt", but that command needs to start a process and keep running.  If you run cat, it's going to do it's thing and exit.  CF will interpret that exit as your app crashing.  

You also want to also add "no-route: true" in your manifest, since you're not taking web requests with your app.  Otherwise the health check to make sure you're listening on the right port is going to fail.

Dan


--
You received this message because you are subscribed to the Google Groups "Cloud Foundry Developers" group.
To view this discussion on the web visit https://groups.google.com/a/cloudfoundry.org/d/msgid/vcap-dev/fea8b6d4-0751-40ef-9401-b286a6f10d54%40cloudfoundry.org.

To unsubscribe from this group and stop receiving emails from it, send an email to vcap-dev+u...@cloudfoundry.org.

Arbi Akhina

unread,
Apr 6, 2015, 6:03:37 AM4/6/15
to vcap...@cloudfoundry.org
OK but why the "echo"s are not logged? I don't see "entrying the compile phase" or "entrying the detect phase" !!

It sounds like I can't use ap-get to install something [1] what's the alternative? 
the problem is I can't see logs, do I need to setup warden [2] locally to validate my detect/compile/release scripts before pushing to CF?

Josh Ghiloni

unread,
Apr 6, 2015, 7:45:32 AM4/6/15
to vcap...@cloudfoundry.org
The code that runs the buildpack scripts [1] does not capture the output of the compile script, only detect and release.


Daniel Mikusa

unread,
Apr 6, 2015, 10:14:25 AM4/6/15
to vcap...@cloudfoundry.org
On Mon, Apr 6, 2015 at 6:03 AM, Arbi Akhina <arbi....@gmail.com> wrote:
OK but why the "echo"s are not logged? I don't see "entrying the compile phase" or "entrying the detect phase" !!

Not sure off the top of my head.  There could be other issues here as well, I didn't do an exhaustive test on your BP.

If you're looking for a very simple build pack to play around with, you might want to give this a try.  It's a few simple bash scripts, the compile script logs a bunch of info and is easy enough to play around with, and it starts a simple Python web server in the container so you can browse the filesystem of the app container.

 

It sounds like I can't use ap-get to install something [1] what's the alternative? 

Correct.  The build pack does not have root / sudo, so you can't use apt-get.  Generally it's up to the build pack to bring with it any software that's required to run the app.  Usually this happens by downloading precompiled binaries and extracting them into the environment, but if the software you need is small you could compile it when the build pack runs.  

I wrote this article a while back, but it's got a lot of info about creating custom build packs.

 
the problem is I can't see logs, do I need to setup warden [2] locally to validate my detect/compile/release scripts before pushing to CF?

If you can't see the logs, you might have a proxy issue.  Give this a try and see if it helps.


As far as running your own CF install, that can be helpful when writing custom build packs.  It gives you more access to the environment to troubleshoot things.  I personally like bosh-lite for this.  It's easy enough to run on your PC, it's compatible with other CF installs and you can access the app container directly to troubleshoot or test things.


Dan

 

Dieu Cao

unread,
Apr 6, 2015, 11:48:52 AM4/6/15
to vcap...@cloudfoundry.org
The current way that logs are retrieved from staging requires the dea logging agent to watch for changes in instances.json before attaching to retrieve logs.  If staging exits quickly, it might not have enough time to attach before the container goes away.
You could try adding a sleep of 10 seconds before your echo.
This issue will be resolved with Diego as it's been implemented differently.

-Dieu
CF Runtime PM
To unsubscribe from this group and stop receiving emails from it, send an email to vcap-dev+unsubscribe@cloudfoundry.org.

Arbi Akhina

unread,
Apr 8, 2015, 4:16:01 AM4/8/15
to vcap...@cloudfoundry.org
thanks Dan, i tried your buildpack it worked for me I can browse the warden container filesystem!!
I've already tried bosh-lite (I've wrote about it [1]), my problem is whenever I shutdown the machine (e.g. vagrant halt), CF services can no longer be started and I've to setup another bosh-lite vm

Daniel Mikusa

unread,
Apr 8, 2015, 9:12:26 AM4/8/15
to vcap...@cloudfoundry.org
On Wed, Apr 8, 2015 at 4:16 AM, Arbi Akhina <arbi....@gmail.com> wrote:
thanks Dan, i tried your buildpack it worked for me I can browse the warden container filesystem!!
I've already tried bosh-lite (I've wrote about it [1]), my problem is whenever I shutdown the machine (e.g. vagrant halt), CF services can no longer be started and I've to setup another bosh-lite vm

You're better off doing a `vagrant suspend`.  That'll stop the VM, but keep the state.  That way the next time you `vagrant up` you'll still have a working environment.

If you do need to `vagrant halt`, after the next time you `vagrant up` you should be able to restore the environment by running `bosh cck`.  It'll take some time, but it should rebuild your environment and be faster than starting over from the beginning.

Dan

 
Reply all
Reply to author
Forward
0 new messages