From bcfea0cfad831f5a7a4e23797f9c5b77eb0dd712 Mon Sep 17 00:00:00 2001 From: Riccardo Di Dato Date: Sat, 1 Oct 2022 12:42:57 +0200 Subject: [PATCH] #6 - WIP --- app/private/bin/worker.php | 2 +- cicd/docker-compose/deploy.yml | 9 ++++++-- private/crontab/core.daily.php | 38 ------------------------------- private/crontab/core.hourly.php | 40 --------------------------------- private/crontab/core.minute.php | 37 ------------------------------ 5 files changed, 8 insertions(+), 118 deletions(-) delete mode 100644 private/crontab/core.daily.php delete mode 100644 private/crontab/core.hourly.php delete mode 100644 private/crontab/core.minute.php diff --git a/app/private/bin/worker.php b/app/private/bin/worker.php index 2b16969..6fa0c9c 100755 --- a/app/private/bin/worker.php +++ b/app/private/bin/worker.php @@ -51,7 +51,7 @@ function execute($taskName) { } catch (Exception $ex) { logInfo("Task $taskName failed execution"); - var_dump($taskName); + var_dump($ex); } } diff --git a/cicd/docker-compose/deploy.yml b/cicd/docker-compose/deploy.yml index cb68de0..0b5f5af 100644 --- a/cicd/docker-compose/deploy.yml +++ b/cicd/docker-compose/deploy.yml @@ -30,7 +30,7 @@ services: links: - mongo:database volumes: - - ./persistence/webserver/storage:/home/§PROJECT_AUTHOR§/storage/§PROJECT_BUILDNAME§ + - ./persistence/storage:/home/§PROJECT_AUTHOR§/storage/§PROJECT_BUILDNAME§ - §PROJECT_BUILDNAME§-ws-log:/var/log/§PROJECT_AUTHOR§/ - §PROJECT_BUILDNAME§-job-comms:/jobComunication/ logging: @@ -53,9 +53,14 @@ services: links: - mongo:database volumes: - - ./persistence/worker/storage:/home/§PROJECT_AUTHOR§/storage/§PROJECT_BUILDNAME§ + - ./persistence/storage:/home/§PROJECT_AUTHOR§/storage/§PROJECT_BUILDNAME§ - §PROJECT_BUILDNAME§-wk-log:/var/log/§PROJECT_AUTHOR§/ - §PROJECT_BUILDNAME§-job-comms:/jobComunication/ + logging: + driver: "json-file" + options: + max-file: "5" + max-size: "150m" memcached: image: memcached:1.6.9-alpine restart: "on-failure:3" diff --git a/private/crontab/core.daily.php b/private/crontab/core.daily.php deleted file mode 100644 index f8ec127..0000000 --- a/private/crontab/core.daily.php +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/php -0){ - foreach ($tasks as $taskName){ - try { - if ($taskName::isActive()){ - LoggingFacilityManager::getLogger("task")->log(LoggingFacility::$LEVEL_INFO,"Executing task '".$taskName::getLabel()."' "); - $taskName::execute(); - LoggingFacilityManager::getLogger("task")->log(LoggingFacility::$LEVEL_INFO,"Task '".$taskName::getLabel()."' completed successfully"); - } - }catch (CoreException $ex){ - $msg = "Error while executing task '".$taskName::getLabel()."' with message '".$ex->getMessage()."'"; - LoggingFacilityManager::getLogger("task")->log(LoggingFacility::$LEVEL_ERROR,$msg); - } - catch (Exception $ex){ - $msg = "Unexpected error while executing task '".$taskName::getLabel()."' with message '".$ex->getMessage()."'"; - LoggingFacilityManager::getLogger("task")->log(LoggingFacility::$LEVEL_ERROR,$msg); - } - } -} - -// try { - - -// }catch (UNHADBException $unex){ -// $msg = $application->core->loggingCatalogManager->getCatalog($unex->getMessage(),$unex->getData()); -// LoggingFacilityManager::getLogger("task")->log(LoggingFacility::$LEVEL_ERROR,"log.task.errorWhileExecutingTask",array("ProcessMailQueue.php",$msg),true); -// } -// catch (Exception $ex){ -// $msg = $application->core->loggingCatalogManager->getCatalog($ex->getMessage()); -// LoggingFacilityManager::getLogger("task")->log(LoggingFacility::$LEVEL_ERROR,"log.task.errorWhileExecutingTask",array("ProcessMailQueue.php",$msg),true); -// } - -?> \ No newline at end of file diff --git a/private/crontab/core.hourly.php b/private/crontab/core.hourly.php deleted file mode 100644 index cb0c65e..0000000 --- a/private/crontab/core.hourly.php +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/php -0){ - foreach ($tasks as $taskName){ - try { - if ($taskName::isActive()){ - LoggingFacilityManager::getLogger("task")->log(LoggingFacility::$LEVEL_INFO,"Executing task '".$taskName::getLabel()."' "); - $taskName::execute(); - LoggingFacilityManager::getLogger("task")->log(LoggingFacility::$LEVEL_INFO,"Task '".$taskName::getLabel()."' completed successfully"); - } - }catch (CoreException $ex){ - $msg = "Error while executing task '".$taskName::getLabel()."' with message '".$ex->getMessage()."'"; - LoggingFacilityManager::getLogger("task")->log(LoggingFacility::$LEVEL_ERROR,$msg); - } - catch (Exception $ex){ - $msg = "Unexpected error while executing task '".$taskName::getLabel()."' with message '".$ex->getMessage()."'"; - LoggingFacilityManager::getLogger("task")->log(LoggingFacility::$LEVEL_ERROR,$msg); - } - } -} - -// try { -// SystemController::executeTask("RefreshApiCache.php"); -// } -// catch (UNHADBException $unex){ -// $msg = $application->core->loggingCatalogManager->getCatalog($unex->getMessage(),$unex->getData()); -// LoggingFacilityManager::getLogger("task")->log(LoggingFacility::$LEVEL_ERROR,"log.task.errorWhileExecutingTask",array("GenerateReminderMail.php",$msg),true); - -// } -// catch (Exception $ex){ -// $msg = $application->core->loggingCatalogManager->getCatalog($ex->getMessage()); -// LoggingFacilityManager::getLogger("task")->log(LoggingFacility::$LEVEL_ERROR,"log.task.errorWhileExecutingTask",array("GenerateReminderMail.php",$msg),true); - -// } - -?> \ No newline at end of file diff --git a/private/crontab/core.minute.php b/private/crontab/core.minute.php deleted file mode 100644 index e69dddb..0000000 --- a/private/crontab/core.minute.php +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/php -0){ - foreach ($tasks as $taskName){ - try { - if ($taskName::isActive()){ - LoggingFacilityManager::getLogger("task")->log(LoggingFacility::$LEVEL_INFO,"Executing task '".$taskName::getLabel()."' "); - $taskName::execute(); - LoggingFacilityManager::getLogger("task")->log(LoggingFacility::$LEVEL_INFO,"Task '".$taskName::getLabel()."' completed successfully"); - } - }catch (CoreException $ex){ - $msg = "Error while executing task '".$taskName::getLabel()."' with message '".$ex->getMessage()."'"; - LoggingFacilityManager::getLogger("task")->log(LoggingFacility::$LEVEL_ERROR,$msg); - } - catch (Exception $ex){ - $msg = "Unexpected error while executing task '".$taskName::getLabel()."' with message '".$ex->getMessage()."'"; - LoggingFacilityManager::getLogger("task")->log(LoggingFacility::$LEVEL_ERROR,$msg); - } - } -} - -?> \ No newline at end of file