OpenELIS-Global 1 to 2 Conversion
Notes:
Be sure to create a backup BEFORE attempting this!
Choosing a Path
Path 1 is going to be the easiest and most reliable method of upgrading from version 1 to 2, but requires having a spare machine to place OpenELIS-Global 2 on.
Path 2 is a less reliable way to move from version 1 to 2, but can be done without using a spare machine.
Backups
Before attempting any upgrade paths, be sure you have accessible backups of your currently running version of OpenELIS-Global 1 available on another drive/server.
For path 1 this involves checking to make sure you are able to successfully restore from your backup file
For path 2, it is recommended to have a backup of your entire system, not just the database.
Testing New Installation
- Ensure you can log in (check more than just admin account)
- Ensure old data can be properly found (ex. Search for an old patient)
Path 1: Migrate Server to New Machine
This is the recommended method of upgrading
ENSURE YOU BACK UP YOUR DATABASE FIRST
Dump Database on Old Server
- make a logical backup of your database
sudo -u postgres pg_dump -d clinlims > OpenELIS-backup.sql
Install OpenELIS-Global 2 on New Server
- Follow normal install instructions for OpenELIS-Global 2
- Currently located here
Pause Docker containers on New Server
- Run the following command
sudo docker kill openelisglobal-webapp external-fhir-api
Restore Database Dump on New Server
- Copy OpenELIS-backup.sql from old server onto new server
- Copy OpenELIS-backup.sql into the docker db container
sudo docker cp OpenELIS-backup.sql openelisglobal-database:/OpenELIS-backup.sql
- Recreate the database and import the dump
sudo docker exec openelisglobal-database psql -Uadmin -dpostgres -c 'DROP DATABASE clinlims;'
sudo docker exec openelisglobal-database psql -Uadmin -dpostgres -c 'CREATE DATABASE clinlims;'
sudo docker exec openelisglobal-database psql -Uadmin -dpostgres -c 'ALTER DATABASE clinlims OWNER TO clinlims;'
sudo docker exec openelisglobal-database psql -Uadmin -dclinlims -f /OpenELIS-backup.sql
Migrate Passwords (If Unmigrated) on New Server
- Follow password migration instructions
- Currently located here
Migrate Encrypted Values on New Server
sudo docker exec -it openelisglobal-database psql -Uclinlims -dclinlims
SELECT id, name, value FROM clinlims.site_information WHERE encrypted = 't';
- record the "value" column for each row
UPDATE clinlims.site_information SET value = '' WHERE encrypted = 't';
\q
- re-add the values using the front end once the server is back up and running
Run Liquibase on New Server
- Download the old liquibase files and if there is a custom branch, change to it
git clone https://github.com/I-TECH-UW/Liquibase-Outdated.git
cd Liquibase-Outdated
git checkout <branch>
- Run the liquibase command
- put the correct connection values in
./liquibase.properties
java -jar -Dfile.encoding=utf-8 ./lib/liquibase-1.9.5.jar --defaultsFile=./liquibase.properties --url=jdbc:postgresql://localhost:5432/clinlims --contexts=<context> update
- if it complains about md5 checksums, run
sudo docker exec -it openelisglobal-database psql -Uclinlims -dclinlims -c "UPDATE clinlims.databasechangelog SET md5sum = NULL;"
- if Liquibase exits citing that a changeset failed, then that changeset will need to be updated in the proper branch to accommodate that DB. Fixing a changeset can occur in many ways and should be done by a developer who understands OpenELIS and its relationship with the DB.
- If the changeset is doing an operation that is non-essential for your context (ie updating an Organization that doesn't exist in your DB), your context can be dropped from that changesets list of contexts
- If the changeset relies on a previous changeset to run first (dropping a constraint from a table that is missing one), that previous changeset can be added to your context
- If the changeset is updating based on some value that is different in this DB, the SQL should be updated to accommodate both values (ie test section called Microbiology vs Microbiologie)
- put the correct connection values in
Update Installation on New Server
- Run upgrade script from OE2 Installer directory
sudo python2 setup_OpenELIS.py
Path 2: Update Server in Place
ENSURE YOU HAVE BACKED UP YOUR DATABASE AND SERVER FIRST
Backup Postgres
- Run the following command
sudo -u postgres pg_dump > OpenELIS-backup.sql
Uninstall Tomcat from Server
Upgrade Ubuntu to Target Version
- Update packages
sudo apt-get update
sudo apt-get upgrade
- Update current distribution
sudo apt-get dist-upgrade
- Upgrade to next version
sudo apt-get install update-manager-core
sudo do-release-upgrade
- Will run for a while...
- Check if running target version
lsb_release -a
- If version does not match target version, repeat from step 1
Update/Install Installation
- Follow normal install/upgrade instructions for OpenELIS-Global 2
- Currently located here
Restore Database Dump into new DB
- Copy OpenELIS-backup.sql into the docker db container
sudo docker cp OpenELIS-backup.sql openelisglobal-database:/OpenELIS-backup.sql
- Recreate the database and import the dump
sudo docker exec openelisglobal-database psql -Uadmin -dpostgres -c 'DROP DATABASE clinlims;'
sudo docker exec openelisglobal-database psql -Uadmin -dpostgres -c 'CREATE DATABASE clinlims;'
sudo docker exec openelisglobal-database psql -Uadmin -dpostgres -c 'ALTER DATABASE clinlims OWNER TO clinlims;'
sudo docker exec openelisglobal-database psql -Uadmin -dclinlims -f /OpenELIS-backup.sql
Migrate Passwords (If Unmigrated)
- Follow password migration instructions
- Currently located here
Migrate Encrypted Values on New Server
sudo docker exec -it openelisglobal-database psql -Uclinlims -dclinlims
SELECT id, name, value FROM clinlims.site_information WHERE encrypted = 't';
- record the "value" column for each row
UPDATE clinlims.site_information SET value = '' WHERE encrypted = 't';
\q
- re-add the values using the front end once the server is back up and running
Run Liquibase on New Server
- Download the old liquibase files and if there is a custom branch, change to it
git clone https://github.com/I-TECH-UW/Liquibase-Outdated.git
cd Liquibase-Outdated
git checkout <branch>
- Run the liquibase command
- put the correct connection values in
./liquibase.properties
java -jar -Dfile.encoding=utf-8 ./lib/liquibase-1.9.5.jar --defaultsFile=./liquibase.properties --url=jdbc:postgresql://localhost:5432/clinlims --contexts=<context> update
- if it complains about md5 checksums, run
sudo docker exec -it openelisglobal-database psql -Uclinlims -dclinlims -c "UPDATE clinlims.databasechangelog SET md5sum = NULL;"
- put the correct connection values in
Update Installation
- Run upgrade script from OE2 Installer directory
sudo python setup_OpenELIS.py