monarc-project / MonarcAppFO

MONARC - Method for an Optimised aNAlysis of Risks by @NC3-LU
https://www.monarc.lu
GNU Affero General Public License v3.0
100 stars 38 forks source link

Upgrade from version 2.12.5 to 2.12.7-p4 #533

Closed abalis closed 3 months ago

abalis commented 3 months ago

I have a MonarcFO installation of version 2.12.5 that I need to upgrade to version 2.12.7-p4. The installation was performed using the instructions for manual deployment on Ubuntu 22.04 (https://github.com/monarc-project/MonarcAppFO/blob/master/INSTALL/INSTALL.ubuntu2204.md). The update instructions mention that the following commands should be executed: $ ./scripts/update-all.sh -c $ rm -Rf ./data/cache $ sudo systemctl restart apache2.service

But, the update-all.sh scripts requires a git project in order to perform its operations. Such git project does not exist in our installation, since the instructions of manual deployment on Ubuntu 22.04 do not include the initialization of a git project. I have tried to initialize a git project inside the installation folder in order to execute the update-all.sh script but I didn't manage to perform the upgrade. Are there any update instructions for installations created using the above instructions for Ubuntu 22.04? What are the official steps that should be followed in this case?

I tried the following solution: 1) I have created a new installation folder under /var/lib/monarc/releases/, using the following commands: PATH_TO_MONARC='/var/lib/monarc/fo' PATH_TO_MONARC_DATA='/var/lib/monarc/fo-data' MONARC_VERSION=$(curl --silent -H 'Content-Type: application/json' https://api.github.com/repos/monarc-project/MonarcAppFO/releases/latest | jq -r '.tag_name') MONARCFO_RELEASE_URL="https://github.com/monarc-project/MonarcAppFO/releases/download/$MONARC_VERSION/MonarcAppFO-$MONARC_VERSION.tar.gz"

-- Download release sudo curl -sL $MONARCFO_RELEASE_URL -o /var/lib/monarc/releases/basename $MONARCFO_RELEASE_URL -- Create release directory sudo mkdir /var/lib/monarc/releases/basename $MONARCFO_RELEASE_URL | sed 's/.tar.gz//' -- Unarchive release sudo tar -xzf /var/lib/monarc/releases/basename $MONARCFO_RELEASE_URL -C /var/lib/monarc/releases/basename $MONARCFO_RELEASE_URL | sed 's/.tar.gz//' -- Create release symlink sudo ln -s /var/lib/monarc/releases/basename $MONARCFO_RELEASE_URL | sed 's/.tar.gz//' $PATH_TO_MONARC -- Create data directory symlink sudo ln -s $PATH_TO_MONARC_DATA $PATH_TO_MONARC/data

2) I have created the required git project using the following commands: cd /var/lib/monarc/releases/MonarcAppFO-v2.12.7-p4 git clean -fd git pull origin master

3) I have updated the db connection properties in file ./config/autoload/local.php

4) I have executed script update-all.sh in /var/lib/monarc/fo I have also tried executing each command of the above script separately so that I can monitor each step of the update process.

5) I have executed command rm -rf /var/lib/monarc/fo/data/cache/*

6) sudo systemctl restart apache2.service

Although the update process is completed the application is not upgraded. Version 2.12.5 is still displayed in the UI and bugs are not fixed.

In the installation directory of MONARC (/var/lib/monarc/fo/), version 2.12.7 is specified in the "VERSION.json".

Following are the latest records of table phinxlog of monarc_cli schema: '20210521090000', 'ChangeableOperationalImpact', '2022-12-22 17:20:15', '2022-12-22 17:20:15', '0' '20220408110500', 'AddMetadataOnInstances', '2022-12-22 17:20:15', '2022-12-22 17:20:16', '0' '20220411123641', 'AddTwoFaRelatedKeys', '2022-12-22 17:20:16', '2022-12-22 17:20:16', '0' '20220511123641', 'AddCustomizableSoaScale', '2022-12-22 17:20:16', '2022-12-22 17:20:16', '0' '20220718123641', 'AddSeveralModelsPerClient', '2022-12-22 17:20:16', '2022-12-22 17:20:16', '0' '20220829123641', 'FixIssueWithSpecificModel', '2022-12-22 17:20:16', '2022-12-22 17:20:16', '0' '20230110110655', 'CreateCronTask', '2024-06-02 11:36:49', '2024-06-02 11:36:50', '0'

Following are the latest records displayed when command ls -l vendor/monarc/frontoffice/migrations/db/ is executed:

-rw-r--r-- 1 www-data www-data 18855 Μαΐ 14 12:32 20210521090000_changeable_operational_impact.php -rw-r--r-- 1 www-data www-data 2795 Μαΐ 14 12:32 20220408110500_add_metadata_on_instances.php -rw-r--r-- 1 www-data www-data 1310 Μαΐ 14 12:32 20220411123641_add_two_fa_related_keys.php -rw-r--r-- 1 www-data www-data 5890 Μαΐ 14 12:32 20220511123641_add_customizable_soa_scale.php -rw-r--r-- 1 www-data www-data 2282 Μαΐ 14 12:32 20220718123641_add_several_models_per_client.php -rw-r--r-- 1 www-data www-data 1282 Μαΐ 14 12:32 20220829123641_fix_issue_with_specific_model.php -rw-r--r-- 1 www-data www-data 1254 Μαΐ 14 12:32 20230110110655_create_cron_task.php

Following is the output of composer up: Problem 1

What I have noticed is that new ./data/cache/* files created still mention the previous version installation folder. For example, file /var/lib/monarc/fo/data/cache/module-config-cache.c8aaaaa11586f8b1bf5565cc6064e70a.php has the following references:

    'driver' => [
        'Monarc_core_driver' => [
            'class' => 'Doctrine\\ORM\\Mapping\\Driver\\AnnotationDriver',
            'cache' => 'array',
            'paths' => [
                '/var/lib/monarc/releases/MonarcAppFO-v2.12.5/vendor/monarc/core/config/../src/Model/Entity'
            ]
        ],
        'orm_default' => [
            'drivers' => [
                'Monarc\\Core\\Model\\Entity' => 'Monarc_core_driver'
            ],
            'class' => 'Doctrine\\Persistence\\Mapping\\Driver\\MappingDriverChain'
        ],
        'Monarc_cli_driver' => [
            'class' => 'Doctrine\\ORM\\Mapping\\Driver\\AnnotationDriver',
            'cache' => 'array',
            'paths' => [
                '/var/lib/monarc/releases/MonarcAppFO-v2.12.5/vendor/monarc/core/config/../src/Model/Entity',
                '/var/lib/monarc/releases/MonarcAppFO-v2.12.5/vendor/monarc/frontoffice/config/../src/Model/Entity',
                '/var/lib/monarc/releases/MonarcAppFO-v2.12.5/vendor/monarc/frontoffice/config/../../core/src/Model/Entity',
                '/var/lib/monarc/releases/MonarcAppFO-v2.12.5/vendor/monarc/frontoffice/config/../../frontoffice/src/Model/Entity'
            ]
        ],

So, I do not know how to clear these cache files.