irontec / ivozprovider

IVOZ Provider - Multitenant solution for VoIP telephony providers
https://ivoz.irontec.com/
GNU General Public License v3.0
193 stars 79 forks source link

ivozprovider-scheduler-historic-calls.service in failed state because MicroKernel.php file does not exist #2680

Closed danifernandezs closed 3 months ago

danifernandezs commented 3 months ago

Description

The ivozprovider-scheduler-historic-calls.service is in failed state due to midding MicroKernel.php file

 run-billable-calls-historic[2553944]: PHP Warning:  require(/opt/irontec/ivozprovider/microservices/scheduler/bin/../MicroKernel.php): Failed to open stream: No such file or directory in /opt/irontec/ivozprovider/microservices/scheduler/bin/run-billable-calls-historic on line 10
 run-billable-calls-historic[2553944]: PHP Fatal error:  Uncaught Error: Failed opening required '/opt/irontec/ivozprovider/microservices/scheduler/bin/../MicroKernel.php): Failed to open stream: No such file or directory in /opt/irontec/ivozprovider/microservices/scheduler/bin/run-billable-calls-historic on line 10
 run-billable-calls-historic[2553944]: Stack trace:
 run-billable-calls-historic[2553944]: #0 {main}
 run-billable-calls-historic[2553944]:   thrown in /opt/irontec/ivozprovider/microservices/scheduler/bin/run-billable-calls-historic on line 10
 systemd[1]: ivozprovider-scheduler-historic-calls.service: Main process exited, code=exited, status=255/EXCEPTION

Referenced in line 10 https://github.com/irontec/ivozprovider/blob/tempest/microservices/scheduler/bin/run-billable-calls-historic#L10

And in line 15 https://github.com/irontec/ivozprovider/blob/tempest/microservices/scheduler/bin/run-billable-calls-historic#L15

After checking the rest of the scripts, they are using the bootstrap.php files instead of the MicroKernel.php one


Troubleshooting

journalctl -xeu ivozprovider-scheduler-historic-calls.service

Additional Information

By modifying the file to use the bootstrap.php file instead of the MicroKernel, and calling Kernel instead of the MicroKernel, the service starts and runs without problems

// require Composer's autoloader
// require __DIR__.'/../vendor/autoload.php';    <----  Can it be removed???

require __DIR__.'/../config/bootstrap.php';

// require __DIR__.'/../src/MicroKernel.php';    <----  Can it be removed???

$kernel = new Kernel($env, false);
danifernandezs commented 3 months ago

Can the complete file be like the following?

#!/usr/bin/env php
<?php

use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\HttpFoundation\Request;

// require Composer's autoloader
require __DIR__.'/../config/bootstrap.php';

$input = new ArgvInput();
$env = $input->getParameterOption(['--env', '-e'], getenv('APP_ENV') ?: 'dev');

$kernel = new Kernel($env, false);
$request = new Request([], [], [], [], [], ['REQUEST_URI' => '/billable-calls-historic']);

$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);

if ($response->getStatusCode() >= 300) {
    die(1);
}
Kaian commented 3 months ago

Hi @danifernandezs

Looks like you're on the right track and this microservice has not been properly adapted. We'll try to investigate it further and make any required corrections for the next release.

Also, sorry for the late response and thanks for reporting!!