Upgrading to ME 1.24

Elentra ME 1.24 was released on September 16th, 2022.

Release 1.27 introduced breaking changes to EJS 2. If you are using a version of Elentra that is 1.26.0 or less, you need to update deploy.php to ensure "branch_ejs" is pointing to "v2.6.0".

Important Upgrade Notes

Elentra ME 1.24 Introduces a new database for Dynamic CBE. Please ensure your config.inc.php and settings.inc.php files are up to date and back up your database before performing any migrations.

PHP 8.0 support was added. Upgrading your version of PHP can introduce breaking changes to your customizations.

Please review the Important Changes section before proceeding.

Part 1: Source Code Update

  1. From within Sourcetree on your developer workstation, open your existing local Elentra ME Branded Edition (i.e., uni-elentra-1x-me) repository.

  2. If you do not currently have a consortium Git remote that points to the Consortium Edition elentra-1x-me repository, then ensure that you add one:

    git remote add consortium git@github.com:ElentraProject/elentra-1x-me.git
  3. Click the "Fetch" button (ensuring that "Fetch from all remotes" and "Prune tracking branches no longer present on remote(s)" options are checked) or type git fetch consortium.

  4. Checkout your Branded Edition staging branch (e.g., uni/staging) and create a new branch based on this branch (e.g., uni/staging-pre-1240) just for easy restore purposes in case it's needed. Once that branch has been created, checkout the original Branded Edition staging branch (e.g., uni/staging) and continue.

  5. Within the "Remotes" section in Sourcetree sidebar, expand the consortium remote, then right click on release/1.24 and click Pull consortium/release/1.24 into uni/staging. Alternatively, pull the latest stable release tag, e.g. v1.24.2. At this point, you may be asked to resolve any merge conflicts that have been created by making modifications to your Branded Edition that conflict with changes that have been made to the Consortium Edition. Depending on your level of conflict, this could be as simple as a minor modification to the composer.lock file or something much more complex. If you require assistance, please book an appointment with the Elentra Consortium Core Team, or chat with us on Slack in the #developers channel and we will provide you with guidance or assistance on moving forward. Generally speaking, we always recommend that Consortium Participants follow the Contribution best practices defined in our documentation, which may help reduce the number of conflicts that you encounter.

  6. Once the merge conflicts have been resolved, commit the merge to your uni/staging branch and continue to Part 2 of the instructions.

We recommend against pushing your changes to your origin remote at this point. Please wait until Part 2 has been completed and you have finished some initial testing on your local developer environment.

Release branches (e.g. release/1.24) usually only get bug fixes and have low potential risk, but issues may not be identified until our integration testing before the next release. Therefore, release branches are not completely stable. Release tags (e.g. v1.24.2), on the other hand, are NEVER actively worked on and are the official minor release for a given major release, because tags are only created from the release/1.x branches AFTER our integration testing has passed.

Updating a Branded Edition Elentra API

If your institution does not have a Branded Edition Elentra API, skip this section entirely. These instructions are only applicable to installations of Elentra that have a Branded Edition Elentra API. Not sure? Please contact the Elentra Consortium Core Team for assistance.

  1. To update your Branded Edition Elentra API, first clone or checkout the compatible version of your Branded Edition Elentra API to your local environment using a git tool like Sourcetree. To find the required version, please consult the Compatibility Matrix.

  2. Click the "Fetch" button (ensuring that "Fetch from all remotes" and "Prune tracking branches no longer present on remote(s)" options are checked) or type git fetch consortium.

  3. Within the "Remotes" section in Sourcetree sidebar, expand the consortium remote, then right click on the identified branch from step 1 (i.e. compatible version listed in Compatibility Matrix) and click Pull consortium/<branch> into <Deployed Branch>. There may be merge conflicts that must be resolved if customizations made to your Branded Edition Elentra API.

  4. Resolve any merge conflicts and commit the changes to the master branch of your Branded Edition Elentra API. Push these changes to your origin remote.

  5. Using Sourcetree, create a new tag that follows semantic versioning. For example at the time of writing, the latest tagged release of the api is v7.0.0 and the composer.json provided with Elentra ME 1.24 specifies that the major version of API version must be ~7.0. Create a new tag where the current date follows the patch version: 7.0.1.20220812. More information about tagging API releases can be found here.

  6. Finally, ensure that within your new Deployer deployment recipe (deploy.php) to set the enabled_branded_api option to true and the deployment script will take care of the rest during deployment.

Part 2: Settings and Branding Update

During every major Elentra ME version upgrade, you are required to compare:

  1. The stock settings.inc.php file with each environmental settings file in use.

  2. The www-root/templates/default template directory with each Branded Edition customized template within the www-root/templates directory.

Failure to compare and update all environmental settings files and customized templates could result in a non-functional or semi-functional installation of Elentra ME. If you have questions or require assistance, please contact the Elentra Consortium Core Team.

  1. Using a tool like Araxis Merge or Meld, compare www-root/core/config/settings.inc.php with each environmental settings file in the www-root/core/config directory (e.g., settings-staging.inc.php, settings-production.inc.php). When you compare the Consortium Edition settings.inc.php file with your Branded Edition files, you are looking to add additional settings that have been added to the stock settings.inc.php file and remove any settings that have been removed from the stock settings.inc.php file. In most cases, your Branded Edition settings files should have the same lines (albeit potentially different settings values) as the Consortium Edition. Once you have compared your settings files, commit the changes to your uni/staging branch.

  2. Using a tool like Araxis Merge or Meld, compare the www-root/templates/default directory with each Branded Edition customized template in the www-root/templates directory (e.g., www-root/templates/uni). In most cases, you will want to add missing files, update your language files, examine each modification to the CSS files, and add any modifications to your header.tpl.php files. This process can take some time depending on the level of change in your implementation, and should be repeated for each template you have created. Once you have compared your templates, commit the changes to your uni/staging branch.

Part 3: Testing Locally

Now that you have upgraded your source code and updated your settings and templates. You should begin reviewing and testing the upgrade on your developer workstation. Before testing can begin we need to do a few things.

  1. Log into your local elentra-developer Docker container, and change to your uni-elentra-1x-me directory:

    docker exec -it elentra-developer bash
    cd /var/www/vhosts/uni-elentra-1x-me
  2. Ensure that the latest Composer dependencies installed:

    composer install
  3. Ensure that the database migrations are completed:

    php elentra migrate --up
  4. Providing these steps were successful, you should now be able to visit https://uni-elentra-1x-me.localhost in your web browser and being your local upgrade review.

At this point, providing you're satisfied with your local testing, we would recommend that you push your changes to your origin remote.

Part 4: Configuring Deployer

Elentra ME 1.24 requires Deployer v6.8.0 in order to support the new requirement of a local build step for Elentra JS 2. If you already have Deployer configured, you can skip this step.

The full Elentra Deployment Tool documentation is available from within the Elentra Deployment documentation section.

The following transition instructions are to be used as reference-only, as there may be unique circumstances within your existing deployment recipe to be considered.

Step 1: Copy Deployer template files into your Branded Edition repository

Copy the .deployignore and deploy.php files from the Elentra Developer GitHub Repository and place them in your ~/Sites/uni-elentra-1x-me/deployment directory

Step 2: Update the values in the Deployer recipe template

Open the Deployer deployment/deploy.php deployment recipes in your editor. There are a few variables at the top of deploy.php that need to be set. The following table describes variable names that must set.

Once you have configured all of the variables correctly, the next step is to translate the hosts configuration. The following section illustrates a single staging server and multiple production server transition.

For more documentation related to host configuration options, please see the Deployer Hosts documentation, which is quite extensive.

Example Deployer (deploy.php) Recipe Host configuration

# Elentra ME

// Staging Server
host('elentra-staging.med.university.edu')
    ->stage('staging')
    ->user('staging')
    ->set('branch', 'uni/staging')
    ->set('branch_ejs', 'develop')
    ->set('deploy_path', '/var/www/vhosts/elentra-staging.med.university.edu')
    ->roles('app')
    ->forwardAgent();

// Production Server
host('elentra01.med.university.edu', 'elentra02.med.university.edu')
    ->stage('production')
    ->user('production')
    ->set('branch', 'uni/production')
    ->set('branch_ejs', 'master')
    ->set('deploy_path', '/var/www/vhosts/elentra.med.university.edu')
    ->roles('app')
    ->forwardAgent();

Step 3: Review Deployment Commands

The typical deployment commands used by institutions are referenced below, but please see the Elentra Deployment documentation for a full list of all commands available.

The Deployer deployment strategy transition should require no Apache configuration changes and was designed to be fully backwards compatible with older Capistrano recipes.

Part 5: Testing on Staging

Providing that you have pushed the changes to your uni/staging branch to your origin remote, you can now deploy the upgrade to your staging environment from within your Docker container.

  1. Log into your local elentra-developer Docker container, and navigate to your deployment directory:

    docker exec -it elentra-developer bash
    cd /var/www/vhosts/uni-elentra-1x-me/deployment
  2. Deploy changes to your staging server using the new Deployer deployment recipe:

    dep deploy staging
  3. Providing the deployment was successful, you should now be able to visit https://elentra-staging.med.university.edu in your web browser to begin a thorough review of your upgraded Branded Edition implementation of Elentra ME.

For the most accurate review possible, we would recommend that you have a recent version of your production databases installed and scrubbed loaded on your staging database server. This is typically achieved using the scrub.sh shell script included with the Elentra Platform.

Part 6: Deploy to Production

Providing that you have thoroughly tested your upgraded Branded Edition implementation of Elentra ME on within your staging environment, it is safe to proceed with a production upgrade.

  1. From within Sourcetree on your developer workstation, open your existing local Elentra ME Branded Edition (i.e., uni-elentra-1x-me) repository.

  2. Checkout your uni/production branch.

  3. Right click on your uni/staging branch and click "Merge uni/staging into uni/production". This will merge all of the commits that have gone into creating the upgrade, into your uni/production branch.

  4. Push the commits in the uni/production branch to your origin remote. Log into your local elentra-developer Docker container, and change to your deployment directory:

    docker exec -it elentra-developer bash
    cd /var/www/vhosts/uni-elentra-1x-me/deployment
  5. Deploy changes to your production server using the new Deployer deployment recipe:

    dep deploy production
  6. Providing the deployment was successful, you should now be able to visit https://elentra.med.university.edu in your web browser and verify that you are now running the latest version of Elentra ME.

Important Changes

Dynamic CBE Database

Verify that your config.inc.php and settings.inc.php files are up to date and that any new entries have been added.

The following steps should be completed before running any new migrations, e.g. using dep deploy or php elentra migrate --up.

The CBE migrations can take several hours depending on how much data you have in CBME.

Please test the migrations by running them on data in your staging environment, and compare the tree version data running in the upgraded environment to the already existing CBME tree version data.

1. Create a new database for CBE and grant all privileges to the appropriate database user

CREATE_DATABASE `staging_elentra_cbe`;
GRANT ALL PRIVILEGES ON `staging_elentra_cbe`.* TO 'staging'@'localhost';

2. Ensure that that the value of cbe_database has been set to the correct database in your config.inc.php

<?php
return array(
    ...
    'database' => array(
        ...
        'entrada_database' => 'staging_elentra_me',
        'auth_database' => 'staging_elentra_auth',
        'clerkship_database' => 'staging_elentra_me_clerkship',
        'cbe_database' => 'staging_elentra_cbe',
    ),
    ...
);

3. Ensure that that there is a CBE_DATABASE const defined in settings.inc.php

define ("CBE_DATABASE", $config->database->cbe_database);

4. Back up the existing Elentra ME databases on staging and production. The following command may need to be adapated to the specific database server

mysqldump staging_elentra_me > ~/staging_elentra_me-$(date +%Y-%m-%d).sql
mysqldump production_elentra_me > ~/production_elentra_me-$(date +%Y-%m-%d).sql

5. Add the following command(s) to the crontab for running Elentra cron jobs (e.g. using the crontab -e command in Linux)

0 0 * * * php ENTRADA_ABSOLUTE/www-root/cron/cbme-learner-dashboard-statistics-generator.php --all_cbme_courses
30 4 * * * php ENTRADA_ABSOLUTE/www-root/cron/cbme-visual-summary-statistics-generator.php --all_cbme_courses

6. Add the following CBE upload directories to your storage folder, and ensure they have the correct permissions for the apache user to write to them.

mkdir /var/www/vhosts/elentra.med.university.edu/storage/app/cbe-uploads
mkdir /var/www/vhosts/elentra.med.university.edu/storage/app/cbe-uploads/learner-self-assessment-files

PHP 8.0 Support

  • If you upgrade your version of PHP to 8.0, you will need to test your customizations to make sure they are compatible with PHP 8.0.

  • If you run 1.24 with PHP 7.4, everything should work as normal.

  • Backward Incompatible Changes in PHP 8.0: https://www.php.net/manual/en/migration80.incompatible.php

Last updated