Fix markdown ()

* Fix markdown

* Fix all indentations in numbered lists

* add additional "space" indentation for 
This commit is contained in:
Adriano Cunha 2019-05-30 11:00:36 -07:00 committed by Knative Prow Robot
parent eaa9bbf59b
commit 65adb947ae
1 changed files with 139 additions and 140 deletions
docs/serving/samples/hello-world/helloworld-java-spring

View File

@ -6,11 +6,9 @@ Follow the steps below to create the sample code and then deploy the app to your
cluster. You can also download a working copy of the sample, by running the
following commands:
```shell
```shell
git clone -b "release-0.6" https://github.com/knative/docs knative-docs cd
knative-docs/serving/samples/hello-world/helloworld-java-spring
````
## Before you begin
@ -26,7 +24,7 @@ and a Docker Hub account configured (we'll use it for a container registry).
## Recreating the sample code
1. From the console, create a new empty web project using the curl and unzip
commands:
commands:
```shell
curl https://start.spring.io/starter.zip \
@ -37,15 +35,15 @@ commands:
unzip helloworld.zip
```
If you don't have curl installed, you can accomplish the same by visiting the
[Spring Initializr](https://start.spring.io/) page. Specify Artifact as
`helloworld` and add the `Web` dependency. Then click `Generate Project`,
download and unzip the sample archive.
If you don't have curl installed, you can accomplish the same by visiting the
[Spring Initializr](https://start.spring.io/) page. Specify Artifact as
`helloworld` and add the `Web` dependency. Then click `Generate Project`,
download and unzip the sample archive.
1. Update the `SpringBootApplication` class in
`src/main/java/com/example/helloworld/HelloworldApplication.java` by adding a
`@RestController` to handle the "/" mapping and also add a `@Value` field to
provide the TARGET environment variable:
`src/main/java/com/example/helloworld/HelloworldApplication.java` by adding a
`@RestController` to handle the "/" mapping and also add a `@Value` field to
provide the TARGET environment variable:
```java
package com.example.helloworld;
@ -85,11 +83,11 @@ provide the TARGET environment variable:
Go to `http://localhost:8080/` to see your `Hello World!` message.
1. In your project directory, create a file named `Dockerfile` and copy the code
block below into it. For detailed instructions on dockerizing a Spring Boot
app, see
[Spring Boot with Docker](https://spring.io/guides/gs/spring-boot-docker/).
For additional information on multi-stage docker builds for Java see
[Creating Smaller Java Image using Docker Multi-stage Build](http://blog.arungupta.me/smaller-java-image-docker-multi-stage-build/).
block below into it. For detailed instructions on dockerizing a Spring Boot
app, see
[Spring Boot with Docker](https://spring.io/guides/gs/spring-boot-docker/).
For additional information on multi-stage docker builds for Java see
[Creating Smaller Java Image using Docker Multi-stage Build](http://blog.arungupta.me/smaller-java-image-docker-multi-stage-build/).
```docker
# Use the official maven/Java 8 image to create a build artifact.
@ -118,8 +116,8 @@ For additional information on multi-stage docker builds for Java see
```
1. Create a new file, `service.yaml` and copy the following service definition
into the file. Make sure to replace `{username}` with your Docker Hub
username.
into the file. Make sure to replace `{username}` with your Docker Hub
username.
```yaml
apiVersion: serving.knative.dev/v1alpha1
@ -143,8 +141,8 @@ Once you have recreated the sample code files (or used the files in the sample
folder) you're ready to build and deploy the sample app.
1. Use Docker to build the sample code into a container. To build and push with
Docker Hub, run these commands replacing `{username}` with your Docker Hub
username:
Docker Hub, run these commands replacing `{username}` with your Docker Hub
username:
```shell
# Build the container on your local machine
@ -155,9 +153,9 @@ username:
```
1. After the build has completed and the container is pushed to docker hub, you
can deploy the app into your cluster. Ensure that the container image value
in `service.yaml` matches the container you built in the previous step. Apply
the configuration using `kubectl`:
can deploy the app into your cluster. Ensure that the container image value
in `service.yaml` matches the container you built in the previous step. Apply
the configuration using `kubectl`:
```shell
kubectl apply --filename service.yaml
@ -165,13 +163,13 @@ the configuration using `kubectl`:
1. Now that your service is created, Knative will perform the following steps:
- Create a new immutable revision for this version of the app.
- Network programming to create a route, ingress, service, and load balancer
- Create a new immutable revision for this version of the app.
- Network programming to create a route, ingress, service, and load balancer
for your app.
- Automatically scale your pods up and down (including to zero active pods).
- Automatically scale your pods up and down (including to zero active pods).
1. To find the IP address for your service, use. If your cluster is new, it may
take sometime for the service to get asssigned an external IP address.
take sometime for the service to get asssigned an external IP address.
```shell
# In Knative 0.2.x and prior versions, the `knative-ingressgateway` service was used instead of `istio-ingressgateway`.
@ -193,6 +191,7 @@ take sometime for the service to get asssigned an external IP address.
export IP_ADDRESS=<EXTERNAL-IP column from the command above>
# Or just execute:
export IP_ADDRESS=$(kubectl get svc $INGRESSGATEWAY \
--namespace istio-system \
--output jsonpath="{.status.loadBalancer.ingress[*].ip}")
@ -213,7 +212,7 @@ take sometime for the service to get asssigned an external IP address.
```
1. Now you can make a request to your app to see the result. Presuming, the IP
address you got in the step above is in the `${IP_ADDRESS}` env variable:
address you got in the step above is in the `${IP_ADDRESS}` env variable:
```shell
curl -H "Host: ${DOMAIN_NAME}" http://${IP_ADDRESS}