Compare commits
155 Commits
|
@ -20,7 +20,7 @@ JWT_PASSPHRASE=8b9154df37ffa91ef9186ce095324e39e50ff3b023bb1ed34383abd019ba4515
|
|||
###< lexik/jwt-authentication-bundle ###
|
||||
|
||||
###> symfony/mercure-bundle ###
|
||||
MERCURE_URL=http://localhost:3000/.well-known/mercure
|
||||
MERCURE_PUBLIC_URL=http://localhost:3000/.well-known/mercure
|
||||
MERCURE_URL=https://localhost:3000/.well-known/mercure
|
||||
MERCURE_PUBLIC_URL=https://localhost:3000/.well-known/mercure
|
||||
MERCURE_JWT_SECRET="!ChangeThisMercureHubJWTSecretKey!"
|
||||
###< symfony/mercure-bundle ###
|
||||
|
|
|
@ -25,3 +25,11 @@
|
|||
/phpunit.xml
|
||||
.phpunit.result.cache
|
||||
###< phpunit/phpunit ###
|
||||
|
||||
### Debian packaging
|
||||
debian/ogcore
|
||||
debian/*.substvars
|
||||
debian/*.log
|
||||
debian/.debhelper/
|
||||
|
||||
|
||||
|
|
141
CHANGELOG.md
141
CHANGELOG.md
|
@ -1,6 +1,132 @@
|
|||
# Changelog
|
||||
## [0.14.2] - 2025-06-09
|
||||
### Improved
|
||||
- Cambio en el template base del menu. Ahora apunta a los script de python de manera correcta.
|
||||
|
||||
---
|
||||
## [0.14.1] - 2025-06-09
|
||||
### Fixed
|
||||
- Se han corregido los mensajes de error que se envian cuando las APIs de los modulos no estan disponibles.
|
||||
- Se ha corregido un bug en la herencia de datos entre aulas y grupos, que hacia que no se almacenaran los datos de manera correcta.
|
||||
|
||||
---
|
||||
## [0.14.0] - 2025-06-02
|
||||
### Added
|
||||
- Se ha añadido la funcionalidad de mover equipos entre aulas y grupos.
|
||||
- Se ha añadido la funcionalidad para eliminar imagen cache.
|
||||
- Se ha añadido la funcionalidad para iniciar sesion.
|
||||
|
||||
### Improved
|
||||
- Se ha cambiado la restriccion que comprobaba los puertos de MULTICAST.
|
||||
- Se ha modificado el tiempo en el script, que se encarga de comprobar el estado de los equipos. Ahora es de 1 min en lugar de 3.
|
||||
|
||||
### Fixed
|
||||
- Se ha corregido un bug que hacia que al modificar un cliente o eliminarlo, no se actualizaba su estado en la subred.
|
||||
- Se ha corregido un bug que hacia que al modificar un cliente, no se actualizara su fichero de arranque.
|
||||
|
||||
---
|
||||
## [0.13.1] - 2025-05-23
|
||||
### Fixed
|
||||
- Variable de entorno "SSl_ENABLED" desactivada por defecto.
|
||||
|
||||
---
|
||||
## [0.13.0] - 2025-05-20
|
||||
### Added
|
||||
- Se ha creado la base para la comunicacion TLS con el agente.
|
||||
|
||||
### Improved
|
||||
- Refactorizacion de la API para la gestion de llamadas al agente
|
||||
|
||||
### Fixed
|
||||
- Se ha corregido un bug que hacia que no se eliminara la imagen al particionar.
|
||||
|
||||
---
|
||||
## [0.12.1] - 2025-05-14
|
||||
### Improved
|
||||
- Se ha eliminado la restriccion en el formulario de crear/editar repositorio, que hacia que la comprobara el formato de IP. Ahora tambien puede ser DNS.
|
||||
- Mejora en el script de ejecutar tareas.
|
||||
- Ahora al editar la mac de un cliente, se borra el fichero de arranque antiguo.
|
||||
- Se ha añadido una restriccion en plantillas para que tan solo haya 1 por defecto
|
||||
|
||||
---
|
||||
## [0.12.0] - 2025-05-13
|
||||
### Added
|
||||
- Se ha añadido nueva API para poder gestionar las tareas y acciones programadas.
|
||||
- Se ha añadido un nuevo campo en plantillas (defecto) el cual nos permite tener una plantilla por defecto en caso de que se elimine una.
|
||||
- Se ha comenzado la integracion con ogGit.
|
||||
|
||||
### Improved
|
||||
- Mejorado el comportamiento de la API al crear una imagen. Ahora se guardan datos del pc de origen.
|
||||
|
||||
### Fixed
|
||||
- Se ha corregido el bug en la creacion de clientes masivos donde no se le asignaba la plantilla PXE.
|
||||
- Se ha corregido un bug en el DTO de clientes, que hacia que PHP diera un timeout por bucle infinito.
|
||||
|
||||
---
|
||||
## [0.11.2] - 2025-04-23
|
||||
### Fixed
|
||||
- Se ha cambiado la forma en guardar la fecha al recibir "ping" de los clientes.
|
||||
|
||||
---
|
||||
## [0.11.1] - 2025-04-16
|
||||
### Fixed
|
||||
- Se ha corregido un error al crear imagen versionada. Si la particion de origen era diferente, no dejaba crear.
|
||||
- Error en la transmision de imagenes. No se actualizaba con la imagen versionada, si no con la canonica.
|
||||
|
||||
---
|
||||
## [0.11.0] - 2025-04-11
|
||||
### Added
|
||||
- Se ha añadido funcionalidad para renombrar imagenes en ogRepository. Nuevo sistema de versionado.
|
||||
- Se ha añadido la integracion con el ogAgent para poder ejecutar scripts.
|
||||
- Se ha añadido el poder añadir descripcion a una imagen.
|
||||
- Se han añadido 2 nuevos campos en la gestion de los repositorios: usuario y puerto ssh.
|
||||
- Se ha añadido funcionalidad para poder gestionar el estado de un equipo de manera automatica. En caso de no haber conexion con el cliente, la web sera notificada en un tiempo maximo de 5 min.
|
||||
|
||||
### Improved
|
||||
- Se han modificado los logs para que puedan "salir" por syslog ademas de por fichero.
|
||||
|
||||
### Fixed
|
||||
- Se ha corregido el bug que hacia que cuando habia demasiados clientes, no se mostraran en pantalla debido a un error de memoria.
|
||||
---
|
||||
|
||||
## [0.10.1] - 2025-03-25
|
||||
### Improved
|
||||
- Se ha modificado el script de creación de usuarios, añadiendole la opcion del tipo de visionalizacion por defecto de la vista "grupos".
|
||||
|
||||
## [0.10.0] - 2025-03-25
|
||||
### Added
|
||||
- Nuevo endpoint ogRepository. Convertir imagen en imagen virtual.
|
||||
- Nuevo endpoint ogRepository. Importar imágenes externas al sistema.
|
||||
- Nuevo método para desplegar imagenes sin cache.
|
||||
|
||||
---
|
||||
## [0.9.5] - 2025-03-19
|
||||
### Added
|
||||
- Jenkinsfile updated to publish in repo
|
||||
|
||||
---
|
||||
## [0.9.4] - 2025-03-17
|
||||
### Fixed
|
||||
- Mercure service behind nginx server for containers, expose port in docker compose for nginx
|
||||
|
||||
---
|
||||
## [0.9.3] - 2025-03-17
|
||||
### Fixed
|
||||
- Mercure service behind nginx server for containers
|
||||
|
||||
---
|
||||
## [0.9.2] - 2025-03-12
|
||||
### Fixed
|
||||
- Added mercure service in docker compose file for deployments.
|
||||
|
||||
---
|
||||
## [0.9.1] - 2025-03-12
|
||||
### Fixed
|
||||
- Corrección en la cancelacion de transmisiones p2p.
|
||||
|
||||
---
|
||||
## [0.9.0] - 2025-03-04
|
||||
### 🔹 Added
|
||||
### Added
|
||||
- Nueva funcionalidad para tener notificaciones en tiempo real. Instalación de bundle "Mercure".
|
||||
- Creacion de EventListener en Symfony, para publicar mensajes en Mercure, cuando se realicen cambios en la base de datos ( cambio de estado en lo equipos, y trazas).
|
||||
- Nuevo endpoint "backup image". Integracion con ogRepository.
|
||||
|
@ -10,24 +136,24 @@
|
|||
- Nueva funcionalidad para cancelar despliegues de imagenes.
|
||||
- Añadido nuevo campo "cancelado" en trazas.
|
||||
|
||||
### ⚡ Changed
|
||||
### Changed
|
||||
- Cambios en logs. Cambios en salida (stderror -> file.log)
|
||||
- Modulo DHCP. Añadir equipos, ahora se gestiona con una unica llamada a la API.
|
||||
- Acciones masivas en equipos. Se ha cambiado la respuesta para que no fallen las peticiones si uno o mas equipos no da respuesta.
|
||||
|
||||
---
|
||||
## [0.8.1] - 2025-02-25
|
||||
### 🐛 Fixed
|
||||
### Fixed
|
||||
- Corrección de bug en el deploy de imágenes
|
||||
|
||||
---
|
||||
|
||||
## [0.8.0] - 2025-01-10
|
||||
### 🔹 Added
|
||||
### Added
|
||||
- Nuevos campos en "aulas" para la jerarquia en clientes.
|
||||
- Nueva funcionalidad "imagen global". Integracion con ogRepository.
|
||||
|
||||
### ⚡ Changed
|
||||
### Changed
|
||||
- Limpieza en campos "name" y "date" de ogLive. Es necesario parsear el campo "filename" para facilitar el uso al usuario en la web.
|
||||
### 🐛 Fixed
|
||||
- Corrección de bug que impedia borrar un cliente si tenia una traza enlazada.
|
||||
|
@ -35,7 +161,7 @@
|
|||
|
||||
|
||||
## [0.7.3] - 2025-01-03
|
||||
### 🔹 Added
|
||||
### Added
|
||||
- Adaptados cambios en los endpoints para multiseleccion de clientes.
|
||||
- Se agregó la funcionalidad de importar/exportar. Integración con ogRepository.
|
||||
- Se agregó la funcionalidad de borrar imágenes. Integración con ogRepository.
|
||||
|
@ -50,4 +176,5 @@
|
|||
- **Added**: Secciones con nuevas características.
|
||||
- **Fixed**: Corrección de errores y bugs.
|
||||
- **Changed**: Modificaciones o mejoras en funcionalidades existentes.
|
||||
- **Removed**: Funcionalidades o dependencias eliminadas.
|
||||
- **Improved**: Mejoras en funcionalidades existentes.
|
||||
- **Removed**: Funcionalidades o dependencias eliminadas.
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
ogcore (1.0) unstable; urgency=low
|
||||
|
||||
* Initial release.
|
||||
|
||||
-- Your Name <your.email@example.com> Thu, 01 Jan 1970 00:00:00 +0000
|
|
@ -1,12 +0,0 @@
|
|||
Package: ogcore
|
||||
Version: %%VERSION%%
|
||||
Section: base
|
||||
Priority: optional
|
||||
Architecture: all
|
||||
Depends: mariadb-server, systemd, nginx, libzip-dev, zip, unzip, php8.3-opcache,
|
||||
php8.3-bcmath, php8.3-cli, php8.3-curl, php8.3-fpm, php8.3-gd,
|
||||
php8.3-ldap, php8.3-mbstring, php8.3-mysql, php8.3-common,
|
||||
php8.3-xml, php8.3-zip
|
||||
Maintainer: Nicolas Arenas <nicolas.arenas@qindel.com>
|
||||
Description: Description of the ogcore package
|
||||
This is a longer description of the ogcore package.
|
|
@ -1,21 +0,0 @@
|
|||
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Upstream-Name: ogcore
|
||||
Source: <source URL>
|
||||
|
||||
Files: *
|
||||
Copyright: 2023 Your Name <your.email@example.com>
|
||||
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.
|
|
@ -1,54 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
# Asegurarse de que el usuario exista
|
||||
USER="opengnsys"
|
||||
|
||||
|
||||
# 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/ogcore/api
|
||||
mariadb -e "GRANT ALL ON *.* to 'root'@'localhost' IDENTIFIED BY 'root' WITH GRANT OPTION;"
|
||||
echo "Primera instalación"
|
||||
# Provisionar base de datos si es necesario en caso de instalación.
|
||||
echo "Creando par de claves para JWT"
|
||||
php bin/console lexik:jwt:generate-keypair --overwrite
|
||||
echo "Creando base de datos y cargando datos iniciales"
|
||||
php bin/console doctrine:database:create --if-not-exists
|
||||
php bin/console doctrine:migrations:migrate --no-interaction
|
||||
# Cargar datos iniciales
|
||||
echo "Cargando datos iniciales"
|
||||
php bin/console opengnsys:load-default-user
|
||||
|
||||
echo "Cargando usuarios y grupos por defecto"
|
||||
php bin/console app:load-default-user-groups
|
||||
echo "Cargando comandos por defecto"
|
||||
php bin/console app:load-default-commands
|
||||
echo "Cargando menú por defecto"
|
||||
php bin/console opengnsys:load-default-menu
|
||||
elif [ "$1" = "configure" ] && [ -n "$2" ]; then
|
||||
cd /opt/opengnsys/ogcore/api
|
||||
echo "Actualización desde la versión $2"
|
||||
# Ejecutar comandos específicos para la actualización
|
||||
php bin/console doctrine:migrations:migrate --no-interaction
|
||||
# Otros comandos específicos para la actualización
|
||||
fi
|
||||
|
||||
# Cambiar la propiedad de los archivos al usuario especificado
|
||||
chown opengnsys:www-data /opt/opengnsys/
|
||||
chown -R opengnsys:www-data /opt/opengnsys/ogcore
|
||||
# Install http server stuff
|
||||
ln -s /opt/opengnsys/ogcore/etc/nginx/sites-available/ogcore.conf /etc/nginx/sites-enabled/ogcore.conf
|
||||
ln -s /opt/opengnsys/ogcore/etc/php/8.3/fpm/pool.d/ogcore-fpm.conf /etc/php/8.3/fpm/pool.d/ogcore-fpm.conf
|
||||
# Reiniciar servicios si es necesario
|
||||
# systemctl restart nombre_del_servicio
|
||||
|
||||
systemctl daemon-reload
|
||||
systemctl restart nginx
|
||||
systemctl restart php8.3-fpm
|
||||
|
||||
exit 0
|
|
@ -1,15 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
# Asegurarse de que el usuario exista
|
||||
USER="opengnsys"
|
||||
HOME_DIR="/opt/opengnsys"
|
||||
if id "$USER" &>/dev/null; then
|
||||
echo "El usuario $USER ya existe."
|
||||
else
|
||||
echo "Creando el usuario $USER con home en $HOME_DIR."
|
||||
useradd -m -d "$HOME_DIR" -s /bin/bash "$USER"
|
||||
fi
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,107 @@
|
|||
@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}/ogcore"
|
||||
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('Generate Changelog (Nightly)'){
|
||||
when {
|
||||
branch 'main'
|
||||
}
|
||||
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,"nightly")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Build') {
|
||||
steps {
|
||||
script {
|
||||
construirPaquete(env.BUILD_DIR, "../artifacts", "172.17.8.68", "/var/tmp/opengnsys/debian-repo/ogcore")
|
||||
}
|
||||
}
|
||||
}
|
||||
stage ('Publish to Debian Repository') {
|
||||
when {
|
||||
expression {
|
||||
return env.TAG_NAME != null
|
||||
}
|
||||
}
|
||||
agent { label 'debian-repo' }
|
||||
steps {
|
||||
script {
|
||||
// Construir el patrón de versión esperado en el nombre del paquete
|
||||
def versionPattern = "${env.TAG_NAME}-${env.BUILD_NUMBER}"
|
||||
publicarEnAptly('/var/tmp/opengnsys/debian-repo/ogcore', 'opengnsys-devel', versionPattern)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage ('Publish to Debian Repository (Nightly)') {
|
||||
when {
|
||||
branch 'main'
|
||||
}
|
||||
agent { label 'debian-repo' }
|
||||
steps {
|
||||
script {
|
||||
// Construir el patrón de versión esperado en el nombre del paquete
|
||||
def versionPattern = "-${env.BUILD_NUMBER}~nightly"
|
||||
publicarEnAptly('/var/tmp/opengnsys/debian-repo/ogcore', 'nightly', versionPattern)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
notifyBuildStatus('narenas@qindel.com')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -32,7 +32,7 @@ resources:
|
|||
class: ApiPlatform\Metadata\Post
|
||||
method: POST
|
||||
input: App\Dto\Input\ChangeOrganizationalUnitInput
|
||||
uriTemplate: /clients/change-organizational-units
|
||||
uriTemplate: /clients/change-organizational-unit
|
||||
controller: App\Controller\ChangeOrganizationalUnitAction
|
||||
|
||||
agent_status:
|
||||
|
@ -50,6 +50,34 @@ resources:
|
|||
uriTemplate: /clients/server/{uuid}/get-pxe
|
||||
controller: App\Controller\OgBoot\PxeBootFile\GetAction
|
||||
|
||||
boot_client:
|
||||
class: ApiPlatform\Metadata\Post
|
||||
method: POST
|
||||
input: App\Dto\Input\BootClientsInput
|
||||
uriTemplate: /clients/server/boot-client
|
||||
controller: App\Controller\OgAgent\LoginAction
|
||||
|
||||
remove_cache_image:
|
||||
class: ApiPlatform\Metadata\Post
|
||||
method: POST
|
||||
input: App\Dto\Input\BootClientsInput
|
||||
uriTemplate: /clients/server/remove-cache-image
|
||||
controller: App\Controller\OgAgent\RemoveCacheImageAction
|
||||
|
||||
hardware_inventory:
|
||||
class: ApiPlatform\Metadata\Post
|
||||
method: POST
|
||||
input: false
|
||||
uriTemplate: /clients/server/{uuid}/hardware-inventory
|
||||
controller: App\Controller\OgAgent\HardwareInventoryAction
|
||||
|
||||
software_inventory:
|
||||
class: ApiPlatform\Metadata\Post
|
||||
method: POST
|
||||
input: App\Dto\Input\SoftwareInventoryPartitionInput
|
||||
uriTemplate: /clients/server/{uuid}/software-inventory
|
||||
controller: App\Controller\OgAgent\SoftwareInventoryAction
|
||||
|
||||
reboot_client:
|
||||
class: ApiPlatform\Metadata\Post
|
||||
method: POST
|
||||
|
|
|
@ -7,6 +7,8 @@ resources:
|
|||
groups: ['default', 'command:read']
|
||||
denormalizationContext:
|
||||
groups: ['command:write']
|
||||
order:
|
||||
id: 'DESC'
|
||||
operations:
|
||||
ApiPlatform\Metadata\GetCollection:
|
||||
provider: App\State\Provider\CommandProvider
|
||||
|
@ -28,9 +30,8 @@ resources:
|
|||
class: ApiPlatform\Metadata\Post
|
||||
method: POST
|
||||
input: App\Dto\Input\CommandExecuteInput
|
||||
uriTemplate: /commands/{uuid}/execute
|
||||
controller: App\Controller\CommandExecuteAction
|
||||
|
||||
uriTemplate: /commands/run-script
|
||||
controller: App\Controller\OgAgent\RunScriptAction
|
||||
properties:
|
||||
App\Entity\Command:
|
||||
id:
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
resources:
|
||||
App\Entity\CommandTaskSchedule:
|
||||
processor: App\State\Processor\CommandTaskScheduleProcessor
|
||||
input: App\Dto\Input\CommandTaskScheduleInput
|
||||
output: App\Dto\Output\CommandTaskScheduleOutput
|
||||
normalizationContext:
|
||||
groups: ['default', 'command-task-schedule:read']
|
||||
denormalizationContext:
|
||||
groups: ['command-task-schedule:write']
|
||||
operations:
|
||||
ApiPlatform\Metadata\GetCollection:
|
||||
provider: App\State\Provider\CommandTaskScheduleProvider
|
||||
filters:
|
||||
- 'api_platform.filter.command_task_schedule.order'
|
||||
- 'api_platform.filter.command_task_schedule.search'
|
||||
- 'api_platform.filter.command_task_schedule.boolean'
|
||||
|
||||
ApiPlatform\Metadata\Get:
|
||||
provider: App\State\Provider\CommandTaskScheduleProvider
|
||||
ApiPlatform\Metadata\Put:
|
||||
provider: App\State\Provider\CommandTaskScheduleProvider
|
||||
ApiPlatform\Metadata\Patch:
|
||||
provider: App\State\Provider\CommandTaskScheduleProvider
|
||||
ApiPlatform\Metadata\Post: ~
|
||||
ApiPlatform\Metadata\Delete: ~
|
||||
|
||||
properties:
|
||||
App\Entity\CommandTaskSchedule:
|
||||
id:
|
||||
identifier: false
|
||||
uuid:
|
||||
identifier: true
|
|
@ -0,0 +1,32 @@
|
|||
resources:
|
||||
App\Entity\CommandTaskScript:
|
||||
processor: App\State\Processor\CommandTaskScriptProcessor
|
||||
input: App\Dto\Input\CommandTaskScriptInput
|
||||
output: App\Dto\Output\CommandTaskScriptOutput
|
||||
normalizationContext:
|
||||
groups: ['default', 'command-task-script:read']
|
||||
denormalizationContext:
|
||||
groups: ['command-task-script:write']
|
||||
operations:
|
||||
ApiPlatform\Metadata\GetCollection:
|
||||
provider: App\State\Provider\CommandTaskScriptProvider
|
||||
filters:
|
||||
- 'api_platform.filter.command_task_script.order'
|
||||
- 'api_platform.filter.command_task_script.search'
|
||||
- 'api_platform.filter.command_task_script.boolean'
|
||||
|
||||
ApiPlatform\Metadata\Get:
|
||||
provider: App\State\Provider\CommandTaskScriptProvider
|
||||
ApiPlatform\Metadata\Put:
|
||||
provider: App\State\Provider\CommandTaskScriptProvider
|
||||
ApiPlatform\Metadata\Patch:
|
||||
provider: App\State\Provider\CommandTaskScriptProvider
|
||||
ApiPlatform\Metadata\Post: ~
|
||||
ApiPlatform\Metadata\Delete: ~
|
||||
|
||||
properties:
|
||||
App\Entity\CommandTaskScript:
|
||||
id:
|
||||
identifier: false
|
||||
uuid:
|
||||
identifier: true
|
|
@ -0,0 +1,50 @@
|
|||
resources:
|
||||
App\Entity\GitImageRepository:
|
||||
processor: App\State\Processor\GitImageRepositoryProcessor
|
||||
input: App\Dto\Input\GitImageRepositoryInput
|
||||
output: App\Dto\Output\GitImageRepositoryOutput
|
||||
normalizationContext:
|
||||
groups: ['default', 'git-image-repository:read']
|
||||
denormalizationContext:
|
||||
groups: ['git-image-repository:write']
|
||||
operations:
|
||||
ApiPlatform\Metadata\GetCollection:
|
||||
provider: App\State\Provider\GitImageRepositoryProvider
|
||||
filters:
|
||||
- 'api_platform.filter.image_image_repository.order'
|
||||
- 'api_platform.filter.image_image_repository.search'
|
||||
|
||||
ApiPlatform\Metadata\Get:
|
||||
provider: App\State\Provider\GitImageRepositoryProvider
|
||||
ApiPlatform\Metadata\Put:
|
||||
provider: App\State\Provider\GitImageRepositoryProvider
|
||||
ApiPlatform\Metadata\Patch:
|
||||
provider: App\State\Provider\GitImageRepositoryProvider
|
||||
ApiPlatform\Metadata\Post: ~
|
||||
ApiPlatform\Metadata\Delete: ~
|
||||
|
||||
get_image_ogrepository:
|
||||
shortName: OgRepository Server
|
||||
description: Get image in OgRepository
|
||||
class: ApiPlatform\Metadata\Get
|
||||
method: GET
|
||||
input: false
|
||||
uriTemplate: /image-image-repositories/server/{uuid}/get
|
||||
controller: App\Controller\OgRepository\Image\GetAction
|
||||
|
||||
get_image_tags:
|
||||
shortName: OgRepository Server
|
||||
description: Get image tags in OgRepository
|
||||
class: ApiPlatform\Metadata\Get
|
||||
method: GET
|
||||
input: false
|
||||
uriTemplate: /git-image-repositories/server/{uuid}/get-tags
|
||||
controller: App\Controller\OgRepository\Git\GetTagsAction
|
||||
|
||||
|
||||
properties:
|
||||
App\Entity\GitImageRepository:
|
||||
id:
|
||||
identifier: false
|
||||
uuid:
|
||||
identifier: true
|
|
@ -56,6 +56,22 @@ resources:
|
|||
uriTemplate: /image-image-repositories/{uuid}/backup-image
|
||||
controller: App\Controller\OgRepository\Image\BackupImageAction
|
||||
|
||||
convert_image_to_virtual_image_ogrepository:
|
||||
shortName: OgRepository Server
|
||||
class: ApiPlatform\Metadata\Post
|
||||
method: POST
|
||||
input: App\Dto\Input\ConvertImageToVirtualInput
|
||||
uriTemplate: /image-image-repositories/{uuid}/convert-image-to-virtual
|
||||
controller: App\Controller\OgRepository\Image\ConvertImageToVirtualAction
|
||||
|
||||
rename_image_ogrepository:
|
||||
shortName: OgRepository Server
|
||||
class: ApiPlatform\Metadata\Post
|
||||
method: POST
|
||||
input: App\Dto\Input\RenameImageInput
|
||||
uriTemplate: /image-image-repositories/{uuid}/rename-image
|
||||
controller: App\Controller\OgRepository\Image\RenameAction
|
||||
|
||||
trash_delete_image_ogrepository:
|
||||
shortName: OgRepository Server
|
||||
description: Delete Image in OgRepository
|
||||
|
@ -88,7 +104,7 @@ resources:
|
|||
description: Export Image in OgRepository
|
||||
class: ApiPlatform\Metadata\Post
|
||||
method: POST
|
||||
input: App\Dto\Input\ExportImportImageRepositoryInput
|
||||
input: App\Dto\Input\TransferGlobalImageInput
|
||||
uriTemplate: /image-image-repositories/{uuid}/transfer-image
|
||||
controller: App\Controller\OgRepository\Image\TransferAction
|
||||
|
||||
|
@ -101,6 +117,15 @@ resources:
|
|||
uriTemplate: /image-image-repositories/server/{uuid}/status
|
||||
controller: App\Controller\OgRepository\Image\GetStatusAction
|
||||
|
||||
transfer_global_image_repository:
|
||||
shortName: OgRepository Server
|
||||
description: Transfer Global Image in OgRepository
|
||||
class: ApiPlatform\Metadata\Post
|
||||
method: POST
|
||||
input: false
|
||||
uriTemplate: /image-image-repositories/server/{uuid}/transfer-global
|
||||
controller: App\Controller\OgRepository\Image\TransferGlobalAction
|
||||
|
||||
properties:
|
||||
App\Entity\ImageImageRepository:
|
||||
id:
|
||||
|
|
|
@ -30,7 +30,7 @@ resources:
|
|||
method: POST
|
||||
input: false
|
||||
uriTemplate: /image-repositories/server/{uuid}/sync
|
||||
controller: App\Controller\OgRepository\SyncAction
|
||||
controller: App\Controller\OgRepository\Image\SyncAction
|
||||
|
||||
wol_client:
|
||||
class: ApiPlatform\Metadata\Post
|
||||
|
@ -46,7 +46,7 @@ resources:
|
|||
method: POST
|
||||
input: false
|
||||
uriTemplate: /image-repositories/server/{uuid}/get-collection
|
||||
controller: App\Controller\OgRepository\GetCollectionAction
|
||||
controller: App\Controller\OgRepository\Image\GetCollectionAction
|
||||
|
||||
images_ogrepository_status:
|
||||
shortName: OgRepository Server
|
||||
|
@ -57,14 +57,40 @@ resources:
|
|||
uriTemplate: /image-repositories/server/{uuid}/status
|
||||
controller: App\Controller\OgRepository\StatusAction
|
||||
|
||||
export_image_ogrepository:
|
||||
import_image_ogrepository:
|
||||
shortName: OgRepository Server
|
||||
description: Export Image in OgRepository
|
||||
class: ApiPlatform\Metadata\Post
|
||||
method: POST
|
||||
input: App\Dto\Input\ExportImportImageRepositoryInput
|
||||
uriTemplate: /image-repositories/{uuid}/export-image
|
||||
controller: App\Controller\OgRepository\Image\ExportAction
|
||||
input: App\Dto\Input\ImportImageRepositoryInput
|
||||
uriTemplate: /image-repositories/{uuid}/import-image
|
||||
controller: App\Controller\OgRepository\Image\ImportAction
|
||||
|
||||
convert_image_ogrepository:
|
||||
shortName: OgRepository Server
|
||||
description: Convert Image in OgRepository
|
||||
class: ApiPlatform\Metadata\Post
|
||||
method: POST
|
||||
input: App\Dto\Input\ConvertImageRepositoryInput
|
||||
uriTemplate: /image-repositories/{uuid}/convert-image
|
||||
controller: App\Controller\OgRepository\Image\ConvertAction
|
||||
|
||||
get_collection_images_oggit:
|
||||
shortName: OgRepository Server
|
||||
description: Get collection of image in OgRepository
|
||||
class: ApiPlatform\Metadata\Post
|
||||
method: POST
|
||||
input: false
|
||||
uriTemplate: /image-repositories/server/git/{uuid}/get-collection
|
||||
controller: App\Controller\OgRepository\Git\GetCollectionAction
|
||||
|
||||
git_image_ogrepository_sync:
|
||||
shortName: OgRepository Server
|
||||
class: ApiPlatform\Metadata\Post
|
||||
method: POST
|
||||
input: false
|
||||
uriTemplate: /image-repositories/server/git/{uuid}/sync
|
||||
controller: App\Controller\OgRepository\Git\SyncAction
|
||||
|
||||
properties:
|
||||
App\Entity\ImageRepository:
|
||||
|
|
|
@ -4,6 +4,7 @@ resources:
|
|||
input: App\Dto\Input\PartitionPostInput
|
||||
output: App\Dto\Output\PartitionOutput
|
||||
order:
|
||||
diskNumber: 'ASC'
|
||||
partitionNumber: 'ASC'
|
||||
normalizationContext:
|
||||
groups: ['default', 'partition:read']
|
||||
|
|
|
@ -13,6 +13,7 @@ resources:
|
|||
filters:
|
||||
- 'api_platform.filter.software.order'
|
||||
- 'api_platform.filter.software.search'
|
||||
- 'software.software_profile_filter'
|
||||
|
||||
ApiPlatform\Metadata\Get:
|
||||
provider: App\State\Provider\SoftwareProvider
|
||||
|
|
|
@ -9,6 +9,8 @@ resources:
|
|||
filters:
|
||||
- 'api_platform.filter.trace.order'
|
||||
- 'api_platform.filter.trace.search'
|
||||
- 'api_platform.filter.trace.date'
|
||||
|
||||
ApiPlatform\Metadata\Get:
|
||||
provider: App\State\Provider\TraceProvider
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ framework:
|
|||
handler_id: null
|
||||
cookie_secure: auto
|
||||
cookie_samesite: lax
|
||||
storage_factory_id: session.storage.factory.native
|
||||
|
||||
#esi: true
|
||||
#fragments: true
|
||||
|
|
|
@ -15,6 +15,12 @@ when@dev:
|
|||
type: console
|
||||
process_psr_3_messages: false
|
||||
channels: ["!event", "!doctrine", "!console"]
|
||||
syslog:
|
||||
type: syslog
|
||||
ident: "ogcore"
|
||||
level: info
|
||||
formatter: App\Formatter\CustomLineFormatter
|
||||
channels: ["!event"]
|
||||
|
||||
when@test:
|
||||
monolog:
|
||||
|
@ -42,6 +48,12 @@ when@prod:
|
|||
type: console
|
||||
process_psr_3_messages: false
|
||||
channels: ["!event", "!doctrine"]
|
||||
syslog:
|
||||
type: syslog
|
||||
ident: "ogcore"
|
||||
level: info
|
||||
formatter: App\Formatter\CustomLineFormatter
|
||||
channels: ["!event"]
|
||||
deprecation:
|
||||
type: stream
|
||||
channels: [deprecation]
|
||||
|
|
|
@ -33,6 +33,7 @@ security:
|
|||
- { path: ^/og-repository/webhook, roles: PUBLIC_ACCESS }
|
||||
- { path: ^/og-lives/install/webhook, roles: PUBLIC_ACCESS }
|
||||
- { path: ^/auth/refresh, roles: PUBLIC_ACCESS }
|
||||
- { path: ^/validate, roles: PUBLIC_ACCESS }
|
||||
- { path: ^/menu-browser, roles: PUBLIC_ACCESS }
|
||||
- { path: ^/menu/, roles: PUBLIC_ACCESS }
|
||||
- { path: ^/, roles: IS_AUTHENTICATED_FULLY }
|
||||
|
|
|
@ -14,4 +14,4 @@ when@test:
|
|||
intercept_redirects: false
|
||||
|
||||
framework:
|
||||
profiler: { collect: false }
|
||||
profiler: { collect: false }
|
|
@ -156,3 +156,18 @@ services:
|
|||
bind:
|
||||
$collectionProvider: '@api_platform.doctrine.orm.state.collection_provider'
|
||||
$itemProvider: '@api_platform.doctrine.orm.state.item_provider'
|
||||
|
||||
App\State\Provider\CommandTaskScheduleProvider:
|
||||
bind:
|
||||
$collectionProvider: '@api_platform.doctrine.orm.state.collection_provider'
|
||||
$itemProvider: '@api_platform.doctrine.orm.state.item_provider'
|
||||
|
||||
App\State\Provider\CommandTaskScriptProvider:
|
||||
bind:
|
||||
$collectionProvider: '@api_platform.doctrine.orm.state.collection_provider'
|
||||
$itemProvider: '@api_platform.doctrine.orm.state.item_provider'
|
||||
|
||||
App\State\Provider\GitImageRepositoryProvider:
|
||||
bind:
|
||||
$collectionProvider: '@api_platform.doctrine.orm.state.collection_provider'
|
||||
$itemProvider: '@api_platform.doctrine.orm.state.item_provider'
|
||||
|
|
|
@ -41,6 +41,52 @@ services:
|
|||
tags: [ 'api_platform.filter' ]
|
||||
|
||||
api_platform.filter.command.boolean:
|
||||
parent: 'api_platform.doctrine.orm.boolean_filter'
|
||||
arguments: [ { 'enabled': ~, 'readOnly': ~ } ]
|
||||
tags: [ 'api_platform.filter' ]
|
||||
|
||||
api_platform.filter.command_task.order:
|
||||
parent: 'api_platform.doctrine.orm.order_filter'
|
||||
arguments:
|
||||
$properties: { 'id': ~, 'name': ~ }
|
||||
$orderParameterName: 'order'
|
||||
tags: [ 'api_platform.filter' ]
|
||||
|
||||
api_platform.filter.command_task.search:
|
||||
parent: 'api_platform.doctrine.orm.search_filter'
|
||||
arguments: [ { 'id': 'exact', 'name': 'partial' } ]
|
||||
tags: [ 'api_platform.filter' ]
|
||||
|
||||
api_platform.filter.command_task_schedule.order:
|
||||
parent: 'api_platform.doctrine.orm.order_filter'
|
||||
arguments:
|
||||
$properties: { 'id': ~, 'name': ~ }
|
||||
$orderParameterName: 'order'
|
||||
tags: [ 'api_platform.filter' ]
|
||||
|
||||
api_platform.filter.command_task_schedule.search:
|
||||
parent: 'api_platform.doctrine.orm.search_filter'
|
||||
arguments: [ { 'id': 'exact', 'name': 'partial', 'commandTask.id': 'exact' } ]
|
||||
tags: [ 'api_platform.filter' ]
|
||||
|
||||
api_platform.filter.command_task_schedule.boolean:
|
||||
parent: 'api_platform.doctrine.orm.boolean_filter'
|
||||
arguments: [ { 'enabled': ~} ]
|
||||
tags: [ 'api_platform.filter' ]
|
||||
|
||||
api_platform.filter.command_task_script.order:
|
||||
parent: 'api_platform.doctrine.orm.order_filter'
|
||||
arguments:
|
||||
$properties: { 'id': ~, 'name': ~ }
|
||||
$orderParameterName: 'order'
|
||||
tags: [ 'api_platform.filter' ]
|
||||
|
||||
api_platform.filter.command_task_script.search:
|
||||
parent: 'api_platform.doctrine.orm.search_filter'
|
||||
arguments: [ { 'id': 'exact', 'name': 'partial', 'commandTask.id': 'exact' } ]
|
||||
tags: [ 'api_platform.filter' ]
|
||||
|
||||
api_platform.filter.command_task_script.boolean:
|
||||
parent: 'api_platform.doctrine.orm.boolean_filter'
|
||||
arguments: [ { 'enabled': ~ } ]
|
||||
tags: [ 'api_platform.filter' ]
|
||||
|
@ -61,7 +107,7 @@ services:
|
|||
|
||||
api_platform.filter.image.search:
|
||||
parent: 'api_platform.doctrine.orm.search_filter'
|
||||
arguments: [ { 'id': 'exact', 'name': 'partial', 'repository.id': 'exact', status: 'exact'} ]
|
||||
arguments: [ { 'id': 'exact', 'name': 'partial', 'repository.id': 'exact', status: 'exact', type: 'exact' } ]
|
||||
tags: [ 'api_platform.filter' ]
|
||||
|
||||
api_platform.filter.image.boolean:
|
||||
|
@ -73,6 +119,10 @@ services:
|
|||
parent: 'App\Filter\ImageSearchRepositoryFilter'
|
||||
tags: [ 'api_platform.filter' ]
|
||||
|
||||
software.software_profile_filter:
|
||||
parent: 'App\Filter\SoftwareProfileSearchSoftwareFilter'
|
||||
tags: [ 'api_platform.filter' ]
|
||||
|
||||
api_platform.filter.og_live.order:
|
||||
parent: 'api_platform.doctrine.orm.order_filter'
|
||||
arguments:
|
||||
|
@ -82,7 +132,7 @@ services:
|
|||
|
||||
api_platform.filter.og_live.search:
|
||||
parent: 'api_platform.doctrine.orm.search_filter'
|
||||
arguments: [ { 'id': 'exact', 'name': 'partial', } ]
|
||||
arguments: [ { 'id': 'exact', 'name': 'partial', 'status': 'exact' } ]
|
||||
tags: [ 'api_platform.filter' ]
|
||||
|
||||
api_platform.filter.og_live.boolean:
|
||||
|
@ -167,7 +217,7 @@ services:
|
|||
|
||||
api_platform.filter.pxe_template.boolean:
|
||||
parent: 'api_platform.doctrine.orm.boolean_filter'
|
||||
arguments: [ { 'synchronized': ~ } ]
|
||||
arguments: [ { 'synchronized': ~, 'isDefault': ~ } ]
|
||||
tags: [ 'api_platform.filter' ]
|
||||
|
||||
api_platform.filter.remote_calendar.order:
|
||||
|
@ -231,7 +281,7 @@ services:
|
|||
|
||||
api_platform.filter.software_profile.search:
|
||||
parent: 'api_platform.doctrine.orm.search_filter'
|
||||
arguments: [ { 'id': 'exact', 'description': 'partial' } ]
|
||||
arguments: [ { 'id': 'exact', 'description': 'partial'} ]
|
||||
tags: [ 'api_platform.filter' ]
|
||||
|
||||
api_platform.filter.subnet.order:
|
||||
|
@ -248,7 +298,7 @@ services:
|
|||
|
||||
api_platform.filter.trace.search:
|
||||
parent: 'api_platform.doctrine.orm.search_filter'
|
||||
arguments: [ { 'id': 'exact', 'command.id': 'exact', 'client.id': 'exact', status: 'exact' } ]
|
||||
arguments: [ { 'id': 'exact', 'command': 'exact', 'client.id': 'exact', status: 'exact' } ]
|
||||
tags: [ 'api_platform.filter' ]
|
||||
|
||||
api_platform.filter.trace.order:
|
||||
|
@ -258,6 +308,11 @@ services:
|
|||
$orderParameterName: 'order'
|
||||
tags: [ 'api_platform.filter' ]
|
||||
|
||||
api_platform.filter.trace.date:
|
||||
parent: 'api_platform.doctrine.orm.date_filter'
|
||||
arguments: [ { 'executedAt': ~, 'createdAt': ~ } ]
|
||||
tags: [ 'api_platform.filter' ]
|
||||
|
||||
api_platform.filter.user.order:
|
||||
parent: 'api_platform.doctrine.orm.order_filter'
|
||||
arguments:
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
# Changelog
|
||||
|
||||
## [Unreleased]
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
ogcore (0.9.2-1) unstable; urgency=medium
|
||||
|
||||
* Added mercure service in docker compose file for deployments.
|
||||
|
||||
-- Manuel Aranda <maranda@qindel.com> Wed, 12 Mar 2025 14:00:00 +0200
|
||||
|
||||
ogcore (0.9.1-1) unstable; urgency=medium
|
||||
|
||||
* Corrección en la cancelación de transmisiones p2p.
|
||||
|
||||
-- Manuel Aranda <maranda@qindel.com> Wed, 12 Mar 2025 13:00:00 +0200
|
||||
|
||||
ogcore (0.9.0-1) unstable; urgency=medium
|
||||
|
||||
* Nueva funcionalidad para tener notificaciones en tiempo real. Instalación de bundle "Mercure".
|
||||
* Creación de EventListener en Symfony, para publicar mensajes en Mercure cuando se realicen cambios en la base de datos.
|
||||
* Nuevo endpoint "backup image". Integración con ogRepository.
|
||||
* Nuevo campo en "usuarios" para escoger la visualización por defecto de la vista "grupos".
|
||||
* Nuevo campo "dns" en "subredes" para gestionar los servidores DNS.
|
||||
* Integración de endpoint ogRepository para verificar la integridad de una imagen.
|
||||
* Nueva funcionalidad para cancelar despliegues de imágenes.
|
||||
* Añadido nuevo campo "cancelado" en trazas.
|
||||
* Cambios en logs: salida redirigida de stderr a file.log.
|
||||
* Modificación en módulo DHCP: gestión de equipos con una única llamada a la API.
|
||||
* Cambios en las respuestas de acciones masivas en equipos para evitar fallos en peticiones parciales.
|
||||
|
||||
-- Manuel Aranda <maranda@qindel.com> Tue, 04 Mar 2025 15:00:00 +0200
|
||||
|
||||
ogcore (0.8.1-1) unstable; urgency=medium
|
||||
|
||||
* Corrección de bug en el deploy de imágenes.
|
||||
|
||||
-- Manuel Aranda <maranda@qindel.com> Tue, 25 Feb 2025 10:00:00 +0200
|
||||
|
||||
ogcore (0.8.0-1) unstable; urgency=medium
|
||||
|
||||
* Nuevos campos en "aulas" para la jerarquía en clientes.
|
||||
* Nueva funcionalidad "imagen global". Integración con ogRepository.
|
||||
* Limpieza en campos "name" y "date" de ogLive. Ahora se parsea el campo "filename" para mejorar la experiencia del usuario.
|
||||
* Corrección de bug que impedía borrar un cliente si tenía una traza enlazada.
|
||||
|
||||
-- Manuel Aranda <maranda@qindel.com> Fri, 10 Jan 2025 12:00:00 +0200
|
||||
|
||||
ogcore (0.7.3-1) unstable; urgency=medium
|
||||
|
||||
* Adaptados cambios en los endpoints para multiselección de clientes.
|
||||
* Se agregó la funcionalidad de importar/exportar. Integración con ogRepository.
|
||||
* Se agregó la funcionalidad de borrar imágenes. Integración con ogRepository.
|
||||
* Se agregó el modo "TORRENT" y "UDPCAST" en el despliegue de imágenes.
|
||||
* Refactorización del webhook de ogRepository.
|
||||
|
||||
-- Manuel Aranda <maranda@qindel.com> Fri, 03 Jan 2025 11:00:00 +0200
|
||||
|
|
@ -0,0 +1 @@
|
|||
12
|
|
@ -0,0 +1,16 @@
|
|||
Source: ogcore
|
||||
Section: web
|
||||
Priority: optional
|
||||
Maintainer: Nicolas Arenas <nicolas.arenas@qindel.com>
|
||||
Build-Depends: debhelper (>= 12), composer, php-cli, php-mysql, php-fpm, libzip-dev, zip, unzip
|
||||
Standards-Version: 4.5.0
|
||||
|
||||
Package: ogcore
|
||||
Architecture: all
|
||||
Depends: ${misc:Depends}, mariadb-server, systemd, nginx, libzip-dev, zip, unzip,
|
||||
php8.3-opcache, php8.3-bcmath, php8.3-cli, php8.3-curl, php8.3-fpm,
|
||||
php8.3-gd, php8.3-ldap, php8.3-mbstring, php8.3-mysql, php8.3-common,
|
||||
php8.3-xml, php8.3-zip, mercure
|
||||
Description: OpenGnsys Core
|
||||
OgCore package is responsible about management of Opengnsys platform
|
||||
OpenGnsys Core is a platform for system management.
|
|
@ -0,0 +1,21 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -x
|
||||
INPUT_FILE="changelog"
|
||||
OUTPUT_FILE="CHANGELOG.md"
|
||||
|
||||
echo "# Changelog" > "$OUTPUT_FILE"
|
||||
echo -e "\n## [Unreleased]\n" >> "$OUTPUT_FILE"
|
||||
|
||||
# Procesar el changelog de Debian
|
||||
awk '
|
||||
/^ogcore/ {
|
||||
version = $2
|
||||
gsub(/[()]/, "", version) # Eliminar paréntesis de la versión
|
||||
printf "\n## [%s] - %s\n\n", version, $NF
|
||||
}
|
||||
/^\s*\*/ {
|
||||
gsub(/^\s*\*\s*/, "- ", $0) # Convertir a lista de viñetas
|
||||
print $0 >> "'"$OUTPUT_FILE"'"
|
||||
}
|
||||
' "$INPUT_FILE"
|
|
@ -0,0 +1,43 @@
|
|||
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Source: <url://example.com>
|
||||
Upstream-Name: ogcore
|
||||
Upstream-Contact: <preferred name and address to reach the upstream project>
|
||||
|
||||
Files:
|
||||
*
|
||||
Copyright:
|
||||
<years> <put author's name and email here>
|
||||
<years> <likewise for another author>
|
||||
License: GPL-3.0+
|
||||
|
||||
Files:
|
||||
debian/*
|
||||
Copyright:
|
||||
2025 root <root@build>
|
||||
License: GPL-3.0+
|
||||
|
||||
License: GPL-3.0+
|
||||
This program 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 program. If not, see <https://www.gnu.org/licenses/>.
|
||||
Comment:
|
||||
On Debian systems, the complete text of the GNU General
|
||||
Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
|
||||
|
||||
# Please also look if there are files or directories which have a
|
||||
# different copyright/license attached and list them here.
|
||||
# Please avoid picking licenses with terms that are more restrictive than the
|
||||
# packaged work, as it may make Debian's contributions unacceptable upstream.
|
||||
#
|
||||
# If you need, there are some extra license texts available in two places:
|
||||
# /usr/share/debhelper/dh_make/licenses/
|
||||
# /usr/share/common-licenses/
|
|
@ -0,0 +1 @@
|
|||
ogcore
|
|
@ -0,0 +1,2 @@
|
|||
ogcore_1.0.5+develop20250310-1_all.deb web optional
|
||||
ogcore_1.0.5+develop20250310-1_amd64.buildinfo web optional
|
|
@ -0,0 +1,18 @@
|
|||
bin/* /opt/opengnsys/ogcore/api/bin/
|
||||
config/* /opt/opengnsys/ogcore/api/config/
|
||||
migrations/* /opt/opengnsys/ogcore/api/migrations/
|
||||
public/* /opt/opengnsys/ogcore/api/public/
|
||||
src/* /opt/opengnsys/ogcore/api/src/
|
||||
swagger-assets/* /opt/opengnsys/ogcore/api/swagger-assets/
|
||||
templates/* /opt/opengnsys/ogcore/api/templates/
|
||||
translations/* /opt/opengnsys/ogcore/api/translations/
|
||||
var/* /opt/opengnsys/ogcore/api/var/
|
||||
vendor/* /opt/opengnsys/ogcore/api/vendor/
|
||||
composer.json /opt/opengnsys/ogcore/api/
|
||||
composer.lock /opt/opengnsys/ogcore/api/
|
||||
symfony.lock /opt/opengnsys/ogcore/api/
|
||||
.env.local.php /opt/opengnsys/ogcore/api/
|
||||
env.json /opt/opengnsys/ogcore/api/
|
||||
etc /opt/opengnsys/ogcore/
|
||||
docker/certs/* /opt/opengnsys/ogcore/etc/nginx/certs/
|
||||
|
|
@ -0,0 +1,160 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
set -x
|
||||
. /usr/share/debconf/confmodule
|
||||
|
||||
restore_config_if_modified() {
|
||||
local new="$1"
|
||||
local backup="$1.bak"
|
||||
|
||||
if [ -f "$backup" ]; then
|
||||
if ! cmp -s "$new" "$backup"; then
|
||||
echo ">>> Archivo modificado por el usuario detectado en $new"
|
||||
echo " - Guardando archivo nuevo como ${new}.new"
|
||||
mv -f "$new" "${new}.new"
|
||||
echo " - Restaurando archivo anterior desde backup"
|
||||
mv -f "$backup" "$new"
|
||||
else
|
||||
echo ">>> El archivo $new no ha cambiado desde la última versión, eliminando backup"
|
||||
rm -f "$backup"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
USER="opengnsys"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Detectar si es una instalación nueva o una actualización
|
||||
if [ "$1" = "configure" ] && [ -z "$2" ]; then
|
||||
# Detectar IP de la interfaz de red asociad a la ruta por defecto.
|
||||
|
||||
IP=$(ip -4 route get 8.8.8.8 | grep -oP '(?<=src )[\d.]+')
|
||||
echo ">>> Instalación nueva detectada."
|
||||
|
||||
# Solicitar credenciales solo en instalación nueva
|
||||
db_input high opengnsys/ogcore_adminUser || true
|
||||
db_go
|
||||
db_get opengnsys/ogcore_adminUser
|
||||
ADMIN_USER="$RET"
|
||||
|
||||
db_input high opengnsys/ogcore_adminPass || true
|
||||
db_go
|
||||
db_get opengnsys/ogcore_adminPass
|
||||
ADMIN_PASS="$RET"
|
||||
|
||||
cd /opt/opengnsys/ogcore/api
|
||||
|
||||
# Configuración inicial
|
||||
echo ">>> Configurando base de datos y permisos"
|
||||
mariadb -e "ALTER USER 'root'@'localhost' IDENTIFIED VIA unix_socket OR mysql_native_password USING PASSWORD('root');"
|
||||
|
||||
|
||||
echo ">>> Creando par de claves para JWT"
|
||||
php bin/console lexik:jwt:generate-keypair --overwrite
|
||||
|
||||
echo ">>> Creando base de datos"
|
||||
php bin/console doctrine:database:create --if-not-exists
|
||||
php bin/console doctrine:migrations:migrate --no-interaction
|
||||
|
||||
echo ">>> Cargando datos iniciales"
|
||||
php bin/console opengnsys:load-default-user
|
||||
php bin/console app:load-default-user-groups
|
||||
php bin/console app:load-default-commands
|
||||
php bin/console opengnsys:load-default-menu
|
||||
|
||||
echo ">>> Configurando servidor web y servicios"
|
||||
ln -s /opt/opengnsys/ogcore/etc/nginx/sites-available/ogcore.conf /etc/nginx/sites-enabled/ogcore.conf
|
||||
ln -s /opt/opengnsys/ogcore/etc/nginx/sites-available/mercure.conf /etc/nginx/sites-enabled/mercure.conf
|
||||
ln -s /opt/opengnsys/ogcore/etc/php/8.3/fpm/pool.d/ogcore-fpm.conf /etc/php/8.3/fpm/pool.d/ogcore-fpm.conf
|
||||
ln -s /opt/opengnsys/ogcore/etc/systemd/system/og-mercure.service /etc/systemd/system/og-mercure.service
|
||||
|
||||
echo ">>> Configurando permisos de archivos"
|
||||
chown opengnsys:www-data /opt/opengnsys/
|
||||
chown -R opengnsys:www-data /opt/opengnsys/ogcore
|
||||
systemctl daemon-reload
|
||||
systemctl enable og-mercure
|
||||
systemctl restart og-mercure
|
||||
systemctl restart nginx
|
||||
systemctl restart php8.3-fpm
|
||||
|
||||
#Obteniendo bearer token
|
||||
BEARER=$(curl -sk -X 'POST' 'https://localhost:8443/auth/login' \
|
||||
-H 'accept: application/json' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{ "username": "ogadmin", "password": "12345678" }' | jq -r .token)
|
||||
# Creando nuevo repo
|
||||
curl -skL -X POST 'https://localhost:8443/image-repositories' \
|
||||
-H "Authorization: Bearer $BEARER" \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d "{ \"name\": \"Repository 1\", \"ip\": \"$IP\", \"comments\": \"Repositorio creado automaticamente por oginstaller\" }"
|
||||
# Solo gestionar credenciales en instalación nueva
|
||||
if [ "$ADMIN_USER" == "ogadmin" ]; then
|
||||
echo ">>> Cambiando contraseña de ogadmin"¡
|
||||
OGADMIN_UUID=$(curl -skL "https://localhost:8443/users/?username=ogadmin" \
|
||||
-H 'accept: application/json' \
|
||||
-H "Authorization: Bearer $BEARER" | jq -r '.[0].uuid')
|
||||
curl -skL -X PUT "https://localhost:8443/users/$OGADMIN_UUID/reset-password" \
|
||||
-H 'accept: application/ld+json' \
|
||||
-H 'Content-Type: application/ld+json' \
|
||||
-H "Authorization: Bearer $BEARER" \
|
||||
-d "{ \"currentPassword\": \"12345678\", \"newPassword\": \"$ADMIN_PASS\", \"repeatNewPassword\": \"$ADMIN_PASS\" }"
|
||||
echo ">>> Contraseña de ogadmin cambiada."
|
||||
else
|
||||
echo ">>> Creando nuevo usuario administrador: $ADMIN_USER"
|
||||
curl -skL --location 'https://localhost:8443/users' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--header "Authorization: Bearer $BEARER" \
|
||||
--data "{ \"username\": \"$ADMIN_USER\", \"password\": \"$ADMIN_PASS\", \"roles\": [\"ROLE_SUPER_ADMIN\"] }"
|
||||
|
||||
echo ">>> Usuario administrador $ADMIN_USER creado."
|
||||
fi
|
||||
# Install crontab
|
||||
echo ">>> Configurando cron para comprobar disponibilidad de clientes"
|
||||
cp /opt/opengnsys/ogcore/etc/cron.d/opengnsys-check-clients /etc/cron.d/opengnsys-check-clients
|
||||
chmod 644 /etc/cron.d/opengnsys-check-clients
|
||||
chown root:root /etc/cron.d/opengnsys-check-clients
|
||||
|
||||
elif [ "$1" = "configure" ] && [ -n "$2" ]; then
|
||||
echo ">>> Actualización detectada desde la versión $2"
|
||||
|
||||
# Restaurar archivos de configuración si han sido modificados
|
||||
restore_config_if_modified "/opt/opengnsys/ogcore/etc/nginx/sites-available/ogcore.conf"
|
||||
restore_config_if_modified "/opt/opengnsys/ogcore/etc/nginx/sites-available/mercure.conf"
|
||||
restore_config_if_modified "/opt/opengnsys/ogcore/etc/php/8.3/fpm/pool.d/ogcore-fpm.conf"
|
||||
restore_config_if_modified "/opt/opengnsys/ogcore/etc/systemd/system/og-mercure.service"
|
||||
restore_config_if_modified "/opt/opengnsys/ogcore/api/env.json"
|
||||
|
||||
cd /opt/opengnsys/ogcore/api
|
||||
echo ">>> Aplicando migraciones de base de datos"
|
||||
php bin/console doctrine:migrations:migrate --no-interaction
|
||||
echo ">>> Configurando servidor web y servicios"
|
||||
[ ! -L /etc/nginx/sites-enabled/ogcore.conf ] && ln -s /opt/opengnsys/ogcore/etc/nginx/sites-available/ogcore.conf /etc/nginx/sites-enabled/ogcore.conf
|
||||
[ ! -L /etc/php/8.3/fpm/pool.d/ogcore-fpm.conf ] && ln -s /opt/opengnsys/ogcore/etc/php/8.3/fpm/pool.d/ogcore-fpm.conf /etc/php/8.3/fpm/pool.d/ogcore-fpm.conf
|
||||
[ ! -L /etc/systemd/system/og-mercure.service ] && ln -s /opt/opengnsys/ogcore/etc/systemd/system/og-mercure.service /etc/systemd/system/og-mercure.service
|
||||
echo ">>> Configurando permisos de archivos"
|
||||
chown opengnsys:www-data /opt/opengnsys/
|
||||
chown -R opengnsys:www-data /opt/opengnsys/ogcore
|
||||
if [ ! -f /etc/cron.d/opengnsys-check-clients ]; then
|
||||
echo ">>> Configurando cron para comprobar disponibilidad de clientes"
|
||||
cp /opt/opengnsys/ogcore/etc/cron.d/opengnsys-check-clients /etc/cron.d/opengnsys-check-clients
|
||||
chmod 644 /etc/cron.d/opengnsys-check-clients
|
||||
chown root:root /etc/cron.d/opengnsys-check-clients
|
||||
else
|
||||
echo ">>> El archivo de cron ya existe, no se realizan cambios se ajustan permisos"
|
||||
chmod 644 /etc/cron.d/opengnsys-check-clients
|
||||
chown root:root /etc/cron.d/opengnsys-check-clients
|
||||
fi
|
||||
systemctl daemon-reload
|
||||
systemctl enable og-mercure
|
||||
systemctl restart og-mercure
|
||||
systemctl restart nginx
|
||||
systemctl restart php8.3-fpm
|
||||
fi
|
||||
# Recargar systemd y reiniciar servicios en ambos casos
|
||||
|
||||
|
||||
exit 0
|
|
@ -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
|
|
@ -0,0 +1,42 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
backup_file_if_exists() {
|
||||
local original="$1"
|
||||
local backup="$1.bak"
|
||||
|
||||
if [ -e "$original" ]; then
|
||||
echo " - Guardando backup de $original en $backup"
|
||||
cp -a "$original" "$backup"
|
||||
fi
|
||||
}
|
||||
|
||||
CONFIG_FILE="/opt/opengnsys/ogcore/api/env.json"
|
||||
BACKUP_FILE="/opt/opengnsys/ogcore/api/env.json.bak"
|
||||
|
||||
# Asegurarse de que el usuario exista
|
||||
USER="opengnsys"
|
||||
HOME_DIR="/opt/opengnsys"
|
||||
if id "$USER" &>/dev/null; then
|
||||
echo "El usuario $USER ya existe."
|
||||
else
|
||||
echo "Creando el usuario $USER con home en $HOME_DIR."
|
||||
useradd -m -d "$HOME_DIR" -s /bin/bash "$USER"
|
||||
fi
|
||||
|
||||
CONFIG_FILE="/opt/opengnsys/ogcore/api/env.json"
|
||||
BACKUP_FILE="/opt/opengnsys/ogcore/api/env.json.bak"
|
||||
|
||||
# Solo hacemos backup si el archivo existe y es una actualización (posición 1 = upgrade)
|
||||
if [ "$1" = "upgrade" ]; then
|
||||
echo ">>> Backup de archivos de configuración reales en /opt/opengnsys"
|
||||
backup_file_if_exists "/opt/opengnsys/ogcore/etc/nginx/sites-available/ogcore.conf"
|
||||
backup_file_if_exists "/opt/opengnsys/ogcore/etc/nginx/sites-available/mercure.conf"
|
||||
backup_file_if_exists "/opt/opengnsys/ogcore/etc/php/8.3/fpm/pool.d/ogcore-fpm.conf"
|
||||
backup_file_if_exists "/opt/opengnsys/ogcore/etc/systemd/system/og-mercure.service"
|
||||
backup_file_if_exists "/opt/opengnsys/ogcore/api/env.json"
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
if [ "$1" = "remove" ] || [ "$1" = "upgrade" ]; then
|
||||
# Eliminar enlaces simbólicos creados en postinst
|
||||
rm -f /etc/nginx/sites-enabled/ogcore.conf
|
||||
rm -f /etc/php/8.3/fpm/pool.d/ogcore-fpm.conf
|
||||
# Deshabilitar el servicio antes de eliminarlo
|
||||
systemctl disable og-mercure || true
|
||||
systemctl stop og-mercure || true
|
||||
systemctl restart nginx || true
|
||||
systemctl restart php8.3-fpm || true
|
||||
rm -f /etc/systemd/system/og-mercure.service
|
||||
systemctl daemon-reload
|
||||
fi
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,10 @@
|
|||
Template: opengnsys/ogcore_adminUser
|
||||
Type: string
|
||||
Default: ogadmin
|
||||
Description: Introduzca el nombre de usuario para la configuración
|
||||
|
||||
Template: opengnsys/ogcore_adminPass
|
||||
Type: password
|
||||
Default: 12345678
|
||||
Description: Introduzca la contraseña
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
#!/usr/bin/make -f
|
||||
|
||||
%:
|
||||
dh $@
|
||||
|
||||
# Ejecutar composer install durante la fase de construcción
|
||||
override_dh_auto_build:
|
||||
export COMPOSER_ALLOW_SUPERUSER=1
|
||||
export APP_ENV=prod
|
||||
dh_auto_build
|
||||
COMPOSER_ALLOW_SUPERUSER=1 APP_ENV=prod composer install --no-dev --no-interaction --no-progress --optimize-autoloader
|
||||
COMPOSER_ALLOW_SUPERUSER=1 APP_ENV=prod composer dump-env prod
|
|
@ -0,0 +1 @@
|
|||
3.0 (native)
|
|
@ -20,6 +20,7 @@ services:
|
|||
ports:
|
||||
- 8080:80
|
||||
- 8443:443
|
||||
- 3000:3000
|
||||
volumes:
|
||||
- ogpublic:/var/www/html/public:cached
|
||||
networks:
|
||||
|
@ -39,9 +40,32 @@ services:
|
|||
- ogcore-network
|
||||
image: opengnsys/ogcore-php:static
|
||||
|
||||
mercure:
|
||||
image: dunglas/mercure
|
||||
restart: unless-stopped
|
||||
container_name: ogcore-mercure
|
||||
environment:
|
||||
# Uncomment the following line to disable HTTPS,
|
||||
SERVER_NAME: ':3000'
|
||||
MERCURE_PUBLISHER_JWT_KEY: '!ChangeThisMercureHubJWTSecretKey!'
|
||||
MERCURE_SUBSCRIBER_JWT_KEY: '!ChangeThisMercureHubJWTSecretKey!'
|
||||
MERCURE_EXTRA_DIRECTIVES: |
|
||||
cors_origins *
|
||||
# Comment the following line to disable the development mode
|
||||
command: /usr/bin/caddy run --config /etc/caddy/dev.Caddyfile
|
||||
# ports:
|
||||
# - "3000:3000"
|
||||
volumes:
|
||||
- mercure_data:/data
|
||||
- mercure_config:/config
|
||||
networks:
|
||||
- ogcore-network
|
||||
|
||||
volumes:
|
||||
database_data:
|
||||
ogpublic:
|
||||
mercure_data:
|
||||
mercure_config:
|
||||
|
||||
|
||||
networks:
|
||||
|
|
|
@ -26,7 +26,8 @@ services:
|
|||
- 8443:443 # Añadir el puerto 443
|
||||
volumes:
|
||||
- ./public:/var/www/html/public:cached
|
||||
- ./docker/certs:/etc/nginx/certs # Montar certificados en Nginx
|
||||
- ./docker/certs:/etc/nginx/certs
|
||||
- ./certs:/opt/opengnsys/ogcore/etc/certificates
|
||||
networks:
|
||||
- ogcore-network
|
||||
|
||||
|
@ -37,6 +38,7 @@ services:
|
|||
dockerfile: ./docker/Dockerfile-php
|
||||
volumes:
|
||||
- ./:/var/www/html
|
||||
- ./certs:/opt/opengnsys/ogcore/etc/certificates
|
||||
depends_on:
|
||||
- database
|
||||
networks:
|
||||
|
|
|
@ -12,20 +12,11 @@ server {
|
|||
root /var/www/html/public;
|
||||
index index.html index.php;
|
||||
|
||||
#ssl_certificate /opt/opengnsys/ogcore/etc/certificates/ogcore.crt;
|
||||
#ssl_certificate_key /opt/opengnsys/ogcore/etc/certificates/ogcore.key;
|
||||
ssl_certificate /etc/nginx/certs/ogcore.uds-test.net.crt.pem;
|
||||
ssl_certificate_key /etc/nginx/certs/ogcore.uds-test.net.key.pem;
|
||||
|
||||
location /.well-known/mercure {
|
||||
proxy_pass https://mercure:3000/.well-known/mercure;
|
||||
proxy_read_timeout 24h;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Connection "";
|
||||
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
location /opengnsys/rest/ous// {
|
||||
rewrite ^/opengnsys/rest/ous//([0-9]+)/images /opengnsys/rest/ous/$1/images;
|
||||
rewrite ^/opengnsys/rest/ous//([0-9]+)/labs /opengnsys/rest/ous/$1/labs;
|
||||
|
@ -53,4 +44,31 @@ server {
|
|||
|
||||
error_log /var/log/nginx/error.log debug;
|
||||
access_log /var/log/nginx/access.log;
|
||||
|
||||
#ssl_client_certificate /opt/opengnsys/ogcore/etc/certificates/ca.crt;
|
||||
#ssl_verify_client on;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 3000 ssl http2;
|
||||
listen [::]:3000 ssl http2;
|
||||
|
||||
|
||||
ssl_certificate /etc/nginx/certs/ogcore.uds-test.net.crt.pem;
|
||||
ssl_certificate_key /etc/nginx/certs/ogcore.uds-test.net.key.pem;
|
||||
|
||||
location / {
|
||||
proxy_pass http://ogcore-mercure:3000/;
|
||||
proxy_read_timeout 24h;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Connection "";
|
||||
|
||||
# Enable fast reply in SSE
|
||||
proxy_buffering off;
|
||||
|
||||
## Be sure to set USE_FORWARDED_HEADERS=1 to allow the hub to use those headers ##
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Host $host;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
}
|
13
env.json
13
env.json
|
@ -1,12 +1,15 @@
|
|||
{
|
||||
"vars": {
|
||||
"OG_BOOT_API_URL": "192.168.68.51:8082",
|
||||
"OG_DHCP_API_URL": "192.168.68.51:8081",
|
||||
"OG_CORE_IP": "192.168.68.62",
|
||||
"OG_LOG_IP": "192.168.68.51",
|
||||
"OG_DHCP_API_URL": "127.0.0.1:8081",
|
||||
"OG_CORE_IP": "127.0.0.1",
|
||||
"OG_LOG_IP": "127.0.0.1",
|
||||
"UDS_AUTH_LOGIN": "test",
|
||||
"UDS_AUTH_USERNAME": "test",
|
||||
"UDS_AUTH_PASSWORD": "test",
|
||||
"UDS_URL": "https:\/\/localhost:8087\/uds\/rest\/"
|
||||
"UDS_URL": "https:\/\/localhost:8087\/uds\/rest\/",
|
||||
"SSL_ENABLED": "false",
|
||||
"OG_BOOT_IP": "127.0.0.1",
|
||||
"OG_BOOT_API_PORT": "8082",
|
||||
"OG_BOOT_PXE_PORT": "8082"
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
*/5 * * * * opengnsys php -d memory_limit=512M /opt/opengnsys/ogcore/api/bin/console opengnsys:check-client-availability >> /opt/opengnsys/ogcore/api/var/log/cron.log 2>&1
|
|
@ -0,0 +1,4 @@
|
|||
SERVER_NAME=":3001"
|
||||
MERCURE_PUBLISHER_JWT_KEY="!ChangeThisMercureHubJWTSecretKey!"
|
||||
MERCURE_SUBSCRIBER_JWT_KEY="!ChangeThisMercureHubJWTSecretKey!"
|
||||
MERCURE_EXTRA_DIRECTIVES="cors_origins *"
|
|
@ -0,0 +1,44 @@
|
|||
# Learn how to configure the Mercure.rocks Hub on https://mercure.rocks/docs/hub/config
|
||||
{
|
||||
{$GLOBAL_OPTIONS}
|
||||
}
|
||||
|
||||
{$CADDY_EXTRA_CONFIG}
|
||||
|
||||
{$SERVER_NAME:localhost} {
|
||||
log {
|
||||
format filter {
|
||||
fields {
|
||||
request>uri query {
|
||||
replace authorization REDACTED
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
encode zstd gzip
|
||||
|
||||
mercure {
|
||||
# Publisher JWT key
|
||||
publisher_jwt {env.MERCURE_PUBLISHER_JWT_KEY} {env.MERCURE_PUBLISHER_JWT_ALG}
|
||||
# Subscriber JWT key
|
||||
subscriber_jwt {env.MERCURE_SUBSCRIBER_JWT_KEY} {env.MERCURE_SUBSCRIBER_JWT_ALG}
|
||||
# Permissive configuration for the development environment
|
||||
cors_origins *
|
||||
publish_origins *
|
||||
demo
|
||||
anonymous
|
||||
subscriptions
|
||||
# Extra directives
|
||||
{$MERCURE_EXTRA_DIRECTIVES}
|
||||
}
|
||||
|
||||
{$CADDY_SERVER_EXTRA_DIRECTIVES}
|
||||
|
||||
redir / /.well-known/mercure/ui/
|
||||
|
||||
respond /healthz 200
|
||||
respond /robots.txt `User-agent: *
|
||||
Disallow: /`
|
||||
respond "Not Found" 404
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
server {
|
||||
listen 3000 ssl http2;
|
||||
listen [::]:3000 ssl http2;
|
||||
|
||||
|
||||
ssl_certificate /opt/opengnsys/ogcore/etc/nginx/certs/ogcore.uds-test.net.crt.pem;
|
||||
ssl_certificate_key /opt/opengnsys/ogcore/etc/nginx/certs/ogcore.uds-test.net.key.pem;
|
||||
|
||||
location / {
|
||||
proxy_pass http://localhost:3001/;
|
||||
proxy_read_timeout 24h;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Connection "";
|
||||
|
||||
# Enable fast reply in SSE
|
||||
proxy_buffering off;
|
||||
|
||||
## Be sure to set USE_FORWARDED_HEADERS=1 to allow the hub to use those headers ##
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Host $host;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
}
|
|
@ -31,7 +31,6 @@ server {
|
|||
location ~ \.php$ {
|
||||
return 404;
|
||||
}
|
||||
|
||||
error_log /var/log/nginx/ogcore-error.log;
|
||||
access_log /var/log/nginx/ogcore-access.log;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
[Unit]
|
||||
Description=Mercure Hub
|
||||
After=network.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=opengnsys
|
||||
Group=opengnsys
|
||||
WorkingDirectory=/opt/opengnsys/ogcore/
|
||||
|
||||
# Cargar variables de entorno desde archivo
|
||||
EnvironmentFile=/opt/opengnsys/ogcore/etc/mercure/mercure-og.env
|
||||
|
||||
# Validar configuración antes de arrancar
|
||||
ExecStartPre=/bin/sh -c '/usr/bin/mercure adapt -c /opt/opengnsys/ogcore/etc/mercure/mercure.orig.conf --envfile /opt/opengnsys/ogcore/etc/mercure/mercure-og.env > /opt/opengnsys/ogcore/etc/mercure/mercure.config'
|
||||
ExecStartPre=/bin/sh -c '/usr/bin/mercure fmt --overwrite -c /opt/opengnsys/ogcore/etc/mercure/mercure.config'
|
||||
|
||||
# Iniciar y detener el servicio con la configuración generada
|
||||
ExecStart=/usr/bin/mercure run -c /opt/opengnsys/ogcore/etc/mercure/mercure.config --envfile /opt/opengnsys/ogcore/etc/mercure/mercure-og.env
|
||||
ExecStop=/usr/bin/mercure stop -c /opt/opengnsys/ogcore/etc/mercure/mercure.config
|
||||
|
||||
Restart=always
|
||||
RestartSec=5s
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250325075647 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE client ADD firmware_type VARCHAR(255) DEFAULT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE client DROP firmware_type');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250326061450 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command ADD parameters TINYINT(1) DEFAULT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command DROP parameters');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250331144522 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE image_image_repository ADD datasize VARCHAR(255) DEFAULT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE image_image_repository DROP datasize');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250402060324 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE image ADD version INT DEFAULT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE image DROP version');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250402081107 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('DROP INDEX UNIQ_IDENTIFIER_IMAGE_REPOSITORY ON image_image_repository');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE UNIQUE INDEX UNIQ_IDENTIFIER_IMAGE_REPOSITORY ON image_image_repository (image_id, repository_id)');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250402094550 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE image_image_repository ADD version INT DEFAULT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE image_image_repository DROP version');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250407063100 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE image_image_repository ADD description VARCHAR(255) DEFAULT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE image_image_repository DROP description');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250407154425 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE INDEX IDX_STATUS ON client (status)');
|
||||
$this->addSql('CREATE INDEX IDX_UPDATED_AT ON client (updated_at)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('DROP INDEX IDX_STATUS ON client');
|
||||
$this->addSql('DROP INDEX IDX_UPDATED_AT ON client');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250407154620 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE INDEX IDX_STATUS_UPDATED_AT ON client (status, updated_at)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('DROP INDEX IDX_STATUS_UPDATED_AT ON client');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250408140101 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE image_repository ADD user VARCHAR(255) DEFAULT NULL, ADD ssh_port VARCHAR(255) DEFAULT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE image_repository DROP user, DROP ssh_port');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250409093554 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE image_image_repository ADD name VARCHAR(255) NOT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE image_image_repository DROP name');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250421122715 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command_task ADD parameters LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:array)\'');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command_task DROP parameters');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250422092348 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE network_settings ADD pxe_template_id INT DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE network_settings ADD CONSTRAINT FK_48869B543BD7665C FOREIGN KEY (pxe_template_id) REFERENCES pxe_template (id)');
|
||||
$this->addSql('CREATE INDEX IDX_48869B543BD7665C ON network_settings (pxe_template_id)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE network_settings DROP FOREIGN KEY FK_48869B543BD7665C');
|
||||
$this->addSql('DROP INDEX IDX_48869B543BD7665C ON network_settings');
|
||||
$this->addSql('ALTER TABLE network_settings DROP pxe_template_id');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250422140927 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command_task ADD name VARCHAR(255) NOT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command_task DROP name');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250423070720 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command_task DROP datetime');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command_task ADD datetime DATETIME NOT NULL');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250423071243 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command_task ADD organizational_unit_id INT DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE command_task ADD CONSTRAINT FK_F3D475A8FB84408A FOREIGN KEY (organizational_unit_id) REFERENCES organizational_unit (id)');
|
||||
$this->addSql('CREATE INDEX IDX_F3D475A8FB84408A ON command_task (organizational_unit_id)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command_task DROP FOREIGN KEY FK_F3D475A8FB84408A');
|
||||
$this->addSql('DROP INDEX IDX_F3D475A8FB84408A ON command_task');
|
||||
$this->addSql('ALTER TABLE command_task DROP organizational_unit_id');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250423092037 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE TABLE command_task_schedule (id INT AUTO_INCREMENT NOT NULL, command_task_id INT NOT NULL, uuid CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', migration_id VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, created_by VARCHAR(255) DEFAULT NULL, updated_by VARCHAR(255) DEFAULT NULL, recurrence_type VARCHAR(255) NOT NULL, start_time DATETIME NOT NULL, recurrence_details JSON DEFAULT NULL COMMENT \'(DC2Type:json)\', UNIQUE INDEX UNIQ_3BEA77AD17F50A6 (uuid), INDEX IDX_3BEA77A62DC5265 (command_task_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
||||
$this->addSql('ALTER TABLE command_task_schedule ADD CONSTRAINT FK_3BEA77A62DC5265 FOREIGN KEY (command_task_id) REFERENCES command_task (id)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command_task_schedule DROP FOREIGN KEY FK_3BEA77A62DC5265');
|
||||
$this->addSql('DROP TABLE command_task_schedule');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250427110103 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE TABLE command_task_scripts (id INT AUTO_INCREMENT NOT NULL, command_task_id INT NOT NULL, uuid CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', migration_id VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, created_by VARCHAR(255) DEFAULT NULL, updated_by VARCHAR(255) DEFAULT NULL, content VARCHAR(255) NOT NULL, execution_order INT NOT NULL, UNIQUE INDEX UNIQ_E8950142D17F50A6 (uuid), INDEX IDX_E895014262DC5265 (command_task_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
||||
$this->addSql('ALTER TABLE command_task_scripts ADD CONSTRAINT FK_E895014262DC5265 FOREIGN KEY (command_task_id) REFERENCES command_task (id)');
|
||||
$this->addSql('ALTER TABLE command_task_command_group DROP FOREIGN KEY FK_C43618BD62DC5265');
|
||||
$this->addSql('ALTER TABLE command_task_command_group DROP FOREIGN KEY FK_C43618BDC7B800D6');
|
||||
$this->addSql('ALTER TABLE command_task_command DROP FOREIGN KEY FK_BB417CA862DC5265');
|
||||
$this->addSql('ALTER TABLE command_task_command DROP FOREIGN KEY FK_BB417CA833E1689A');
|
||||
$this->addSql('DROP TABLE command_task_command_group');
|
||||
$this->addSql('DROP TABLE command_task_command');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE TABLE command_task_command_group (command_task_id INT NOT NULL, command_group_id INT NOT NULL, INDEX IDX_C43618BD62DC5265 (command_task_id), INDEX IDX_C43618BDC7B800D6 (command_group_id), PRIMARY KEY(command_task_id, command_group_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
|
||||
$this->addSql('CREATE TABLE command_task_command (command_task_id INT NOT NULL, command_id INT NOT NULL, INDEX IDX_BB417CA862DC5265 (command_task_id), INDEX IDX_BB417CA833E1689A (command_id), PRIMARY KEY(command_task_id, command_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
|
||||
$this->addSql('ALTER TABLE command_task_command_group ADD CONSTRAINT FK_C43618BD62DC5265 FOREIGN KEY (command_task_id) REFERENCES command_task (id) ON DELETE CASCADE');
|
||||
$this->addSql('ALTER TABLE command_task_command_group ADD CONSTRAINT FK_C43618BDC7B800D6 FOREIGN KEY (command_group_id) REFERENCES command_group (id) ON DELETE CASCADE');
|
||||
$this->addSql('ALTER TABLE command_task_command ADD CONSTRAINT FK_BB417CA862DC5265 FOREIGN KEY (command_task_id) REFERENCES command_task (id) ON DELETE CASCADE');
|
||||
$this->addSql('ALTER TABLE command_task_command ADD CONSTRAINT FK_BB417CA833E1689A FOREIGN KEY (command_id) REFERENCES command (id) ON DELETE CASCADE');
|
||||
$this->addSql('ALTER TABLE command_task_scripts DROP FOREIGN KEY FK_E895014262DC5265');
|
||||
$this->addSql('DROP TABLE command_task_scripts');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250427125746 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE TABLE command_task_script (id INT AUTO_INCREMENT NOT NULL, command_task_id INT NOT NULL, uuid CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', migration_id VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, created_by VARCHAR(255) DEFAULT NULL, updated_by VARCHAR(255) DEFAULT NULL, content VARCHAR(255) NOT NULL, execution_order INT NOT NULL, UNIQUE INDEX UNIQ_22BF0112D17F50A6 (uuid), INDEX IDX_22BF011262DC5265 (command_task_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
||||
$this->addSql('ALTER TABLE command_task_script ADD CONSTRAINT FK_22BF011262DC5265 FOREIGN KEY (command_task_id) REFERENCES command_task (id)');
|
||||
$this->addSql('ALTER TABLE command_task_scripts DROP FOREIGN KEY FK_E895014262DC5265');
|
||||
$this->addSql('DROP TABLE command_task_scripts');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE TABLE command_task_scripts (id INT AUTO_INCREMENT NOT NULL, command_task_id INT NOT NULL, uuid CHAR(36) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', migration_id VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, created_by VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, updated_by VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, content VARCHAR(255) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, execution_order INT NOT NULL, INDEX IDX_E895014262DC5265 (command_task_id), UNIQUE INDEX UNIQ_E8950142D17F50A6 (uuid), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
|
||||
$this->addSql('ALTER TABLE command_task_scripts ADD CONSTRAINT FK_E895014262DC5265 FOREIGN KEY (command_task_id) REFERENCES command_task (id)');
|
||||
$this->addSql('ALTER TABLE command_task_script DROP FOREIGN KEY FK_22BF011262DC5265');
|
||||
$this->addSql('DROP TABLE command_task_script');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250428065311 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command_task_schedule ADD execution_date DATE NOT NULL, ADD execution_time TIME NOT NULL, DROP start_time');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command_task_schedule ADD start_time DATETIME NOT NULL, DROP execution_date, DROP execution_time');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250428065937 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command_task_schedule ADD enabled TINYINT(1) NOT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command_task_schedule DROP enabled');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250428070851 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command_task_schedule CHANGE execution_date execution_date DATE DEFAULT NULL, CHANGE execution_time execution_time TIME DEFAULT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command_task_schedule CHANGE execution_date execution_date DATE NOT NULL, CHANGE execution_time execution_time TIME NOT NULL');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250429065612 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command_task ADD last_execution DATETIME DEFAULT NULL, ADD next_execution DATETIME DEFAULT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command_task DROP last_execution, DROP next_execution');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250429091808 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command_task ADD scope VARCHAR(255) NOT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command_task DROP scope');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250430052434 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command_task_script ADD type VARCHAR(255) NOT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command_task_script DROP type');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250430053742 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command_task_script ADD parameters LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:array)\'');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command_task_script DROP parameters');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250430054513 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command_task_script CHANGE content content VARCHAR(255) DEFAULT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command_task_script CHANGE content content VARCHAR(255) NOT NULL');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250430094459 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command_task DROP status');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE command_task ADD status VARCHAR(255) NOT NULL');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250430135412 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE TABLE git_image_repository (id INT AUTO_INCREMENT NOT NULL, image_id INT NOT NULL, uuid CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', migration_id VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, created_by VARCHAR(255) DEFAULT NULL, updated_by VARCHAR(255) DEFAULT NULL, status VARCHAR(255) NOT NULL, branch VARCHAR(255) NOT NULL, created TINYINT(1) NOT NULL, UNIQUE INDEX UNIQ_E6944D5ED17F50A6 (uuid), INDEX IDX_E6944D5E3DA5256D (image_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
||||
$this->addSql('ALTER TABLE git_image_repository ADD CONSTRAINT FK_E6944D5E3DA5256D FOREIGN KEY (image_id) REFERENCES image (id)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE git_image_repository DROP FOREIGN KEY FK_E6944D5E3DA5256D');
|
||||
$this->addSql('DROP TABLE git_image_repository');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250430140218 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE git_image_repository ADD image_repository_id INT DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE git_image_repository ADD CONSTRAINT FK_E6944D5E14C736FC FOREIGN KEY (image_repository_id) REFERENCES image_repository (id)');
|
||||
$this->addSql('CREATE INDEX IDX_E6944D5E14C736FC ON git_image_repository (image_repository_id)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE git_image_repository DROP FOREIGN KEY FK_E6944D5E14C736FC');
|
||||
$this->addSql('DROP INDEX IDX_E6944D5E14C736FC ON git_image_repository');
|
||||
$this->addSql('ALTER TABLE git_image_repository DROP image_repository_id');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250430140326 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE git_image_repository ADD name VARCHAR(255) NOT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE git_image_repository DROP name');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250506094654 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE pxe_template ADD is_default TINYINT(1) DEFAULT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE pxe_template DROP is_default');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250506141057 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE client DROP FOREIGN KEY FK_C74404555DA0FB8');
|
||||
$this->addSql('ALTER TABLE client ADD CONSTRAINT FK_C74404555DA0FB8 FOREIGN KEY (template_id) REFERENCES pxe_template (id) ON DELETE SET NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE client DROP FOREIGN KEY FK_C74404555DA0FB8');
|
||||
$this->addSql('ALTER TABLE client ADD CONSTRAINT FK_C74404555DA0FB8 FOREIGN KEY (template_id) REFERENCES pxe_template (id)');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250508134732 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE `partition` DROP FOREIGN KEY FK_9EB910E43DA5256D');
|
||||
$this->addSql('ALTER TABLE `partition` ADD CONSTRAINT FK_9EB910E43DA5256D FOREIGN KEY (image_id) REFERENCES image_image_repository (id)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE `partition` DROP FOREIGN KEY FK_9EB910E43DA5256D');
|
||||
$this->addSql('ALTER TABLE `partition` ADD CONSTRAINT FK_9EB910E43DA5256D FOREIGN KEY (image_id) REFERENCES image (id)');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250508152437 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE image ADD type VARCHAR(255) NOT NULL, DROP description, DROP comments');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE image ADD description VARCHAR(255) DEFAULT NULL, ADD comments VARCHAR(255) DEFAULT NULL, DROP type');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250512071804 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE git_image_repository DROP FOREIGN KEY FK_E6944D5E14C736FC');
|
||||
$this->addSql('DROP INDEX IDX_E6944D5E14C736FC ON git_image_repository');
|
||||
$this->addSql('ALTER TABLE git_image_repository ADD tag VARCHAR(255) NOT NULL, CHANGE image_repository_id repository_id INT DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE git_image_repository ADD CONSTRAINT FK_E6944D5E50C9D4F7 FOREIGN KEY (repository_id) REFERENCES image_repository (id)');
|
||||
$this->addSql('CREATE INDEX IDX_E6944D5E50C9D4F7 ON git_image_repository (repository_id)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE git_image_repository DROP FOREIGN KEY FK_E6944D5E50C9D4F7');
|
||||
$this->addSql('DROP INDEX IDX_E6944D5E50C9D4F7 ON git_image_repository');
|
||||
$this->addSql('ALTER TABLE git_image_repository DROP tag, CHANGE repository_id image_repository_id INT DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE git_image_repository ADD CONSTRAINT FK_E6944D5E14C736FC FOREIGN KEY (image_repository_id) REFERENCES image_repository (id)');
|
||||
$this->addSql('CREATE INDEX IDX_E6944D5E14C736FC ON git_image_repository (image_repository_id)');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250512075927 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE git_image_repository CHANGE branch branch VARCHAR(255) DEFAULT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE git_image_repository CHANGE branch branch VARCHAR(255) NOT NULL');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250512081045 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE git_image_repository ADD version INT DEFAULT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE git_image_repository DROP version');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250513050921 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE git_image_repository ADD description VARCHAR(255) DEFAULT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE git_image_repository DROP description');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250513055057 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE image_image_repository ADD partition_info VARCHAR(255) DEFAULT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE image_image_repository DROP partition_info');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250514051344 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE client ADD token VARCHAR(255) DEFAULT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE client DROP token');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250514101117 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE UNIQUE INDEX UNIQ_IDENTIFIER_NAME ON command (name)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('DROP INDEX UNIQ_IDENTIFIER_NAME ON command');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20250604084222 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE `partition` DROP FOREIGN KEY FK_9EB910E43DA5256D');
|
||||
$this->addSql('ALTER TABLE `partition` ADD CONSTRAINT FK_9EB910E43DA5256D FOREIGN KEY (image_id) REFERENCES image_image_repository (id) ON DELETE SET NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE `partition` DROP FOREIGN KEY FK_9EB910E43DA5256D');
|
||||
$this->addSql('ALTER TABLE `partition` ADD CONSTRAINT FK_9EB910E43DA5256D FOREIGN KEY (image_id) REFERENCES image_image_repository (id)');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,100 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Command;
|
||||
|
||||
use App\Entity\Client;
|
||||
use App\Entity\Trace;
|
||||
use App\Model\ClientStatus;
|
||||
use App\Model\TraceStatus;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\Console\Attribute\AsCommand;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
use Symfony\Component\Mercure\HubInterface;
|
||||
use Symfony\Component\Mercure\Update;
|
||||
|
||||
#[AsCommand(name: 'opengnsys:check-client-availability', description: 'Check client availability')]
|
||||
class CheckClientAvailability extends Command
|
||||
{
|
||||
const int THRESHOLD_MINUTES = 1;
|
||||
|
||||
public function __construct(
|
||||
private readonly HubInterface $hub,
|
||||
private readonly EntityManagerInterface $entityManager
|
||||
)
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
$io = new SymfonyStyle($input, $output);
|
||||
$threshold = (new \DateTime())->modify(' - '.self::THRESHOLD_MINUTES . ' minutes');
|
||||
$startQueryTime = microtime(true);
|
||||
|
||||
$validStatuses = [ClientStatus::OG_LIVE, ClientStatus::WINDOWS, ClientStatus::LINUX, ClientStatus::MACOS];
|
||||
|
||||
$query = $this->entityManager->createQuery(
|
||||
'UPDATE App\Entity\Client c
|
||||
SET c.status = :status
|
||||
WHERE c.status IN (:currentStatuses)
|
||||
AND c.updatedAt < :threshold'
|
||||
);
|
||||
$query->setParameter('status', ClientStatus::DISCONNECTED);
|
||||
$query->setParameter('currentStatuses', $validStatuses);
|
||||
$query->setParameter('threshold', $threshold);
|
||||
$updatedCount = $query->execute();
|
||||
|
||||
$queryTime = microtime(true) - $startQueryTime;
|
||||
|
||||
$startMercureTime = microtime(true);
|
||||
|
||||
$clients = $this->entityManager->createQueryBuilder()
|
||||
->select('c')
|
||||
->from(Client::class, 'c')
|
||||
->where('c.status = :status')
|
||||
->andWhere('c.updatedAt < :threshold')
|
||||
->setParameter('status', ClientStatus::DISCONNECTED)
|
||||
->setParameter('threshold', $threshold)
|
||||
->getQuery()
|
||||
->getResult();
|
||||
|
||||
$this->dispatchMercureEvent($clients);
|
||||
|
||||
$mercureTime = microtime(true) - $startMercureTime;
|
||||
|
||||
$io->success("Updated $updatedCount clients to DISCONNECTED status.");
|
||||
$io->note("Query time: " . round($queryTime, 3) . "s");
|
||||
$io->note("Mercure dispatch time: " . round($mercureTime, 3) . "s");
|
||||
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
|
||||
private function dispatchMercureEvent(array $clients, int $chunkSize = 10000): void
|
||||
{
|
||||
$chunks = array_chunk($clients, $chunkSize);
|
||||
|
||||
foreach ($chunks as $chunk) {
|
||||
$data = [];
|
||||
|
||||
foreach ($chunk as $client) {
|
||||
$data[] = [
|
||||
'@id' => '/clients/' . $client->getUuid(),
|
||||
'status' => $client->getStatus(),
|
||||
];
|
||||
}
|
||||
|
||||
$update = new Update(
|
||||
'clients',
|
||||
json_encode($data)
|
||||
);
|
||||
|
||||
$this->hub->publish($update);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -20,6 +20,8 @@ class LoadDefaultUserAdminCommand extends Command
|
|||
CONST string PLAIN_PASSWORD = '12345678';
|
||||
const string USERNAME = 'ogadmin';
|
||||
|
||||
const string DEFAULT_GROUPS_VIEW = 'card';
|
||||
|
||||
public function __construct(
|
||||
private readonly EntityManagerInterface $entityManager
|
||||
)
|
||||
|
@ -37,6 +39,7 @@ class LoadDefaultUserAdminCommand extends Command
|
|||
|
||||
$user = new User();
|
||||
$user->setUsername(self::USERNAME);
|
||||
$user->setGroupsView(self::DEFAULT_GROUPS_VIEW);
|
||||
$user->setRoles([UserGroupPermissions::ROLE_SUPER_ADMIN]);
|
||||
$user->setPassword($hash);
|
||||
|
||||
|
|
|
@ -0,0 +1,89 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Command;
|
||||
|
||||
use App\Controller\OgAgent\DeployImageAction;
|
||||
use App\Controller\OgAgent\RunScriptAction;
|
||||
use App\Dto\Input\CommandExecuteInput;
|
||||
use App\Dto\Input\DeployImageInput;
|
||||
use App\Dto\Output\ClientOutput;
|
||||
use App\Entity\CommandTask;
|
||||
use App\Model\ClientStatus;
|
||||
use App\Repository\CommandTaskRepository;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\Console\Attribute\AsCommand;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
|
||||
|
||||
#[AsCommand(name: 'opengnsys:run-scheduled-command-tasks', description: 'Run scheduled command tasks')]
|
||||
class RunScheduledCommandTasksCommand extends Command
|
||||
{
|
||||
public function __construct(
|
||||
private readonly CommandTaskRepository $commandTaskRepository,
|
||||
private readonly EntityManagerInterface $entityManager,
|
||||
private readonly RunScriptAction $runScriptAction,
|
||||
private readonly DeployImageAction $deployImageAction,
|
||||
)
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Exception
|
||||
* @throws TransportExceptionInterface
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
$now = new \DateTimeImmutable('now +2 hours');
|
||||
$now->setTimezone(new \DateTimeZone('Europe/Madrid'));
|
||||
$nowMinute = $now->format('Y-m-d H:i');
|
||||
|
||||
$tasks = $this->commandTaskRepository->findAll();
|
||||
|
||||
foreach ($tasks as $task) {
|
||||
/** @var CommandTask $task */
|
||||
$nextExecution = $task->getNextExecution();
|
||||
if (!$nextExecution) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$taskMinute = $nextExecution->format('Y-m-d H:i');
|
||||
|
||||
if ($taskMinute === $nowMinute) {
|
||||
$output->writeln("Ejecutando tarea: " . $task->getName());
|
||||
|
||||
$scripts = $task->getCommandTaskScripts()->toArray();
|
||||
usort($scripts, fn($a, $b) => $a->getExecutionOrder() <=> $b->getExecutionOrder());
|
||||
|
||||
foreach ($scripts as $script) {
|
||||
$output->writeln(" - Ejecutando script de tipo {$script->getType()} con orden {$script->getExecutionOrder()}");
|
||||
|
||||
if ($script->getType() === 'run-script') {
|
||||
$input = new CommandExecuteInput();
|
||||
|
||||
foreach ($task->getOrganizationalUnit()?->getClients() as $client) {
|
||||
if ($client->getStatus() !== ClientStatus::OG_LIVE) {
|
||||
continue;
|
||||
}
|
||||
$input->clients[] = new ClientOutput($client);
|
||||
}
|
||||
$input->script = $script->getContent();
|
||||
|
||||
$this->runScriptAction->__invoke($input);
|
||||
}
|
||||
}
|
||||
|
||||
$task->setLastExecution(new \DateTime());
|
||||
$task->setNextExecution($task->calculateNextExecutionDate());
|
||||
$this->entityManager->persist($task);
|
||||
}
|
||||
}
|
||||
|
||||
$this->entityManager->flush();
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Command;
|
||||
|
||||
use App\Entity\Client;
|
||||
use App\Entity\Trace;
|
||||
use App\Model\ClientStatus;
|
||||
use App\Model\TraceStatus;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\Console\Attribute\AsCommand;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
use Symfony\Component\Mercure\HubInterface;
|
||||
use Symfony\Component\Mercure\Update;
|
||||
|
||||
#[AsCommand(name: 'opengnsys:test', description: 'Hello PhpStorm')]
|
||||
class TestCommand extends Command
|
||||
{
|
||||
public function __construct(
|
||||
private readonly HubInterface $hub,
|
||||
private readonly EntityManagerInterface $entityManager
|
||||
)
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
$io = new SymfonyStyle($input, $output);
|
||||
$trace = $this->entityManager->getRepository(Trace::class)->find(7236);
|
||||
|
||||
$trace->setStatus(TraceStatus::SUCCESS);
|
||||
$trace->setProgress(1000);
|
||||
|
||||
$this->entityManager->persist($trace);
|
||||
$this->entityManager->flush();
|
||||
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Lexik\Bundle\JWTAuthenticationBundle\Services\JWTTokenManagerInterface;
|
||||
use Symfony\Component\Security\Core\Exception\AuthenticationException;
|
||||
|
||||
class AuthValidatorController extends AbstractController
|
||||
{
|
||||
private JWTTokenManagerInterface $jwtManager;
|
||||
|
||||
public function __construct(JWTTokenManagerInterface $jwtManager)
|
||||
{
|
||||
$this->jwtManager = $jwtManager;
|
||||
}
|
||||
|
||||
#[Route('/validate', name: 'auth_validate', methods: ['POST'])]
|
||||
public function validate(Request $request): Response
|
||||
{
|
||||
$sslClientVerify = $request->headers->get('SSL_CLIENT_VERIFY');
|
||||
$clientCertOk = $sslClientVerify === 'SUCCESS';
|
||||
|
||||
$authHeader = $request->headers->get('Authorization');
|
||||
$hasValidJwt = $this->validateJwtToken($authHeader);
|
||||
|
||||
if ($clientCertOk || $hasValidJwt) {
|
||||
return new Response('Authorized', Response::HTTP_OK);
|
||||
}
|
||||
|
||||
return new Response('Unauthorized', Response::HTTP_UNAUTHORIZED);
|
||||
}
|
||||
|
||||
private function validateJwtToken(?string $authHeader): bool
|
||||
{
|
||||
if (!$authHeader || !str_starts_with($authHeader, 'Bearer ')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$token = substr($authHeader, 7);
|
||||
|
||||
try {
|
||||
$payload = $this->jwtManager->parse($token);
|
||||
|
||||
return true;
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue