-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.html.md.erb
84 lines (61 loc) · 2.88 KB
/
deploy.html.md.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
---
title: Deploy the App
owner: Tobias Fuhrimann
---
<strong><%= modified_date %></strong>
In this step, you will deploy the app to <%= vars.product_full %>.
Push your app to the cloud by executing the following command and replacing the “my-random-hostname” with your own hostname. This will be part of the URL your app will be reached at and it has to be globally unique so be creative. The `-m 64M` tells Cloud Foundry to use 64MB of memory for our app which should be plenty.
<pre class="terminal">
$ cf push my-go-app -m 64M -n my-random-hostname
Creating app my-go-app in org MyOrg / space MySpace as user@mydomain.com...
OK
Creating route my-random-hostname.scapp.io...
OK
Binding my-random-hostname.scapp.io to my-go-app...
OK
Uploading my-go-app...
Uploading app files from: /Users/taafuto1/go/src/github.com/swisscom/cf-sample-app-go
Uploading 912B, 3 files
Done uploading
OK
...
OK
App my-go-app was started using this command `cf-sample-app-go`
Showing health and status for app my-go-app in org MyOrg / space MySpace as user@mydomain.com...
OK
requested state: started
instances: 1/1
usage: 64M x 1 instances
urls: my-random-hostname.scapp.io
last uploaded: Mon Nov 7 13:59:18 UTC 2016
stack: cflinuxfs2
buildpack: Go
state since cpu memory disk details
#0 running 2016-11-07 02:59:51 PM 0.0% 3.3M of 64M 8.7M of 1G
</pre>
The application is now deployed. Ensure that the app is running:
<pre class="terminal">
$ cf app my-go-app
Showing health and status for app my-go-app in org MyOrg / space MySpace as user@mydomain.com...
OK
requested state: started
instances: 1/1
usage: 64M x 1 instances
urls: my-random-hostname.scapp.io
last uploaded: Mon Nov 7 13:59:18 UTC 2016
stack: cflinuxfs2
buildpack: Go
state since cpu memory disk details
#0 running 2016-11-07 02:59:51 PM 0.0% 7M of 64M 8.7M of 1G
</pre>
Now visit the app at the URL. You can find the URL in the `urls` property of the statement above.
## Binary buildpack
By building your app locally using the `go build` command, you can also push your application as a binary file using the <a href="../buildpacks/binary/index.html" target="_blank">Binary buildpack</a>. This method allows you to manage dependencies locally and is an alternative to using the standard <a href="../buildpacks/go/index.html" target="_blank">Go buildpack</a>. To try it out, execute the following commands:
<pre class="terminal">
$ GOOS=linux GOARCH=amd64 go build
$ cf push my-go-app -b binary_buildpack -c './cf-sample-app-go'
</pre>
The first line tells go to cross-compile your app for linux so that it runs in the cloud. The `-c` flag specifies the command to start your app with. In our case, that's just executing the binary.
<div style="text-align:center;margin:3em;">
<a href="./logs.html" class="btn btn-primary">I have deployed my App</a>
</div>