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:
Sam O'Dell 2018-07-22 16:21:39 -07:00 committed by Google Prow Robot
parent 68502bb573
commit b3feaf4164
2 changed files with 38 additions and 28 deletions

View File

@ -1,36 +1,37 @@
# Buildpack Sample App
A sample app that demonstrates usage of Cloud Foundry buildpacks on Knative Serving,
using the [packs Docker images](https://github.com/sclevine/packs).
A sample app that demonstrates using [Cloud Foundry](https://www.cloudfoundry.org/)
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)
sample app for Cloud Foundry.
## Prerequisites
[Install Knative Serving](https://github.com/knative/docs/blob/master/install/README.md)
* [Install Knative Serving](../../../install/README.md)
## Running
This sample uses the [Buildpack build
template](https://github.com/knative/build-templates/blob/master/buildpack/buildpack.yaml)
in 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
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
# Replace the token string with a suitable registry
REPO="gcr.io/<your-project-here>"
perl -pi -e "s@DOCKER_REPO_OVERRIDE@$REPO@g" serving/samples/buildpack-app-dotnet/sample.yaml
# Replace <your-project-here> with your own registry
export REPO="gcr.io/<your-project-here>"
perl -pi -e "s@DOCKER_REPO_OVERRIDE@$REPO@g" sample.yaml
# 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:
@ -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
$ watch kubectl get svc knative-ingressgateway -n istio-system
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
```
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
# 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.
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}/
[response]
```

View File

@ -1,22 +1,22 @@
# Buildpack Sample Function
A sample function that demonstrates usage of Cloud Foundry buildpacks on
Knative Serving, using the [packs Docker images](https://github.com/sclevine/packs).
A sample function that demonstrates using [Cloud Foundry](https://www.cloudfoundry.org/)
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)
sample function for riff.
## Prerequisites
[Install Knative Serving](https://github.com/knative/docs/blob/master/install/README.md)
* [Install Knative Serving](../../../install/README.md)
## Running
This sample uses the [Buildpack build
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
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:
```shell
# Replace the token string with a suitable registry
REPO="gcr.io/<your-project-here>"
perl -pi -e "s@DOCKER_REPO_OVERRIDE@$REPO@g" serving/samples/buildpack-function-nodejs/sample.yaml
# Replace <your-project-here> with your own registry
export REPO="gcr.io/<your-project-here>"
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:
@ -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 via `curl`, we first need to determine its ingress address:
To access this service using `curl`, we first need to determine its ingress address:
```shell
watch kubectl get svc knative-ingressgateway -n istio-system
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
```
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
# 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.
$ 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"
[response]
```