From 08694ee0ecfa8318f750836f838e6abea9f39ef6 Mon Sep 17 00:00:00 2001 From: asunder123 Date: Fri, 1 Oct 2021 16:44:45 +0530 Subject: [PATCH 01/46] Changes including chaos --- pom.xml | 64 ++++++++++++++++++- ...gBootRestcontrollerExampleApplication.java | 16 ++++- .../dev/restexample/SpanishGreeting.java | 8 ++- src/main/resources/application.properties | 22 +++++++ 4 files changed, 103 insertions(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index 2bc8983..1f418ed 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,7 @@ org.springframework.boot spring-boot-starter-parent - 1.5.1.RELEASE + 2.3.12.RELEASE @@ -22,14 +22,60 @@ UTF-8 UTF-8 1.8 + - + + + org.springframework.boot + spring-boot-starter-jdbc + + + mysql + mysql-connector-java + + + org.springframework.boot + spring-boot-starter-actuator + 2.5.4 + + + org.springframework.boot + spring-boot-starter-data-jpa + + + org.projectlombok + lombok + 1.18.20 + provided + + + de.codecentric + chaos-monkey-spring-boot + + 2.5.3 + + + org.springframework.boot + spring-boot-starter-test + test + org.springframework.boot spring-boot-starter-web - + io.springfox springfox-swagger2 @@ -49,6 +95,18 @@ org.springframework.boot spring-boot-maven-plugin + + + + + + repackage + + + diff --git a/src/main/java/es/macero/dev/SpringBootRestcontrollerExampleApplication.java b/src/main/java/es/macero/dev/SpringBootRestcontrollerExampleApplication.java index d1f6df4..093c9a4 100644 --- a/src/main/java/es/macero/dev/SpringBootRestcontrollerExampleApplication.java +++ b/src/main/java/es/macero/dev/SpringBootRestcontrollerExampleApplication.java @@ -1,19 +1,22 @@ package es.macero.dev; import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.*; import org.springframework.context.annotation.Bean; import springfox.documentation.builders.PathSelectors; import springfox.documentation.builders.RequestHandlerSelectors; import springfox.documentation.spi.DocumentationType; import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.swagger2.annotations.EnableSwagger2; +//import es.macero.dev.restexample.SpanishGreeting; -@SpringBootApplication +@SpringBootApplication(scanBasePackages="es.macero") @EnableSwagger2 +@EnableAutoConfiguration public class SpringBootRestcontrollerExampleApplication { public static void main(String[] args) { + SpringApplication.run(SpringBootRestcontrollerExampleApplication.class, args); } @@ -24,6 +27,15 @@ public Docket api() { .apis(RequestHandlerSelectors.any()) .paths(PathSelectors.regex("/spanish-greeting.*")) .build(); + + + } + /*@Bean + public SpanishGreetingSpanishGreeting() { + + return new SpanishGreeting(); + }*/ + } diff --git a/src/main/java/es/macero/dev/restexample/SpanishGreeting.java b/src/main/java/es/macero/dev/restexample/SpanishGreeting.java index 59a8018..6a3fde8 100644 --- a/src/main/java/es/macero/dev/restexample/SpanishGreeting.java +++ b/src/main/java/es/macero/dev/restexample/SpanishGreeting.java @@ -1,7 +1,11 @@ package es.macero.dev.restexample; +import org.springframework.stereotype.*; +import org.springframework.beans.factory.annotation.*; -class SpanishGreeting { - +@Component +public class SpanishGreeting { + + @Value("${name}") private String message; // Required for JSON deserialization diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index e69de29..dc20054 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -0,0 +1,22 @@ +spring.datasource.url=jdbc:mysql://localhost:3306/db +spring.datasource.username="" +spring.datasource.password="" +#spring.datasource.driver-class-name=com.mysql.jdbc.Driver +#spring.jpa.database-platform = org.hibernate.dialect.MySQL5Dialect +#spring.jpa.generate-ddl=true +#sring.jpa.hibernate.ddl-auto = update +spring.profiles.active=chaos-monkey +server.port=8082 +chaos.monkey.enabled=false +#chaos.monkey.assaults.latencyActive=true +#chaos.monkey.assaults.latencyRangeStart=1000 +#chaos.monkey.assaults.latencyRangeEnd=4500 +chaos.monkey.watcher.controller=false +#chaos.monkey.watcher.restController=false +chaos.monkey.watcher.service=true +#chaos.monkey.watcher.repository=false +chaos.monkey.assaults.level=1 +#management.endpoint.chaosmonkey.enabled=true +#management.endpoint.chaosmonkeyjmx.enabled=false +management.endpoints.web.exposure.include=* +#management.server.port=8888 From 9c489769d1d1098f54dfb83b13f5b3251eb91ba7 Mon Sep 17 00:00:00 2001 From: asunder123 Date: Fri, 1 Oct 2021 17:46:43 +0530 Subject: [PATCH 02/46] Corrections --- pom.xml | 6 ++++++ src/main/resources/application.properties | 15 ++++++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index 1f418ed..b33e0be 100644 --- a/pom.xml +++ b/pom.xml @@ -32,6 +32,12 @@ spring-context 5.0.6.RELEASE + + com.h2database + h2 + 1.4.200 + compile + org.springframework.boot spring-boot-starter-jdbc diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index dc20054..057d0a5 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,10 +1,15 @@ -spring.datasource.url=jdbc:mysql://localhost:3306/db -spring.datasource.username="" -spring.datasource.password="" +#spring.datasource.url=jdbc:mysql://localhost:3306/db +#spring.datasource.username="" +#spring.datasource.password="" #spring.datasource.driver-class-name=com.mysql.jdbc.Driver #spring.jpa.database-platform = org.hibernate.dialect.MySQL5Dialect -#spring.jpa.generate-ddl=true -#sring.jpa.hibernate.ddl-auto = update +spring.datasource.url=jdbc:h2:mem:testdb +spring.datasource.driverClassName=org.h2.Driver +spring.datasource.username= +spring.datasource.password= +spring.jpa.database-platform=org.hibernate.dialect.H2Dialect +spring.jpa.generate-ddl=true +sring.jpa.hibernate.ddl-auto = update spring.profiles.active=chaos-monkey server.port=8082 chaos.monkey.enabled=false From 2e1d77898ed425ad5d56a32cb8c136b241035bc5 Mon Sep 17 00:00:00 2001 From: asunder123 Date: Fri, 1 Oct 2021 17:58:02 +0530 Subject: [PATCH 03/46] Succesfully installed chaos --- src/main/resources/application.properties | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 057d0a5..26718a1 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -12,16 +12,16 @@ spring.jpa.generate-ddl=true sring.jpa.hibernate.ddl-auto = update spring.profiles.active=chaos-monkey server.port=8082 -chaos.monkey.enabled=false +chaos.monkey.enabled=true #chaos.monkey.assaults.latencyActive=true #chaos.monkey.assaults.latencyRangeStart=1000 #chaos.monkey.assaults.latencyRangeEnd=4500 -chaos.monkey.watcher.controller=false -#chaos.monkey.watcher.restController=false +#chaos.monkey.watcher.controller=false +chaos.monkey.watcher.restController=true chaos.monkey.watcher.service=true #chaos.monkey.watcher.repository=false chaos.monkey.assaults.level=1 -#management.endpoint.chaosmonkey.enabled=true +management.endpoint.chaosmonkey.enabled=true #management.endpoint.chaosmonkeyjmx.enabled=false management.endpoints.web.exposure.include=* #management.server.port=8888 From 8ff58208a4aa04233d8834f972dded09edfc8baa Mon Sep 17 00:00:00 2001 From: Anand Sunder <50335583+asunder123@users.noreply.github.com> Date: Fri, 1 Oct 2021 18:10:25 +0530 Subject: [PATCH 04/46] Update readme.md --- readme.md | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/readme.md b/readme.md index f9b71b5..4c9d5ae 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,4 @@ -# Spring Boot @RestController Example +# Spring Boot @RestController Example with Chaos Monkey Enabled in Spring Application Properties ## Description @@ -8,8 +8,27 @@ The main goal of the project is to show how to write a `@RestController` in Spri ## How does it work? -You can use the endpoints behind `http://localhost:8080/spanish-greetings`. If you append `/random` to a `GET` request you'll receive a random Spanish greeting (which are actually hard-coded). You can also `GET` them by `id` (only from 1 to 3). To create a new one, you need to perform a `POST` operation. +You can use the endpoints behind `http://localhost:8082/spanish-greetings`. If you append `/random` to a `GET` request you'll receive a random Spanish greeting (which are actually hard-coded). You can also `GET` them by `id` (only from 1 to 3). To create a new one, you need to perform a `POST` operation. + +Actually, much better if you just start the application and navigate to `http://localhost:8082/swagger-ui.html`. There you'll find a nice API documentation thanks to Swagger. Moreover, *you can play with it*. + +![Swagger Documentation](images/swagger.png) + +Upon Succesful Initialization of Chaos Monkey you should see something like this : + +![image](https://user-images.githubusercontent.com/50335583/135620733-ee4eb8bc-918d-461a-8cca-40f085976f90.png) + + +In addition to the end points and controller, chaos testing can be done as shown using postman for the endpoints exposed under actuator: + +![image](https://user-images.githubusercontent.com/50335583/135618904-26996ad8-1824-4d03-a97c-4e878b8ef2a2.png) +![image](https://user-images.githubusercontent.com/50335583/135619103-a6322eba-2fb0-4df9-847c-68daf95f5a6b.png) +![image](https://user-images.githubusercontent.com/50335583/135619155-9b62c70a-b8fa-4028-b11a-d58f2ba09b75.png) +![image](https://user-images.githubusercontent.com/50335583/135619288-a3968210-c7aa-48d9-8105-36be2bbacc18.png) +![image](https://user-images.githubusercontent.com/50335583/135619450-1a7e2d03-0fa4-4c14-bcdb-7d95c6cbee98.png) +![image](https://user-images.githubusercontent.com/50335583/135620247-d62f0021-a1e1-4464-9e62-0d58e705d623.png) + + + -Actually, much better if you just start the application and navigate to `http://localhost:8080/swagger-ui.html`. There you'll find a nice API documentation thanks to Swagger. Moreover, *you can play with it*. -![Swagger Documentation](images/swagger.png) \ No newline at end of file From fcf792db355377dd413db5949a496188c67c0593 Mon Sep 17 00:00:00 2001 From: asunder123 Date: Mon, 4 Oct 2021 21:53:56 +0530 Subject: [PATCH 05/46] Changes to add jaeger client --- pom.xml | 5 +++++ src/main/resources/application.properties | 5 ++++- src/main/resources/application.resources | 0 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 src/main/resources/application.resources diff --git a/pom.xml b/pom.xml index b33e0be..17cc968 100644 --- a/pom.xml +++ b/pom.xml @@ -32,6 +32,11 @@ spring-context 5.0.6.RELEASE + + io.opentracing.contrib + opentracing-spring-jaeger-web-starter + 3.3.1 + com.h2database h2 diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 26718a1..e7427f6 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -3,6 +3,8 @@ #spring.datasource.password="" #spring.datasource.driver-class-name=com.mysql.jdbc.Driver #spring.jpa.database-platform = org.hibernate.dialect.MySQL5Dialect +spring.main.allow-bean-definition-overriding=true +opentracing.jaeger.http.sender.url=http://localhost:16686/api/traces spring.datasource.url=jdbc:h2:mem:testdb spring.datasource.driverClassName=org.h2.Driver spring.datasource.username= @@ -16,9 +18,10 @@ chaos.monkey.enabled=true #chaos.monkey.assaults.latencyActive=true #chaos.monkey.assaults.latencyRangeStart=1000 #chaos.monkey.assaults.latencyRangeEnd=4500 -#chaos.monkey.watcher.controller=false +chaos.monkey.watcher.controller=true chaos.monkey.watcher.restController=true chaos.monkey.watcher.service=true +chaos.monkey.assaults.watchedCustomServices=* #chaos.monkey.watcher.repository=false chaos.monkey.assaults.level=1 management.endpoint.chaosmonkey.enabled=true diff --git a/src/main/resources/application.resources b/src/main/resources/application.resources new file mode 100644 index 0000000..e69de29 From b28ff116d4d938f45b825b46d1c4f43fa443404f Mon Sep 17 00:00:00 2001 From: Anand Sunder <50335583+asunder123@users.noreply.github.com> Date: Tue, 5 Oct 2021 15:03:38 +0530 Subject: [PATCH 06/46] Create Jenkinsfile --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1 @@ + From d013297ad19764994cf46cbef7c966002c6933ad Mon Sep 17 00:00:00 2001 From: Anand Sunder <50335583+asunder123@users.noreply.github.com> Date: Tue, 5 Oct 2021 15:08:10 +0530 Subject: [PATCH 07/46] Update Jenkinsfile --- Jenkinsfile | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 8b13789..bc7041f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1 +1,11 @@ +pipeline { + agent { any { image 'maven:3.3.3' } } + stages { + stage('build') { + steps { + sh 'mvn --version' + } + } + } +} From 0e8ecd69fb1f700ca2da177407832f50011f33fe Mon Sep 17 00:00:00 2001 From: Anand Sunder <50335583+asunder123@users.noreply.github.com> Date: Tue, 5 Oct 2021 15:08:29 +0530 Subject: [PATCH 08/46] Update Jenkinsfile --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile b/Jenkinsfile index bc7041f..c76242e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -5,6 +5,7 @@ pipeline { stage('build') { steps { sh 'mvn --version' + sh 'mvn clean install' } } } From 0dd25f65805bcc012b936eec64dcdf1802c270f8 Mon Sep 17 00:00:00 2001 From: Anand Sunder <50335583+asunder123@users.noreply.github.com> Date: Tue, 5 Oct 2021 15:15:45 +0530 Subject: [PATCH 09/46] Update Jenkinsfile --- Jenkinsfile | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index c76242e..b83a5c3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,6 +7,28 @@ pipeline { sh 'mvn --version' sh 'mvn clean install' } + + stage('run'){ + steps{ + + sh 'cd /var/lib/jenkins/workspace/springbootpipeline_test/target' + sh 'java -jar *.jar' + + } + + stage ('test'){ + + steps{ + + sh 'curl http://localhost:8082' + + + } + + + } + + } } } } From c0a622f51dadebad7906a60af833073844eea460 Mon Sep 17 00:00:00 2001 From: Anand Sunder <50335583+asunder123@users.noreply.github.com> Date: Tue, 5 Oct 2021 15:18:21 +0530 Subject: [PATCH 10/46] Update Jenkinsfile --- Jenkinsfile | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index b83a5c3..483d320 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,7 +7,7 @@ pipeline { sh 'mvn --version' sh 'mvn clean install' } - + } stage('run'){ steps{ @@ -15,7 +15,7 @@ pipeline { sh 'java -jar *.jar' } - + } stage ('test'){ steps{ @@ -25,10 +25,7 @@ pipeline { } + } - - } - } } -} From 4e732870d81730cfcf527e3a27e2e988c4b51a05 Mon Sep 17 00:00:00 2001 From: Anand Sunder <50335583+asunder123@users.noreply.github.com> Date: Tue, 5 Oct 2021 15:19:15 +0530 Subject: [PATCH 11/46] Update Jenkinsfile --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile b/Jenkinsfile index 483d320..b0f3fbb 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -29,3 +29,4 @@ pipeline { } } +} From bc57b3f5df8517b200cb68dda7a7e42ccecc3751 Mon Sep 17 00:00:00 2001 From: Anand Sunder <50335583+asunder123@users.noreply.github.com> Date: Tue, 5 Oct 2021 15:21:13 +0530 Subject: [PATCH 12/46] Update Jenkinsfile --- Jenkinsfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index b0f3fbb..6022547 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -10,7 +10,8 @@ pipeline { } stage('run'){ steps{ - + + sh 'sudo su' sh 'cd /var/lib/jenkins/workspace/springbootpipeline_test/target' sh 'java -jar *.jar' From 5235b5db4f7499eb2a85de0c21967b180a322e67 Mon Sep 17 00:00:00 2001 From: Anand Sunder <50335583+asunder123@users.noreply.github.com> Date: Tue, 5 Oct 2021 15:22:27 +0530 Subject: [PATCH 13/46] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6022547..7274f3a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -11,7 +11,7 @@ pipeline { stage('run'){ steps{ - sh 'sudo su' + sh 'sudo -u asunder -p Ubuntu@123' sh 'cd /var/lib/jenkins/workspace/springbootpipeline_test/target' sh 'java -jar *.jar' From 333cccddf2fe6e860ea2036e9c4282f218dfc71f Mon Sep 17 00:00:00 2001 From: Anand Sunder <50335583+asunder123@users.noreply.github.com> Date: Tue, 5 Oct 2021 15:23:43 +0530 Subject: [PATCH 14/46] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 7274f3a..a4d220e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -11,7 +11,7 @@ pipeline { stage('run'){ steps{ - sh 'sudo -u asunder -p Ubuntu@123' + sh 'sudo su -s /bin/bash jenkins' sh 'cd /var/lib/jenkins/workspace/springbootpipeline_test/target' sh 'java -jar *.jar' From f24279e9aabf44cb7780ba3d0563bd307908d892 Mon Sep 17 00:00:00 2001 From: Anand Sunder <50335583+asunder123@users.noreply.github.com> Date: Tue, 5 Oct 2021 15:25:37 +0530 Subject: [PATCH 15/46] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index a4d220e..4f99ba1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -11,7 +11,7 @@ pipeline { stage('run'){ steps{ - sh 'sudo su -s /bin/bash jenkins' + sh 'sudo su -s /bin/bash jenkins -u 'asunder' -p 'Ubuntu@123'' sh 'cd /var/lib/jenkins/workspace/springbootpipeline_test/target' sh 'java -jar *.jar' From 9b18a3417f0a7da7eb254300254cd93c89876b2d Mon Sep 17 00:00:00 2001 From: Anand Sunder <50335583+asunder123@users.noreply.github.com> Date: Tue, 5 Oct 2021 15:26:37 +0530 Subject: [PATCH 16/46] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 4f99ba1..d4aa412 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -11,7 +11,7 @@ pipeline { stage('run'){ steps{ - sh 'sudo su -s /bin/bash jenkins -u 'asunder' -p 'Ubuntu@123'' + sh 'sudo su -s /bin/bash jenkins -u asunder -p Ubuntu@123' sh 'cd /var/lib/jenkins/workspace/springbootpipeline_test/target' sh 'java -jar *.jar' From 7d68b1f07a95cfc17848482cf3fb6d2bfa5067bd Mon Sep 17 00:00:00 2001 From: Anand Sunder <50335583+asunder123@users.noreply.github.com> Date: Tue, 5 Oct 2021 15:29:57 +0530 Subject: [PATCH 17/46] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index d4aa412..fcadb86 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -11,7 +11,7 @@ pipeline { stage('run'){ steps{ - sh 'sudo su -s /bin/bash jenkins -u asunder -p Ubuntu@123' + sh 'pwd' sh 'cd /var/lib/jenkins/workspace/springbootpipeline_test/target' sh 'java -jar *.jar' From d09559bc5914ef1f2701ecaa1bd8dc64cef7bd60 Mon Sep 17 00:00:00 2001 From: Anand Sunder <50335583+asunder123@users.noreply.github.com> Date: Tue, 5 Oct 2021 15:31:21 +0530 Subject: [PATCH 18/46] Update Jenkinsfile --- Jenkinsfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index fcadb86..1c4bcbe 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -12,8 +12,9 @@ pipeline { steps{ sh 'pwd' - sh 'cd /var/lib/jenkins/workspace/springbootpipeline_test/target' - sh 'java -jar *.jar' + sh 'ls -ltr' + //sh 'cd /var/lib/jenkins/workspace/springbootpipeline_test/target' + //sh 'java -jar *.jar' } } @@ -21,7 +22,7 @@ pipeline { steps{ - sh 'curl http://localhost:8082' + //sh 'curl http://localhost:8082' } From af1217965539894cbe5ddc2cc36d2ff1a67f48ac Mon Sep 17 00:00:00 2001 From: Anand Sunder <50335583+asunder123@users.noreply.github.com> Date: Tue, 5 Oct 2021 15:32:35 +0530 Subject: [PATCH 19/46] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 1c4bcbe..f75acde 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -22,7 +22,7 @@ pipeline { steps{ - //sh 'curl http://localhost:8082' + sh 'curl http://localhost:8080' } From bfc2f7b3f0df229c17fc6d5e4f5ff351f319c839 Mon Sep 17 00:00:00 2001 From: Anand Sunder <50335583+asunder123@users.noreply.github.com> Date: Tue, 5 Oct 2021 15:33:54 +0530 Subject: [PATCH 20/46] Update Jenkinsfile --- Jenkinsfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index f75acde..251b08c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -13,7 +13,8 @@ pipeline { sh 'pwd' sh 'ls -ltr' - //sh 'cd /var/lib/jenkins/workspace/springbootpipeline_test/target' + sh 'cd target' + sh 'ls-ltr | grep *.jar' //sh 'java -jar *.jar' } From 2fdea00471b1ca666186c311c35d29155639eaf0 Mon Sep 17 00:00:00 2001 From: Anand Sunder <50335583+asunder123@users.noreply.github.com> Date: Tue, 5 Oct 2021 15:35:13 +0530 Subject: [PATCH 21/46] Update Jenkinsfile --- Jenkinsfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 251b08c..ec13470 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -14,7 +14,8 @@ pipeline { sh 'pwd' sh 'ls -ltr' sh 'cd target' - sh 'ls-ltr | grep *.jar' + sh 'pwd' + sh 'ls-ltr' //sh 'java -jar *.jar' } From 062a881adf926d1c1aee6c57b1214be0ef5a995a Mon Sep 17 00:00:00 2001 From: Anand Sunder <50335583+asunder123@users.noreply.github.com> Date: Tue, 5 Oct 2021 15:36:05 +0530 Subject: [PATCH 22/46] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index ec13470..b819480 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -15,7 +15,7 @@ pipeline { sh 'ls -ltr' sh 'cd target' sh 'pwd' - sh 'ls-ltr' + sh 'ls -ltr' //sh 'java -jar *.jar' } From 7526d31b3f2339c8561ab4b2965b93bfbcae44d6 Mon Sep 17 00:00:00 2001 From: Anand Sunder <50335583+asunder123@users.noreply.github.com> Date: Tue, 5 Oct 2021 15:49:54 +0530 Subject: [PATCH 23/46] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index b819480..5c551b6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -13,7 +13,7 @@ pipeline { sh 'pwd' sh 'ls -ltr' - sh 'cd target' + sh 'cd /target' sh 'pwd' sh 'ls -ltr' //sh 'java -jar *.jar' From 8d18f9c044a0e883b96a6a4cc20fea9919a6592e Mon Sep 17 00:00:00 2001 From: Anand Sunder <50335583+asunder123@users.noreply.github.com> Date: Tue, 5 Oct 2021 15:50:30 +0530 Subject: [PATCH 24/46] Update Jenkinsfile --- Jenkinsfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 5c551b6..5227670 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -13,7 +13,8 @@ pipeline { sh 'pwd' sh 'ls -ltr' - sh 'cd /target' + sh 'sudo -S' + sh 'cd target' sh 'pwd' sh 'ls -ltr' //sh 'java -jar *.jar' From f7d5b42e1c9022fd14623cab1f45c32c7b32fba9 Mon Sep 17 00:00:00 2001 From: Anand Sunder <50335583+asunder123@users.noreply.github.com> Date: Tue, 5 Oct 2021 15:52:53 +0530 Subject: [PATCH 25/46] Update Jenkinsfile --- Jenkinsfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 5227670..79815a3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -13,8 +13,10 @@ pipeline { sh 'pwd' sh 'ls -ltr' - sh 'sudo -S' + sh 'cd *test' + sh 'ls-ltr' sh 'cd target' + sh 'ls -ltr' sh 'pwd' sh 'ls -ltr' //sh 'java -jar *.jar' From b90e3b0f85bafa4fbb6cf817606fa183513090a5 Mon Sep 17 00:00:00 2001 From: Anand Sunder <50335583+asunder123@users.noreply.github.com> Date: Tue, 5 Oct 2021 15:55:33 +0530 Subject: [PATCH 26/46] Update Jenkinsfile --- Jenkinsfile | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 79815a3..835995d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -13,11 +13,9 @@ pipeline { sh 'pwd' sh 'ls -ltr' - sh 'cd *test' - sh 'ls-ltr' sh 'cd target' - sh 'ls -ltr' - sh 'pwd' + sh 'echo $HOME' + sh 'pwd' sh 'ls -ltr' //sh 'java -jar *.jar' From 2ec08ea680972f97481a64ffca346f839655cb36 Mon Sep 17 00:00:00 2001 From: Anand Sunder <50335583+asunder123@users.noreply.github.com> Date: Tue, 5 Oct 2021 15:57:31 +0530 Subject: [PATCH 27/46] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 835995d..6bf0c50 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -15,7 +15,7 @@ pipeline { sh 'ls -ltr' sh 'cd target' sh 'echo $HOME' - sh 'pwd' + sh 'cd $HOME/workspace/springbootpipeline_test/target' sh 'ls -ltr' //sh 'java -jar *.jar' From 62a712be3291d0ee9e5cfe081da516fec8072f07 Mon Sep 17 00:00:00 2001 From: Anand Sunder <50335583+asunder123@users.noreply.github.com> Date: Tue, 5 Oct 2021 15:58:47 +0530 Subject: [PATCH 28/46] Update Jenkinsfile --- Jenkinsfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6bf0c50..0221ff4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -15,8 +15,7 @@ pipeline { sh 'ls -ltr' sh 'cd target' sh 'echo $HOME' - sh 'cd $HOME/workspace/springbootpipeline_test/target' - sh 'ls -ltr' + sh 'cd $HOME/workspace/springbootpipeline_test/target | ls -ltr' //sh 'java -jar *.jar' } From 22228dba6579d56f6e44a1e450be6e1d4a17097d Mon Sep 17 00:00:00 2001 From: Anand Sunder <50335583+asunder123@users.noreply.github.com> Date: Tue, 5 Oct 2021 16:00:27 +0530 Subject: [PATCH 29/46] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0221ff4..c0a7acc 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -15,7 +15,7 @@ pipeline { sh 'ls -ltr' sh 'cd target' sh 'echo $HOME' - sh 'cd $HOME/workspace/springbootpipeline_test/target | ls -ltr' + sh 'cd $HOME/workspace/springbootpipeline_test | ls -ltr | cd target | ls -ltr' //sh 'java -jar *.jar' } From 450eb2a1b92db6b0cabfbe8e348e0963f0aa535b Mon Sep 17 00:00:00 2001 From: Anand Sunder <50335583+asunder123@users.noreply.github.com> Date: Tue, 5 Oct 2021 16:02:28 +0530 Subject: [PATCH 30/46] Update Jenkinsfile --- Jenkinsfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index c0a7acc..a4bc9a4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -15,7 +15,9 @@ pipeline { sh 'ls -ltr' sh 'cd target' sh 'echo $HOME' - sh 'cd $HOME/workspace/springbootpipeline_test | ls -ltr | cd target | ls -ltr' + sh 'cd $HOME/workspace/springbootpipeline_test/target' + sh 'pwd' + sh 'ls -ltr' //sh 'java -jar *.jar' } From bfe4ff55706cec340d0c7f24b9adf727dfb7bb9c Mon Sep 17 00:00:00 2001 From: Anand Sunder <50335583+asunder123@users.noreply.github.com> Date: Tue, 5 Oct 2021 16:04:15 +0530 Subject: [PATCH 31/46] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index a4bc9a4..47320d5 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,7 +16,7 @@ pipeline { sh 'cd target' sh 'echo $HOME' sh 'cd $HOME/workspace/springbootpipeline_test/target' - sh 'pwd' + sh 'set HOME=/var/lib/workspace/springbootpipeline_test/target' sh 'ls -ltr' //sh 'java -jar *.jar' From decdbf1fddac5adc409bf8fd1e0b8e6866bd93ad Mon Sep 17 00:00:00 2001 From: Anand Sunder <50335583+asunder123@users.noreply.github.com> Date: Tue, 5 Oct 2021 16:05:23 +0530 Subject: [PATCH 32/46] Update Jenkinsfile --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile b/Jenkinsfile index 47320d5..c69686f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -17,6 +17,7 @@ pipeline { sh 'echo $HOME' sh 'cd $HOME/workspace/springbootpipeline_test/target' sh 'set HOME=/var/lib/workspace/springbootpipeline_test/target' + sh 'cd $HOME' sh 'ls -ltr' //sh 'java -jar *.jar' From ce80c5922bc8bae5c04e07a0901f5ecb0c35e331 Mon Sep 17 00:00:00 2001 From: Anand Sunder <50335583+asunder123@users.noreply.github.com> Date: Tue, 5 Oct 2021 16:06:35 +0530 Subject: [PATCH 33/46] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index c69686f..dc7b7e5 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -17,7 +17,7 @@ pipeline { sh 'echo $HOME' sh 'cd $HOME/workspace/springbootpipeline_test/target' sh 'set HOME=/var/lib/workspace/springbootpipeline_test/target' - sh 'cd $HOME' + sh 'echo $HOME' sh 'ls -ltr' //sh 'java -jar *.jar' From fb4802d2327d6835aaba4a0507046fe553fba7dd Mon Sep 17 00:00:00 2001 From: Anand Sunder <50335583+asunder123@users.noreply.github.com> Date: Tue, 5 Oct 2021 16:10:28 +0530 Subject: [PATCH 34/46] Update Jenkinsfile --- Jenkinsfile | 28 +--------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index dc7b7e5..e2e9f28 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -8,32 +8,6 @@ pipeline { sh 'mvn clean install' } } - stage('run'){ - steps{ - - sh 'pwd' - sh 'ls -ltr' - sh 'cd target' - sh 'echo $HOME' - sh 'cd $HOME/workspace/springbootpipeline_test/target' - sh 'set HOME=/var/lib/workspace/springbootpipeline_test/target' - sh 'echo $HOME' - sh 'ls -ltr' - //sh 'java -jar *.jar' - - } - } - stage ('test'){ - - steps{ - - sh 'curl http://localhost:8080' - - - } - - - - } + } } From f1d0c7c509990b19f1847d4be614df90c7025555 Mon Sep 17 00:00:00 2001 From: Anand Sunder <50335583+asunder123@users.noreply.github.com> Date: Tue, 5 Oct 2021 16:38:32 +0530 Subject: [PATCH 35/46] Create test --- test | 1 + 1 file changed, 1 insertion(+) create mode 100644 test diff --git a/test b/test new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/test @@ -0,0 +1 @@ + From 55b926172218fb7bdbb71429bc611879b4406740 Mon Sep 17 00:00:00 2001 From: Anand Sunder <50335583+asunder123@users.noreply.github.com> Date: Tue, 5 Oct 2021 16:41:09 +0530 Subject: [PATCH 36/46] Delete test --- test | 1 - 1 file changed, 1 deletion(-) delete mode 100644 test diff --git a/test b/test deleted file mode 100644 index 8b13789..0000000 --- a/test +++ /dev/null @@ -1 +0,0 @@ - From 0259cdcfc55de5538fafe40b827095ddb7b00e53 Mon Sep 17 00:00:00 2001 From: Anand Sunder <50335583+asunder123@users.noreply.github.com> Date: Tue, 5 Oct 2021 16:47:20 +0530 Subject: [PATCH 37/46] Create triggerjenkins --- triggerjenkins | 1 + 1 file changed, 1 insertion(+) create mode 100644 triggerjenkins diff --git a/triggerjenkins b/triggerjenkins new file mode 100644 index 0000000..9daeafb --- /dev/null +++ b/triggerjenkins @@ -0,0 +1 @@ +test From 1cb97aae8a5c3ac3ebbaa58abd4d3fb802b222a6 Mon Sep 17 00:00:00 2001 From: Anand Sunder <50335583+asunder123@users.noreply.github.com> Date: Tue, 5 Oct 2021 16:49:23 +0530 Subject: [PATCH 38/46] Create testcleanbuild --- testcleanbuild | 1 + 1 file changed, 1 insertion(+) create mode 100644 testcleanbuild diff --git a/testcleanbuild b/testcleanbuild new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/testcleanbuild @@ -0,0 +1 @@ + From dd885d2d9fd2cc9b3e57e2e73e535b04ff85ddb6 Mon Sep 17 00:00:00 2001 From: Anand Sunder <50335583+asunder123@users.noreply.github.com> Date: Tue, 5 Oct 2021 16:51:16 +0530 Subject: [PATCH 39/46] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index e2e9f28..0ee42f6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,7 +4,7 @@ pipeline { stages { stage('build') { steps { - sh 'mvn --version' + sh 'mvn clean package' sh 'mvn clean install' } } From 53615bf452fac5d2db2fb725030ee0054368a804 Mon Sep 17 00:00:00 2001 From: Anand Sunder <50335583+asunder123@users.noreply.github.com> Date: Tue, 5 Oct 2021 16:53:03 +0530 Subject: [PATCH 40/46] Update Jenkinsfile --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile b/Jenkinsfile index 0ee42f6..4fa28e2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,6 +4,7 @@ pipeline { stages { stage('build') { steps { + sh 'mvn --version' sh 'mvn clean package' sh 'mvn clean install' } From 6bb08356a22137d311b62b0a85a9ebd445f60dc0 Mon Sep 17 00:00:00 2001 From: asunder123 Date: Tue, 5 Oct 2021 17:28:58 +0530 Subject: [PATCH 41/46] Changes --- src/main/resources/application.properties | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index e7427f6..c8d5c8a 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -24,6 +24,7 @@ chaos.monkey.watcher.service=true chaos.monkey.assaults.watchedCustomServices=* #chaos.monkey.watcher.repository=false chaos.monkey.assaults.level=1 +spring.aop.proxy-target-class=true management.endpoint.chaosmonkey.enabled=true #management.endpoint.chaosmonkeyjmx.enabled=false management.endpoints.web.exposure.include=* From 058705172a0323d1c2656c3a2099ca68e56d1a83 Mon Sep 17 00:00:00 2001 From: asunder123 Date: Tue, 5 Oct 2021 17:36:02 +0530 Subject: [PATCH 42/46] Changes to application properties --- src/main/resources/application.properties | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index c8d5c8a..925f15a 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -25,6 +25,7 @@ chaos.monkey.assaults.watchedCustomServices=* #chaos.monkey.watcher.repository=false chaos.monkey.assaults.level=1 spring.aop.proxy-target-class=true +spring.application.admin.enabled=true management.endpoint.chaosmonkey.enabled=true #management.endpoint.chaosmonkeyjmx.enabled=false management.endpoints.web.exposure.include=* From 970f2d7cc28ed2455300850da3bc712a62f3eb11 Mon Sep 17 00:00:00 2001 From: asunder123 Date: Tue, 5 Oct 2021 17:40:50 +0530 Subject: [PATCH 43/46] Changes to appl properties --- src/main/resources/application.properties | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 925f15a..c439bca 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -13,6 +13,7 @@ spring.jpa.database-platform=org.hibernate.dialect.H2Dialect spring.jpa.generate-ddl=true sring.jpa.hibernate.ddl-auto = update spring.profiles.active=chaos-monkey +management.server.add-application-context-header=true server.port=8082 chaos.monkey.enabled=true #chaos.monkey.assaults.latencyActive=true From 5987d53ca821198573adb37466780b1c979c832d Mon Sep 17 00:00:00 2001 From: asunder123 Date: Tue, 5 Oct 2021 20:34:05 +0530 Subject: [PATCH 44/46] Trigger jenkins script --- triggerjenkins | 1 - 1 file changed, 1 deletion(-) delete mode 100644 triggerjenkins diff --git a/triggerjenkins b/triggerjenkins deleted file mode 100644 index 9daeafb..0000000 --- a/triggerjenkins +++ /dev/null @@ -1 +0,0 @@ -test From 9f0e9587c8f3365277a2c3172bee1de14d817228 Mon Sep 17 00:00:00 2001 From: asunder123 Date: Wed, 6 Oct 2021 12:05:58 +0530 Subject: [PATCH 45/46] Bash script to test jar after changes --- src/main/java/es/macero/dev/restexample/SpanishGreeting.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/es/macero/dev/restexample/SpanishGreeting.java b/src/main/java/es/macero/dev/restexample/SpanishGreeting.java index 6a3fde8..267d685 100644 --- a/src/main/java/es/macero/dev/restexample/SpanishGreeting.java +++ b/src/main/java/es/macero/dev/restexample/SpanishGreeting.java @@ -5,7 +5,7 @@ @Component public class SpanishGreeting { - @Value("${name}") + //@Value("${name}") private String message; // Required for JSON deserialization From ba6eedcbead1a0732a0e98b695e2022b8c5063c1 Mon Sep 17 00:00:00 2001 From: Anand Sunder <50335583+asunder123@users.noreply.github.com> Date: Wed, 6 Oct 2021 13:01:47 +0530 Subject: [PATCH 46/46] Delete testcleanbuild --- testcleanbuild | 1 - 1 file changed, 1 deletion(-) delete mode 100644 testcleanbuild diff --git a/testcleanbuild b/testcleanbuild deleted file mode 100644 index 8b13789..0000000 --- a/testcleanbuild +++ /dev/null @@ -1 +0,0 @@ -