xazziri/elabftw

By xazziri

Updated about 1 month ago

ElabFTW / elabimg and MySQL docker images needed for updating old ElabFTW version (=<1.8) + how-to.

Image
Content Management System
Data Science

51

Upgrade old elabFTW

Even though elabFTW is a great Lab Journal, upgrading elabFTW from an extremely old version is a pain and not supported.

So when we found an elabFTW 1.7 install running an important lab journal, we needed to find the upgrade path. This documents the process we took. The docker container images we used are uploaded to this repo. If you don't trust this repo, please build them yourself.

Our process

We started in docker with mysql 5.6 and the official elabftw 1.8 docker image (which contains version 1.8.5). We imported our data according to the guide at: https://doc.elabftw.net/upgrade-to-docker.html

So we moved the uploaded files into the web folder and ran the chown:

cp -r /path/to/uploads/* /var/elabftw/web
# fix permissions
chown -R 101:101 /var/elabftw/web

The we started elabFTW and imported the sql dump:

elabctl start
docker cp elabftw-mysql.sql mysql:/
docker exec -it mysql bash
mysql -uroot -p
# here you type the password you put in MYSQL_ROOT_PASSWORD in the /etc/elabftw.yml file
Mysql> drop database elabftw;
Mysql> create database elabftw character set utf8mb4; #(there is no support for collate utf8mb4_0900_ai_ci in this old mysql version)
Mysql> use elabftw;
Mysql> source elabftw-mysql.sql;
Mysql> exit;
rm -rf elabftw-mysql.sql
exit
elabctl update

Next we used the information found on the wayback machine about updating from 1.8 to 2, and the newer official update documentation, along with several githubissues and the releasenotes to construct our update path.

Update steps

We used the following intermediate image versions. You may be able to skip some, but not all. These worked for us (YMMV!!).

Start with elabFTW 1.8 (1.8.5) with mysql 5.6 and copy your files and import db as described above
upgrade to 2.0.0 (elabFTW may be not working, ignore for now, it worked again after the next step to 2.0.7)! >
2.0.7 > backup mysql > 3.0.3 > run updateto3 (see below) > 
3.3.0 > 3.4.2 > updateto34 (see below) > 3.4.17 >
3.6.7 > switch mysql to 5.7 > 4.0.0 >
4.2.4 > switch mysql to 8.0 (4.3.0 needs 8.0, but do not use mysql 8.0 before this step, it wil break database migrations!) >
4.3.0 > 4.4.0 > 4.9.0 > 5.0.0 > 5.1.0 > 5.1.14 (latest at the time of writing)

In between every update you need to start elabFTW, visit the website and refresh several times (we used a minimum of 3x) to trigger a database check. From version 3 and further you need to manually run updatedb:

# change the name of the container if it is different in your configuration
docker exec -it elabftw bin/console db:update
# Note: for version 3.3 to 3.4 use this instead
docker exec -it elabftw bin/console db:updateTo34
# Note: for version 2.x to 3.x use this instead
docker exec -it elabftw bin/console db:updateto3

Error: Integrity check failed during DB update

If you recieve the following error after the step to 4.9.0:

docker exec -it elabftw bin/console db:update
PHP Fatal error:  Uncaught Defuse\Crypto\Exception\WrongKeyOrModifiedCiphertextException: Integrity check failed. in /elabftw/vendor/defuse/php-encryption/src/Crypto.php:364
Stack trace:
#0 /elabftw/vendor/defuse/php-encryption/src/Crypto.php(113): Defuse\Crypto\Crypto::decryptInternal()
#1 /elabftw/src/models/Config.php(277): Defuse\Crypto\Crypto::decrypt()
#2 /elabftw/bin/console(30): Elabftw\Models\Config->getDsn()
#3 {main}
  thrown in /elabftw/vendor/defuse/php-encryption/src/Crypto.php on line 364

According to this issue this error is caused by the library in charge of decryption, and related to the SECRET_KEY value. What you want to do is blank the smtp_password as it does not match your current key (integrity check failed). Try this after doing elabctl mysql:

update config set conf_value = null where conf_name = 'smtp_password';

Then do the update, and use the web interface to reset the password from the Sysconfig panel. Do the same with ts_password if set (for timestamping provider).

Building docker images

Docker images < 3.4.11 are not available on docker hub (except 1.8) so you can use the ones provided here or build them yourself:

# For example, build 2.0.0:
git clone https://github.com/elabftw/elabimg
cd elabimg
git checkout 2.0.0
docker build -t elabftw/elabimg:2.0.0 .

Good luck!

Docker Pull Command

docker pull xazziri/elabftw