diff --git a/.gitignore b/.gitignore index 4e338bd..ac68a18 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,9 @@ ogWebconsole/.env ogWebconsole/test-results/ogGui-junit-report.xml +node_modules/ +### Debian packaging +debian/oggui +debian/*.substvars +debian/*.log +debian/.debhelper/ +debian/files diff --git a/CHANGELOG.md b/CHANGELOG.md index eb2e5f3..8d9ea42 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,13 @@ # Changelog +## [0.9.2] - 2025-03-19 +### Changed +- Jenkinsfile to pubilsh packages in repo in case og release + +## [0.9.1] - 2025-03-12 +### ⚡ Changed +- Se ha modificado el acceso a Mercure añadiendo nueva variable de entorno. + + ## [0.9.0] - 2025-3-4 ### 🔹 Added - Integracion con Mercure. Subscriber tanto en "Trazas" con en "Clientes". diff --git a/DEBIAN/changelog b/DEBIAN/changelog deleted file mode 100644 index 65d538d..0000000 --- a/DEBIAN/changelog +++ /dev/null @@ -1,5 +0,0 @@ -oggui (1.0) unstable; urgency=low - - * Initial release. - - -- Your Name Thu, 01 Jan 1970 00:00:00 +0000 diff --git a/DEBIAN/control b/DEBIAN/control deleted file mode 100644 index 3bd121f..0000000 --- a/DEBIAN/control +++ /dev/null @@ -1,9 +0,0 @@ -Package: oggui -Version: %%VERSION%% -Section: base -Priority: optional -Architecture: all -Depends: nginx , npm , nodejs -Maintainer: Nicolas Arenas -Description: Description of the ogcore package - This is a longer description of the ogcore package. diff --git a/DEBIAN/copyright b/DEBIAN/copyright deleted file mode 100644 index 97ef204..0000000 --- a/DEBIAN/copyright +++ /dev/null @@ -1,21 +0,0 @@ -Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ -Upstream-Name: ogcore -Source: - -Files: * -Copyright: 2023 Your Name -License: GPL-3+ - This package is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - . - This package is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - . - You should have received a copy of the GNU General Public License - along with this package; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - MA 02110-1301 USA. diff --git a/DEBIAN/postinst b/DEBIAN/postinst deleted file mode 100644 index 393ab12..0000000 --- a/DEBIAN/postinst +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash - -set -e - -# Asegurarse de que el usuario exista -USER="opengnsys" -HASH_FILE="/opt/opengnsys/oggui/var/lib/oggui/oggui.config.hash" -CONFIG_FILE="/opt/opengnsys/oggui/src/.env" - -# Provisionar base de datos si es necesario en caso de instalación. - - -# Detectar si es una instalación nueva o una actualización -if [ "$1" = "configure" ] && [ -z "$2" ]; then - cd /opt/opengnsys/oggui/src/ - npm install -g @angular/cli - npm install - /usr/local/bin/ng build --base-href=/ --output-path=dist/oggui --optimization=true --configuration=production --localize=false - cp -pr /opt/opengnsys/oggui/src/dist/oggui/browser/* /opt/opengnsys/oggui/browser/ - md5sum "$CONFIG_FILE" > "$HASH_FILE" - ln -s /opt/opengnsys/oggui/etc/systemd/system/oggui.service /etc/systemd/system/oggui.service - systemctl daemon-reload - systemctl enable oggui -elif [ "$1" = "configure" ] && [ -n "$2" ]; then - cd /opt/opengnsys/oggui - echo "Actualización desde la versión $2" -fi - -# Cambiar la propiedad de los archivos al usuario especificado -chown opengnsys:www-data /opt/opengnsys/ -chown -R opengnsys:www-data /opt/opengnsys/oggui -# Install http server stuff -ln -s /opt/opengnsys/oggui/etc/nginx/oggui.conf /etc/nginx/sites-enabled/oggui.conf -# Reiniciar servicios si es necesario -# systemctl restart nombre_del_servicio - -systemctl daemon-reload -systemctl restart nginx - -exit 0 diff --git a/Jenkins/Jenkinsfile-deb-pkg b/Jenkins/Jenkinsfile-deb-pkg new file mode 100644 index 0000000..f032770 --- /dev/null +++ b/Jenkins/Jenkinsfile-deb-pkg @@ -0,0 +1,82 @@ +@Library('jenkins-shared-library') _ +pipeline { + agent { + label 'jenkins-slave' + } + environment { + DEBIAN_FRONTEND = 'noninteractive' + DEFAULT_DEV_NAME = 'Opengnsys Team' + DEFAULT_DEV_EMAIL = 'opengnsys@qindel.com' + } + options { + skipDefaultCheckout() + } + parameters { + string(name: 'DEV_NAME', defaultValue: '', description: 'Nombre del desarrollador') + string(name: 'DEV_EMAIL', defaultValue: '', description: 'Email del desarrollador') + } + stages { + stage('Prepare Workspace') { + steps { + script { + env.BUILD_DIR = "${WORKSPACE}/oggui" + sh "mkdir -p ${env.BUILD_DIR}" + } + } + } + + stage('Checkout') { + steps { + dir("${env.BUILD_DIR}") { + checkout scm + } + } + } + + stage('Generate Changelog') { + when { + expression { + return env.TAG_NAME != null + } + } + steps { + script { + def devName = params.DEV_NAME ? params.DEV_NAME : env.DEFAULT_DEV_NAME + def devEmail = params.DEV_EMAIL ? params.DEV_EMAIL : env.DEFAULT_DEV_EMAIL + + generateDebianChangelog(env.BUILD_DIR, devName, devEmail) + } + } + } + + stage('Build') { + steps { + dir("${env.BUILD_DIR}") { + sh ''' + dpkg-buildpackage -us -uc + mkdir -p ../artifacts && mv ../*.deb ../*.changes ../*.buildinfo ../artifacts/ + ssh aptly@172.17.8.68 "rm -rf /var/tmp/opengnsys/debian-repo/oggui && mkdir -p /var/tmp/opengnsys/debian-repo/oggui" + scp -r ../artifacts/* aptly@172.17.8.68:/var/tmp/opengnsys/debian-repo/oggui/ + ''' + } + } + } + stage ('Publish to Debian Repository') { + when { + expression { + return env.TAG_NAME != null + } + } + agent { label 'debian-repo' } + steps { + sh "aptly repo add opengnsys-devel /var/tmp/opengnsys/debian-repo/oggui/*.deb" + } + } + } + post { + always { + notifyBuildStatus('narenas@qindel.com') + } + } +} + diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..ecbbe3d --- /dev/null +++ b/debian/changelog @@ -0,0 +1,14 @@ +oggui (0.0.1-1) unstable; urgency=medium + + * Add debian files + * Update .gitignore + * refs #1637 refactor: remove unused client edit and create components; add manage client component + * refs #1619. Style: enhance cards view layout and paginator integration in groups component + * refactor: update paginator settings and improve page change handling in groups component + * Merge branch 'develop' of ssh://ognproject.evlt.uma.es:21987/opengnsys/oggui into develop + * style: clean up and optimize CSS for groups component; enhance HTML structure and improve responsiveness + * Updated groups paginator + * Merge branch 'develop' of ssh://ognproject.evlt.uma.es:21987/opengnsys/oggui into develop + * refs #1567. New subnet field: 'dns' + + -- Tu Nombre Mon, 10 Mar 2025 14:48:36 +0000 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..48082f7 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +12 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..629ce11 --- /dev/null +++ b/debian/control @@ -0,0 +1,13 @@ +Source: oggui +Section: web +Priority: optional +Maintainer: Nicolas Arenas +Build-Depends: debhelper (>= 12), nodejs, npm +Standards-Version: 4.5.0 + +Package: oggui +Architecture: any +Maintainer: Nicolas Arenas +Depends: ${shlibs:Depends}, ${misc:Depends}, nginx, nodejs, npm +Description: OpenGnsys GUI + Una interfaz gráfica para OpenGnsys. diff --git a/debian/debhelper-build-stamp b/debian/debhelper-build-stamp new file mode 100644 index 0000000..f1164bb --- /dev/null +++ b/debian/debhelper-build-stamp @@ -0,0 +1 @@ +oggui diff --git a/debian/files b/debian/files new file mode 100644 index 0000000..4d6bb5d --- /dev/null +++ b/debian/files @@ -0,0 +1,2 @@ +oggui_1.0.1+deb-pkg20250310-1_amd64.buildinfo web optional +oggui_1.0.1+deb-pkg20250310-1_amd64.deb web optional diff --git a/debian/oggui.config b/debian/oggui.config new file mode 100644 index 0000000..a938da8 --- /dev/null +++ b/debian/oggui.config @@ -0,0 +1,11 @@ +#!/bin/sh + +set -e + +. /usr/share/debconf/confmodule + +db_input high opengnsys/oggui_ogcoreUrl || true +db_input high opengnsys/oggui_ogmercureUrl || true + + +db_go diff --git a/debian/oggui.install b/debian/oggui.install new file mode 100644 index 0000000..a14cbae --- /dev/null +++ b/debian/oggui.install @@ -0,0 +1,9 @@ +ogWebconsole/dist/oggui/browser /opt/opengnsys/oggui/browser/ +etc /opt/opengnsys/oggui/ +bin /opt/opengnsys/oggui/ +var /opt/opengnsys/oggui/ +ogWebconsole/*.json /opt/opengnsys/oggui/src/ +ogWebconsole/*.js /opt/opengnsys/oggui/src/ +ogWebconsole/src /opt/opengnsys/oggui/src/ +ogWebconsole/ssl/* /opt/opengnsys/oggui/etc/nginx/certs/ + diff --git a/debian/oggui.postinst b/debian/oggui.postinst new file mode 100644 index 0000000..c873baf --- /dev/null +++ b/debian/oggui.postinst @@ -0,0 +1,50 @@ +#!/bin/bash + +set -e + +. /usr/share/debconf/confmodule + +db_get opengnsys/oggui_ogcoreUrl +OGCORE_URL="$RET" +db_get opengnsys/oggui_ogmercureUrl +OGMERCURE_URL="$RET" + +# Asegurarse de que el usuario exista +USER="opengnsys" +HASH_FILE="/opt/opengnsys/oggui/var/lib/oggui/oggui.config.hash" +CONFIG_FILE="/opt/opengnsys/oggui/src/.env" + +# Detectar si es una instalación nueva o una actualización +if [ "$1" = "configure" ] && [ -z "$2" ]; then + cd /opt/opengnsys/oggui/src/ + echo NG_APP_BASE_API_URL=$OGCORE_URL > "$CONFIG_FILE" + echo NG_APP_OGCORE_MERCURE_BASE_URL=$OGMERCURE_URL >> "$CONFIG_FILE" + npm install -g @angular/cli + npm install + /usr/local/bin/ng build --base-href=/ --output-path=dist/oggui --optimization=true --configuration=production --localize=false + cp -pr /opt/opengnsys/oggui/src/dist/oggui/browser /opt/opengnsys/oggui/ + md5sum "$CONFIG_FILE" > "$HASH_FILE" + ln -s /opt/opengnsys/oggui/etc/systemd/system/oggui.service /etc/systemd/system/oggui.service + ln -s /opt/opengnsys/oggui/etc/nginx/oggui.conf /etc/nginx/sites-enabled/oggui.conf + mkdir -p /etc/nginx/certs/ + cp -p /opt/opengnsys/oggui/etc/nginx/certs/* /etc/nginx/certs/ + chown -R www-data:www-data /etc/nginx/certs + systemctl daemon-reload + systemctl enable oggui + # systemctl restart nombre_del_s + systemctl daemon-reload + systemctl restart nginx +elif [ "$1" = "configure" ] && [ -n "$2" ]; then + cd /opt/opengnsys/oggui + echo "Actualización desde la versión $2" + /usr/local/bin/ng build --base-href=/ --output-path=dist/oggui --optimization=true --configuration=production --localize=false + rm -rf /opt/opengnsys/oggui/browser + cp -pr /opt/opengnsys/oggui/src/dist/oggui/browser /opt/opengnsys/oggui/ + md5sum "$CONFIG_FILE" > "$HASH_FILE" +fi + +# Cambiar la propiedad de los archivos al usuario especificado +chown opengnsys:www-data /opt/opengnsys/ +chown -R opengnsys:www-data /opt/opengnsys/oggui +chmod 755 /opt/opengnsys/oggui/bin/start-oggui.sh +exit 0 diff --git a/DEBIAN/postrm b/debian/oggui.postrm similarity index 100% rename from DEBIAN/postrm rename to debian/oggui.postrm diff --git a/debian/oggui.postrm.debhelper b/debian/oggui.postrm.debhelper new file mode 100644 index 0000000..9535d85 --- /dev/null +++ b/debian/oggui.postrm.debhelper @@ -0,0 +1,6 @@ +# Automatically added by dh_installdebconf/13.14.1ubuntu5 +if [ "$1" = purge ] && [ -e /usr/share/debconf/confmodule ]; then + . /usr/share/debconf/confmodule + db_purge +fi +# End automatically added section diff --git a/DEBIAN/preinst b/debian/oggui.preinst similarity index 100% rename from DEBIAN/preinst rename to debian/oggui.preinst diff --git a/debian/oggui.prerm b/debian/oggui.prerm new file mode 100644 index 0000000..2f86a9f --- /dev/null +++ b/debian/oggui.prerm @@ -0,0 +1,14 @@ +#!/bin/bash + +set -e +set -x + +if [ "$1" = "upgrade" ]; then + # Eliminar enlaces simbólicos creados en postinst + rm -f /etc/systemd/system/oggui.service + rm -f /etc/nginx/sites-enabled/oggui.conf + systemctl daemon-reload + systemctl restart nginx +fi + +exit 0 diff --git a/debian/oggui.templates b/debian/oggui.templates new file mode 100644 index 0000000..dc0d172 --- /dev/null +++ b/debian/oggui.templates @@ -0,0 +1,9 @@ +Template: opengnsys/oggui_ogcoreUrl +Type: string +Default: https://127.0.0.1:8443 +Description: Introduzca la URL delAPI de OgCore + +Template: opengnsys/oggui_ogmercureUrl +Type: string +Default: https://127.0.0.1:3000/.well-known/mercure +Description: Introduzca el endpoint de mercure diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..e98db95 --- /dev/null +++ b/debian/rules @@ -0,0 +1,20 @@ +#!/usr/bin/make -f + +%: + dh $@ + +override_dh_auto_build: + cd ogWebconsole && npm install + cd ogWebconsole && /usr/local/bin/ng build --base-href=/ --output-path=dist/oggui --optimization=true --configuration=production --localize=false + +override_dh_auto_install: + dh_auto_install + mkdir -p debian/oggui/opt/opengnsys/oggui/browser + mkdir -p debian/oggui/opt/opengnsys/oggui/src/ + cp -pr ogWebconsole/dist/oggui/browser/* debian/oggui/opt/opengnsys/oggui/browser/ + rm -rf debian/oggui/opt/opengnsys/oggui/browser/node_modules + cp -pr etc debian/oggui/opt/opengnsys/oggui/ + cp -pr bin debian/oggui/opt/opengnsys/oggui/ + cp -pr var debian/oggui/opt/opengnsys/oggui/ + cp -p ogWebconsole/.env debian/oggui/opt/opengnsys/oggui/src/ + md5sum debian/oggui/opt/opengnsys/oggui/src/.env > debian/oggui/opt/opengnsys/oggui/var/lib/oggui/oggui.config.hash diff --git a/etc/nginx/oggui.conf b/etc/nginx/oggui.conf index e036513..2f25085 100644 --- a/etc/nginx/oggui.conf +++ b/etc/nginx/oggui.conf @@ -1,5 +1,5 @@ server { - listen 4200; + listen 4200 ssl; server_name localhost; root /opt/opengnsys/oggui/browser; @@ -13,7 +13,8 @@ server { location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ { try_files $uri =404; } - + ssl_certificate /opt/opengnsys/oggui/etc/nginx/certs/oggui.uds-test.net.crt.pem; + ssl_certificate_key /opt/opengnsys/oggui/etc/nginx/certs/oggui.uds-test.net.key.pem; # Configuración para evitar problemas con rutas de Angular error_page 404 /index.html; } \ No newline at end of file