From d7996c060196df016296575d008621d5dfed3c56 Mon Sep 17 00:00:00 2001 From: Francesco Albano <73170315+fra2404@users.noreply.github.com> Date: Thu, 27 Nov 2025 11:51:02 +0800 Subject: [PATCH] Add Jenkinsfile for deployment and update docker-compose --- .DS_Store | Bin 0 -> 6148 bytes Jenkinsfile | 80 ++++++++++++++++++ backend/storage/trip.sqlite | Bin 163840 -> 163840 bytes .../trip/__pycache__/__init__.cpython-312.pyc | Bin 189 -> 189 bytes .../utils/__pycache__/zip.cpython-312.pyc | Bin 33085 -> 33085 bytes docker-compose.yml | 2 +- src/angular.json | 18 +++- .../shared-trip/shared-trip.component.html | 3 +- .../shared-trip/shared-trip.component.ts | 2 + storage/trip.sqlite | Bin 163840 -> 163840 bytes 10 files changed, 99 insertions(+), 6 deletions(-) create mode 100644 .DS_Store create mode 100644 Jenkinsfile diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..48b0fbbec70d184d81c60c3e6645175be4f6df34 GIT binary patch literal 6148 zcmeHKO-jR15T4f-8Yx1-O&2cS#sl;M5=-0*y+BPODs46uBcp` zkEcZ)MVsL_GQiKSPdS}ZL33(7ziP=px4(ZkizBK!%ko8?!;`!|KOW5Ux1()QX9d zjsf&+mSiAkt1(~<7y~N?`1|0YjHzNH7(N|X!UzED!5jp8o+UWPE2fH#AUqH!sX$3} zI$}6Uhuv#js@MohIyoIaoK|)^p}0^T=lc*&E)}%Z7%&Dl8R*L8ko*7f*Yp2ol3f`C z#=xIq!1c0eHo+}vZ;ft_d##7gpe!8M2(D7F39T5h+=@rgAh3Jh08_ trip.tar' + } + } + } + + stage('Deploy') { + steps { + script { + if (env.BRANCH_NAME != 'main') { + echo "Skipping deployment: not on main branch" + return + } + + echo "Deploying to PRODUCTION VM: ${DEPLOY_SERVER}" + + sh """ + # Installa sshpass se non presente + which sshpass || (apt-get update && apt-get install -y sshpass) + + sshpass -p '${DEPLOY_PASS}' scp -o StrictHostKeyChecking=no trip.tar ${DEPLOY_USER}@${DEPLOY_SERVER}:${DEPLOY_PATH}/ + sshpass -p '${DEPLOY_PASS}' scp -o StrictHostKeyChecking=no docker-compose.yml ${DEPLOY_USER}@${DEPLOY_SERVER}:${DEPLOY_PATH}/ + # Copia storage solo al primo deploy, poi commenta questa riga + sshpass -p '${DEPLOY_PASS}' scp -o StrictHostKeyChecking=no -r storage ${DEPLOY_USER}@${DEPLOY_SERVER}:${DEPLOY_PATH}/ 2>/dev/null || true + + sshpass -p '${DEPLOY_PASS}' ssh -o StrictHostKeyChecking=no ${DEPLOY_USER}@${DEPLOY_SERVER} " + cd ${DEPLOY_PATH} + docker load < trip.tar + docker-compose down || true + docker-compose up -d + rm trip.tar + " + """ + + echo "Deployment completed to ${DEPLOY_SERVER}" + } + } + } + } + + post { + success { + echo 'Deployment successful!' + } + failure { + echo 'Deployment failed!' + } + always { + cleanWs() + } + } +} \ No newline at end of file diff --git a/backend/storage/trip.sqlite b/backend/storage/trip.sqlite index dfd4fb83976031afdb6420ebc318d0867ba6a974..9c3df70648735653c88d0bc2b7c3ac38031939a5 100644 GIT binary patch delta 663 zcmZo@;A&{#njp=%dZLUo>uLtQE|HBX3-mdd_+BvZm-4;X*m#GJvyqF5pPgNpS9)@t zy&{vT`Q-Wb@=jqDNrgrM#*Svm`DG?amW63~p82VcDi#^eDM6WGZYeHVSz*CWX+@Fg z{^g~9&c3;YW;q7FZdrw;W|}tj1K_90=HrS delta 189 zcmZo@;A&{#njp=%Vxo*Q>k0e8{LxNv z@_hSLpyYQ3{_oob6&T<0Z~pGjD1_trTx9b%)|E*`A0Mxh005k!JJtXI diff --git a/backend/trip/__pycache__/__init__.cpython-312.pyc b/backend/trip/__pycache__/__init__.cpython-312.pyc index ed90f2f001c24ad0c97290ccbaa152f0f927b6f9..cadd13c97c9d5c315636243fead71b73f8516415 100644 GIT binary patch delta 18 YcmdnXxR;UZG%qg~0}z~^H<4>I04|>eEdT%j delta 18 YcmdnXxR;UZG%qg~0}#BJIgx8K052Q`MF0Q* diff --git a/backend/trip/utils/__pycache__/zip.cpython-312.pyc b/backend/trip/utils/__pycache__/zip.cpython-312.pyc index 1af1f04a5ecd9153a736872dd682678c82974b51..381100502dcbad0546bc302c969638d500ebed6a 100644 GIT binary patch delta 21 bcmdnn#I(1GiR&~kFBbz4oSwIl%eWB$Nc09& delta 21 bcmdnn#I(1GiR&~kFBbz4yqLL>%eWB$Nr?t* diff --git a/docker-compose.yml b/docker-compose.yml index aeba06f..fa8cbb2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,6 @@ services: app: - image: ghcr.io/itskovacs/trip:1 + build: . ports: - 127.0.0.1:8080:8000 #127.0.0.1: locally exposed, on port 8080 by default volumes: diff --git a/src/angular.json b/src/angular.json index e0f45be..3e3fca1 100644 --- a/src/angular.json +++ b/src/angular.json @@ -20,7 +20,9 @@ "outputPath": "dist/trip", "index": "src/index.html", "browser": "src/main.ts", - "polyfills": ["zone.js"], + "polyfills": [ + "zone.js" + ], "tsConfig": "tsconfig.app.json", "inlineStyleLanguage": "scss", "assets": [ @@ -63,6 +65,9 @@ }, "serve": { "builder": "@angular-devkit/build-angular:dev-server", + "options": { + "proxyConfig": "proxy.conf.json" + }, "configurations": { "production": { "buildTarget": "trip:build:production" @@ -79,7 +84,10 @@ "test": { "builder": "@angular-devkit/build-angular:karma", "options": { - "polyfills": ["zone.js", "zone.js/testing"], + "polyfills": [ + "zone.js", + "zone.js/testing" + ], "tsConfig": "tsconfig.spec.json", "inlineStyleLanguage": "scss", "assets": [ @@ -88,7 +96,9 @@ "input": "public" } ], - "styles": ["src/styles.scss"], + "styles": [ + "src/styles.scss" + ], "scripts": [] } } @@ -98,4 +108,4 @@ "cli": { "analytics": false } -} +} \ No newline at end of file diff --git a/src/src/app/components/shared-trip/shared-trip.component.html b/src/src/app/components/shared-trip/shared-trip.component.html index bce8ef9..765d4b9 100644 --- a/src/src/app/components/shared-trip/shared-trip.component.html +++ b/src/src/app/components/shared-trip/shared-trip.component.html @@ -586,7 +586,7 @@ } - + } diff --git a/src/src/app/components/shared-trip/shared-trip.component.ts b/src/src/app/components/shared-trip/shared-trip.component.ts index dd71cf6..fb9cbb2 100644 --- a/src/src/app/components/shared-trip/shared-trip.component.ts +++ b/src/src/app/components/shared-trip/shared-trip.component.ts @@ -27,6 +27,7 @@ import { calculateDistanceBetween } from '../../shared/haversine'; import { orderByPipe } from '../../shared/order-by.pipe'; import { generateTripICSFile } from '../trip/ics'; import { generateTripCSVFile } from '../trip/csv'; +import { DatePicker } from "primeng/datepicker"; @Component({ selector: 'app-shared-trip', @@ -48,6 +49,7 @@ import { generateTripCSVFile } from '../trip/csv'; CheckboxModule, ClipboardModule, orderByPipe, + DatePicker ], templateUrl: './shared-trip.component.html', styleUrls: ['./shared-trip.component.scss'], diff --git a/storage/trip.sqlite b/storage/trip.sqlite index dfd4fb83976031afdb6420ebc318d0867ba6a974..29bda7c252a0e205e8ac469f87656b00f328a277 100644 GIT binary patch delta 610 zcmZo@;A&{#njp=%YNCuY>naAls=|#a3-mdd_+BvZm-4;X*m#GJvyqF5pPgNpS9)@t zy&{vT`Q-Wb@=m20p6=e^j@f2uJ`q7>X_k@YuI>TlDw(C)&c!~K