0

我们无法将示例 Go Web 程序部署到 Bluemix。服务器正在尝试启动并最终崩溃而没有任何错误。请让我知道是否有任何文件需要修改。

在 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
4

2 回答 2

3

您的代码正在侦听硬编码端口“8081”,而不是 Bluemix/Cloud Foundry 环境提供的端口。在您的Main函数中尝试以下操作:

err := http.ListenAndServe(":"+os.Getenv("PORT"), nil)
于 2017-05-29T10:55:30.613 回答
1

可能这个链接可以帮助您,有一些关于使用 go with Bluemix 的问答

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

于 2017-05-29T10:53:48.827 回答