2014-03-23 13:28
浏览 38


I have developed a basic go rest webservice in go 1.2. It is working as expected in my local linux box. But when I scp'ed the generated binary to openshift and try to execute, it terminates instantaneously without listening to the port. Here is the application code : https://gist.github.com/anidotnet/9720936

I tried with both binary compiled at openshift server and binary compiled at my local linux box, but the result is same. Tried executing it using

nohup ./app $

but it still terminates. No panic log is there as well. What is going wrong here? Am I missing something?

图片转代码服务由CSDN问答提供 功能建议

我在go 1.2中开发了一个基本的go rest网络服务。 它在我的本地linux框中按预期工作。 但是,当我将生成的二进制文件scp'到openshift并尝试执行时,它会立即终止而不需要监听端口。 这是应用程序代码: https://gist.github.com/anidotnet/9720936

我尝试在openshift服务器上编译的二进制文件和在本地linux机器上编译的二进制文件都尝试过,但是结果是一样的。 尝试使用

nohup ./app $

执行它,但它仍然终止。 也没有恐慌日志。 这是怎么了? 我想念什么吗?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dragon8002 2014-03-23 15:18

    I am not a Go expert, but here are some things to check in your program:

    Make sure that you are binding to port 8080 to serve your application from Make sure that you are binding to your openshift ip address (not, localhost, or which are usually the defaults)

    Here is an OpenShift Go Cartridge that you can try (check out the code in the template directory) for hints on how to bind correctly: https://github.com/smarterclayton/openshift-go-cart

    The environment variables you need can be found by sshing into your gear and running the following commands:
    env | grep IP
    env | grep PORT

    These will be named according to the type of web cartridge you have installed.

    点赞 打赏 评论