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.
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
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)