mirror of https://github.com/knative/docs.git
Buildpack sample edits (#222)
* First edits to dotnet buildpack * Updates to buildpack nodejs sample * More edits to dotnet sample * Update README.md * Update README.md * Update README.md * Update README.md * Making Ryan's suggested changes - dotnet * Making Ryan's suggested changes - nodejs
This commit is contained in:
parent
68502bb573
commit
b3feaf4164
|
@ -1,36 +1,37 @@
|
||||||
# Buildpack Sample App
|
# Buildpack Sample App
|
||||||
|
|
||||||
A sample app that demonstrates usage of Cloud Foundry buildpacks on Knative Serving,
|
A sample app that demonstrates using [Cloud Foundry](https://www.cloudfoundry.org/)
|
||||||
using the [packs Docker images](https://github.com/sclevine/packs).
|
buildpacks on Knative Serving, using the [packs Docker images](https://github.com/sclevine/packs).
|
||||||
|
|
||||||
This deploys the [.NET Core Hello World](https://github.com/cloudfoundry-samples/dotnet-core-hello-world)
|
This deploys the [.NET Core Hello World](https://github.com/cloudfoundry-samples/dotnet-core-hello-world)
|
||||||
sample app for Cloud Foundry.
|
sample app for Cloud Foundry.
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
[Install Knative Serving](https://github.com/knative/docs/blob/master/install/README.md)
|
* [Install Knative Serving](../../../install/README.md)
|
||||||
|
|
||||||
## Running
|
## Running
|
||||||
|
|
||||||
This sample uses the [Buildpack build
|
This sample uses the [Buildpack build
|
||||||
template](https://github.com/knative/build-templates/blob/master/buildpack/buildpack.yaml)
|
template](https://github.com/knative/build-templates/blob/master/buildpack/buildpack.yaml)
|
||||||
in the [build-templates](https://github.com/knative/build-templates/) repo.
|
in the [build-templates](https://github.com/knative/build-templates/) repo.
|
||||||
|
Save a copy of `buildpack.yaml`, then install it:
|
||||||
First, install the Buildpack build template from that repo:
|
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
kubectl apply -f https://raw.githubusercontent.com/knative/build-templates/master/buildpack/buildpack.yaml
|
kubectl apply -f https://raw.githubusercontent.com/knative/build-templates/master/buildpack/buildpack.yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
Then you can deploy this to Knative Serving from the root directory via:
|
Then you can deploy this to Knative Serving from the root directory
|
||||||
|
by entering the following commands:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
# Replace the token string with a suitable registry
|
# Replace <your-project-here> with your own registry
|
||||||
REPO="gcr.io/<your-project-here>"
|
export REPO="gcr.io/<your-project-here>"
|
||||||
perl -pi -e "s@DOCKER_REPO_OVERRIDE@$REPO@g" serving/samples/buildpack-app-dotnet/sample.yaml
|
|
||||||
|
perl -pi -e "s@DOCKER_REPO_OVERRIDE@$REPO@g" sample.yaml
|
||||||
|
|
||||||
# Create the Kubernetes resources
|
# Create the Kubernetes resources
|
||||||
kubectl apply -f serving/samples/buildpack-app-dotnet/sample.yaml
|
kubectl apply -f sample.yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
Once deployed, you will see that it first builds:
|
Once deployed, you will see that it first builds:
|
||||||
|
@ -50,17 +51,18 @@ items:
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
Once the `BuildComplete` status becomes `True` the resources will start getting created.
|
Once the `BuildComplete` status is `True`, resource creation begins.
|
||||||
|
|
||||||
|
To access this service using `curl`, we first need to determine its ingress address:
|
||||||
|
|
||||||
To access this service via `curl`, we first need to determine its ingress address:
|
|
||||||
```shell
|
```shell
|
||||||
$ watch kubectl get svc knative-ingressgateway -n istio-system
|
$ watch kubectl get svc knative-ingressgateway -n istio-system
|
||||||
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
|
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
|
||||||
knative-ingressgateway LoadBalancer 10.23.247.74 35.203.155.229 80:32380/TCP,443:32390/TCP,32400:32400/TCP 2d
|
knative-ingressgateway LoadBalancer 10.23.247.74 35.203.155.229 80:32380/TCP,443:32390/TCP,32400:32400/TCP 2d
|
||||||
```
|
```
|
||||||
|
|
||||||
Once the `ADDRESS` gets assigned to the cluster, you can run:
|
Once the `EXTERNAL-IP` gets assigned to the cluster, enter the follow commands to capture
|
||||||
|
the host URL and the IP of the ingress endpoint in environment variables:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
# Put the Host name into an environment variable.
|
# Put the Host name into an environment variable.
|
||||||
|
@ -68,8 +70,12 @@ export SERVICE_HOST=`kubectl get route buildpack-sample-app -o jsonpath="{.statu
|
||||||
|
|
||||||
# Put the ingress IP into an environment variable.
|
# Put the ingress IP into an environment variable.
|
||||||
export SERVICE_IP=`kubectl get svc knative-ingressgateway -n istio-system -o jsonpath="{.status.loadBalancer.ingress[*].ip}"`
|
export SERVICE_IP=`kubectl get svc knative-ingressgateway -n istio-system -o jsonpath="{.status.loadBalancer.ingress[*].ip}"`
|
||||||
|
```
|
||||||
|
|
||||||
# Curl the ingress IP "as-if" DNS were properly configured.
|
Now curl the service IP to make sure the deployment succeeded:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
# Curl the ingress IP as if DNS were properly configured
|
||||||
curl --header "Host: $SERVICE_HOST" http://${SERVICE_IP}/
|
curl --header "Host: $SERVICE_HOST" http://${SERVICE_IP}/
|
||||||
[response]
|
[response]
|
||||||
```
|
```
|
||||||
|
|
|
@ -1,22 +1,22 @@
|
||||||
# Buildpack Sample Function
|
# Buildpack Sample Function
|
||||||
|
|
||||||
A sample function that demonstrates usage of Cloud Foundry buildpacks on
|
A sample function that demonstrates using [Cloud Foundry](https://www.cloudfoundry.org/)
|
||||||
Knative Serving, using the [packs Docker images](https://github.com/sclevine/packs).
|
buildpacks on Knative Serving, using the [packs Docker images](https://github.com/sclevine/packs).
|
||||||
|
|
||||||
This deploys the [riff square](https://github.com/scothis/riff-square-buildpack)
|
This deploys the [riff square](https://github.com/scothis/riff-square-buildpack)
|
||||||
sample function for riff.
|
sample function for riff.
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
[Install Knative Serving](https://github.com/knative/docs/blob/master/install/README.md)
|
* [Install Knative Serving](../../../install/README.md)
|
||||||
|
|
||||||
## Running
|
## Running
|
||||||
|
|
||||||
This sample uses the [Buildpack build
|
This sample uses the [Buildpack build
|
||||||
template](https://github.com/knative/build-templates/blob/master/buildpack/buildpack.yaml)
|
template](https://github.com/knative/build-templates/blob/master/buildpack/buildpack.yaml)
|
||||||
in the [build-templates](https://github.com/knative/build-templates/) repo.
|
from the [build-templates](https://github.com/knative/build-templates/) repo.
|
||||||
|
|
||||||
First, install the Buildpack build template from that repo:
|
Save a copy of `buildpack.yaml`, then install it:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
kubectl apply -f https://raw.githubusercontent.com/knative/build-templates/master/buildpack/buildpack.yaml
|
kubectl apply -f https://raw.githubusercontent.com/knative/build-templates/master/buildpack/buildpack.yaml
|
||||||
|
@ -25,11 +25,12 @@ kubectl apply -f https://raw.githubusercontent.com/knative/build-templates/maste
|
||||||
Then you can deploy this to Knative Serving from the root directory via:
|
Then you can deploy this to Knative Serving from the root directory via:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
# Replace the token string with a suitable registry
|
# Replace <your-project-here> with your own registry
|
||||||
REPO="gcr.io/<your-project-here>"
|
export REPO="gcr.io/<your-project-here>"
|
||||||
perl -pi -e "s@DOCKER_REPO_OVERRIDE@$REPO@g" serving/samples/buildpack-function-nodejs/sample.yaml
|
|
||||||
|
|
||||||
kubectl apply -f serving/samples/buildpack-function-nodejs/sample.yaml
|
perl -pi -e "s@DOCKER_REPO_OVERRIDE@$REPO@g" sample.yaml
|
||||||
|
|
||||||
|
kubectl apply -f sample.yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
Once deployed, you will see that it first builds:
|
Once deployed, you will see that it first builds:
|
||||||
|
@ -49,17 +50,17 @@ items:
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
Once the `BuildComplete` status becomes `True` the resources will start getting created.
|
Once the `BuildComplete` status is `True`, resource creation begins.
|
||||||
|
|
||||||
|
To access this service using `curl`, we first need to determine its ingress address:
|
||||||
To access this service via `curl`, we first need to determine its ingress address:
|
|
||||||
```shell
|
```shell
|
||||||
watch kubectl get svc knative-ingressgateway -n istio-system
|
watch kubectl get svc knative-ingressgateway -n istio-system
|
||||||
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
|
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
|
||||||
knative-ingressgateway LoadBalancer 10.23.247.74 35.203.155.229 80:32380/TCP,443:32390/TCP,32400:32400/TCP 2d
|
knative-ingressgateway LoadBalancer 10.23.247.74 35.203.155.229 80:32380/TCP,443:32390/TCP,32400:32400/TCP 2d
|
||||||
```
|
```
|
||||||
|
|
||||||
Once the `EXTERNAL-IP` gets assigned to the cluster, you can run:
|
Once the `EXTERNAL-IP` gets assigned to the cluster, enter the follow commands to capture
|
||||||
|
the host URL and the IP of the ingress endpoint in environment variables:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
# Put the Host name into an environment variable.
|
# Put the Host name into an environment variable.
|
||||||
|
@ -67,9 +68,12 @@ $ export SERVICE_HOST=`kubectl get route buildpack-function -o jsonpath="{.statu
|
||||||
|
|
||||||
# Put the ingress IP into an environment variable.
|
# Put the ingress IP into an environment variable.
|
||||||
$ export SERVICE_IP=`kubectl get svc knative-ingressgateway -n istio-system -o jsonpath="{.status.loadBalancer.ingress[*].ip}"`
|
$ export SERVICE_IP=`kubectl get svc knative-ingressgateway -n istio-system -o jsonpath="{.status.loadBalancer.ingress[*].ip}"`
|
||||||
|
```
|
||||||
|
|
||||||
|
Now curl the service IP to make sure the deployment succeeded:
|
||||||
|
|
||||||
# Curl the ingress IP "as-if" DNS were properly configured.
|
```shell
|
||||||
|
# Curl the ingress IP as if DNS were properly configured
|
||||||
$ curl http://${SERVICE_IP}/ -H "Host: $SERVICE_HOST" -H "Content-Type: application/json" -d "33"
|
$ curl http://${SERVICE_IP}/ -H "Host: $SERVICE_HOST" -H "Content-Type: application/json" -d "33"
|
||||||
[response]
|
[response]
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in New Issue