From 84a9a9008e54a1fda3d19448048f8ddcd10a7845 Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Sun, 29 Jun 2025 23:15:23 +0200 Subject: [PATCH 01/56] Create Jenkinsfile --- Jenkinsfile | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 00000000..002a77ec --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,61 @@ +pipeline { + agent any + + tools { + maven 'Maven 3' + nodejs 'Node 12' + } + + environment { + BACKEND_DIR = 'expensetracker-backend' + FRONTEND_DIR = 'expensetracker-frontend' + } + + stages { + stage('Clone') { + steps { + echo "Cloning repo..." + // Automatically cloned via SCM config + } + } + + stage('Build Backend') { + steps { + dir("${BACKEND_DIR}") { + sh 'mvn clean install' + } + } + } + + stage('Build Frontend') { + steps { + dir("${FRONTEND_DIR}") { + sh 'npm install' + sh 'ng build --prod' + } + } + } + + stage('Run Spring Boot App') { + steps { + dir("${BACKEND_DIR}") { + sh 'nohup java -jar target/*.jar &' + } + } + } + + stage('Health Check') { + steps { + script { + sleep(10) // wait for app to start + def response = sh(script: "curl -s -o /dev/null -w '%{http_code}' http://localhost:8080/api/v1/expenses", returnStdout: true).trim() + if (response != '200') { + error "Health check failed! Status code: ${response}" + } else { + echo "Backend is up and running!" + } + } + } + } + } +} From 0cbbe4bbde76147484ebe1f2a89bde0dbcd00c6d Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Sun, 29 Jun 2025 23:33:30 +0200 Subject: [PATCH 02/56] Update Jenkinsfile --- Jenkinsfile | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 002a77ec..200a5176 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -21,7 +21,6 @@ pipeline { stage('Build Backend') { steps { - dir("${BACKEND_DIR}") { sh 'mvn clean install' } } @@ -29,20 +28,18 @@ pipeline { stage('Build Frontend') { steps { - dir("${FRONTEND_DIR}") { sh 'npm install' sh 'ng build --prod' } } - } + stage('Run Spring Boot App') { steps { - dir("${BACKEND_DIR}") { sh 'nohup java -jar target/*.jar &' } } - } + stage('Health Check') { steps { @@ -58,4 +55,4 @@ pipeline { } } } -} + From 56f4cf44fd5ead26c0fd3f6b343447705764f503 Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Sun, 29 Jun 2025 23:35:43 +0200 Subject: [PATCH 03/56] Update1 Jenkinsfile --- Jenkinsfile | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 200a5176..218bdb46 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -6,45 +6,30 @@ pipeline { nodejs 'Node 12' } - environment { - BACKEND_DIR = 'expensetracker-backend' - FRONTEND_DIR = 'expensetracker-frontend' - } - stages { - stage('Clone') { - steps { - echo "Cloning repo..." - // Automatically cloned via SCM config - } - } - stage('Build Backend') { steps { - sh 'mvn clean install' - } + sh 'mvn clean install' } } stage('Build Frontend') { steps { - sh 'npm install' - sh 'ng build --prod' - } + sh 'npm install' + sh 'ng build --prod' } - + } - stage('Run Spring Boot App') { + stage('Run Spring Boot') { steps { - sh 'nohup java -jar target/*.jar &' - } + sh 'nohup java -jar target/*.jar &' } - + } stage('Health Check') { steps { script { - sleep(10) // wait for app to start + sleep(10) def response = sh(script: "curl -s -o /dev/null -w '%{http_code}' http://localhost:8080/api/v1/expenses", returnStdout: true).trim() if (response != '200') { error "Health check failed! Status code: ${response}" @@ -55,4 +40,5 @@ pipeline { } } } +} From 0f902939f3a00dfae4b1115a9be77901473cc7d9 Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Sun, 29 Jun 2025 23:39:38 +0200 Subject: [PATCH 04/56] Update da proradi Jenkinsfile --- Jenkinsfile | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 218bdb46..b4b55a6f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,3 +1,4 @@ + pipeline { agent any @@ -9,20 +10,26 @@ pipeline { stages { stage('Build Backend') { steps { - sh 'mvn clean install' + dir('angular9-springboot-expensetracker') { + sh 'mvn clean install' + } } } stage('Build Frontend') { steps { - sh 'npm install' - sh 'ng build --prod' + dir('angular9-springboot-expensetracker') { + sh 'npm install' + sh 'ng build --prod' + } } } stage('Run Spring Boot') { steps { - sh 'nohup java -jar target/*.jar &' + dir('angular9-springboot-expensetracker') { + sh 'nohup java -jar target/*.jar &' + } } } @@ -41,4 +48,3 @@ pipeline { } } } - From 6f0d9a08086e9baca458baff036b485ab33cafaf Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Sun, 29 Jun 2025 23:41:46 +0200 Subject: [PATCH 05/56] pomozi boze --- Jenkinsfile | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index b4b55a6f..68974cc7 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,4 +1,3 @@ - pipeline { agent any @@ -8,6 +7,15 @@ pipeline { } stages { + stage('Provera strukture') { + steps { + sh 'echo "SADRŽAJ ROOT-a:"' + sh 'ls -lah' + sh 'echo "PRONALAZAK pom.xml:"' + sh 'find . -name "pom.xml"' + } + } + stage('Build Backend') { steps { dir('angular9-springboot-expensetracker') { @@ -20,7 +28,7 @@ pipeline { steps { dir('angular9-springboot-expensetracker') { sh 'npm install' - sh 'ng build --prod' + sh 'npx ng build --prod' } } } @@ -48,3 +56,4 @@ pipeline { } } } + From 51121ab6c6e9a29974c96217f2a4050351f11014 Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Sun, 29 Jun 2025 23:46:37 +0200 Subject: [PATCH 06/56] proveraPonovo --- Jenkinsfile | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 68974cc7..bae3dc41 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,15 +7,16 @@ pipeline { } stages { - stage('Provera strukture') { + // Stage za proveru strukture direktorijuma + stage('Verifikacija direktorijuma') { steps { - sh 'echo "SADRŽAJ ROOT-a:"' - sh 'ls -lah' - sh 'echo "PRONALAZAK pom.xml:"' - sh 'find . -name "pom.xml"' + sh 'echo "Trenutni direktorijum:"' + sh 'pwd' + sh 'ls -l' } } + // Stage za build backend-a (Spring Boot) stage('Build Backend') { steps { dir('angular9-springboot-expensetracker') { @@ -24,15 +25,17 @@ pipeline { } } + // Stage za build frontend-a (Angular) stage('Build Frontend') { steps { dir('angular9-springboot-expensetracker') { sh 'npm install' - sh 'npx ng build --prod' + sh 'ng build --prod' } } } + // Stage za pokretanje Spring Boot aplikacije stage('Run Spring Boot') { steps { dir('angular9-springboot-expensetracker') { @@ -41,6 +44,7 @@ pipeline { } } + // Stage za health check aplikacije stage('Health Check') { steps { script { From 077907b7139c02d783b2b846d4f13de39104735f Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Sun, 29 Jun 2025 23:52:17 +0200 Subject: [PATCH 07/56] ajd --- Jenkinsfile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index bae3dc41..f85eaca7 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,7 +7,7 @@ pipeline { } stages { - // Stage za proveru strukture direktorijuma + // Stage za verifikaciju trenutnog direktorijuma stage('Verifikacija direktorijuma') { steps { sh 'echo "Trenutni direktorijum:"' @@ -19,7 +19,7 @@ pipeline { // Stage za build backend-a (Spring Boot) stage('Build Backend') { steps { - dir('angular9-springboot-expensetracker') { + dir('expensetracker') { // Ovdje je promenjeno u pravi folder sh 'mvn clean install' } } @@ -30,7 +30,7 @@ pipeline { steps { dir('angular9-springboot-expensetracker') { sh 'npm install' - sh 'ng build --prod' + sh 'npx ng build --prod' } } } @@ -38,7 +38,7 @@ pipeline { // Stage za pokretanje Spring Boot aplikacije stage('Run Spring Boot') { steps { - dir('angular9-springboot-expensetracker') { + dir('expensetracker') { // Ovdje je promenjeno u pravi folder sh 'nohup java -jar target/*.jar &' } } @@ -61,3 +61,4 @@ pipeline { } } + From 1825dcfaba55086a19999b1018f8a636094b2ee1 Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Sun, 29 Jun 2025 23:57:12 +0200 Subject: [PATCH 08/56] ajd1 --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index f85eaca7..3f6fa930 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,7 +20,7 @@ pipeline { stage('Build Backend') { steps { dir('expensetracker') { // Ovdje je promenjeno u pravi folder - sh 'mvn clean install' + sh 'mvn clean install' -Dmaven.compiler.arguments="--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED"' } } } From 4732d8fdd8de6d2983dc3913867d906f746784a8 Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Mon, 30 Jun 2025 00:08:51 +0200 Subject: [PATCH 09/56] Update pom.xml --- expensetracker/pom.xml | 146 ++++++++++++++++++++++++----------------- 1 file changed, 84 insertions(+), 62 deletions(-) diff --git a/expensetracker/pom.xml b/expensetracker/pom.xml index 77d004d0..5216114c 100644 --- a/expensetracker/pom.xml +++ b/expensetracker/pom.xml @@ -1,70 +1,92 @@ - 4.0.0 - - org.springframework.boot - spring-boot-starter-parent - 2.3.1.RELEASE - - - in.bushansirgur - expensetracker - v1 - expensetracker - Expense tracking application + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 + + + org.springframework.boot + spring-boot-starter-parent + 2.3.1.RELEASE + + + + in.bushansirgur + expensetracker + v1 + expensetracker + Expense tracking application - - 1.8 - 2.6 - + + 1.8 + 2.6 + - - - org.springframework.boot - spring-boot-starter-data-jpa - - - org.springframework.boot - spring-boot-starter-web - + + + org.springframework.boot + spring-boot-starter-data-jpa + + + org.springframework.boot + spring-boot-starter-web + - - org.springframework.boot - spring-boot-devtools - runtime - true - - - mysql - mysql-connector-java - runtime - - - org.projectlombok - lombok - true - - - org.springframework.boot - spring-boot-starter-test - test - - - org.junit.vintage - junit-vintage-engine - - - - + + org.springframework.boot + spring-boot-devtools + runtime + true + + + mysql + mysql-connector-java + runtime + - - - - org.springframework.boot - spring-boot-maven-plugin - - - + + + org.projectlombok + lombok + 1.18.38 + provided + + + + org.springframework.boot + spring-boot-starter-test + test + + + org.junit.vintage + junit-vintage-engine + + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + ${java.version} + ${java.version} + + + --add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED + + + + + + From c657fb58f29bde2ad96372b81e8dedab7faccbf5 Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Mon, 30 Jun 2025 00:10:30 +0200 Subject: [PATCH 10/56] pliz --- expensetracker/pom.xml | 108 +++++++---------------------------------- 1 file changed, 18 insertions(+), 90 deletions(-) diff --git a/expensetracker/pom.xml b/expensetracker/pom.xml index 5216114c..3690644d 100644 --- a/expensetracker/pom.xml +++ b/expensetracker/pom.xml @@ -1,92 +1,20 @@ - - - 4.0.0 - - - org.springframework.boot - spring-boot-starter-parent - 2.3.1.RELEASE - - - - in.bushansirgur - expensetracker - v1 - expensetracker - Expense tracking application - - - 1.8 - 2.6 - - - - - org.springframework.boot - spring-boot-starter-data-jpa - - + + + org.springframework.boot - spring-boot-starter-web - - - - org.springframework.boot - spring-boot-devtools - runtime - true - - - mysql - mysql-connector-java - runtime - - - - - org.projectlombok - lombok - 1.18.38 - provided - - - - org.springframework.boot - spring-boot-starter-test - test - - - org.junit.vintage - junit-vintage-engine - - - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.8.1 - - ${java.version} - ${java.version} - - - --add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED - - - - - - - + spring-boot-maven-plugin + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + ${java.version} + ${java.version} + + + + From 9f0a6c6d57abf59287dffab56311d6871e9887c4 Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Mon, 30 Jun 2025 00:12:13 +0200 Subject: [PATCH 11/56] ajde2 --- expensetracker/pom.xml | 104 ++++++++++++++++++++++++++++++++++------- 1 file changed, 86 insertions(+), 18 deletions(-) diff --git a/expensetracker/pom.xml b/expensetracker/pom.xml index 3690644d..865a7600 100644 --- a/expensetracker/pom.xml +++ b/expensetracker/pom.xml @@ -1,20 +1,88 @@ - - - + + + 4.0.0 + + + org.springframework.boot + spring-boot-starter-parent + 2.3.1.RELEASE + + + + in.bushansirgur + expensetracker + v1 + expensetracker + Expense tracking application + + + 1.8 + 2.6 + + + + + org.springframework.boot + spring-boot-starter-data-jpa + + org.springframework.boot - spring-boot-maven-plugin - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.8.1 - - ${java.version} - ${java.version} - - - - + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-devtools + runtime + true + + + mysql + mysql-connector-java + runtime + + + + + org.projectlombok + lombok + 1.18.38 + provided + + + + org.springframework.boot + spring-boot-starter-test + test + + + org.junit.vintage + junit-vintage-engine + + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + ${java.version} + ${java.version} + + + + + + From 3250ca4ed592f2ac3073940e28e6a9405f0f79e1 Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Mon, 30 Jun 2025 00:21:12 +0200 Subject: [PATCH 12/56] Update application.properties --- .../src/main/resources/application.properties | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/expensetracker/src/main/resources/application.properties b/expensetracker/src/main/resources/application.properties index 9be04a93..20fba801 100644 --- a/expensetracker/src/main/resources/application.properties +++ b/expensetracker/src/main/resources/application.properties @@ -1,5 +1,16 @@ -spring.datasource.url=jdbc:mysql://localhost:3306/expensetracker?useSSL=false +# Podaci za konekciju sa bazom podataka +spring.datasource.url=jdbc:mysql://localhost:3306/expensetracker?useSSL=false&serverTimezone=UTC spring.datasource.username=expensetracker spring.datasource.password=expensetracker +spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver -spring.jpa.generate-ddl=true \ No newline at end of file +# Hibernate Dialekt za MySQL +spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect # Za MySQL 8.x +# spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect # Za MySQL 5.x + +# Postavke za automatsko kreiranje/izmene DDL tabele (update, create, validate, none) +spring.jpa.hibernate.ddl-auto=update # Možeš koristiti: update, create, validate, none + +# Postavke za SQL logovanje (opciono, korisno za debugging) +spring.jpa.show-sql=true +spring.jpa.properties.hibernate.format_sql=true From c35ca9587ece6706fc5fe7514171d5ae26288f57 Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Mon, 30 Jun 2025 00:26:36 +0200 Subject: [PATCH 13/56] testovi --- expensetracker/pom.xml | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/expensetracker/pom.xml b/expensetracker/pom.xml index 865a7600..d88bae07 100644 --- a/expensetracker/pom.xml +++ b/expensetracker/pom.xml @@ -1,15 +1,16 @@ - 4.0.0 - + org.springframework.boot spring-boot-starter-parent 2.3.1.RELEASE - + in.bushansirgur expensetracker v1 @@ -42,15 +43,12 @@ mysql-connector-java runtime - - org.projectlombok lombok - 1.18.38 + 1.18.38 provided - org.springframework.boot spring-boot-starter-test @@ -67,22 +65,26 @@ - org.springframework.boot - spring-boot-maven-plugin + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 1.8 + 1.8 + - + org.apache.maven.plugins - maven-compiler-plugin - 3.8.1 + maven-surefire-plugin + 2.22.2 - ${java.version} - ${java.version} + true - + From 541540961284d56548f61bd0feae76890118edb7 Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Mon, 30 Jun 2025 00:28:30 +0200 Subject: [PATCH 14/56] frontend --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3f6fa930..43a4d08b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -28,7 +28,7 @@ pipeline { // Stage za build frontend-a (Angular) stage('Build Frontend') { steps { - dir('angular9-springboot-expensetracker') { + dir('expense-tracker-frontend') { sh 'npm install' sh 'npx ng build --prod' } From cf3265b345bd08c95ddb1f064b1784b8d48b3fdd Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Mon, 30 Jun 2025 00:37:40 +0200 Subject: [PATCH 15/56] pls pls pls --- Jenkinsfile | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 43a4d08b..3a1273af 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,7 +20,7 @@ pipeline { stage('Build Backend') { steps { dir('expensetracker') { // Ovdje je promenjeno u pravi folder - sh 'mvn clean install' -Dmaven.compiler.arguments="--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED"' + sh 'mvn clean install -Dmaven.compiler.arguments="--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED"' } } } @@ -48,12 +48,22 @@ pipeline { stage('Health Check') { steps { script { - sleep(10) - def response = sh(script: "curl -s -o /dev/null -w '%{http_code}' http://localhost:8080/api/v1/expenses", returnStdout: true).trim() - if (response != '200') { - error "Health check failed! Status code: ${response}" - } else { - echo "Backend is up and running!" + def retries = 10 + def success = false + while (retries > 0) { + def response = sh(script: "curl -s -o /dev/null -w '%{http_code}' http://localhost:8080/api/v1/expenses", returnStdout: true).trim() + if (response == '200') { + echo "Backend is up and running!" + success = true + break + } else { + retries-- + echo "Health check failed. Retrying... (${retries} attempts left)" + sleep(10) + } + } + if (!success) { + error "Health check failed after multiple attempts!" } } } @@ -62,3 +72,4 @@ pipeline { } + From 6d051bd952c82b81ef4a7f50406d6c610ee90c1f Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Mon, 30 Jun 2025 00:51:39 +0200 Subject: [PATCH 16/56] ajd ziv bio --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3a1273af..76d5afbe 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -28,7 +28,7 @@ pipeline { // Stage za build frontend-a (Angular) stage('Build Frontend') { steps { - dir('expense-tracker-frontend') { + dir('angular9-springboot-expensetracker/expense-tracker-frontend') { sh 'npm install' sh 'npx ng build --prod' } From e299f10e5cfa4b3b5718d5889e555dc28d810060 Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Mon, 30 Jun 2025 01:03:32 +0200 Subject: [PATCH 17/56] za spavanje --- Jenkinsfile | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 76d5afbe..94f46c9e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -19,7 +19,7 @@ pipeline { // Stage za build backend-a (Spring Boot) stage('Build Backend') { steps { - dir('expensetracker') { // Ovdje je promenjeno u pravi folder + dir('angular9-springboot-expensetracker/expensetracker') { // Putanja do backend direktorijuma sh 'mvn clean install -Dmaven.compiler.arguments="--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED"' } } @@ -28,9 +28,19 @@ pipeline { // Stage za build frontend-a (Angular) stage('Build Frontend') { steps { - dir('angular9-springboot-expensetracker/expense-tracker-frontend') { - sh 'npm install' - sh 'npx ng build --prod' + dir('angular9-springboot-expensetracker/expense-tracker-frontend') { // Putanja do frontend direktorijuma + sh 'npm install' // Instalira sve zavisnosti + sh 'npx ng build --prod' // Pravi produkcijsku verziju aplikacije + } + } + } + + // Stage za kopiranje generisanih fajlova na server ili folder + stage('Deploy Frontend') { + steps { + dir('angular9-springboot-expensetracker/expense-tracker-frontend/dist/expense-tracker-frontend') { // Putanja do dist direktorijuma + sh 'echo "Deploying Frontend to /path/to/deployment/folder"' + sh 'cp -r * /path/to/deployment/folder' // Kopira fajlove na odgovarajući folder ili server } } } @@ -38,7 +48,7 @@ pipeline { // Stage za pokretanje Spring Boot aplikacije stage('Run Spring Boot') { steps { - dir('expensetracker') { // Ovdje je promenjeno u pravi folder + dir('angular9-springboot-expensetracker/expensetracker') { // Putanja do backend direktorijuma sh 'nohup java -jar target/*.jar &' } } @@ -71,5 +81,3 @@ pipeline { } } - - From cc3d9233ad7504474abb85385408fac66cd7d832 Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Tue, 1 Jul 2025 01:06:43 +0200 Subject: [PATCH 18/56] port --- expensetracker/src/main/resources/application.properties | 2 ++ 1 file changed, 2 insertions(+) diff --git a/expensetracker/src/main/resources/application.properties b/expensetracker/src/main/resources/application.properties index 20fba801..0f26971f 100644 --- a/expensetracker/src/main/resources/application.properties +++ b/expensetracker/src/main/resources/application.properties @@ -1,3 +1,5 @@ +#Konfiguracija porta za aplikaciju +server.port=8081 # Podaci za konekciju sa bazom podataka spring.datasource.url=jdbc:mysql://localhost:3306/expensetracker?useSSL=false&serverTimezone=UTC spring.datasource.username=expensetracker From 7ecb5ae37c24f543de1322a5df0aef93481c8c4b Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Tue, 1 Jul 2025 01:07:21 +0200 Subject: [PATCH 19/56] port Jenkins --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 94f46c9e..4a7799bd 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -61,7 +61,7 @@ pipeline { def retries = 10 def success = false while (retries > 0) { - def response = sh(script: "curl -s -o /dev/null -w '%{http_code}' http://localhost:8080/api/v1/expenses", returnStdout: true).trim() + def response = sh(script: "curl -s -o /dev/null -w '%{http_code}' http://localhost:8081/api/v1/expenses", returnStdout: true).trim() if (response == '200') { echo "Backend is up and running!" success = true From 660db7bf160d5616a34ebdef30b38e853c1c1ebe Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Tue, 1 Jul 2025 01:24:34 +0200 Subject: [PATCH 20/56] pls --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 4a7799bd..2ab73493 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -19,7 +19,7 @@ pipeline { // Stage za build backend-a (Spring Boot) stage('Build Backend') { steps { - dir('angular9-springboot-expensetracker/expensetracker') { // Putanja do backend direktorijuma + dir('expensetracker') { // Putanja do backend direktorijuma sh 'mvn clean install -Dmaven.compiler.arguments="--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED"' } } @@ -28,7 +28,7 @@ pipeline { // Stage za build frontend-a (Angular) stage('Build Frontend') { steps { - dir('angular9-springboot-expensetracker/expense-tracker-frontend') { // Putanja do frontend direktorijuma + dir('expense-tracker-frontend') { // Putanja do frontend direktorijuma sh 'npm install' // Instalira sve zavisnosti sh 'npx ng build --prod' // Pravi produkcijsku verziju aplikacije } From 8eb14e1fe47c6947ad0300c7ea7ba5891ca80a1e Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Tue, 1 Jul 2025 01:35:51 +0200 Subject: [PATCH 21/56] lol --- Jenkinsfile | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2ab73493..43b5ea36 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -35,16 +35,7 @@ pipeline { } } - // Stage za kopiranje generisanih fajlova na server ili folder - stage('Deploy Frontend') { - steps { - dir('angular9-springboot-expensetracker/expense-tracker-frontend/dist/expense-tracker-frontend') { // Putanja do dist direktorijuma - sh 'echo "Deploying Frontend to /path/to/deployment/folder"' - sh 'cp -r * /path/to/deployment/folder' // Kopira fajlove na odgovarajući folder ili server - } - } - } - + // Stage za pokretanje Spring Boot aplikacije stage('Run Spring Boot') { steps { From 5f1c1734b9ebcfb6e61a247daeae40aefc86473d Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Tue, 1 Jul 2025 01:42:38 +0200 Subject: [PATCH 22/56] ajd plz --- Jenkinsfile | 59 ++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 40 insertions(+), 19 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 43b5ea36..3ff2998e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,45 +7,67 @@ pipeline { } stages { - // Stage za verifikaciju trenutnog direktorijuma + // ✅ Provera trenutnog direktorijuma stage('Verifikacija direktorijuma') { steps { - sh 'echo "Trenutni direktorijum:"' - sh 'pwd' - sh 'ls -l' + sh ''' + echo "Trenutni direktorijum:" + pwd + ls -la + ''' } } - // Stage za build backend-a (Spring Boot) + // ✅ Build backend (Spring Boot) stage('Build Backend') { steps { - dir('expensetracker') { // Putanja do backend direktorijuma - sh 'mvn clean install -Dmaven.compiler.arguments="--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED"' + dir('expensetracker') { + sh 'mvn clean install -Dmaven.test.skip=true' } } } - // Stage za build frontend-a (Angular) + // ✅ Build frontend (Angular) stage('Build Frontend') { steps { - dir('expense-tracker-frontend') { // Putanja do frontend direktorijuma - sh 'npm install' // Instalira sve zavisnosti - sh 'npx ng build --prod' // Pravi produkcijsku verziju aplikacije + dir('expense-tracker-frontend') { + sh ''' + npm install + npx ng build --prod + ''' } } } - - // Stage za pokretanje Spring Boot aplikacije + // ✅ Deploy frontend fajlova + stage('Deploy Frontend') { + steps { + dir('angular9-springboot-expensetracker/expense-tracker-frontend/dist/expense-tracker-frontend') { + sh ''' + echo "Deploying frontend to /var/www/html" + sudo mkdir -p /var/www/html + sudo cp -r ./* /var/www/html/ + ''' + } + } + } + + // ✅ Pokretanje backend aplikacije stage('Run Spring Boot') { steps { - dir('angular9-springboot-expensetracker/expensetracker') { // Putanja do backend direktorijuma - sh 'nohup java -jar target/*.jar &' + dir('angular9-springboot-expensetracker/expensetracker') { + sh ''' + echo "Zaustavljanje postojeće aplikacije ako postoji..." + pkill -f 'java.*expensetracker' || true + + echo "Pokretanje nove instance aplikacije na portu 8081" + nohup java -jar target/*.jar --server.port=8081 > springboot.log 2>&1 & + ''' } } } - // Stage za health check aplikacije + // ✅ Health check backend aplikacije stage('Health Check') { steps { script { @@ -54,7 +76,7 @@ pipeline { while (retries > 0) { def response = sh(script: "curl -s -o /dev/null -w '%{http_code}' http://localhost:8081/api/v1/expenses", returnStdout: true).trim() if (response == '200') { - echo "Backend is up and running!" + echo "✅ Backend is up and running!" success = true break } else { @@ -64,11 +86,10 @@ pipeline { } } if (!success) { - error "Health check failed after multiple attempts!" + error "❌ Health check failed after multiple attempts!" } } } } } } - From 46dbb881289f4355ae66ebe5b21a6d9f68f05402 Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Tue, 1 Jul 2025 01:45:40 +0200 Subject: [PATCH 23/56] nmg vise --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3ff2998e..81eb2343 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -45,8 +45,8 @@ pipeline { dir('angular9-springboot-expensetracker/expense-tracker-frontend/dist/expense-tracker-frontend') { sh ''' echo "Deploying frontend to /var/www/html" - sudo mkdir -p /var/www/html - sudo cp -r ./* /var/www/html/ + mkdir -p /var/www/html + cp -r ./* /var/www/html/ ''' } } From e0e6f1c32de8402d70ca297614c9d551cfc758a0 Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Tue, 1 Jul 2025 01:50:01 +0200 Subject: [PATCH 24/56] plizomgomg --- Jenkinsfile | 56 ++++++++++++++++++++++------------------------------- 1 file changed, 23 insertions(+), 33 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 81eb2343..0015e139 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,76 +7,66 @@ pipeline { } stages { - // ✅ Provera trenutnog direktorijuma + // Stage za verifikaciju trenutnog direktorijuma stage('Verifikacija direktorijuma') { steps { - sh ''' - echo "Trenutni direktorijum:" - pwd - ls -la - ''' + sh 'echo "Trenutni direktorijum:"' + sh 'pwd' + sh 'ls -l' } } - // ✅ Build backend (Spring Boot) + // Stage za build backend-a (Spring Boot) stage('Build Backend') { steps { - dir('expensetracker') { - sh 'mvn clean install -Dmaven.test.skip=true' + dir('expensetracker') { // Putanja do backend direktorijuma + sh 'mvn clean install -Dmaven.compiler.arguments="--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED"' } } } - // ✅ Build frontend (Angular) + // Stage za build frontend-a (Angular) stage('Build Frontend') { steps { - dir('expense-tracker-frontend') { - sh ''' - npm install - npx ng build --prod - ''' + dir('expense-tracker-frontend') { // Putanja do frontend direktorijuma + sh 'npm install' // Instalira sve zavisnosti + sh 'npx ng build --prod' // Pravi produkcijsku verziju aplikacije } } } - // ✅ Deploy frontend fajlova + // Stage za deploy frontend-a bez sudo stage('Deploy Frontend') { steps { - dir('angular9-springboot-expensetracker/expense-tracker-frontend/dist/expense-tracker-frontend') { + dir('angular9-springboot-expensetracker/expense-tracker-frontend/dist/expense-tracker-frontend') { // Putanja do generisanog dist direktorijuma sh ''' - echo "Deploying frontend to /var/www/html" - mkdir -p /var/www/html - cp -r ./* /var/www/html/ + echo "Deploying frontend to /home/jenkins/frontend-dist" + mkdir -p /home/jenkins/frontend-dist + cp -r ./* /home/jenkins/frontend-dist/ ''' } } } - // ✅ Pokretanje backend aplikacije + // Stage za pokretanje Spring Boot aplikacije stage('Run Spring Boot') { steps { - dir('angular9-springboot-expensetracker/expensetracker') { - sh ''' - echo "Zaustavljanje postojeće aplikacije ako postoji..." - pkill -f 'java.*expensetracker' || true - - echo "Pokretanje nove instance aplikacije na portu 8081" - nohup java -jar target/*.jar --server.port=8081 > springboot.log 2>&1 & - ''' + dir('angular9-springboot-expensetracker/expensetracker') { // Putanja do backend direktorijuma + sh 'nohup java -jar target/*.jar &' } } } - // ✅ Health check backend aplikacije + // Stage za health check aplikacije stage('Health Check') { steps { script { def retries = 10 def success = false while (retries > 0) { - def response = sh(script: "curl -s -o /dev/null -w '%{http_code}' http://localhost:8081/api/v1/expenses", returnStdout: true).trim() + def response = sh(script: "curl -s -o /dev/null -w '%{http_code}' http://localhost:8080/api/v1/expenses", returnStdout: true).trim() if (response == '200') { - echo "✅ Backend is up and running!" + echo "Backend is up and running!" success = true break } else { @@ -86,7 +76,7 @@ pipeline { } } if (!success) { - error "❌ Health check failed after multiple attempts!" + error "Health check failed after multiple attempts!" } } } From b4bf01e515c890fa04cd4a33907fe78032975b90 Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Tue, 1 Jul 2025 01:53:04 +0200 Subject: [PATCH 25/56] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0015e139..41d585ea 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -41,7 +41,7 @@ pipeline { dir('angular9-springboot-expensetracker/expense-tracker-frontend/dist/expense-tracker-frontend') { // Putanja do generisanog dist direktorijuma sh ''' echo "Deploying frontend to /home/jenkins/frontend-dist" - mkdir -p /home/jenkins/frontend-dist + sudo mkdir -p /home/jenkins/frontend-dist cp -r ./* /home/jenkins/frontend-dist/ ''' } From 50e32cd5b64085ef31703ef944d7ba9caa4d3064 Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Wed, 2 Jul 2025 14:50:45 +0200 Subject: [PATCH 26/56] Create JenkinsProba --- JenkinsProba | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 JenkinsProba diff --git a/JenkinsProba b/JenkinsProba new file mode 100644 index 00000000..4816333d --- /dev/null +++ b/JenkinsProba @@ -0,0 +1,80 @@ +pipeline { + agent any + + environment { + BACKEND_DIR = "backend" + FRONTEND_DIR = "frontend" + JAR_NAME = "expensetracker-0.0.1-SNAPSHOT.jar" + FRONTEND_DEPLOY_PATH = "/home/jenkins/frontend-dist" + BACKEND_PORT = "9090" + } + + stages { + stage('Clone Repo') { + steps { + git branch: 'patch-1', url: 'https://github.com/phk01-afk/angular9-springboot-expensetracker.git' + } + } + + stage('Build Backend') { + steps { + dir("${BACKEND_DIR}") { + sh 'mvn clean install -DskipTests' + } + } + } + + stage('Build Frontend') { + steps { + dir("${FRONTEND_DIR}") { + sh 'npm install' + sh 'ng build --prod' + } + } + } + + stage('Deploy Backend') { + steps { + script { + // kill old process if running + sh "pkill -f '${JAR_NAME}' || true" + // run with custom port + sh """ + nohup java -jar ${BACKEND_DIR}/target/${JAR_NAME} \ + --server.port=${BACKEND_PORT} > backend.log 2>&1 & + """ + } + } + } + + stage('Deploy Frontend') { + steps { + script { + def distDir = "${FRONTEND_DIR}/dist/frontend" + def targetDir = "${FRONTEND_DEPLOY_PATH}" + sh "mkdir -p ${targetDir}" + sh "rm -rf ${targetDir}/*" + sh "cp -r ${distDir}/* ${targetDir}/" + } + } + } + + stage('Health Check') { + steps { + script { + sleep 10 + sh "curl -f http://localhost:${BACKEND_PORT}/api/v1/expenses || exit 1" + } + } + } + } + + post { + success { + echo "✅ Deployment successful on port ${BACKEND_PORT}!" + } + failure { + echo "❌ Deployment failed!" + } + } +} From c2a26845526019b6ad63c8f73e76ebad4543e467 Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Wed, 2 Jul 2025 14:56:42 +0200 Subject: [PATCH 27/56] Update JenkinsProba1 --- JenkinsProba | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/JenkinsProba b/JenkinsProba index 4816333d..c1d7ed5a 100644 --- a/JenkinsProba +++ b/JenkinsProba @@ -2,11 +2,10 @@ pipeline { agent any environment { - BACKEND_DIR = "backend" - FRONTEND_DIR = "frontend" + BACKEND_DIR = "expense-tracker" // ispravljeno! + FRONTEND_DIR = "expense-tracker-frontend" // ispravljeno! JAR_NAME = "expensetracker-0.0.1-SNAPSHOT.jar" - FRONTEND_DEPLOY_PATH = "/home/jenkins/frontend-dist" - BACKEND_PORT = "9090" + BACKEND_PORT = "9091" } stages { @@ -33,12 +32,10 @@ pipeline { } } - stage('Deploy Backend') { + stage('Run Backend') { steps { script { - // kill old process if running sh "pkill -f '${JAR_NAME}' || true" - // run with custom port sh """ nohup java -jar ${BACKEND_DIR}/target/${JAR_NAME} \ --server.port=${BACKEND_PORT} > backend.log 2>&1 & @@ -47,14 +44,10 @@ pipeline { } } - stage('Deploy Frontend') { + stage('Run Frontend (Dev Server)') { steps { - script { - def distDir = "${FRONTEND_DIR}/dist/frontend" - def targetDir = "${FRONTEND_DEPLOY_PATH}" - sh "mkdir -p ${targetDir}" - sh "rm -rf ${targetDir}/*" - sh "cp -r ${distDir}/* ${targetDir}/" + dir("${FRONTEND_DIR}") { + sh 'nohup npm run start -- --port 4200 > frontend.log 2>&1 &' } } } @@ -62,8 +55,12 @@ pipeline { stage('Health Check') { steps { script { - sleep 10 + sleep 15 + echo "Testing backend on http://localhost:${BACKEND_PORT}/api/v1/expenses" sh "curl -f http://localhost:${BACKEND_PORT}/api/v1/expenses || exit 1" + + echo "Testing frontend on http://localhost:4200" + sh "curl -f http://localhost:4200 || exit 1" } } } @@ -71,10 +68,10 @@ pipeline { post { success { - echo "✅ Deployment successful on port ${BACKEND_PORT}!" + echo "✅ Backend is running on port ${BACKEND_PORT}, frontend on port 4200" } failure { - echo "❌ Deployment failed!" + echo "❌ Pipeline failed. Check backend.log or frontend.log for details." } } } From 46a0cb0161aba5cd6cf9edaafcbfced2cbbe26c0 Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Wed, 2 Jul 2025 15:01:48 +0200 Subject: [PATCH 28/56] Update JenkinsProba2 --- JenkinsProba | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/JenkinsProba b/JenkinsProba index c1d7ed5a..d1eaab09 100644 --- a/JenkinsProba +++ b/JenkinsProba @@ -1,6 +1,13 @@ pipeline { agent any + +tools { + maven 'Maven 3' // ovo si dodao u Global Tool Configuration + nodejs 'Node 12' // NodeJS koji si tamo dodao + } + + environment { BACKEND_DIR = "expense-tracker" // ispravljeno! FRONTEND_DIR = "expense-tracker-frontend" // ispravljeno! From e6b042f792add50b74a0a6777d21ffb8770c2466 Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Wed, 2 Jul 2025 15:04:28 +0200 Subject: [PATCH 29/56] Update JenkinsProba4 --- JenkinsProba | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/JenkinsProba b/JenkinsProba index d1eaab09..34577861 100644 --- a/JenkinsProba +++ b/JenkinsProba @@ -8,12 +8,6 @@ tools { } - environment { - BACKEND_DIR = "expense-tracker" // ispravljeno! - FRONTEND_DIR = "expense-tracker-frontend" // ispravljeno! - JAR_NAME = "expensetracker-0.0.1-SNAPSHOT.jar" - BACKEND_PORT = "9091" - } stages { stage('Clone Repo') { @@ -24,7 +18,7 @@ tools { stage('Build Backend') { steps { - dir("${BACKEND_DIR}") { + dir("expensetracker") { sh 'mvn clean install -DskipTests' } } @@ -32,7 +26,7 @@ tools { stage('Build Frontend') { steps { - dir("${FRONTEND_DIR}") { + dir("expense-tracker-fronted") { sh 'npm install' sh 'ng build --prod' } From de30962be7bf211b6c0168af87ffbb370569a081 Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Wed, 2 Jul 2025 15:06:05 +0200 Subject: [PATCH 30/56] Update JenkinsProba5 --- JenkinsProba | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/JenkinsProba b/JenkinsProba index 34577861..8e0b4185 100644 --- a/JenkinsProba +++ b/JenkinsProba @@ -18,7 +18,7 @@ tools { stage('Build Backend') { steps { - dir("expensetracker") { + dir('expensetracker') { sh 'mvn clean install -DskipTests' } } @@ -26,7 +26,7 @@ tools { stage('Build Frontend') { steps { - dir("expense-tracker-fronted") { + dir('expense-tracker-fronten') { sh 'npm install' sh 'ng build --prod' } From 1e4dfc468743658d115aa5d1b3562e98b737ac33 Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Wed, 2 Jul 2025 15:33:22 +0200 Subject: [PATCH 31/56] Update Jenkinsfile --- Jenkinsfile | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 41d585ea..78c91bfc 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,7 +7,6 @@ pipeline { } stages { - // Stage za verifikaciju trenutnog direktorijuma stage('Verifikacija direktorijuma') { steps { sh 'echo "Trenutni direktorijum:"' @@ -16,48 +15,53 @@ pipeline { } } - // Stage za build backend-a (Spring Boot) stage('Build Backend') { steps { - dir('expensetracker') { // Putanja do backend direktorijuma - sh 'mvn clean install -Dmaven.compiler.arguments="--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED"' + dir('expensetracker') { + sh 'mvn clean install -Dmaven.test.skip=true -Dmaven.compiler.arguments="--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED"' } } } - // Stage za build frontend-a (Angular) stage('Build Frontend') { steps { - dir('expense-tracker-frontend') { // Putanja do frontend direktorijuma - sh 'npm install' // Instalira sve zavisnosti - sh 'npx ng build --prod' // Pravi produkcijsku verziju aplikacije + dir('expense-tracker-frontend') { + sh 'npm install' + sh 'npx ng build --prod' } } } - // Stage za deploy frontend-a bez sudo - stage('Deploy Frontend') { + stage('Run Spring Boot') { steps { - dir('angular9-springboot-expensetracker/expense-tracker-frontend/dist/expense-tracker-frontend') { // Putanja do generisanog dist direktorijuma + script { sh ''' - echo "Deploying frontend to /home/jenkins/frontend-dist" - sudo mkdir -p /home/jenkins/frontend-dist - cp -r ./* /home/jenkins/frontend-dist/ + echo "Zaustavljam prethodnu instancu backend-a (ako postoji)..." + pkill -f 'java -jar' || true + + echo "Pokrećem backend..." + cd expensetracker + nohup java -jar target/*.jar > ../../backend.log 2>&1 & ''' } } } - // Stage za pokretanje Spring Boot aplikacije - stage('Run Spring Boot') { + stage('Run Angular Frontend') { steps { - dir('angular9-springboot-expensetracker/expensetracker') { // Putanja do backend direktorijuma - sh 'nohup java -jar target/*.jar &' + script { + sh ''' + echo "Zaustavljam prethodni ng serve (ako postoji)..." + pkill -f 'ng serve' || true + + echo "Pokrećem Angular frontend..." + cd expense-tracker-frontend + nohup npx ng serve --port 4200 --host 0.0.0.0 > ../../frontend.log 2>&1 & + ''' } } } - // Stage za health check aplikacije stage('Health Check') { steps { script { From 60c985fc78ff2e6fcd7fc2d9d75a9db14a735853 Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Wed, 2 Jul 2025 15:37:23 +0200 Subject: [PATCH 32/56] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 78c91bfc..08bb9f47 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -27,7 +27,7 @@ pipeline { steps { dir('expense-tracker-frontend') { sh 'npm install' - sh 'npx ng build --prod' + sh 'ng serve --open' } } } From d4a264785d6fa278efcd05af5021e81c63756c17 Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Wed, 2 Jul 2025 15:39:58 +0200 Subject: [PATCH 33/56] Update Jenkinsfile --- Jenkinsfile | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 08bb9f47..1c6286cf 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -47,20 +47,7 @@ pipeline { } } - stage('Run Angular Frontend') { - steps { - script { - sh ''' - echo "Zaustavljam prethodni ng serve (ako postoji)..." - pkill -f 'ng serve' || true - - echo "Pokrećem Angular frontend..." - cd expense-tracker-frontend - nohup npx ng serve --port 4200 --host 0.0.0.0 > ../../frontend.log 2>&1 & - ''' - } - } - } + stage('Health Check') { steps { From ccd0f8523549476f641909ae3e96ef1cb9484ef0 Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Wed, 2 Jul 2025 15:45:24 +0200 Subject: [PATCH 34/56] Update Jenkinsfile --- Jenkinsfile | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 1c6286cf..ed2ce5f9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,6 +7,7 @@ pipeline { } stages { + stage('Verifikacija direktorijuma') { steps { sh 'echo "Trenutni direktorijum:"' @@ -18,7 +19,7 @@ pipeline { stage('Build Backend') { steps { dir('expensetracker') { - sh 'mvn clean install -Dmaven.test.skip=true -Dmaven.compiler.arguments="--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED"' + sh 'mvn clean install -Dmaven.compiler.arguments="--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED" -DskipTests' } } } @@ -27,27 +28,26 @@ pipeline { steps { dir('expense-tracker-frontend') { sh 'npm install' - sh 'ng serve --open' + sh 'npx ng build --prod' } } } - stage('Run Spring Boot') { + stage('Run Backend') { steps { - script { - sh ''' - echo "Zaustavljam prethodnu instancu backend-a (ako postoji)..." - pkill -f 'java -jar' || true - - echo "Pokrećem backend..." - cd expensetracker - nohup java -jar target/*.jar > ../../backend.log 2>&1 & - ''' + dir('expensetracker') { + sh 'nohup java -jar target/*.jar &' } } } - + stage('Run Frontend') { + steps { + dir('expense-tracker-frontend') { + sh 'nohup npx ng serve --port 4200 --host 0.0.0.0 &' + } + } + } stage('Health Check') { steps { From 6562bd2d87cca926caad891bb13c4a868f5683d7 Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Wed, 2 Jul 2025 15:49:41 +0200 Subject: [PATCH 35/56] Update Jenkinsfile --- Jenkinsfile | 46 ++++++++++++++++++++-------------------------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index ed2ce5f9..02409f52 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,7 +7,6 @@ pipeline { } stages { - stage('Verifikacija direktorijuma') { steps { sh 'echo "Trenutni direktorijum:"' @@ -19,37 +18,21 @@ pipeline { stage('Build Backend') { steps { dir('expensetracker') { - sh 'mvn clean install -Dmaven.compiler.arguments="--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED" -DskipTests' + sh 'mvn clean install -Dmaven.test.skip=true -Dmaven.compiler.arguments="--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED"' } } } - stage('Build Frontend') { - steps { - dir('expense-tracker-frontend') { - sh 'npm install' - sh 'npx ng build --prod' - } - } - } - - stage('Run Backend') { + stage('Run Spring Boot') { steps { dir('expensetracker') { - sh 'nohup java -jar target/*.jar &' - } - } - } - - stage('Run Frontend') { - steps { - dir('expense-tracker-frontend') { - sh 'nohup npx ng serve --port 4200 --host 0.0.0.0 &' + sh 'pkill -f "java -jar" || true' + sh 'nohup java -jar target/*.jar > backend.log 2>&1 &' } } } - stage('Health Check') { + stage('Health Check Backend') { steps { script { def retries = 10 @@ -57,20 +40,31 @@ pipeline { while (retries > 0) { def response = sh(script: "curl -s -o /dev/null -w '%{http_code}' http://localhost:8080/api/v1/expenses", returnStdout: true).trim() if (response == '200') { - echo "Backend is up and running!" + echo "✅ Backend is up and running!" success = true break } else { retries-- - echo "Health check failed. Retrying... (${retries} attempts left)" - sleep(10) + echo "⏳ Backend check failed. Retrying... (${retries} left)" + sleep(5) } } if (!success) { - error "Health check failed after multiple attempts!" + error "❌ Backend health check failed after multiple attempts!" } } } } + + stage('Build & Serve Frontend') { + steps { + dir('expense-tracker-frontend') { + sh 'npm install' + sh 'pkill -f "ng serve" || true' + sh 'nohup npx ng serve --host 0.0.0.0 --port 4200 > frontend.log 2>&1 &' + } + } + } } } + From b0f79d2789acc3e4794210e995a1bafd4db5ddb6 Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Sun, 13 Jul 2025 22:39:38 +0200 Subject: [PATCH 36/56] ajd sad --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 02409f52..7993fc4d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -38,7 +38,7 @@ pipeline { def retries = 10 def success = false while (retries > 0) { - def response = sh(script: "curl -s -o /dev/null -w '%{http_code}' http://localhost:8080/api/v1/expenses", returnStdout: true).trim() + def response = sh(script: "curl -s -o /dev/null -w '%{http_code}' http://localhost:8081/api/v1/expenses", returnStdout: true).trim() if (response == '200') { echo "✅ Backend is up and running!" success = true From 384d5af6a9e7f9c824773ca34efbc52e4540b269 Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Sun, 13 Jul 2025 23:18:21 +0200 Subject: [PATCH 37/56] Update Jenkinsfile --- Jenkinsfile | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 7993fc4d..b3466e5d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -23,14 +23,22 @@ pipeline { } } - stage('Run Spring Boot') { - steps { - dir('expensetracker') { - sh 'pkill -f "java -jar" || true' - sh 'nohup java -jar target/*.jar > backend.log 2>&1 &' - } - } + stage('Run Spring Boot') { + steps { + dir('angular9-springboot-expensetracker/expensetracker') { + sh ''' + echo "✔ Provera .jar fajla:" + ls -l target/*.jar || { echo "❌ JAR fajl nije pronađen!"; exit 1; } + + echo "⚙️ Pokretanje Spring Boot aplikacije..." + pkill -f 'expensetracker-v1.jar' || true # Zaustavi prethodnu instancu ako postoji + nohup java -jar target/expensetracker-v1.jar > backend.log 2>&1 & + echo "✅ Backend pokrenut!" + ''' } + } +} + stage('Health Check Backend') { steps { From fe956ae1e7bfd5a95922e2992af218ebf19dd572 Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Sun, 13 Jul 2025 23:21:37 +0200 Subject: [PATCH 38/56] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index b3466e5d..5d7f8b86 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -25,7 +25,7 @@ pipeline { stage('Run Spring Boot') { steps { - dir('angular9-springboot-expensetracker/expensetracker') { + dir('expensetracker') { sh ''' echo "✔ Provera .jar fajla:" ls -l target/*.jar || { echo "❌ JAR fajl nije pronađen!"; exit 1; } From 9554d7a77bed6b05f3872b90dc38f2f3a75add7b Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Sun, 13 Jul 2025 23:23:38 +0200 Subject: [PATCH 39/56] Update Jenkinsfile --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile b/Jenkinsfile index 5d7f8b86..15d717ed 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -33,6 +33,7 @@ pipeline { echo "⚙️ Pokretanje Spring Boot aplikacije..." pkill -f 'expensetracker-v1.jar' || true # Zaustavi prethodnu instancu ako postoji nohup java -jar target/expensetracker-v1.jar > backend.log 2>&1 & + ps aux | grep 'expensetracker-v1.jar' echo "✅ Backend pokrenut!" ''' } From 4ad7882d595e7ba030653c9a4aeb3aca63008d5a Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Sun, 13 Jul 2025 23:27:32 +0200 Subject: [PATCH 40/56] Update Jenkinsfile --- Jenkinsfile | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 15d717ed..4494f2ae 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -23,7 +23,7 @@ pipeline { } } - stage('Run Spring Boot') { +stage('Run Spring Boot') { steps { dir('expensetracker') { sh ''' @@ -33,14 +33,35 @@ pipeline { echo "⚙️ Pokretanje Spring Boot aplikacije..." pkill -f 'expensetracker-v1.jar' || true # Zaustavi prethodnu instancu ako postoji nohup java -jar target/expensetracker-v1.jar > backend.log 2>&1 & - ps aux | grep 'expensetracker-v1.jar' - echo "✅ Backend pokrenut!" + + # Daje aplikaciji vreme da se pokrene + sleep 10 + + # Provera da li je backend aplikacija dostupna na portu 8081 + retries=5 + while [ $retries -gt 0 ]; do + response=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:8081/api/v1/expenses) + if [ "$response" -eq 200 ]; then + echo "✅ Backend is up and running!" + break + else + retries=$((retries - 1)) + echo "❌ Backend not available. Retrying... ($retries attempts left)" + sleep 10 + fi + done + + if [ $retries -eq 0 ]; then + echo "❌ Backend failed to start. Please check the logs for more details." + exit 1 + fi ''' } } } + stage('Health Check Backend') { steps { script { From 8f4bae58c45474c5ccffc181843de5b715a2869a Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Sun, 13 Jul 2025 23:37:12 +0200 Subject: [PATCH 41/56] Update application.properties --- expensetracker/src/main/resources/application.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/expensetracker/src/main/resources/application.properties b/expensetracker/src/main/resources/application.properties index 0f26971f..98f32f13 100644 --- a/expensetracker/src/main/resources/application.properties +++ b/expensetracker/src/main/resources/application.properties @@ -1,5 +1,5 @@ #Konfiguracija porta za aplikaciju -server.port=8081 +server.port=9091 # Podaci za konekciju sa bazom podataka spring.datasource.url=jdbc:mysql://localhost:3306/expensetracker?useSSL=false&serverTimezone=UTC spring.datasource.username=expensetracker From 3ba857f7d649e6d6909a1938f18d1c8654619cd7 Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Sun, 13 Jul 2025 23:41:03 +0200 Subject: [PATCH 42/56] Update Jenkinsfile --- Jenkinsfile | 67 +++++++++++++++++++++++++---------------------------- 1 file changed, 32 insertions(+), 35 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 4494f2ae..66d90099 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,7 +9,7 @@ pipeline { stages { stage('Verifikacija direktorijuma') { steps { - sh 'echo "Trenutni direktorijum:"' + sh 'echo "📁 Trenutni direktorijum:"' sh 'pwd' sh 'ls -l' } @@ -23,44 +23,40 @@ pipeline { } } -stage('Run Spring Boot') { - steps { - dir('expensetracker') { - sh ''' - echo "✔ Provera .jar fajla:" - ls -l target/*.jar || { echo "❌ JAR fajl nije pronađen!"; exit 1; } - - echo "⚙️ Pokretanje Spring Boot aplikacije..." - pkill -f 'expensetracker-v1.jar' || true # Zaustavi prethodnu instancu ako postoji - nohup java -jar target/expensetracker-v1.jar > backend.log 2>&1 & + stage('Run Spring Boot') { + steps { + dir('expensetracker') { + sh ''' + echo "✔ Provera .jar fajla:" + ls -l target/*.jar || { echo "❌ JAR fajl nije pronađen!"; exit 1; } - # Daje aplikaciji vreme da se pokrene - sleep 10 + echo "⚙️ Pokretanje Spring Boot aplikacije..." + pkill -f 'expensetracker-v1.jar' || true + nohup java -jar target/expensetracker-v1.jar > backend.log 2>&1 & - # Provera da li je backend aplikacija dostupna na portu 8081 - retries=5 - while [ $retries -gt 0 ]; do - response=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:8081/api/v1/expenses) - if [ "$response" -eq 200 ]; then - echo "✅ Backend is up and running!" - break - else - retries=$((retries - 1)) - echo "❌ Backend not available. Retrying... ($retries attempts left)" sleep 10 - fi - done - - if [ $retries -eq 0 ]; then - echo "❌ Backend failed to start. Please check the logs for more details." - exit 1 - fi - ''' - } - } -} + retries=5 + while [ $retries -gt 0 ]; do + response=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:9091/api/v1/expenses) + if [ "$response" -eq 200 ]; then + echo "✅ Backend is up and running!" + break + else + retries=$((retries - 1)) + echo "⏳ Backend not available. Retrying... ($retries attempts left)" + sleep 10 + fi + done + if [ $retries -eq 0 ]; then + echo "❌ Backend failed to start. Please check the logs for more details." + exit 1 + fi + ''' + } + } + } stage('Health Check Backend') { steps { @@ -68,7 +64,7 @@ stage('Run Spring Boot') { def retries = 10 def success = false while (retries > 0) { - def response = sh(script: "curl -s -o /dev/null -w '%{http_code}' http://localhost:8081/api/v1/expenses", returnStdout: true).trim() + def response = sh(script: "curl -s -o /dev/null -w '%{http_code}' http://localhost:9091/api/v1/expenses", returnStdout: true).trim() if (response == '200') { echo "✅ Backend is up and running!" success = true @@ -98,3 +94,4 @@ stage('Run Spring Boot') { } } + From 6e11b75bcfe1131addecd72c9fafa756da37df42 Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Sun, 13 Jul 2025 23:48:22 +0200 Subject: [PATCH 43/56] Update Jenkinsfile --- Jenkinsfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 66d90099..9bb7b71e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -34,7 +34,8 @@ pipeline { pkill -f 'expensetracker-v1.jar' || true nohup java -jar target/expensetracker-v1.jar > backend.log 2>&1 & - sleep 10 + echo "⏳ Čekam da backend startuje..." + sleep 25 retries=5 while [ $retries -gt 0 ]; do From 7ada5af0d11e4d7a97c764bd0d764201cf285640 Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Sun, 13 Jul 2025 23:55:07 +0200 Subject: [PATCH 44/56] Update Jenkinsfile --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9bb7b71e..24b919c1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -39,7 +39,7 @@ pipeline { retries=5 while [ $retries -gt 0 ]; do - response=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:9091/api/v1/expenses) + response=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:8080/api/v1/expenses) if [ "$response" -eq 200 ]; then echo "✅ Backend is up and running!" break @@ -65,7 +65,7 @@ pipeline { def retries = 10 def success = false while (retries > 0) { - def response = sh(script: "curl -s -o /dev/null -w '%{http_code}' http://localhost:9091/api/v1/expenses", returnStdout: true).trim() + def response = sh(script: "curl -s -o /dev/null -w '%{http_code}' http://localhost:8080/api/v1/expenses", returnStdout: true).trim() if (response == '200') { echo "✅ Backend is up and running!" success = true From 8fa6baf6a75c142ec12008935b528de0049e78be Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Sun, 13 Jul 2025 23:59:16 +0200 Subject: [PATCH 45/56] Update application.properties --- expensetracker/src/main/resources/application.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/expensetracker/src/main/resources/application.properties b/expensetracker/src/main/resources/application.properties index 98f32f13..75ba19a0 100644 --- a/expensetracker/src/main/resources/application.properties +++ b/expensetracker/src/main/resources/application.properties @@ -1,5 +1,5 @@ #Konfiguracija porta za aplikaciju -server.port=9091 +server.port=8080 # Podaci za konekciju sa bazom podataka spring.datasource.url=jdbc:mysql://localhost:3306/expensetracker?useSSL=false&serverTimezone=UTC spring.datasource.username=expensetracker From ce131b6e82362e10787811cc65b4fa1a7f7f10c8 Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Mon, 14 Jul 2025 23:19:41 +0200 Subject: [PATCH 46/56] pls2323 --- Jenkinsfile | 44 ++++++++++++++------------------------------ 1 file changed, 14 insertions(+), 30 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 24b919c1..5f0b8590 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,17 +7,20 @@ pipeline { } stages { - stage('Verifikacija direktorijuma') { + + stage('Kloniraj Repozitorijum') { steps { - sh 'echo "📁 Trenutni direktorijum:"' - sh 'pwd' - sh 'ls -l' + echo "📥 Kloniram GitHub repozitorijum..." + dir('angular9-springboot-expensetracker') { + deleteDir() + } + git url: 'https://github.com/phk01-afk/angular9-springboot-expensetracker.git', branch: 'patch-1' } } stage('Build Backend') { steps { - dir('expensetracker') { + dir('angular9-springboot-expensetracker/expensetracker') { sh 'mvn clean install -Dmaven.test.skip=true -Dmaven.compiler.arguments="--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED"' } } @@ -25,7 +28,7 @@ pipeline { stage('Run Spring Boot') { steps { - dir('expensetracker') { + dir('angular9-springboot-expensetracker/expensetracker') { sh ''' echo "✔ Provera .jar fajla:" ls -l target/*.jar || { echo "❌ JAR fajl nije pronađen!"; exit 1; } @@ -36,24 +39,6 @@ pipeline { echo "⏳ Čekam da backend startuje..." sleep 25 - - retries=5 - while [ $retries -gt 0 ]; do - response=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:8080/api/v1/expenses) - if [ "$response" -eq 200 ]; then - echo "✅ Backend is up and running!" - break - else - retries=$((retries - 1)) - echo "⏳ Backend not available. Retrying... ($retries attempts left)" - sleep 10 - fi - done - - if [ $retries -eq 0 ]; then - echo "❌ Backend failed to start. Please check the logs for more details." - exit 1 - fi ''' } } @@ -62,7 +47,7 @@ pipeline { stage('Health Check Backend') { steps { script { - def retries = 10 + def retries = 5 def success = false while (retries > 0) { def response = sh(script: "curl -s -o /dev/null -w '%{http_code}' http://localhost:8080/api/v1/expenses", returnStdout: true).trim() @@ -72,12 +57,12 @@ pipeline { break } else { retries-- - echo "⏳ Backend check failed. Retrying... (${retries} left)" - sleep(5) + echo "⏳ Backend nije spreman. Pokušavam ponovo... (${retries} pokušaja ostalo)" + sleep(10) } } if (!success) { - error "❌ Backend health check failed after multiple attempts!" + error "❌ Backend health check nije uspeo nakon više pokušaja!" } } } @@ -85,7 +70,7 @@ pipeline { stage('Build & Serve Frontend') { steps { - dir('expense-tracker-frontend') { + dir('angular9-springboot-expensetracker/expense-tracker-frontend') { sh 'npm install' sh 'pkill -f "ng serve" || true' sh 'nohup npx ng serve --host 0.0.0.0 --port 4200 > frontend.log 2>&1 &' @@ -95,4 +80,3 @@ pipeline { } } - From d6cc35a6023f93dfe8b0e4bdad7cba81747a9c2c Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Mon, 14 Jul 2025 23:26:14 +0200 Subject: [PATCH 47/56] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 5f0b8590..2aef9d3e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,7 +20,7 @@ pipeline { stage('Build Backend') { steps { - dir('angular9-springboot-expensetracker/expensetracker') { + dir('expensetracker') { sh 'mvn clean install -Dmaven.test.skip=true -Dmaven.compiler.arguments="--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED"' } } From 17728361876e981abef41e0c8ac6159a1d7fbe7b Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Mon, 14 Jul 2025 23:28:36 +0200 Subject: [PATCH 48/56] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2aef9d3e..ccaafee1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -28,7 +28,7 @@ pipeline { stage('Run Spring Boot') { steps { - dir('angular9-springboot-expensetracker/expensetracker') { + dir('expensetracker') { sh ''' echo "✔ Provera .jar fajla:" ls -l target/*.jar || { echo "❌ JAR fajl nije pronađen!"; exit 1; } From b64f55f8692d991bf62e5ba35649e7aa58e6dcf9 Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Tue, 15 Jul 2025 00:08:07 +0200 Subject: [PATCH 49/56] proba --- Jenkinsfile | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index ccaafee1..a266628d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -44,6 +44,20 @@ pipeline { } } + + + stage('Build & Serve Frontend') { + steps { + dir('angular9-springboot-expensetracker/expense-tracker-frontend') { + sh 'npm install' + sh 'pkill -f "ng serve" || true' + sh 'nohup npx ng serve --host 0.0.0.0 --port 4200 > frontend.log 2>&1 &' + } + } + } + } +} + stage('Health Check Backend') { steps { script { @@ -68,15 +82,5 @@ pipeline { } } - stage('Build & Serve Frontend') { - steps { - dir('angular9-springboot-expensetracker/expense-tracker-frontend') { - sh 'npm install' - sh 'pkill -f "ng serve" || true' - sh 'nohup npx ng serve --host 0.0.0.0 --port 4200 > frontend.log 2>&1 &' - } - } - } - } -} - + + From dd94bd703f67a74536ae961f2fa94295ffae7795 Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Tue, 15 Jul 2025 00:11:40 +0200 Subject: [PATCH 50/56] ajd1212 --- Jenkinsfile | 61 ++++++++++++++++++++++++++++++++--------------------- 1 file changed, 37 insertions(+), 24 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index a266628d..9f1f98b5 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,14 +7,11 @@ pipeline { } stages { - - stage('Kloniraj Repozitorijum') { + stage('Verifikacija direktorijuma') { steps { - echo "📥 Kloniram GitHub repozitorijum..." - dir('angular9-springboot-expensetracker') { - deleteDir() - } - git url: 'https://github.com/phk01-afk/angular9-springboot-expensetracker.git', branch: 'patch-1' + sh 'echo "📁 Trenutni direktorijum:"' + sh 'pwd' + sh 'ls -l' } } @@ -39,29 +36,33 @@ pipeline { echo "⏳ Čekam da backend startuje..." sleep 25 - ''' - } - } - } + retries=5 + while [ $retries -gt 0 ]; do + response=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:8080/api/v1/expenses) + if [ "$response" -eq 200 ]; then + echo "✅ Backend is up and running!" + break + else + retries=$((retries - 1)) + echo "⏳ Backend not available. Retrying... ($retries attempts left)" + sleep 10 + fi + done - - stage('Build & Serve Frontend') { - steps { - dir('angular9-springboot-expensetracker/expense-tracker-frontend') { - sh 'npm install' - sh 'pkill -f "ng serve" || true' - sh 'nohup npx ng serve --host 0.0.0.0 --port 4200 > frontend.log 2>&1 &' + if [ $retries -eq 0 ]; then + echo "❌ Backend failed to start. Please check the logs for more details." + exit 1 + fi + ''' } } } - } -} stage('Health Check Backend') { steps { script { - def retries = 5 + def retries = 10 def success = false while (retries > 0) { def response = sh(script: "curl -s -o /dev/null -w '%{http_code}' http://localhost:8080/api/v1/expenses", returnStdout: true).trim() @@ -71,16 +72,28 @@ pipeline { break } else { retries-- - echo "⏳ Backend nije spreman. Pokušavam ponovo... (${retries} pokušaja ostalo)" - sleep(10) + echo "⏳ Backend check failed. Retrying... (${retries} left)" + sleep(5) } } if (!success) { - error "❌ Backend health check nije uspeo nakon više pokušaja!" + error "❌ Backend health check failed after multiple attempts!" } } } } + stage('Build & Serve Frontend') { + steps { + dir('expense-tracker-frontend') { + sh 'npm install' + sh 'pkill -f "ng serve" || true' + sh 'nohup npx ng serve --host 0.0.0.0 --port 4200 > frontend.log 2>&1 &' + } + } + } + } +} + From af3e2c6ecb8184dbec7d69541dc95e4caae48c8d Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Tue, 15 Jul 2025 01:19:17 +0200 Subject: [PATCH 51/56] pliz --- expensetracker/src/main/resources/application.properties | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/expensetracker/src/main/resources/application.properties b/expensetracker/src/main/resources/application.properties index 75ba19a0..67d92467 100644 --- a/expensetracker/src/main/resources/application.properties +++ b/expensetracker/src/main/resources/application.properties @@ -1,9 +1,9 @@ #Konfiguracija porta za aplikaciju server.port=8080 # Podaci za konekciju sa bazom podataka -spring.datasource.url=jdbc:mysql://localhost:3306/expensetracker?useSSL=false&serverTimezone=UTC -spring.datasource.username=expensetracker -spring.datasource.password=expensetracker +spring.datasource.url=jdbc:mysql://127.0.0.1:3306/expensetracker?useSSL=false&serverTimezone=UTC +spring.datasource.username=root +spring.datasource.password=nova_lozinka spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver # Hibernate Dialekt za MySQL From 7eb59afdc44707a4af981fdbebe2fcc16524f38a Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Tue, 15 Jul 2025 01:23:25 +0200 Subject: [PATCH 52/56] Update application.properties --- expensetracker/src/main/resources/application.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/expensetracker/src/main/resources/application.properties b/expensetracker/src/main/resources/application.properties index 67d92467..29ffbe32 100644 --- a/expensetracker/src/main/resources/application.properties +++ b/expensetracker/src/main/resources/application.properties @@ -1,7 +1,7 @@ #Konfiguracija porta za aplikaciju server.port=8080 # Podaci za konekciju sa bazom podataka -spring.datasource.url=jdbc:mysql://127.0.0.1:3306/expensetracker?useSSL=false&serverTimezone=UTC +spring.datasource.url=jdbc:mysql://localhost:3306/expensetracker?useSSL=false&serverTimezone=UTC spring.datasource.username=root spring.datasource.password=nova_lozinka spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver From f3cf9bee585e2a8d314ace81acd709032e9a0c8e Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Tue, 15 Jul 2025 01:26:49 +0200 Subject: [PATCH 53/56] Update application.properties --- expensetracker/src/main/resources/application.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/expensetracker/src/main/resources/application.properties b/expensetracker/src/main/resources/application.properties index 29ffbe32..75ba19a0 100644 --- a/expensetracker/src/main/resources/application.properties +++ b/expensetracker/src/main/resources/application.properties @@ -2,8 +2,8 @@ server.port=8080 # Podaci za konekciju sa bazom podataka spring.datasource.url=jdbc:mysql://localhost:3306/expensetracker?useSSL=false&serverTimezone=UTC -spring.datasource.username=root -spring.datasource.password=nova_lozinka +spring.datasource.username=expensetracker +spring.datasource.password=expensetracker spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver # Hibernate Dialekt za MySQL From feb4c83b6a482a7eca6df5f7466be57e8d977892 Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Tue, 15 Jul 2025 01:54:07 +0200 Subject: [PATCH 54/56] Update Jenkinsfile --- Jenkinsfile | 60 +++++++++++++++++++++-------------------------------- 1 file changed, 24 insertions(+), 36 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9f1f98b5..a927456d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,11 +7,14 @@ pipeline { } stages { - stage('Verifikacija direktorijuma') { + + stage('Kloniraj Repozitorijum') { steps { - sh 'echo "📁 Trenutni direktorijum:"' - sh 'pwd' - sh 'ls -l' + echo "📥 Kloniram GitHub repozitorijum..." + dir('angular9-springboot-expensetracker') { + deleteDir() + } + git url: 'https://github.com/phk01-afk/angular9-springboot-expensetracker.git', branch: 'patch-1' } } @@ -36,33 +39,29 @@ pipeline { echo "⏳ Čekam da backend startuje..." sleep 25 + ''' + } + } + } - retries=5 - while [ $retries -gt 0 ]; do - response=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:8080/api/v1/expenses) - if [ "$response" -eq 200 ]; then - echo "✅ Backend is up and running!" - break - else - retries=$((retries - 1)) - echo "⏳ Backend not available. Retrying... ($retries attempts left)" - sleep 10 - fi - done - if [ $retries -eq 0 ]; then - echo "❌ Backend failed to start. Please check the logs for more details." - exit 1 - fi - ''' + + stage('Build & Serve Frontend') { + steps { + dir('angular9-springboot-expensetracker/expense-tracker-frontend') { + sh 'npm install' + sh 'pkill -f "ng serve" || true' + sh 'nohup npx ng serve --host 0.0.0.0 --port 4200 > frontend.log 2>&1 &' } } } + } +} stage('Health Check Backend') { steps { script { - def retries = 10 + def retries = 5 def success = false while (retries > 0) { def response = sh(script: "curl -s -o /dev/null -w '%{http_code}' http://localhost:8080/api/v1/expenses", returnStdout: true).trim() @@ -72,28 +71,17 @@ pipeline { break } else { retries-- - echo "⏳ Backend check failed. Retrying... (${retries} left)" - sleep(5) + echo "⏳ Backend nije spreman. Pokušavam ponovo... (${retries} pokušaja ostalo)" + sleep(10) } } if (!success) { - error "❌ Backend health check failed after multiple attempts!" + error "❌ Backend health check nije uspeo nakon više pokušaja!" } } } } - stage('Build & Serve Frontend') { - steps { - dir('expense-tracker-frontend') { - sh 'npm install' - sh 'pkill -f "ng serve" || true' - sh 'nohup npx ng serve --host 0.0.0.0 --port 4200 > frontend.log 2>&1 &' - } - } - } - } -} From 9286e464b6609d46b0d1152159633238a7a98422 Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Tue, 15 Jul 2025 02:28:52 +0200 Subject: [PATCH 55/56] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index a927456d..09bd4729 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -35,7 +35,7 @@ pipeline { echo "⚙️ Pokretanje Spring Boot aplikacije..." pkill -f 'expensetracker-v1.jar' || true - nohup java -jar target/expensetracker-v1.jar > backend.log 2>&1 & + sh 'java -jar target/expensetracker-v1.jar > backend.log 2>&1 &' echo "⏳ Čekam da backend startuje..." sleep 25 From 5dc3651d2e54c80caa22d67f9a16d352fb015bf3 Mon Sep 17 00:00:00 2001 From: phk01-afk Date: Thu, 7 Aug 2025 17:01:37 +0200 Subject: [PATCH 56/56] more --- Jenkinsfile | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 09bd4729..fba771d8 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -35,29 +35,15 @@ pipeline { echo "⚙️ Pokretanje Spring Boot aplikacije..." pkill -f 'expensetracker-v1.jar' || true - sh 'java -jar target/expensetracker-v1.jar > backend.log 2>&1 &' + nohup java -jar target/expensetracker-v1.jar > backend.log 2>&1 & - echo "⏳ Čekam da backend startuje..." + echo "⏳ Čekam 25 sekundi da se backend startuje..." sleep 25 ''' } } } - - - stage('Build & Serve Frontend') { - steps { - dir('angular9-springboot-expensetracker/expense-tracker-frontend') { - sh 'npm install' - sh 'pkill -f "ng serve" || true' - sh 'nohup npx ng serve --host 0.0.0.0 --port 4200 > frontend.log 2>&1 &' - } - } - } - } -} - stage('Health Check Backend') { steps { script { @@ -66,22 +52,32 @@ pipeline { while (retries > 0) { def response = sh(script: "curl -s -o /dev/null -w '%{http_code}' http://localhost:8080/api/v1/expenses", returnStdout: true).trim() if (response == '200') { - echo "✅ Backend is up and running!" + echo "✅ Backend je uspešno startovan!" success = true break } else { retries-- - echo "⏳ Backend nije spreman. Pokušavam ponovo... (${retries} pokušaja ostalo)" + echo "⏳ Backend još nije spreman... (${retries} pokušaja ostalo)" sleep(10) } } if (!success) { - error "❌ Backend health check nije uspeo nakon više pokušaja!" + error "❌ Backend health check nije uspeo!" } } } } + stage('Build & Serve Frontend') { + steps { + dir('angular9-springboot-expensetracker/expense-tracker-frontend') { + sh 'npm install' + sh 'pkill -f "ng serve" || true' + sh 'nohup npx ng serve --host 0.0.0.0 --port 4200 > frontend.log 2>&1 &' + } + } + } + + } +} - -