Why is application portability difficult and how to prepare for it
What portability means?
Application portability means that an application can be installed, used and supported easily on different host environments without needing to change the code. While portability has different aspects, all of which must be considered, it can be split in two components - the application itself and the environment where the application is running. To achieve portability you need both, an application which is designed to be portable and a new environment which is compatible with the application.
Why do you need portable applications?
There are a variety of reasons why apps must be migrated from one environment to another, here are just a few common scenarios.
Deployment of application on new customer environment.
Migrating application from on-premise to the cloud.
Integrating software in a brand new solution, e.g. edge devices.
Cost optimization - move to a cheaper infrastructure.
Avoid vendor lock-in - ability to move if needed in the future.
Types of applications
Different application architectures can differ quite a bit in how difficult are they to migrate.
Applications which often run without on OS directly on a specifically supported hardware device. Those can be extremely difficult to port, because they are rigid, tightly integrated with the host environment and often have custom dependencies which are hard to carry over.
This is old software which is usually not updated often and does not support modern OS and devices. A monolith also means that the application is big and features a lot of functionality. Bigger is usually harder to migrate than smaller pieces.
Those applications are broken down into modules, each responsible for certain functionality. Migration is much easier as it can be done separately for each module which is simpler and easier to move.
Containerized micro services
This is modern application architecture, where software is very loosely coupled (micro services) which communicate with each other via a standard protocol like HTTP/REST. Connectivity to other systems like ingress, storage, monitoring is clearly defined via standard interfaces. Migration is facilitated by the fact that this software runs on a platform like Docker/Kubernetes, has packaging and is designed with portability from the start.
Aspects of portability
Migration of the application is not all that is needed. Here is a full list of things to migrate.
The application itself.
This can be user data or application data, configuration or any other resources.
We have to pay attention to how the software is accessed on the new environment. Are there any specific requirements like latency or bandwidth, geographic or security restrictions which must be fulfilled.
Applications are not isolated and often work together with other systems like IDM, monitoring and alerting, logging, etc. Those must be carried over as well and often are some of the most difficult to port.
How to migrate your application to a new environment
The easiest migration is moving state of the art application which has been designed with industry best practices from the beginning. But what about more difficult legacy solutions?
Document migration requirements.
Try to identify all requirements and dependencies on the software that needs to be migrated and see if those can be implemented.
Also, there are some tools which can automatically move software between environments, however be mindful that those might not work 100% and you will need to manually adjust. Take advantage of virtualization and containers if possible.
Pay attention to security
Pay close attention to user data and security and may be leave the old environment around for some time, just in case you need to go back if something goes wrong.
Redesign the app
If migration is very difficult, the application itself must be redesigned in order to have support for portability.
Automate the migration
While doing the migration, try to automated as much as possible. Use tooling like Ansible and Terraform, CI/CD to build well documented, repeatable scripts which do the migration for you.