diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..48b0fbb Binary files /dev/null and b/.DS_Store differ diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..d50f086 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,80 @@ +pipeline { + agent any + + environment { + DEPLOY_SERVER = '192.168.1.161' + DEPLOY_USER = 'root' + DEPLOY_PASS = 'Temp1234!' + DEPLOY_PATH = '/opt/trip' + } + + stages { + stage('Checkout') { + steps { + checkout scm + } + } + + stage('Build Docker Image') { + steps { + script { + sh 'docker build -t trip:${BUILD_NUMBER} .' + sh 'docker tag trip:${BUILD_NUMBER} trip:latest' + } + } + } + + stage('Save Docker Image') { + steps { + script { + sh 'docker save trip:latest > 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 dfd4fb8..9c3df70 100644 Binary files a/backend/storage/trip.sqlite and b/backend/storage/trip.sqlite differ diff --git a/backend/trip/__pycache__/__init__.cpython-312.pyc b/backend/trip/__pycache__/__init__.cpython-312.pyc index ed90f2f..cadd13c 100644 Binary files a/backend/trip/__pycache__/__init__.cpython-312.pyc and b/backend/trip/__pycache__/__init__.cpython-312.pyc differ diff --git a/backend/trip/utils/__pycache__/zip.cpython-312.pyc b/backend/trip/utils/__pycache__/zip.cpython-312.pyc index 1af1f04..3811005 100644 Binary files a/backend/trip/utils/__pycache__/zip.cpython-312.pyc and b/backend/trip/utils/__pycache__/zip.cpython-312.pyc differ 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 dfd4fb8..29bda7c 100644 Binary files a/storage/trip.sqlite and b/storage/trip.sqlite differ