Contact Us
24/7
Python BlogDjango BlogSearch for Kubernetes Big DataSearch for Kubernetes AWS BlogCloud Services

Migrating a Website with Custom Features and Add-Ons to Plone 5, Python 3

Six Feet Up
<< ALL PROJECTS

Areas of Expertise

Text Link
Upgrades & Migrations
Text Link
Software Configuration Management
Text Link
Performance Optimization

Industries

Technology
Text Link

Technology Used

CHALLENGE

One of the most common issues organizations face with their website occurs when major upgrades to either the programming framework (e.g., Plone) and/or the programming language (e.g., Python) are announced. It’s critical for organizations to keep their websites on the latest supported version of the software to ensure their content stays secure, but the migration can get delayed due to cost, time and sometimes a general fear of what might break.

For small updates, the upgrade can take just a few hours, but for major updates, a complete migration will require an expert developer and weeks of work.

Six Feet Up, a software company that helps organizations build apps faster, innovate with AI, simplify Big Data and leverage cloud technology, recently completed a migration of its website from Plone 5.1.4 to Plone 5.2.4 and from Python 2.7 to Python 3. Because the website has a variety of add-ons and custom features that wouldn’t be compatible with Plone 5.2.4 and Python 3, Six Feet Up’s expert developers knew the migration would require a significant amount of testing and custom coding, but the benefits of upgrading to Python 3 far outweigh the risks.

Implementation Details

Evaluate

To implement the upgrade, the developer’s first step was to examine the website’s existing content and functionality, including all add-ons that were previously installed. Specifically:

  • Does the website have cruft (a.k.a. poorly written or outdated code)? If yes, delete or update the code before migrating the site.
  • Are there add-ons and features that are no longer being used? If yes, uninstall those items.
  • Are the add-ons and custom functionalities compatible with the new software? If no, find new add-ons that are compatible and update the Buildout accordingly.

The older the site, the more complex this evaluation process is.

Six Feet Up’s website — which was built on Plone 5.0 — was relatively new, so there was limited cruft to update. Some add-ons, which were listed via Buildout and the backend of Plone, were deleted. Other add-ons — like PloneFormGen which is not compatible with Python 3 — had to be removed and replaced.

Write and Test Code

Once the evaluation was complete, the developers began writing and testing code. To ensure a seamless migration and limited downtime for the end-user, the developer made a copy of the website and housed it on their local machine.

First, all known incompatible add-ons were removed. Then, the website was moved to the latest version of Plone. Finally, everything was converted to Python 3. In addition to these 10 Tips for Upgrading to Python 3, resources from Plone and Python’s open-source communities including the Python Package Index’s (PyPI’s) zest.zodbupdate project description and forum posts in community.plone.org helped guide the process.

Each step in the process had a unique set of coding needs, so Six Feet Up’s senior Python developer and current Plone Foundation President, Chrissy Wainwright, worked on three different branches.

“It’s important to put as much into upgrade steps as you can so that you’re not having to do it manually through the web,” said Wainwright. “In the code repository, I had four branches for the Six Feet Up website migration. I had the code that was running on production, the code that was reviewed as part of the evaluation, the code that was needed to move everything to Plone 5.2.4, and the code that was needed to move everything to Python 3. This way, I have different versions of the code so that I can run all of my steps sequentially and it’s automating the process as much as possible.”

During this process, the developer added code, removed code and tested the upgraded site multiple times before migrating the database and officially sending the website to production.

Migrate the Database

After the website was evaluated and the code was updated to work on Plone 5.2.4 and Python 3, Six Feet Up’s RelStorage database — which was created in Python 2.7 — had to be migrated.

Specifically, the developers followed the below procedure (for more information about the technical background, read “Why do I have to migrate my database?”):

  1. Back up your database!
  2. Pack your database to 0 days (zodbupdate will not update your database history and will leave old objects in place and you will not be able to pack your database in the future).
  3. In your old Buildout under Python 2, verify your database integrity using zodbverify. Solve integrity problems, if there are any.
  4. Prepare your Buildout for migrating the database to Python 3.
  5. Do not start the instance.
  6. Migrate your database using zodbupdate.
  7. Verify your database integrity using zodbverify. If there are any problems, solve them and redo the migration.
  8. Start the instance.
  9. Manually check that all works as expected.

During the migration of Six Feet Up’s database, the developers ran into an issue with blobs (a.k.a. images and files) because of how they were mounted on the server. Newer versions of RelStorage recommend that blobs be part of the database. Once the developers moved the blobs into Postgres, the issue was corrected.

Publish the Upgraded Website

Following numerous tests and updates, the Six Feet Up website was published — complete with backend updates, community support and new features — on Plone 5.2.4 and Python 3.

Results

As a result of the migration to Plone 5.2.4 and Python 3, Six Feet Up’s site:

  • is more secure;
  • features the newest add-ons for a better visitor experience; and
  • has more customizations including search, content tagging and filter options (as seen on the Projects page) and backend logic that determines which blogs, news and events are displayed (as seen on the Homepage).

Read more about the benefits of upgrading to Python 3 here.

ARE YOU READY TO START YOUR NEXT PROJECT?

Let's Talk