From 69a2fdcbad137d0def35d01464de776e4219261d Mon Sep 17 00:00:00 2001 From: ajaychebbi Date: Fri, 1 Feb 2019 17:24:43 +0530 Subject: [PATCH 1/8] Add swagger doc generator Add swagger doc generator --- java/.gitignore | 1 + java/bluemix-todo-app/pom.xml | 11 +++++++++ .../java/net/bluemix/todo/rest/ToDoAPI.java | 2 ++ .../src/main/webapp/WEB-INF/web.xml | 24 +++++++++++++++++-- 4 files changed, 36 insertions(+), 2 deletions(-) diff --git a/java/.gitignore b/java/.gitignore index eeb62ab..7aa161c 100644 --- a/java/.gitignore +++ b/java/.gitignore @@ -18,6 +18,7 @@ .settings/ target/ *.class +.vscode # Package Files # *.jar diff --git a/java/bluemix-todo-app/pom.xml b/java/bluemix-todo-app/pom.xml index f9974c8..cac9585 100644 --- a/java/bluemix-todo-app/pom.xml +++ b/java/bluemix-todo-app/pom.xml @@ -67,6 +67,12 @@ + + io.swagger + swagger-jersey2-jaxrs + ${swagger.version} + + org.glassfish.jersey jersey-bom @@ -121,6 +127,10 @@ + + io.swagger + swagger-jersey2-jaxrs + org.glassfish.jersey.containers jersey-container-servlet-core @@ -305,6 +315,7 @@ + 1.5.21 2.24 UTF-8 1.6.6 diff --git a/java/bluemix-todo-app/src/main/java/net/bluemix/todo/rest/ToDoAPI.java b/java/bluemix-todo-app/src/main/java/net/bluemix/todo/rest/ToDoAPI.java index 2545d99..9edb794 100644 --- a/java/bluemix-todo-app/src/main/java/net/bluemix/todo/rest/ToDoAPI.java +++ b/java/bluemix-todo-app/src/main/java/net/bluemix/todo/rest/ToDoAPI.java @@ -28,6 +28,7 @@ import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.Response; +import io.swagger.annotations.Api; import net.bluemix.todo.model.ToDo; import net.bluemix.todo.store.ToDoStore; import net.bluemix.todo.store.ToDoStoreException; @@ -37,6 +38,7 @@ * REST API for performing basic CRUD operations on TODOs. */ @Path("todos") +@Api public class ToDoAPI { private ToDoStore store; diff --git a/java/bluemix-todo-app/src/main/webapp/WEB-INF/web.xml b/java/bluemix-todo-app/src/main/webapp/WEB-INF/web.xml index a7d8750..e9d756f 100644 --- a/java/bluemix-todo-app/src/main/webapp/WEB-INF/web.xml +++ b/java/bluemix-todo-app/src/main/webapp/WEB-INF/web.xml @@ -18,12 +18,32 @@ ToDos org.glassfish.jersey.servlet.ServletContainer - + jersey.config.server.provider.packages - net.bluemix.todo.rest + io.swagger.jaxrs.listing, net.bluemix.todo.rest 1 + + + Jersey2Config + io.swagger.jersey.config.JerseyJaxrsConfig + + api.version + 1.0.0 + + + swagger.api.title + To to list + + + swagger.api.basepath + http://your_host:your_port/api + + + 2 + + ToDos /api/* From 920e5df0c4f4fb9f571460f30a43a32541c39877 Mon Sep 17 00:00:00 2001 From: ajaychebbi Date: Sat, 2 Feb 2019 22:32:47 +0530 Subject: [PATCH 2/8] Readme updates for Swagger addition Readme updates for Swagger addition --- java/README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/java/README.md b/java/README.md index 7ae5733..589c58e 100644 --- a/java/README.md +++ b/java/README.md @@ -26,6 +26,11 @@ following Maven command in the root of the project. Then open your favorite browser and navigate to http://localhost:8080. +## Swagger doc +You can access the swaggerdoc of the APIs at http://localhost:8080/api/swagger.json or http://localhost:8080/api/swagger.yaml + +To use the swagger doc for swagger-codegen, change the `host` `your_host:your_port` and the `schemes` to point to your server + ## Deploying The App To Bluemix You can deploy to Bluemix using the cf command line interface, or the cloudfoundry maven plugin. ### Deploy using cf cli From ac1149c663a079b494c2f4586c668e91ea5ef7d6 Mon Sep 17 00:00:00 2001 From: Sachin B Date: Wed, 6 Feb 2019 14:01:31 +0530 Subject: [PATCH 3/8] Docker file edit --- .DS_Store | Bin 0 -> 6148 bytes java/.DS_Store | Bin 0 -> 6148 bytes java/bluemix-todo-app/.DS_Store | Bin 0 -> 6148 bytes java/bluemix-todo-app/Dockerfile | 3 +++ java/bluemix-todo-app/src/.DS_Store | Bin 0 -> 6148 bytes java/bluemix-todo-app/src/test/.DS_Store | Bin 0 -> 6148 bytes java/bluemix-todo-app/src/test/java/.DS_Store | Bin 0 -> 6148 bytes 7 files changed, 3 insertions(+) create mode 100644 .DS_Store create mode 100644 java/.DS_Store create mode 100644 java/bluemix-todo-app/.DS_Store create mode 100755 java/bluemix-todo-app/Dockerfile create mode 100644 java/bluemix-todo-app/src/.DS_Store create mode 100644 java/bluemix-todo-app/src/test/.DS_Store create mode 100644 java/bluemix-todo-app/src/test/java/.DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..55c1fcbeb4ba2bef02771ea2748f3e4b0ea5c07d GIT binary patch literal 6148 zcmeH~J&wXa427SU6iC~oq@0EW>)m< zk%er^j=Knh3!DIf); zz>E~gV|@8Jqi52iNC7D@4+Z@DQ0UH@Y@PAxV2BZb99RzHI%Wy7c!8|R*2xOZa(b|A zwHQOZ9_?hw>uR!f_I6kfAC`AEpJHg%+hK(X&1yhF3P^#80*juHe*W+1ujcQ^n8@Auu4PPqH)~DC=`aY|^Zges(XZZ6Iz{HQ@6+Mjm#TR5vwoX=P`Vj~j6r{kv GD)0dNyb`AX literal 0 HcmV?d00001 diff --git a/java/.DS_Store b/java/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..093fc4b0a1f9ad3f29da40dc2d5923652b4fc8c8 GIT binary patch literal 6148 zcmeHKyH3ME5S)b+k!V~}-VdbU53DGB0Y3o26i7yi1d%9R@m+ixvya9yR1r-yEA7qQ z-p-wF3a=M{ZBN4;&;eM}9r5ME(tO{2VOJF~BAsWv;T50Q-~)$6_U{4bcGzRY2`@AL zz%w>@!V$;e{dwFU4x=Z_q<|EV0#ZNl7fy+c&@8FMq*}EYmUPBj<@JSAV$xyNd|2IV)uCA2&huNO z!}>&xQa}pK6}Zl2=k@=d{zv~mCut=Gq`*ZfV5{B3Zp$ZCZCyOhYi*-H(mm&!?#6jg nI7B%nMmgrf%kga_WnS|+_xr*rG3bm3ov5Dy*F`1;{#$_`#^V>3 literal 0 HcmV?d00001 diff --git a/java/bluemix-todo-app/.DS_Store b/java/bluemix-todo-app/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..0c47aa3e7b028d7dbaf1878869a013d1bede1e95 GIT binary patch literal 6148 zcmeHKF=_)r43uIM3~5}t+%Mz@i*a6%4VZm-0#ZNLiOx_R7;bLwWV4#nek#9O4B_e70S zKnk2HFv;bd_5TTervE=BX(a`uz`s(!r>p1H5>KkyI(i&yZG*qSnezjuVIC9=QI3I8 hj$EObXmufnR&e7>xh` literal 0 HcmV?d00001 diff --git a/java/bluemix-todo-app/Dockerfile b/java/bluemix-todo-app/Dockerfile new file mode 100755 index 0000000..01491a4 --- /dev/null +++ b/java/bluemix-todo-app/Dockerfile @@ -0,0 +1,3 @@ +From tomcat:8-jre8 +MAINTAINER "ajay.chebbi@in.ibm.com" +ADD /target/bluemix-todo-app.war /usr/local/tomcat/webapps/ diff --git a/java/bluemix-todo-app/src/.DS_Store b/java/bluemix-todo-app/src/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..85a85fccef18ae2955e3bb6f0b15027e55e47de4 GIT binary patch literal 6148 zcmeHKOHRWu5S@W2s>G&Cmc9Us-XMz76Z8Uz1c5{%S2W%G9Gt8->6SO10X1#J5*0Kf z*>CLm#C}q24-s*_?^Z-hB3hscvM4hm)3c@S82gz-*El6>FR7zQ zExpm%`X`3|WwmMJuszwu#6HBP>Goqwbf_Ob%Hw(BA$C97x33rZ3mUPc9gTmC)Dwza zbq1UPXTTY_J_c}Si!AOGy>|wj0cYTw0XZK6nqXy^6!X!6E|&nn0@GQbOD!QW!LTw+ zim*UfLxCE~R${P*V?LN)WtbE-oY;yFwl9AbFPy)Q{2{v&SBl;{1J1ydfm literal 0 HcmV?d00001 diff --git a/java/bluemix-todo-app/src/test/.DS_Store b/java/bluemix-todo-app/src/test/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..55c1fcbeb4ba2bef02771ea2748f3e4b0ea5c07d GIT binary patch literal 6148 zcmeH~J&wXa427SU6iC~oq@0EW>)m< zk%er^j=Knh3!DIf); zz>E~gV|@8Jqi52iNC7D@4+Z@DQ0UH@Y@PAxV2BZb99RzHI%Wy7c!8|R*2xOZa(b|A zwHQOZ9_?hw>uR!f_I6kfAC`AEpJHg%+hK(X&1yhF3P^#80*juHe*W+1ujcQ^n8@Auu4PPqH)~DC=`aY|^Zges(XZZ6Iz{HQ@6+Mjm#TR5vwoX=P`Vj~j6r{kv GD)0dNyb`AX literal 0 HcmV?d00001 diff --git a/java/bluemix-todo-app/src/test/java/.DS_Store b/java/bluemix-todo-app/src/test/java/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..a18a3cb0bd444362f59094f73b496f2153f8790c GIT binary patch literal 6148 zcmeH~JqiLr422W55Nx)zoW=uqgF*BJUO@cmL<_Z_qx41vI)z6#m+=T zboDqcMLH3g!cApiVPJ~=ST1ss`|)--@2}T$Uopy+)xbL$Jnsv+AOR8}0TLhq68ISc zc5cI_vrtA7AORBS3E2Okz)fpv3-wSKuI zy&YPzuBNuoXcx`lL-WmQQw&U_U9?~W)9S)N0wgdXFphm^=l=%&Y5pIya7zLt@Mi>c zvfi#&_^3Qv-#*XsyUg0U!J%G`@Nx;j#*X4S+zro*Eub~Eg(3svMZhsIkib_7JOO99 B5pn Date: Wed, 6 Feb 2019 14:08:36 +0530 Subject: [PATCH 4/8] Dockerfile Added --- java/.gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/java/.gitignore b/java/.gitignore index 7aa161c..60d7363 100644 --- a/java/.gitignore +++ b/java/.gitignore @@ -24,3 +24,5 @@ target/ *.jar *.war *.ear + +.DS_Store \ No newline at end of file From da14452b77cd6fc27f8c9b8270847a6b2d3aa0ce Mon Sep 17 00:00:00 2001 From: Sachin B Date: Wed, 6 Feb 2019 14:16:25 +0530 Subject: [PATCH 5/8] Remove .DS_Store from everywhere --- .DS_Store | Bin 6148 -> 0 bytes java/.DS_Store | Bin 6148 -> 0 bytes java/bluemix-todo-app/.DS_Store | Bin 6148 -> 0 bytes java/bluemix-todo-app/src/.DS_Store | Bin 6148 -> 0 bytes java/bluemix-todo-app/src/test/.DS_Store | Bin 6148 -> 0 bytes java/bluemix-todo-app/src/test/java/.DS_Store | Bin 6148 -> 0 bytes 6 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 .DS_Store delete mode 100644 java/.DS_Store delete mode 100644 java/bluemix-todo-app/.DS_Store delete mode 100644 java/bluemix-todo-app/src/.DS_Store delete mode 100644 java/bluemix-todo-app/src/test/.DS_Store delete mode 100644 java/bluemix-todo-app/src/test/java/.DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 55c1fcbeb4ba2bef02771ea2748f3e4b0ea5c07d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeH~J&wXa427SU6iC~oq@0EW>)m< zk%er^j=Knh3!DIf); zz>E~gV|@8Jqi52iNC7D@4+Z@DQ0UH@Y@PAxV2BZb99RzHI%Wy7c!8|R*2xOZa(b|A zwHQOZ9_?hw>uR!f_I6kfAC`AEpJHg%+hK(X&1yhF3P^#80*juHe*W+1ujcQ^n8@Auu4PPqH)~DC=`aY|^Zges(XZZ6Iz{HQ@6+Mjm#TR5vwoX=P`Vj~j6r{kv GD)0dNyb`AX diff --git a/java/.DS_Store b/java/.DS_Store deleted file mode 100644 index 093fc4b0a1f9ad3f29da40dc2d5923652b4fc8c8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKyH3ME5S)b+k!V~}-VdbU53DGB0Y3o26i7yi1d%9R@m+ixvya9yR1r-yEA7qQ z-p-wF3a=M{ZBN4;&;eM}9r5ME(tO{2VOJF~BAsWv;T50Q-~)$6_U{4bcGzRY2`@AL zz%w>@!V$;e{dwFU4x=Z_q<|EV0#ZNl7fy+c&@8FMq*}EYmUPBj<@JSAV$xyNd|2IV)uCA2&huNO z!}>&xQa}pK6}Zl2=k@=d{zv~mCut=Gq`*ZfV5{B3Zp$ZCZCyOhYi*-H(mm&!?#6jg nI7B%nMmgrf%kga_WnS|+_xr*rG3bm3ov5Dy*F`1;{#$_`#^V>3 diff --git a/java/bluemix-todo-app/.DS_Store b/java/bluemix-todo-app/.DS_Store deleted file mode 100644 index 0c47aa3e7b028d7dbaf1878869a013d1bede1e95..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKF=_)r43uIM3~5}t+%Mz@i*a6%4VZm-0#ZNLiOx_R7;bLwWV4#nek#9O4B_e70S zKnk2HFv;bd_5TTervE=BX(a`uz`s(!r>p1H5>KkyI(i&yZG*qSnezjuVIC9=QI3I8 hj$EObXmufnR&e7>xh` diff --git a/java/bluemix-todo-app/src/.DS_Store b/java/bluemix-todo-app/src/.DS_Store deleted file mode 100644 index 85a85fccef18ae2955e3bb6f0b15027e55e47de4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKOHRWu5S@W2s>G&Cmc9Us-XMz76Z8Uz1c5{%S2W%G9Gt8->6SO10X1#J5*0Kf z*>CLm#C}q24-s*_?^Z-hB3hscvM4hm)3c@S82gz-*El6>FR7zQ zExpm%`X`3|WwmMJuszwu#6HBP>Goqwbf_Ob%Hw(BA$C97x33rZ3mUPc9gTmC)Dwza zbq1UPXTTY_J_c}Si!AOGy>|wj0cYTw0XZK6nqXy^6!X!6E|&nn0@GQbOD!QW!LTw+ zim*UfLxCE~R${P*V?LN)WtbE-oY;yFwl9AbFPy)Q{2{v&SBl;{1J1ydfm diff --git a/java/bluemix-todo-app/src/test/.DS_Store b/java/bluemix-todo-app/src/test/.DS_Store deleted file mode 100644 index 55c1fcbeb4ba2bef02771ea2748f3e4b0ea5c07d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeH~J&wXa427SU6iC~oq@0EW>)m< zk%er^j=Knh3!DIf); zz>E~gV|@8Jqi52iNC7D@4+Z@DQ0UH@Y@PAxV2BZb99RzHI%Wy7c!8|R*2xOZa(b|A zwHQOZ9_?hw>uR!f_I6kfAC`AEpJHg%+hK(X&1yhF3P^#80*juHe*W+1ujcQ^n8@Auu4PPqH)~DC=`aY|^Zges(XZZ6Iz{HQ@6+Mjm#TR5vwoX=P`Vj~j6r{kv GD)0dNyb`AX diff --git a/java/bluemix-todo-app/src/test/java/.DS_Store b/java/bluemix-todo-app/src/test/java/.DS_Store deleted file mode 100644 index a18a3cb0bd444362f59094f73b496f2153f8790c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeH~JqiLr422W55Nx)zoW=uqgF*BJUO@cmL<_Z_qx41vI)z6#m+=T zboDqcMLH3g!cApiVPJ~=ST1ss`|)--@2}T$Uopy+)xbL$Jnsv+AOR8}0TLhq68ISc zc5cI_vrtA7AORBS3E2Okz)fpv3-wSKuI zy&YPzuBNuoXcx`lL-WmQQw&U_U9?~W)9S)N0wgdXFphm^=l=%&Y5pIya7zLt@Mi>c zvfi#&_^3Qv-#*XsyUg0U!J%G`@Nx;j#*X4S+zro*Eub~Eg(3svMZhsIkib_7JOO99 B5pn Date: Wed, 6 Feb 2019 16:32:14 +0530 Subject: [PATCH 6/8] Update README.md --- java/README.md | 124 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 124 insertions(+) diff --git a/java/README.md b/java/README.md index 589c58e..738b70f 100644 --- a/java/README.md +++ b/java/README.md @@ -92,6 +92,130 @@ you would like using the space parameter. $ mvn -P cloudant-deploy -Dapp-url=bluemix-todo-java-cloudant.mybluemix.net -Dorg=organization -Dspace=myspace +### Deploying Application to IBM Kubernetes Service (IKS) using Docker +To deploy this application to IKS using docker, follow below steps: +#### Prerequisites +1. Install Kubernetes tool `kubectl` using : https://kubernetes.io/docs/tasks/tools/install-kubectl/ + +2. Install `Docker CE` using : https://hub.docker.com/search/?type=edition&offering=community + +3. Create a `Docker ID` : https://hub.docker.com + +4. Download `VirtualBox` : https://www.virtualbox.org/wiki/Downloads + +5. (Optional) If you want to run locally, `minikube` for MacOS : https://kubernetes.io/docs/tasks/tools/install-minikube/ + +#### Getting Started and Configuration +1. Create a Kubernetes Cluster in Bluemix/IBM Cloud + + a). First let's create an account on Bluemix/IBM Cloud (For Free) : https://www.ibm.com/cloud/ + + b). After login to your Bluemix/IBM Cloud account, click on the `Catalog` on top menu bar, select `Containers` from the left navigation menu and click on the Kubernetes Service and click on `create`. + + c). In the Create a Kubernates Cluster page, set the `Cluster type` as `Free`, enter your `Cluster Name`, and select the location from the dropdown list (Or leave it for default, i used `Dallas`), then click on `create cluster`. Your will see your Kubernetes Cluster is now in `Deploying` status. When the `deployment` is done, you can see your Kubernetes cluster status is updated as `Deployed`(It takes 8-15 minutes). + +2. Run `Kubernetes CLI` + + a). Download and install a few `CLI tools` and the `IBM Kubernetes Service` plug-in. + + `curl -sL https://ibm.biz/idt-installer | bash` + + b). TO gain access to your `cluster`, `Log in` to your `IBM Cloud` account. + + `ibmcloud login -a https://api.ng.bluemix.net` + + If you have a `federated ID`, use ibmcloud login `--sso` to log in to the IBM Cloud CLI + + c). Target the IBM Cloud Container Service `region` in which you want to work. + + `ibmcloud cs region-set us-south` + + d). Get the command to set the environment variable and download the Kubernetes configuration files. + + `ibmcloud cs cluster-config ` + + For example: `ibmcloud cs cluster-config mycluster1` + + e). Set the `KUBECONFIG` environment variable. Copy the output from the previous command and paste it in your terminal. The command output should look similar to the following. + + `export KUBECONFIG=/Users/$USER/.bluemix/plugins/container-service/clusters/mycluster1/kube-config-hou02-mycluster1.yml` + + f). Verify that you can connect to your `cluster` by listing your worker nodes. + + `kubectl get nodes` + +3. Now, Assuming that you already build the project using `mvn`, `login` to the docker by using the command: + + `docker login` + +4. Change directory to the bluemix-todo-app folder within the Java folder and run the following commands: + + `$ cd java/bluemix-todo-app` + + `docker build -t .` + + It will create docker image named ``. You can check it by command `docker images`. + +##### Run the application locally using docker +1. To run the application locally using docker, run the following command: + + `docker run -it --rm -p 8088:8080 --name bluemix-todo-app ` + + here, docker port 8088 is mapped to the locally port 8080 + +2. check for the application at `http://localhost:8088/bluemix-todo-app/` + +##### Deploy and run the application using IKS and docker +1. Login to IBM Cloud using commands : + + `bx login -a https://api.ng.bluemix.net --sso` + + `bx cr login` + + `bx cr namespace-add ` + + `bx cs region-set us-south` + +2. In order to push the new image to IBM Cloud repository you need to `tag` the local images into an IBM specific format.To do this use the commands: + + `docker images` + Notedown these ``, ``, `` to use them in next step. + + `docker tag registry.ng.bluemix.net//:` + + `docker push registry.ng.bluemix.net//` + +3. Deploy containerized application to the Kubernetes cluster in Bluemix using Kubernetes, to do this use the following two kubectl commands: + + `kubectl run --image=registry.ng.bluemix.net//: --port=8080` + + `kubectl expose deployment --type=NodePort` + + You can see the deployed docker container with name `` is up and running in IKS dashboard. + +4. To access the `bluemix-todo-app` application: + + a. In the IKS dashboard, For NodeIP, Go to `Nodes`(left-side bar) --> `details` --> `addresses`, notedown `Extenal IP` + + For Example: + Under Addresses: + InternalIP: 10.76.141.207 + ExternalIP: 184.172.233.230 + Hostname: 10.76.141.207 + Notedown, `ExternalIP` i.e, `184.172.233.230` + + b. For Node port, go to services --> Internal endpoints of "webserver", use second port number + + For Example: + Under services --> + :8080 TCP + :30154 TCP + Notedown, second IP i.e, 30154 + + c. Finally, access application using `184.172.233.230:30154` i.e, ``:`` + + + ### Additional Information This project is leveraging the [spring-cloud library](https://github.com/spring-projects/spring-cloud) From b2fc2cf90b7a1af2fd77954c62aa35132feecdbb Mon Sep 17 00:00:00 2001 From: Sachin Bommale Date: Wed, 6 Feb 2019 16:35:41 +0530 Subject: [PATCH 7/8] Deploy and run the application using IKS and docker --- java/README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/java/README.md b/java/README.md index 738b70f..854610e 100644 --- a/java/README.md +++ b/java/README.md @@ -199,20 +199,20 @@ To deploy this application to IKS using docker, follow below steps: For Example: Under Addresses: - InternalIP: 10.76.141.207 - ExternalIP: 184.172.233.230 - Hostname: 10.76.141.207 - Notedown, `ExternalIP` i.e, `184.172.233.230` + InternalIP: 10.76.141.207 + ExternalIP: 184.172.233.230 + Hostname: 10.76.141.207 + Notedown, `ExternalIP` i.e, `184.172.233.230` b. For Node port, go to services --> Internal endpoints of "webserver", use second port number For Example: Under services --> - :8080 TCP - :30154 TCP - Notedown, second IP i.e, 30154 + :8080 TCP + :30154 TCP + Notedown, second IP i.e, 30154 - c. Finally, access application using `184.172.233.230:30154` i.e, ``:`` + c. Finally, access application using `184.172.233.230:30154/bluemix-todo-app/` i.e, ``:`/bluemix-todo-app/` From 9f1c502b8c68a74d85ba9c0621237e6d5c684be5 Mon Sep 17 00:00:00 2001 From: ajaychebbi Date: Wed, 27 Mar 2019 11:38:24 +0530 Subject: [PATCH 8/8] modifying readme to fix Kube instructions --- java/README.md | 39 +++++++++++++++------------------------ 1 file changed, 15 insertions(+), 24 deletions(-) diff --git a/java/README.md b/java/README.md index 854610e..7663115 100644 --- a/java/README.md +++ b/java/README.md @@ -1,6 +1,6 @@ ## About A backend for the ToDo app written written in Java. ToDos can be stored in -either a Mongo DB or Couch DB using Cloudant. +either a Mongo DB or Couch DB using Cloudant. If you do not provide Cloudant or Couch, the app will run but the items are all in memory. ## Prerequisites @@ -26,14 +26,10 @@ following Maven command in the root of the project. Then open your favorite browser and navigate to http://localhost:8080. -## Swagger doc -You can access the swaggerdoc of the APIs at http://localhost:8080/api/swagger.json or http://localhost:8080/api/swagger.yaml - -To use the swagger doc for swagger-codegen, change the `host` `your_host:your_port` and the `schemes` to point to your server -## Deploying The App To Bluemix -You can deploy to Bluemix using the cf command line interface, or the cloudfoundry maven plugin. -### Deploy using cf cli +## Deploying The App To IBM Cloud +You can deploy the aoo too IBM Cloud as a Cloudfoundry app onn regions that Cf is available. You do this using the cf command line interface, or the cloudfoundry maven plugin. +### Deploy to CloudFoundry using cf cli cf push YOUR-APP-NAME -p target/bluemix-todo-app.war -b java_buildpack @@ -92,25 +88,16 @@ you would like using the space parameter. $ mvn -P cloudant-deploy -Dapp-url=bluemix-todo-java-cloudant.mybluemix.net -Dorg=organization -Dspace=myspace -### Deploying Application to IBM Kubernetes Service (IKS) using Docker +### Deploying Application to IBM Kubernetes Service (IKS) To deploy this application to IKS using docker, follow below steps: -#### Prerequisites -1. Install Kubernetes tool `kubectl` using : https://kubernetes.io/docs/tasks/tools/install-kubectl/ - -2. Install `Docker CE` using : https://hub.docker.com/search/?type=edition&offering=community - -3. Create a `Docker ID` : https://hub.docker.com - -4. Download `VirtualBox` : https://www.virtualbox.org/wiki/Downloads - -5. (Optional) If you want to run locally, `minikube` for MacOS : https://kubernetes.io/docs/tasks/tools/install-minikube/ +Note: to run this app locally on kubernetes, you can use something like Dockerdesktop and minikube. The instructions are not covered here. #### Getting Started and Configuration -1. Create a Kubernetes Cluster in Bluemix/IBM Cloud +1. Create a Kubernetes Cluster on IBM Cloud - a). First let's create an account on Bluemix/IBM Cloud (For Free) : https://www.ibm.com/cloud/ + a). First let's create an account on IBM Cloud (For Free) : https://www.ibm.com/cloud/ - b). After login to your Bluemix/IBM Cloud account, click on the `Catalog` on top menu bar, select `Containers` from the left navigation menu and click on the Kubernetes Service and click on `create`. + b). After login to your IBM Cloud account, click on the `Catalog` on top menu bar, select `Containers` from the left navigation menu and click on the Kubernetes Service and click on `create`. c). In the Create a Kubernates Cluster page, set the `Cluster type` as `Free`, enter your `Cluster Name`, and select the location from the dropdown list (Or leave it for default, i used `Dallas`), then click on `create cluster`. Your will see your Kubernetes Cluster is now in `Deploying` status. When the `deployment` is done, you can see your Kubernetes cluster status is updated as `Deployed`(It takes 8-15 minutes). @@ -185,7 +172,7 @@ To deploy this application to IKS using docker, follow below steps: `docker push registry.ng.bluemix.net//` -3. Deploy containerized application to the Kubernetes cluster in Bluemix using Kubernetes, to do this use the following two kubectl commands: +3. Deploy containerized application to the Kubernetes cluster in IBM Cloud using Kubernetes, to do this use the following two kubectl commands: `kubectl run --image=registry.ng.bluemix.net//: --port=8080` @@ -214,7 +201,11 @@ To deploy this application to IKS using docker, follow below steps: c. Finally, access application using `184.172.233.230:30154/bluemix-todo-app/` i.e, ``:`/bluemix-todo-app/` - +## Swagger doc +You can access the Open API (swagger) doc of the APIs in yaml or json (swagger.json or swagger.yaml) at http://localhost:8080/api/swagger.json or http://``:``/bluemix-todo-app/api/swagger.json or swagger.yaml + +To use the swagger doc in another application, change the `host` to `your_host:your_port` and the `schemes` to `http` or `https` to point to your server + ### Additional Information