Repository navigation
Expand file tree
/
Copy pathindex.html.md.erb
More file actions
181 lines (133 loc) · 5.55 KB
/
Copy pathindex.html.md.erb
File metadata and controls
181 lines (133 loc) · 5.55 KB
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
---
title: Binary buildpack
---
Use the binary buildpack to run arbitrary binary web servers.
## <a id='pushing_apps'></a> Push an app
Specify the binary buildpack to stage an app as a binary file.
On a command line, use `cf push MY-AWESOME-APP` with the `-b` option to specify the
buildpack.
For example:
<pre class="terminal">
$ cf push MY-AWESOME-APP -b https://github.com/cloudfoundry/binary-buildpack.git
</pre>
You can provide Cloud Foundry with the shell command to run your binary in
the following two ways:
* **Procfile**: In the root directory of your app, add a `Procfile` that
specifies a `web` task:
```yaml
web: ./app
```
* **Command line**: Use `cf push MY-AWESOME-APP` with the `-c` option:
<pre class="terminal">
$ cf push MY-AWESOME-APP -c './app' -b binary_buildpack
</pre>
## <a id='compiling'></a> Compile your binary
Cloud Foundry expects your binary to bind to the port specified by the `PORT`
environment variable.
The following example in [Go](https://golang.org/) binds a binary to the PORT
environment variable:
```go
package main
import (
"fmt"
"net/http"
"os"
)
func handler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello, %s", "world!")
}
func main() {
http.HandleFunc("/", handler)
http.ListenAndServe(":"+os.Getenv("PORT"), nil)
}
```
Your binary should run without any additional runtime dependencies on the
cflinuxfs3 or lucid64 root filesystem (rootfs).
Any such dependencies should be statically linked to the binary.
<p class="note important">
<span class="note__title"><strong>Important</strong></span>
To avoid security exposure, verify that you migrate your apps and custom buildpacks to use
the <code>cflinuxfs4</code> stack based on Ubuntu 22.04 LTS (Jammy Jellyfish). The <code>cflinuxfs3</code> stack is based on Ubuntu 18.04 (Bionic Beaver), which
reaches end of standard support in April 2023.
</p>
To boot a Docker container running the cflinuxfs3 filesystem, run the following
command:
<pre class="terminal">
$ docker run -it cloudfoundry/cflinuxfs3 bash
</pre>
To boot a Docker container running the lucid64 filesystem, run the following
command:
<pre class="terminal">
$ docker run -it cloudfoundry/lucid64 bash
</pre>
To compile the above Go application on the rootfs, golang must be installed. `apt-get install golang` and `go build app.go` will produce an `app` binary.
When deploying your binary to Cloud Foundry, use `cf push` with the `-s` option to specify the root filesystem it should run against.
<pre class="terminal">
$ cf push MY-AWESOME-APP -s (cflinuxfs3|lucid64)
</pre>
## <a id='bosh_trusted_cert'></a>BOSH configured custom trusted certificate support
Your platform operator can configure the platform to add the custom certificates into the application container.
The custom trusted certificates are added to the `/etc/ssl/certs` directory and can be used by binary applications.
For more information, see [Configuring Trusted System Certificates for Applications](https://docs.cloudfoundry.org/devguide/deploy-apps/trusted-system-certificates.html).
## <a id='dotnet-console'></a>.NET apps
**.NET Core on Windows**
To run .NET Core apps on the Windows stack, you must use the Binary buildpack. Follow the steps below to configure your
Cloud Foundry manifest appropriately.
1. In the app manifest file, specify the `windows` stack and a custom start command.
This file should be in the same folder as your `.csproj` file and be marked **copy always**.
```
---
applications:
- name: MY-AWESOME-APP
stack: windows
command: cmd /c .\MY-AWESOME-APP --urls=http://0.0.0.0:%PORT%
```
1. Publish the project using the dotnet CLI or Visual Studio.
<pre class="terminal">
$ dotnet publish -o ./publish -r win10-x64 -f netcoreapp2.1
</pre>
1. A `publish` folder should now exist. Navigate to this `publish` folder and verify the `manifest.yml` file exists. Run `cf push` to deploy your app.
<pre class="terminal">
$ cd publish
$ cf push MY-AWESOME-APP
</pre>
**.NET Framework**
To run a self hosted application using OWIN or another kind of .NET Framework app that requires a TCP port, compile the app
to `myapp.exe` and use the Binary buildpack. For an example, see the following manifest:
```
applications:
- name: MY-AWESOME-APP
stack: windows
command: cmd /c .\MY-AWESOME-APP --server.urls=http://0.0.0.0:%PORT%
```
**Console Apps**
Console apps are not recommended to run on Cloud Foundry because they do not normally run as a single instance and are not highly available.
For information about deploying different types of .NET apps, follow the links in the table below.
<table class="table">
<thead>
<tr>
<th>Type of .NET App</th>
<th>Buildpack</th>
</tr>
</thead>
<tr>
<td>
ASP.NET MVC<br>
ASP.NET Web Forms<br>
ASP.NET WebAPI Apps<br>
Windows Communication Foundation (WCF)
</td>
<td><a href="../hwc/index.html">HWC</a></td>
</tr>
<tr>
<td>.NET Core pushed to Linux stack</td>
<td><a href="../dotnet-core/index.html">.NET Core</a></td>
</tr>
</table>
## <a id='help_support'></a>Help and support
Join the #buildpacks channel in our [Slack community](http://slack.cloudfoundry.org/) if you need any further assistance.
For more information about using and extending the binary buildpack in Cloud
Foundry, see the [binary-buildpack GitHub repository](https://github.com/cloudfoundry/binary-buildpack).
You can find current information about this buildpack on the binary buildpack
[release page](https://github.com/cloudfoundry/binary-buildpack/releases) in
GitHub.