dongnaoben4456
2017-05-29 10:42
浏览 120
已采纳

将go app部署到Bluemix后服务器无法启动

We are unable to deploy our sample go web program to Bluemix. Server is trying to start and finally crashing without any error. Please let me know if any files needs modification.

View Our Code In GitHub

Build Log:-

Preparing to start the job...
Downloading build artifacts...
Target: https://api.ng.bluemix.net
Using manifest file /home/pipeline/4095d817-6887-4f7e-b317-c58c97c5afd7/manifest.yml

Creating app JoinSplit-20170529103009108 in org Subhadeep / space dev as subhadeep.bose@in.ibm.com...
OK

Creating route joinsplit-20170529103009108-anecdotal-menorah.mybluemix.net...
OK

Binding joinsplit-20170529103009108-anecdotal-menorah.mybluemix.net to JoinSplit-20170529103009108...
OK

Uploading JoinSplit-20170529103009108...
Uploading app files from: /home/pipeline/4095d817-6887-4f7e-b317-c58c97c5afd7
Uploading 165.2K, 34 files


Done uploading
OK

Starting app JoinSplit-20170529103009108 in org Subhadeep / space dev as subhadeep.bose@in.ibm.com...
Creating container
Successfully created container
Downloaded app package (437.8K)
-----> Download go 1.8.3
-----> Checking Godeps/Godeps.json file
-----> Installing godep v79
       Download [https://buildpacks.cloudfoundry.org/dependencies/godep/godep-v79-linux-x64-9e37ce0f.tgz]
-----> Installing glide v0.12.3
       Download [https://buildpacks.cloudfoundry.org/dependencies/glide/glide-v0.12.3-linux-x64-aa256363.tgz]
-----> Installing go 1.8.3
       Download [https://buildpacks.cloudfoundry.org/dependencies/go/go1.8.3.linux-amd64-32ec5ac6.tar.gz]
-----> Running go build finalize
       [31;1m**WARNING**[0m vendor/ directory does not exist.
       [31;1m**WARNING**[0m Installing package '.' (default)
-----> Running: go install -tags cloudfoundry -buildmode pie .
Exit status 0
Staging complete
Uploading droplet, build artifacts cache...
Uploading build artifacts cache...
Uploading droplet...
Uploaded build artifacts cache (194B)
Uploaded droplet (2.7M)
Uploading complete
Successfully destroyed container

0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 crashed
FAILED
Error restarting application: Start unsuccessful

TIP: use 'cf logs JoinSplit-20170529103009108 --recent' for more information

Finished: FAILED
  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • duan1396 2017-05-29 10:55
    已采纳

    Your code is listening on the hardcoded port "8081", not on the one provided by the Bluemix/Cloud Foundry environment. Try something like the following in your Main function:

    err := http.ListenAndServe(":"+os.Getenv("PORT"), nil)
    
    已采纳该答案
    评论
    解决 无用
    打赏 举报
  • douyi3307 2017-05-29 10:53

    May be this link can help you out there are some Q&A are available on using go with Bluemix

    https://developer.ibm.com/answers/questions/13591/about-using-go-with-bluemix.html

    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题