CF212 - golang app crash - how to perform the troubleshooting?


Rafal Radecki
 

Hi :)

I am starting an app and it crashes. In the meantime when it is trying to start I login to appropriate warden container and after the app crashes I try to start the go binary manually. The problem is that I am not able to see in the environment variables like VCAP_SERVICES and I cannot pass its content correctly to my app.

Can you tell me how to start my app inside the warden container once I login through wsh with proper environment setup? I tried below:

root(a)19g7korv77m:/app# export VCAP_SERVICES='{"mongodb26":[{"credentials":{"dbname":"...}
root(a)19g7korv77m:/app# bin/my_go_binary

but it is obviously not the proper way. How does cloudfoundry pass variables to the process started in the warden container?

BR,
Rafal.


JT Archie <jarchie@...>
 

They are passed via environment variables and then your start command is
used to start the app.

This is an example of the startup script
<https://github.com/cloudfoundry/dea_ng/blob/master/lib/dea/starting/startup_script_generator.rb>
generated.

Does this help?


On Tue, Apr 12, 2016 at 7:52 AM, Rafal Radecki <radecki.rafal(a)gmail.com>
wrote:

Hi :)

I am starting an app and it crashes. In the meantime when it is trying to
start I login to appropriate warden container and after the app crashes I
try to start the go binary manually. The problem is that I am not able to
see in the environment variables like VCAP_SERVICES and I cannot pass its
content correctly to my app.

Can you tell me how to start my app inside the warden container once I
login through wsh with proper environment setup? I tried below:

root(a)19g7korv77m:/app# export
VCAP_SERVICES='{"mongodb26":[{"credentials":{"dbname":"...}
root(a)19g7korv77m:/app# bin/my_go_binary

but it is obviously not the proper way. How does cloudfoundry pass
variables to the process started in the warden container?

BR,
Rafal.


Gwenn Etourneau
 

These are env. variable in Go you can easily get it with os.Getenv("
VCAP_SERVICES") or you can use go-cfenv [1] as helper.


[1] https://github.com/cloudfoundry-community/go-cfenv/

On Wed, Apr 13, 2016 at 1:38 AM, JT Archie <jarchie(a)pivotal.io> wrote:

They are passed via environment variables and then your start command is
used to start the app.

This is an example of the startup script
<https://github.com/cloudfoundry/dea_ng/blob/master/lib/dea/starting/startup_script_generator.rb>
generated.

Does this help?


On Tue, Apr 12, 2016 at 7:52 AM, Rafal Radecki <radecki.rafal(a)gmail.com>
wrote:

Hi :)

I am starting an app and it crashes. In the meantime when it is trying to
start I login to appropriate warden container and after the app crashes I
try to start the go binary manually. The problem is that I am not able to
see in the environment variables like VCAP_SERVICES and I cannot pass its
content correctly to my app.

Can you tell me how to start my app inside the warden container once I
login through wsh with proper environment setup? I tried below:

root(a)19g7korv77m:/app# export
VCAP_SERVICES='{"mongodb26":[{"credentials":{"dbname":"...}
root(a)19g7korv77m:/app# bin/my_go_binary

but it is obviously not the proper way. How does cloudfoundry pass
variables to the process started in the warden container?

BR,
Rafal.


Noburou TANIGUCHI
 

Hi,

It seems too late to be here, but there may be a person coming across by Web
search.
I'll write my script snippet to get environment variables for such a person.

```
cat /proc/$(cat /home/vcap/run.pid)/environ | sed -e 's/\x0/\n/g'
```

This script extracts environment variables from `/proc` info, and I've
confirmed that it works on Warden / DEAng.




-----
I'm not a ...
noburou taniguchi
--
View this message in context: http://cf-dev.70369.x6.nabble.com/cf-dev-CF212-golang-app-crash-how-to-perform-the-troubleshooting-tp4567p4829.html
Sent from the CF Dev mailing list archive at Nabble.com.