Compare commits

..

1 Commits

Author SHA1 Message Date
Nicolas Arenas 6f9de42634 refs #1303 Runs composer install at build time
testing/ogcore-api/pipeline/head This commit looks good Details
testing/ogcore-api/pipeline/pr-main This commit looks good Details
2024-12-23 12:38:27 +01:00
247 changed files with 1643 additions and 7832 deletions

6
.env
View File

@ -50,9 +50,3 @@ UDS_AUTH_USERNAME="natiqindel"
UDS_AUTH_PASSWORD="correct horse battery staple"
UDS_URL=https://localhost:8087/uds/rest/
###< UDS ###
###> symfony/mercure-bundle ###
MERCURE_URL=http://ogcore-mercure:3000/.well-known/mercure
MERCURE_PUBLIC_URL=http://ogcore-mercure:3000/.well-known/mercure
MERCURE_JWT_SECRET="!ChangeThisMercureHubJWTSecretKey!"
###< symfony/mercure-bundle ###

View File

@ -1,26 +0,0 @@
###> symfony/framework-bundle ###
APP_ENV=prod
APP_SECRET=e95c7f17da15ce1b03d77ad655379c34
###< symfony/framework-bundle ###
###> doctrine/doctrine-bundle ###
DATABASE_URL="mysql://root:root@127.0.0.1:3306/ogcore?serverVersion=10.11.2-MariaDB&charset=utf8mb4"
OG_1_DATABASE_URL="mysql://root:root@127.0.0.1:3306/ogcore_old_og?serverVersion=10.11.2-MariaDB&charset=utf8mb4"
###< doctrine/doctrine-bundle ###
###> nelmio/cors-bundle ###
CORS_ALLOW_ORIGIN='*'
###< nelmio/cors-bundle ###
###> lexik/jwt-authentication-bundle ###
JWT_SECRET_KEY=%kernel.project_dir%/config/jwt/private.pem
JWT_PUBLIC_KEY=%kernel.project_dir%/config/jwt/public.pem
JWT_PASSPHRASE=8b9154df37ffa91ef9186ce095324e39e50ff3b023bb1ed34383abd019ba4515
###< lexik/jwt-authentication-bundle ###
###> symfony/mercure-bundle ###
MERCURE_URL=https://localhost:3000/.well-known/mercure
MERCURE_PUBLIC_URL=https://localhost:3000/.well-known/mercure
MERCURE_JWT_SECRET="!ChangeThisMercureHubJWTSecretKey!"
###< symfony/mercure-bundle ###

8
.gitignore vendored
View File

@ -25,11 +25,3 @@
/phpunit.xml
.phpunit.result.cache
###< phpunit/phpunit ###
### Debian packaging
debian/ogcore
debian/*.substvars
debian/*.log
debian/.debhelper/

View File

@ -1,116 +0,0 @@
# Changelog
## [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
- 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.
- Nuevo campo en "usuarios" el cual permite escoger la visualizacion por defecto de la vista "grupos".
- Nuevo campo "dns" en "subredes" para gestionar los servidores DNS.
- Integracion endpoint ogRepository para checkear la integridad de una imagen.
- Nueva funcionalidad para cancelar despliegues de imagenes.
- Añadido nuevo campo "cancelado" en trazas.
### 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
- Corrección de bug en el deploy de imágenes
---
## [0.8.0] - 2025-01-10
### Added
- Nuevos campos en "aulas" para la jerarquia en clientes.
- Nueva funcionalidad "imagen global". Integracion con ogRepository.
### 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.
---
## [0.7.3] - 2025-01-03
### 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.
- Se agregó el modo "TORRENT" y "UDPCAST" en el despliegue de imágenes.
### ⚡ Changed
- Refactorización del webhook de ogRepository.
---
## Formato de cambios:
- **Added**: Secciones con nuevas características.
- **Fixed**: Corrección de errores y bugs.
- **Changed**: Modificaciones o mejoras en funcionalidades existentes.
- **Improved**: Mejoras en funcionalidades existentes.
- **Removed**: Funcionalidades o dependencias eliminadas.

View File

@ -1,107 +0,0 @@
@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')
}
}
}

View File

@ -5,9 +5,3 @@ services:
ports:
- "5432"
###< doctrine/doctrine-bundle ###
###> symfony/mercure-bundle ###
mercure:
ports:
- "80"
###< symfony/mercure-bundle ###

View File

@ -27,7 +27,6 @@
"symfony/flex": "^2",
"symfony/framework-bundle": "6.4.*",
"symfony/http-client": "6.4.*",
"symfony/mercure-bundle": "^0.3.9",
"symfony/monolog-bundle": "^3.10",
"symfony/property-access": "6.4.*",
"symfony/property-info": "6.4.*",

1533
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -7,7 +7,6 @@ resources:
groups: ['default', 'client:read']
denormalizationContext:
groups: ['client:write']
operations:
ApiPlatform\Metadata\GetCollection:
provider: App\State\Provider\ClientProvider
@ -50,25 +49,18 @@ resources:
uriTemplate: /clients/server/{uuid}/get-pxe
controller: App\Controller\OgBoot\PxeBootFile\GetAction
login_client:
class: ApiPlatform\Metadata\Post
method: POST
input: App\Dto\Input\MultipleClientsInput
uriTemplate: /clients/server/login-client
controller: App\Controller\OgAgent\LoginAction
reboot_client:
class: ApiPlatform\Metadata\Post
method: POST
input: App\Dto\Input\MultipleClientsInput
uriTemplate: /clients/server/reboot
input: false
uriTemplate: /clients/server/{uuid}/reboot
controller: App\Controller\OgAgent\RebootAction
power_off_client:
class: ApiPlatform\Metadata\Post
method: POST
input: App\Dto\Input\MultipleClientsInput
uriTemplate: /clients/server/power-off
input: false
uriTemplate: /clients/server/{uuid}/power-off
controller: App\Controller\OgAgent\PowerOffAction

View File

@ -7,8 +7,6 @@ resources:
groups: ['default', 'command:read']
denormalizationContext:
groups: ['command:write']
order:
id: 'DESC'
operations:
ApiPlatform\Metadata\GetCollection:
provider: App\State\Provider\CommandProvider
@ -30,8 +28,9 @@ resources:
class: ApiPlatform\Metadata\Post
method: POST
input: App\Dto\Input\CommandExecuteInput
uriTemplate: /commands/run-script
controller: App\Controller\OgAgent\RunScriptAction
uriTemplate: /commands/{uuid}/execute
controller: App\Controller\CommandExecuteAction
properties:
App\Entity\Command:
id:

View File

@ -7,8 +7,6 @@ resources:
groups: ['default', 'image:read']
denormalizationContext:
groups: ['image:write']
order:
id: 'DESC'
operations:
ApiPlatform\Metadata\GetCollection:
provider: App\State\Provider\ImageProvider
@ -16,8 +14,6 @@ resources:
- 'api_platform.filter.image.order'
- 'api_platform.filter.image.search'
- 'api_platform.filter.image.boolean'
- 'image.repository_filter'
ApiPlatform\Metadata\Get:
provider: App\State\Provider\ImageProvider
ApiPlatform\Metadata\Put:
@ -27,6 +23,58 @@ resources:
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: /images/server/{uuid}/get
controller: App\Controller\OgRepository\Image\GetAction
create_aux_files_image_ogrepository:
shortName: OgRepository Server
class: ApiPlatform\Metadata\Post
method: POST
input: false
uriTemplate: /images/server/{uuid}/create-aux-files
controller: App\Controller\OgRepository\Image\CreateAuxFilesAction
deploy_image_ogrepository:
shortName: OgRepository Server
class: ApiPlatform\Metadata\Post
method: POST
input: App\Dto\Input\DeployImageInput
uriTemplate: /images/{uuid}/deploy-image
controller: App\Controller\DeployImageAction
trash_delete_image_ogrepository:
shortName: OgRepository Server
description: Delete Image in OgRepository
class: ApiPlatform\Metadata\Post
method: POST
input: false
uriTemplate: /images/server/{uuid}/delete-trash
controller: App\Controller\OgRepository\Image\DeleteTrashAction
permanent_delete_image_ogrepository:
shortName: OgRepository Server
description: Delete Image in OgRepository
class: ApiPlatform\Metadata\Post
method: POST
input: false
uriTemplate: /images/server/{uuid}/delete-permanent
controller: App\Controller\OgRepository\Image\DeletePermanentAction
recover_image_ogrepository:
shortName: OgRepository Server
description: Recover Image in OgRepository
class: ApiPlatform\Metadata\Post
method: POST
input: false
uriTemplate: /images/server/{uuid}/recover
controller: App\Controller\OgRepository\Image\RecoverAction
properties:
App\Entity\Image:
id:

View File

@ -1,134 +0,0 @@
resources:
App\Entity\ImageImageRepository:
processor: App\State\Processor\ImageImageRepositoryProcessor
input: App\Dto\Input\ImageImageRepositoryInput
output: App\Dto\Output\ImageImageRepositoryOutput
normalizationContext:
groups: ['default', 'image-image-repository:read']
denormalizationContext:
groups: ['image-image-repository:write']
operations:
ApiPlatform\Metadata\GetCollection:
provider: App\State\Provider\ImageImageRepositoryProvider
filters:
- 'api_platform.filter.image_image_repository.order'
- 'api_platform.filter.image_image_repository.search'
ApiPlatform\Metadata\Get:
provider: App\State\Provider\ImageImageRepositoryProvider
ApiPlatform\Metadata\Put:
provider: App\State\Provider\ImageImageRepositoryProvider
ApiPlatform\Metadata\Patch:
provider: App\State\Provider\ImageImageRepositoryProvider
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
create_aux_files_image_ogrepository:
shortName: OgRepository Server
class: ApiPlatform\Metadata\Post
method: POST
input: false
uriTemplate: /image-image-repositories/server/{uuid}/create-aux-files
controller: App\Controller\OgRepository\Image\CreateAuxFilesAction
deploy_image_ogrepository:
shortName: OgRepository Server
class: ApiPlatform\Metadata\Post
method: POST
input: App\Dto\Input\DeployImageInput
uriTemplate: /image-image-repositories/{uuid}/deploy-image
controller: App\Controller\DeployImageAction
backup_image_ogrepository:
shortName: OgRepository Server
class: ApiPlatform\Metadata\Post
method: POST
input: App\Dto\Input\BackupImageInput
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
class: ApiPlatform\Metadata\Post
method: POST
input: false
uriTemplate: /image-image-repositories/server/{uuid}/delete-trash
controller: App\Controller\OgRepository\Image\DeleteTrashAction
permanent_delete_image_ogrepository:
shortName: OgRepository Server
description: Delete Image in OgRepository
class: ApiPlatform\Metadata\Post
method: POST
input: false
uriTemplate: /image-image-repositories/server/{uuid}/delete-permanent
controller: App\Controller\OgRepository\Image\DeletePermanentAction
recover_image_ogrepository:
shortName: OgRepository Server
description: Recover Image in OgRepository
class: ApiPlatform\Metadata\Post
method: POST
input: false
uriTemplate: /image-image-repositories/server/{uuid}/recover
controller: App\Controller\OgRepository\Image\RecoverAction
transfer_image_ogrepository:
shortName: OgRepository Server
description: Export Image in OgRepository
class: ApiPlatform\Metadata\Post
method: POST
input: App\Dto\Input\TransferGlobalImageInput
uriTemplate: /image-image-repositories/{uuid}/transfer-image
controller: App\Controller\OgRepository\Image\TransferAction
get_status_image_ogrepository:
shortName: OgRepository Server
description: Get Status Image in OgRepository
class: ApiPlatform\Metadata\Post
method: POST
input: false
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:
identifier: false
uuid:
identifier: true

View File

@ -13,8 +13,6 @@ resources:
filters:
- 'api_platform.filter.repository.order'
- 'api_platform.filter.repository.search'
- 'repository.not_equal_filter'
ApiPlatform\Metadata\Get:
provider: App\State\Provider\ImageRepositoryProvider
ApiPlatform\Metadata\Put:
@ -26,26 +24,26 @@ resources:
image_ogrepository_sync:
shortName: OgRepository Server
class: ApiPlatform\Metadata\Post
method: POST
class: ApiPlatform\Metadata\Get
method: GET
input: false
uriTemplate: /image-repositories/server/{uuid}/sync
uriTemplate: /image-repositories/server/sync
controller: App\Controller\OgRepository\SyncAction
wol_client:
class: ApiPlatform\Metadata\Post
method: POST
input: App\Dto\Input\WoLInput
uriTemplate: /image-repositories/wol
uriTemplate: /image-repositories/{uuid}/wol
controller: App\Controller\OgRepository\WoLAction
get_collection_images_ogrepository:
shortName: OgRepository Server
description: Get collection of image in OgRepository
class: ApiPlatform\Metadata\Post
method: POST
class: ApiPlatform\Metadata\Get
method: GET
input: false
uriTemplate: /image-repositories/server/{uuid}/get-collection
uriTemplate: /image-repositories/server/get-collection
controller: App\Controller\OgRepository\GetCollectionAction
images_ogrepository_status:
@ -57,24 +55,6 @@ resources:
uriTemplate: /image-repositories/server/{uuid}/status
controller: App\Controller\OgRepository\StatusAction
import_image_ogrepository:
shortName: OgRepository Server
description: Export Image in OgRepository
class: ApiPlatform\Metadata\Post
method: POST
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
properties:
App\Entity\ImageRepository:
id:

View File

@ -3,7 +3,7 @@ resources:
processor: App\State\Processor\PartitionProcessor
input: App\Dto\Input\PartitionPostInput
output: App\Dto\Output\PartitionOutput
order:
orderBy:
partitionNumber: 'ASC'
normalizationContext:
groups: ['default', 'partition:read']

View File

@ -12,15 +12,6 @@ resources:
ApiPlatform\Metadata\Get:
provider: App\State\Provider\TraceProvider
cancel_trace:
shortName: OgRepository Server
description: Cancel Trace in OgRepository
class: ApiPlatform\Metadata\Post
method: POST
input: false
uriTemplate: /traces/server/{uuid}/cancel
controller: App\Controller\OgRepository\Image\CancelTransmissionAction
order:
createdAt: DESC

View File

@ -17,5 +17,4 @@ return [
Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle::class => ['all' => true],
DAMA\DoctrineTestBundle\DAMADoctrineTestBundle::class => ['test' => true],
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
Symfony\Bundle\MercureBundle\MercureBundle::class => ['all' => true],
];

View File

@ -5,9 +5,6 @@ api_platform:
path_segment_name_generator: api_platform.path_segment_name_generator.dash
defaults:
pagination_client_items_per_page: true
mercure:
enabled: true
collection:
pagination:
items_per_page_parameter_name: 'itemsPerPage'

View File

@ -12,7 +12,6 @@ framework:
handler_id: null
cookie_secure: auto
cookie_samesite: lax
storage_factory_id: session.storage.factory.native
#esi: true
#fragments: true

View File

@ -2,7 +2,6 @@ lexik_jwt_authentication:
secret_key: '%env(resolve:JWT_SECRET_KEY)%'
public_key: '%env(resolve:JWT_PUBLIC_KEY)%'
pass_phrase: '%env(JWT_PASSPHRASE)%'
token_ttl: 86400 # 1 day
api_platform:
check_path: /auth/login
username_path: username

View File

@ -1,8 +0,0 @@
mercure:
hubs:
default:
url: '%env(MERCURE_URL)%'
public_url: '%env(MERCURE_PUBLIC_URL)%'
jwt:
secret: '%env(MERCURE_JWT_SECRET)%'
publish: '*'

View File

@ -7,29 +7,31 @@ when@dev:
handlers:
main:
type: stream
level: info
path: "%kernel.logs_dir%/%kernel.environment%.log"
formatter: App\Formatter\CustomLineFormatter
level: debug
channels: ["!event"]
# uncomment to get logging in your browser
# you may have to allow bigger header sizes in your Web server configuration
#firephp:
# type: firephp
# level: info
#chromephp:
# type: chromephp
# level: info
console:
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:
handlers:
main:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: error
type: fingers_crossed
action_level: error
handler: nested
excluded_http_codes: [404, 405]
channels: ["!event"]
nested:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
@ -39,24 +41,22 @@ when@prod:
monolog:
handlers:
main:
type: fingers_crossed
action_level: error
handler: nested
excluded_http_codes: [404, 405]
buffer_size: 50 # How many messages should be saved? Prevent memory leaks
nested:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: error
formatter: App\Formatter\CustomLineFormatter
channels: ["!event"]
path: php://stderr
level: debug
formatter: monolog.formatter.json
console:
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]
path: "%kernel.logs_dir%/%kernel.environment%.log"
path: php://stderr
formatter: monolog.formatter.json

View File

@ -33,8 +33,6 @@ security:
- { path: ^/og-repository/webhook, roles: PUBLIC_ACCESS }
- { path: ^/og-lives/install/webhook, roles: PUBLIC_ACCESS }
- { path: ^/auth/refresh, roles: PUBLIC_ACCESS }
- { path: ^/menu-browser, roles: PUBLIC_ACCESS }
- { path: ^/menu/, roles: PUBLIC_ACCESS }
- { path: ^/, roles: IS_AUTHENTICATED_FULLY }
when@test:

View File

@ -14,4 +14,4 @@ when@test:
intercept_redirects: false
framework:
profiler: { collect: false }
profiler: { collect: false }

View File

@ -151,8 +151,3 @@ services:
bind:
$collectionProvider: '@api_platform.doctrine.orm.state.collection_provider'
$itemProvider: '@api_platform.doctrine.orm.state.item_provider'
App\State\Provider\ImageImageRepositoryProvider:
bind:
$collectionProvider: '@api_platform.doctrine.orm.state.collection_provider'
$itemProvider: '@api_platform.doctrine.orm.state.item_provider'

View File

@ -20,7 +20,7 @@ services:
api_platform.filter.client.search:
parent: 'api_platform.doctrine.orm.search_filter'
arguments: [ { 'id': 'exact', 'uuid': exact, 'name': 'partial', 'serialNumber': 'exact', 'template.id': 'exact', status: 'exact', organizationalUnit.id: 'exact', mac: 'exact', ip: 'exact', subnet.id: 'exact' } ]
arguments: [ { 'id': 'exact', 'name': 'partial', 'serialNumber': 'exact', 'template.id': 'exact', organizationalUnit.id: 'exact', mac: 'exact', ip: 'exact' } ]
tags: [ 'api_platform.filter' ]
api_platform.filter.client.exist:
@ -42,7 +42,7 @@ services:
api_platform.filter.command.boolean:
parent: 'api_platform.doctrine.orm.boolean_filter'
arguments: [ { 'enabled': ~, 'readOnly': ~ } ]
arguments: [ { 'enabled': ~ } ]
tags: [ 'api_platform.filter' ]
api_platform.filter.hardware.order:
@ -69,10 +69,6 @@ services:
arguments: [ { 'created': ~ } ]
tags: [ 'api_platform.filter' ]
image.repository_filter:
parent: 'App\Filter\ImageSearchRepositoryFilter'
tags: [ 'api_platform.filter' ]
api_platform.filter.og_live.order:
parent: 'api_platform.doctrine.orm.order_filter'
arguments:
@ -82,7 +78,7 @@ services:
api_platform.filter.og_live.search:
parent: 'api_platform.doctrine.orm.search_filter'
arguments: [ { 'id': 'exact', 'name': 'partial', 'status': 'exact' } ]
arguments: [ { 'id': 'exact', 'name': 'partial', } ]
tags: [ 'api_platform.filter' ]
api_platform.filter.og_live.boolean:
@ -182,34 +178,6 @@ services:
arguments: [ { 'id': 'exact', 'name': 'partial', } ]
tags: [ 'api_platform.filter' ]
api_platform.filter.repository.order:
parent: 'api_platform.doctrine.orm.order_filter'
arguments:
$properties: { 'id': ~, 'name': ~ }
$orderParameterName: 'order'
tags: [ 'api_platform.filter' ]
api_platform.filter.repository.search:
parent: 'api_platform.doctrine.orm.search_filter'
arguments: [ { 'id': 'exact', 'name': 'partial', 'ip': 'partial', 'status': 'exact'} ]
tags: [ 'api_platform.filter' ]
api_platform.filter.image_image_repository.order:
parent: 'api_platform.doctrine.orm.order_filter'
arguments:
$properties: { 'id': ~, 'name': ~ }
$orderParameterName: 'order'
tags: [ 'api_platform.filter' ]
api_platform.filter.image_image_repository.search:
parent: 'api_platform.doctrine.orm.search_filter'
arguments: [ { 'id': 'exact', 'name': 'partial', 'ip': 'partial', 'status': 'exact', 'repository.id': 'exact'} ]
tags: [ 'api_platform.filter' ]
repository.not_equal_filter:
parent: 'App\Filter\NotEqualIdFilter'
tags: [ 'api_platform.filter' ]
api_platform.filter.software.order:
parent: 'api_platform.doctrine.orm.order_filter'
arguments:

View File

@ -1,3 +0,0 @@
services:
App\EventListener\ClientStatusNotifier:
tags: ~ # Esto elimina el listener en el entorno de test

4
debian/CHANGELOG.md vendored
View File

@ -1,4 +0,0 @@
# Changelog
## [Unreleased]

53
debian/changelog vendored
View File

@ -1,53 +0,0 @@
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

1
debian/compat vendored
View File

@ -1 +0,0 @@
12

16
debian/control vendored
View File

@ -1,16 +0,0 @@
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.

21
debian/convert.sh vendored
View File

@ -1,21 +0,0 @@
#!/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"

43
debian/copyright vendored
View File

@ -1,43 +0,0 @@
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/

View File

@ -1 +0,0 @@
ogcore

2
debian/files vendored
View File

@ -1,2 +0,0 @@
ogcore_1.0.5+develop20250310-1_all.deb web optional
ogcore_1.0.5+develop20250310-1_amd64.buildinfo web optional

18
debian/ogcore.install vendored
View File

@ -1,18 +0,0 @@
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/

160
debian/ogcore.postinst vendored
View File

@ -1,160 +0,0 @@
#!/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

View File

@ -1,6 +0,0 @@
# 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

42
debian/ogcore.preinst vendored
View File

@ -1,42 +0,0 @@
#!/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

19
debian/ogcore.prerm vendored
View File

@ -1,19 +0,0 @@
#!/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

View File

@ -1,10 +0,0 @@
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

12
debian/rules vendored
View File

@ -1,12 +0,0 @@
#!/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

View File

@ -1 +0,0 @@
3.0 (native)

View File

@ -20,7 +20,6 @@ services:
ports:
- 8080:80
- 8443:443
- 3000:3000
volumes:
- ogpublic:/var/www/html/public:cached
networks:
@ -40,32 +39,9 @@ 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:

View File

@ -42,31 +42,7 @@ services:
networks:
- ogcore-network
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:
mercure_data:
mercure_config:
database_data:
networks:

View File

@ -22,3 +22,5 @@ RUN install-php-extensions sockets
COPY . /var/www/html
RUN APP_ENV=prod composer install --no-dev --no-interaction --no-progress --optimize-autoloader
RUN chown -R www-data:www-data /var/www/html

View File

@ -15,8 +15,6 @@ server {
ssl_certificate /etc/nginx/certs/ogcore.uds-test.net.crt.pem;
ssl_certificate_key /etc/nginx/certs/ogcore.uds-test.net.key.pem;
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;
@ -45,27 +43,3 @@ server {
error_log /var/log/nginx/error.log debug;
access_log /var/log/nginx/access.log;
}
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;
}
}

View File

@ -1,12 +1,11 @@
{
"vars": {
"OG_BOOT_API_URL": "192.168.68.51:8082",
"OG_DHCP_API_URL": "192.168.68.51:8081",
"OG_BOOT_API_URL": "192.168.68.58",
"OG_DHCP_API_URL": "192.168.68.58:81",
"OG_CORE_IP": "192.168.68.62",
"OG_LOG_IP": "192.168.68.51",
"UDS_AUTH_LOGIN": "test",
"UDS_AUTH_USERNAME": "test",
"UDS_AUTH_PASSWORD": "test",
"UDS_AUTH_LOGIN": "Usuarios locales",
"UDS_AUTH_USERNAME": "natiqindel",
"UDS_AUTH_PASSWORD": "correct horse battery staple",
"UDS_URL": "https:\/\/localhost:8087\/uds\/rest\/"
}
}

View File

@ -1 +0,0 @@
*/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

View File

@ -1,4 +0,0 @@
SERVER_NAME=":3001"
MERCURE_PUBLISHER_JWT_KEY="!ChangeThisMercureHubJWTSecretKey!"
MERCURE_SUBSCRIBER_JWT_KEY="!ChangeThisMercureHubJWTSecretKey!"
MERCURE_EXTRA_DIRECTIVES="cors_origins *"

View File

@ -1,44 +0,0 @@
# 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
}

View File

@ -1,23 +0,0 @@
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;
}
}

View File

@ -1,36 +0,0 @@
server {
listen 8443 ssl;
server_name _;
root /opt/opengnsys/ogcore/api/public/;
index index.html index.php;
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 /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;
}
# Bloque principal para archivos
location / {
try_files $uri $uri/ /index.php?$args;
}
# Manejo de PHP
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass unix:/var/run/php/php8.3-fpm-ogcore.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $request_uri;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_script_name;
}
# Bloque para errores PHP
location ~ \.php$ {
return 404;
}
error_log /var/log/nginx/ogcore-error.log;
access_log /var/log/nginx/ogcore-access.log;
}

View File

@ -1,12 +0,0 @@
[ogcore]
user = opengnsys
group = www-data
listen = /run/php/php8.3-fpm-ogcore.sock
listen.owner = opengnsys
listen.group = www-data
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3

View File

@ -1,27 +0,0 @@
[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

View File

@ -1,33 +0,0 @@
<?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 Version20241211074943 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_NAME ON og_live');
$this->addSql('ALTER TABLE og_live DROP name');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE og_live ADD name VARCHAR(255) NOT NULL');
$this->addSql('CREATE UNIQUE INDEX UNIQ_IDENTIFIER_NAME ON og_live (name)');
}
}

View File

@ -1,33 +0,0 @@
<?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 Version20241211075520 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 DROP FOREIGN KEY FK_48869B54F7E54CF3');
$this->addSql('ALTER TABLE network_settings ADD CONSTRAINT FK_48869B54F7E54CF3 FOREIGN KEY (og_live_id) REFERENCES og_live (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 network_settings DROP FOREIGN KEY FK_48869B54F7E54CF3');
$this->addSql('ALTER TABLE network_settings ADD CONSTRAINT FK_48869B54F7E54CF3 FOREIGN KEY (og_live_id) REFERENCES og_live (id)');
}
}

View File

@ -1,33 +0,0 @@
<?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 Version20241211080733 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 og_live CHANGE filename filename VARCHAR(255) NOT NULL');
$this->addSql('CREATE UNIQUE INDEX UNIQ_IDENTIFIER_FILENAME ON og_live (filename)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP INDEX UNIQ_IDENTIFIER_FILENAME ON og_live');
$this->addSql('ALTER TABLE og_live CHANGE filename filename VARCHAR(255) DEFAULT NULL');
}
}

View File

@ -1,31 +0,0 @@
<?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 Version20241216080914 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 menu DROP title');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE menu ADD title VARCHAR(255) NOT NULL');
}
}

View File

@ -1,31 +0,0 @@
<?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 Version20250107121226 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 menu ADD is_default 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 menu DROP is_default');
}
}

View File

@ -1,33 +0,0 @@
<?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 Version20250107124654 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_C7440455CCD7E912');
$this->addSql('ALTER TABLE client ADD CONSTRAINT FK_C7440455CCD7E912 FOREIGN KEY (menu_id) REFERENCES menu (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_C7440455CCD7E912');
$this->addSql('ALTER TABLE client ADD CONSTRAINT FK_C7440455CCD7E912 FOREIGN KEY (menu_id) REFERENCES menu (id)');
}
}

View File

@ -1,31 +0,0 @@
<?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 Version20250203113932 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 is_global 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 image DROP is_global');
}
}

View File

@ -1,41 +0,0 @@
<?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 Version20250206075246 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 image_image_repository (image_id INT NOT NULL, image_repository_id INT NOT NULL, INDEX IDX_B78513373DA5256D (image_id), INDEX IDX_B785133714C736FC (image_repository_id), PRIMARY KEY(image_id, image_repository_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE image_image_repository ADD CONSTRAINT FK_B78513373DA5256D FOREIGN KEY (image_id) REFERENCES image (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE image_image_repository ADD CONSTRAINT FK_B785133714C736FC FOREIGN KEY (image_repository_id) REFERENCES image_repository (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE image DROP FOREIGN KEY FK_C53D045F50C9D4F7');
$this->addSql('DROP INDEX IDX_C53D045F50C9D4F7 ON image');
$this->addSql('ALTER TABLE image DROP repository_id');
}
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 FOREIGN KEY FK_B78513373DA5256D');
$this->addSql('ALTER TABLE image_image_repository DROP FOREIGN KEY FK_B785133714C736FC');
$this->addSql('DROP TABLE image_image_repository');
$this->addSql('ALTER TABLE image ADD repository_id INT NOT NULL');
$this->addSql('ALTER TABLE image ADD CONSTRAINT FK_C53D045F50C9D4F7 FOREIGN KEY (repository_id) REFERENCES image_repository (id)');
$this->addSql('CREATE INDEX IDX_C53D045F50C9D4F7 ON image (repository_id)');
}
}

View File

@ -1,35 +0,0 @@
<?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 Version20250211073126 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 DROP FOREIGN KEY FK_B785133714C736FC');
$this->addSql('ALTER TABLE image_image_repository DROP FOREIGN KEY FK_B78513373DA5256D');
$this->addSql('DROP TABLE image_image_repository');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE image_image_repository (image_id INT NOT NULL, image_repository_id INT NOT NULL, INDEX IDX_B78513373DA5256D (image_id), INDEX IDX_B785133714C736FC (image_repository_id), PRIMARY KEY(image_id, image_repository_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
$this->addSql('ALTER TABLE image_image_repository ADD CONSTRAINT FK_B785133714C736FC FOREIGN KEY (image_repository_id) REFERENCES image_repository (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE image_image_repository ADD CONSTRAINT FK_B78513373DA5256D FOREIGN KEY (image_id) REFERENCES image (id) ON DELETE CASCADE');
}
}

View File

@ -1,35 +0,0 @@
<?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 Version20250211073801 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 image_image_repository (id INT AUTO_INCREMENT NOT NULL, image_id INT DEFAULT NULL, repository_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, UNIQUE INDEX UNIQ_B7851337D17F50A6 (uuid), INDEX IDX_B78513373DA5256D (image_id), INDEX IDX_B785133750C9D4F7 (repository_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE image_image_repository ADD CONSTRAINT FK_B78513373DA5256D FOREIGN KEY (image_id) REFERENCES image (id)');
$this->addSql('ALTER TABLE image_image_repository ADD CONSTRAINT FK_B785133750C9D4F7 FOREIGN KEY (repository_id) REFERENCES 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 image_image_repository DROP FOREIGN KEY FK_B78513373DA5256D');
$this->addSql('ALTER TABLE image_image_repository DROP FOREIGN KEY FK_B785133750C9D4F7');
$this->addSql('DROP TABLE image_image_repository');
}
}

View File

@ -1,33 +0,0 @@
<?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 Version20250211081319 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 DROP FOREIGN KEY FK_B785133750C9D4F7');
$this->addSql('ALTER TABLE image_image_repository ADD CONSTRAINT FK_B785133750C9D4F7 FOREIGN KEY (repository_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 image_image_repository DROP FOREIGN KEY FK_B785133750C9D4F7');
$this->addSql('ALTER TABLE image_image_repository ADD CONSTRAINT FK_B785133750C9D4F7 FOREIGN KEY (repository_id) REFERENCES image_repository (id)');
}
}

View File

@ -1,33 +0,0 @@
<?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 Version20250211081406 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 DROP FOREIGN KEY FK_B785133750C9D4F7');
$this->addSql('ALTER TABLE image_image_repository ADD CONSTRAINT FK_B785133750C9D4F7 FOREIGN KEY (repository_id) REFERENCES 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 image_image_repository DROP FOREIGN KEY FK_B785133750C9D4F7');
$this->addSql('ALTER TABLE image_image_repository ADD CONSTRAINT FK_B785133750C9D4F7 FOREIGN KEY (repository_id) REFERENCES image_image_repository (id)');
}
}

View File

@ -1,31 +0,0 @@
<?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 Version20250211103630 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_IMAGE_REPOSITORY ON image_image_repository (image_id, repository_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP INDEX UNIQ_IDENTIFIER_IMAGE_REPOSITORY ON image_image_repository');
}
}

View File

@ -1,31 +0,0 @@
<?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 Version20250211105319 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 CHANGE image_id image_id INT 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 CHANGE image_id image_id INT DEFAULT NULL');
}
}

View File

@ -1,31 +0,0 @@
<?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 Version20250211162339 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 DROP path, DROP type, DROP revision, DROP info, DROP size, DROP status');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE image ADD path VARCHAR(255) DEFAULT NULL, ADD type VARCHAR(255) DEFAULT NULL, ADD revision VARCHAR(255) DEFAULT NULL, ADD info VARCHAR(255) DEFAULT NULL, ADD size INT DEFAULT NULL, ADD status VARCHAR(255) NOT NULL');
}
}

View File

@ -1,33 +0,0 @@
<?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 Version20250211164155 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 DROP created, DROP image_fullsum');
$this->addSql('ALTER TABLE image_image_repository ADD created TINYINT(1) DEFAULT NULL, ADD image_fullsum 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 created, DROP image_fullsum');
$this->addSql('ALTER TABLE image ADD created TINYINT(1) DEFAULT NULL, ADD image_fullsum VARCHAR(255) DEFAULT NULL');
}
}

View File

@ -1,33 +0,0 @@
<?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 Version20250214083512 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 trace DROP FOREIGN KEY FK_315BD5A119EB6921');
$this->addSql('ALTER TABLE trace ADD CONSTRAINT FK_315BD5A119EB6921 FOREIGN KEY (client_id) REFERENCES client (id) ON DELETE CASCADE');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE trace DROP FOREIGN KEY FK_315BD5A119EB6921');
$this->addSql('ALTER TABLE trace ADD CONSTRAINT FK_315BD5A119EB6921 FOREIGN KEY (client_id) REFERENCES client (id)');
}
}

View File

@ -1,31 +0,0 @@
<?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 Version20250214114518 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 og_live ADD date DATETIME NOT NULL, 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 og_live DROP date, DROP name');
}
}

View File

@ -1,31 +0,0 @@
<?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 Version20250214120305 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 trace CHANGE client_id client_id 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 trace CHANGE client_id client_id INT NOT NULL');
}
}

View File

@ -1,31 +0,0 @@
<?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 Version20250214121437 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 og_live CHANGE date date 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 og_live CHANGE date date DATETIME NOT NULL');
}
}

View File

@ -1,31 +0,0 @@
<?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 Version20250217095913 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 organizational_unit ADD exclude_parent_changes 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 organizational_unit DROP exclude_parent_changes');
}
}

View File

@ -1,31 +0,0 @@
<?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 Version20250217115241 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 trace ADD progress 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 trace DROP progress');
}
}

View File

@ -1,31 +0,0 @@
<?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 Version20250217120940 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 DROP validation, DROP og_log');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE network_settings ADD validation TINYINT(1) DEFAULT NULL, ADD og_log VARCHAR(255) DEFAULT NULL');
}
}

View File

@ -1,31 +0,0 @@
<?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 Version20250225081416 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 netiface 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 network_settings DROP netiface');
}
}

View File

@ -1,31 +0,0 @@
<?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 Version20250227095120 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 user ADD groups_view 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 user DROP groups_view');
}
}

View File

@ -1,31 +0,0 @@
<?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 Version20250227154452 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 subnet ADD dns 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 subnet DROP dns');
}
}

View File

@ -1,31 +0,0 @@
<?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 Version20250304115209 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 user CHANGE groups_view groups_view 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 user CHANGE groups_view groups_view VARCHAR(255) NOT NULL');
}
}

View File

@ -1,31 +0,0 @@
<?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');
}
}

View File

@ -1,31 +0,0 @@
<?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');
}
}

View File

@ -1,31 +0,0 @@
<?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');
}
}

View File

@ -1,31 +0,0 @@
<?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');
}
}

View File

@ -1,31 +0,0 @@
<?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)');
}
}

View File

@ -1,31 +0,0 @@
<?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');
}
}

View File

@ -1,31 +0,0 @@
<?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');
}
}

View File

@ -1,33 +0,0 @@
<?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');
}
}

View File

@ -1,31 +0,0 @@
<?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');
}
}

View File

@ -1,31 +0,0 @@
<?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');
}
}

View File

@ -1,31 +0,0 @@
<?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');
}
}

View File

@ -1,38 +0,0 @@
#!/bin/bash
set -x
set -e
VERSION=$1
DISTDIR=ogcore-$VERSION/opt/opengnsys/ogcore
export COMPOSER_ALLOW_SUPERUSER=1
export APP_ENV=prod
rm -rf ogcore-$VERSION
cd ogcore
composer dump-env prod
composer install --no-dev --no-interaction --no-progress --optimize-autoloader
cd ..
# Crear directorios necesarios
mkdir -p $DISTDIR/api
mkdir -p $DISTDIR/etc/nginx/certs
mkdir -p $DISTDIR/etc/nginx/conf
for i in bin config migrations public src swagger-assets templates translations var vendor ; do
cp -pr ogcore/$i $DISTDIR/api/$i
done
cp -pr ogcore/DEBIAN ogcore-$VERSION/
cp -pr ogcore/etc $DISTDIR/
cp ogcore/docker/certs/* $DISTDIR/etc/nginx/certs/
chmod 755 ogcore-$VERSION/DEBIAN/postinst
chmod 755 ogcore-$VERSION/DEBIAN/preinst
cp ogcore/composer.json $DISTDIR/api
cp ogcore/composer.lock $DISTDIR/api
cp ogcore/symfony.lock $DISTDIR/api
cp ogcore/.env.local.php $DISTDIR/api
cp ogcore/env.json $DISTDIR/api
sed -i "s/%%VERSION%%/$VERSION/g" ogcore-$VERSION/DEBIAN/control
# Imprimir el tag actual
echo "Empaquetando TAG $TAG"
rm -f ogcore-$VERSION.deb
dpkg-deb --build ogcore-$VERSION

View File

@ -15,7 +15,6 @@
<server name="SHELL_VERBOSITY" value="-1" />
<server name="SYMFONY_PHPUNIT_REMOVE" value="" />
<server name="SYMFONY_PHPUNIT_VERSION" value="9.6" />
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak" />
</php>
<testsuites>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

View File

@ -1,49 +0,0 @@
<?php
namespace App\Command;
use App\Entity\Client;
use App\Entity\Trace;
use App\Model\CommandTypes;
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\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
#[AsCommand(name: 'opengnsys:load-traces', description: 'Load traces')]
class ChargeExampleTraceCommand extends Command
{
public function __construct(
private readonly EntityManagerInterface $entityManager
)
{
parent::__construct();
}
protected function execute(InputInterface $input, OutputInterface $output): int
{
$clients = $this->entityManager->getRepository(Client::class)->findAll();
$traces = TraceStatus::getStatusKeys();
foreach ($clients as $client) {
foreach ($traces as $traceStatus) {
$trace = new Trace();
$trace->setClient($client);
$trace->setJobId('CreateAuxiliarFiles_' . $client->getId());
$trace->setStatus($traceStatus);
$trace->setCommand(CommandTypes::CREATE_IMAGE_AUX_FILE);
$trace->setExecutedAt(new \DateTime());
$this->entityManager->persist($trace);
}
}
$this->entityManager->flush();
return Command::SUCCESS;
}
}

View File

@ -1,98 +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:check-client-availability', description: 'Check client availability')]
class CheckClientAvailability extends Command
{
const int THRESHOLD_MINUTES = 3;
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);
$query = $this->entityManager->createQuery(
'UPDATE App\Entity\Client c
SET c.status = :status
WHERE c.status = :currentStatus AND c.updatedAt < :threshold'
);
$query->setParameter('status', ClientStatus::DISCONNECTED);
$query->setParameter('currentStatus', ClientStatus::OG_LIVE);
$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);
}
}
}

View File

@ -89,6 +89,7 @@ class LoadDefaultCommandsCommand extends Command
$this->entityManager->flush();
return Command::SUCCESS;
return 1;
}
}

View File

@ -1,38 +0,0 @@
<?php
declare(strict_types=1);
namespace App\Command;
use App\Entity\Menu;
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;
#[AsCommand(name: 'opengnsys:load-default-menu', description: 'Load the default menu')]
class LoadDefaultMenuCommand extends Command
{
public function __construct(
private readonly EntityManagerInterface $entityManager
)
{
parent::__construct();
}
protected function execute(InputInterface $input, OutputInterface $output): int
{
$menu = new Menu();
$menu->setName('Default menu');
$menu->setResolution('1920x1080');
$menu->setComments('Default menu comments');
$menu->setPublicUrl('main');
$menu->setIsDefault(true);
$this->entityManager->persist($menu);
$this->entityManager->flush();
return Command::SUCCESS;
}
}

Some files were not shown because too many files have changed in this diff Show More