Upgrade Guide from 8.4.2 to 8.5
Upgrade Java
To upgrade Java:
Install Java from app-all 8.5.
./workfusion_setup_full.sh -i javaCheck that Java is linked to new version.
ls -l $INSTALL_DIR/lib/javaOutput:
/opt/workfusion/lib/java -> /opt/workfusion/lib/jdk1.8.0_144Check Java version.
/opt/workfusion/lib/java/bin/java -versionOutput:
java version "1.8.0_144"
Rollback
To link Java to a previous version, run the following command:
ln -snf $INSTALL_DIR/lib/jdk1.8.0_101 $INSTALL_DIR/lib/java
Update Tomcat
Tomcat is updated to version 8.5.20.
To update Tomcat:
Stop Tomcat.
tomcat-service stopBackup existing webapps.
$ cd $INSTALL_DIR/apps $ tar -czf webapps.backup.tar.gz webappsInstall Tomcat and webapps from app-all 8.5.
$ ./workfusion_setup_full.sh -i tomcat $ ./workfusion_setup_full.sh -i webappsStart Tomcat.
tomcat-service start
Rollback
To restore webapps from backup, run the following commands:
$ mv webapps webapps_8.5.20
$ tar -xf webapps.backup.tar.gz
Update MySQL
- MySQL Percona XtraDB Cluster is updated to version 5.7.18.
- &useSSL=false
- innodb_large_prefix=true
To update MySQL:
Stop MySQL.
mysql-service stopBackup existing MySQL data as files.
$ cd $INSTALL_DIR/apps $ tar -czf mysql.backup.tar.gz mysqlInstall mysql app-all 8.5.
./workfusion_setup_full.sh -i mysql_masterCheck that MySQL is linked to the new version.
ls -l $INSTALL_DIR/lib/mysqlOutput:
/opt/workfusion/lib/mysql -> /opt/workfusion/lib/Percona-XtraDB-Cluster-57-5.7.18-29.20.1.el7.x86_64Check that my.cnf contains the following lines.
secure-file-priv="" show_compatibility_56=ON sql_mode='ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'
Also you must load new jdbc:mysql connection (with useSSL=false) to vault manually. Here, jdbc:mysql://db.example.com:3306 is used as an example, remember to use your record.
To load the connection:
Go to the wf_sec_storage directory.
cd $INSTALL_DIR/apps/webapps/wf_sec_storageCheck the mturkds.database.url value in vault.
$INSTALL_DIR/lib/java/bin/java -jar $INSTALL_DIR/app-all/loader-security-properties-correct.jar workfusion connectionProps.json review 2>&1 | grep mturkds.database.urlOutput
[INFO ] mturkds.database.url : jdbc:mysql://db.example.com:3306/wfdb?noAccessToProcedureBodies=true&useLegacyDatetimeCode=false&noAccessToProcedureBodies=true&serverTimezone=UTC&rewriteBatchedStatements=true&failOverReadOnly=falseCreate file add.properties with the following content: Add
&useSSL=falseto the end of your mturkds.database.url.mturkds.database.url=jdbc:mysql://db.example.com:3306/wfdb?noAccessToProcedureBodies=true&useLegacyDatetimeCode=false&noAccessToProcedureBodies=true&serverTimezone=UTC&rewriteBatchedStatements=true&failOverReadOnly=false&useSSL=falseLoad the new value to vault:
$INSTALL_DIR/lib/java/bin/java -jar $INSTALL_DIR/app-all/loader-security-properties-correct.jar workfusion connectionProps.json add.propertiesOutput
/opt/workfusion/lib/mysql -> /opt/workfusion/lib/Percona-XtraDB-Cluster-57-5.7.18-29.20.1.el7.x86_64Check the mturkds.database.url value in vault again.
$INSTALL_DIR/lib/java/bin/java -jar $INSTALL_DIR/app-all/loader-security-properties-correct.jar workfusion connectionProps.json review 2>&1 | grep mturkds.database.urlOutput
[INFO ] mturkds.database.url : jdbc:mysql://db.example.com:3306/wfdb?noAccessToProcedureBodies=true&useLegacyDatetimeCode=false&noAccessToProcedureBodies=true&serverTimezone=UTC&rewriteBatchedStatements=true&failOverReadOnly=false&useSSL=false
Rollback
To restore:
Restore MySQL data from backup.
$ mv mysql mysql_57 $ tar -xf mysql.backup.tar.gzLink MySQL to the previous version.
$ ln -snf $INSTALL_DIR/lib/Percona-XtraDB-Cluster-57-5.7.18-29.20.1.el7.x86_64 $INSTALL_DIR/lib/MySQLLoad the jdbc:mysql record without useSSL=false to vault.
Update Nginx
The temp dirs for proxy are specified in NGINX_CONF_DIR.
To change Nginx:
Create a temporary directory:
$ tempdir=$INSTALL_DIR/apps/nginx/etc/tmp $ mkdir -p $tempdir/{proxy_temp,uwsgi_temp,client_temp,fastcgi_temp,fastcgi_temp} $ chown -R $NGINX_USER $tempdirIn
$INSTALL_DIR/apps/nginx/etc/nginx.conf, in the Server section, add the following lines. Remember to use your installation directory instead ofINSTALL_DIR.proxy_temp_path INSTALL_DIR/apps/nginx/etc/tmp/proxy_temp 1 2; uwsgi_temp_path INSTALL_DIR/apps/nginx/etc/tmp/uwsgi_temp 1 2; client_body_temp_path INSTALL_DIR/apps/nginx/etc/tmp/client_temp 1 2; fastcgi_temp_path INSTALL_DIR/apps/nginx/etc/tmp/fastcgi_temp 1 2; scgi_temp_path INSTALL_DIR/apps/nginx/etc/tmp/scgi_temp 1 2;Restart Nginx.
nginx-service restart
Rollback
To revert the changes:
- Remove the
$INSTALL_DIR/apps/nginx/etc/tmpfile. - In
$INSTALL_DIR/apps/nginx/etc/nginx.conf, remove the_temp_pathrecords. - Restart Nginx.
Add the MySQL wfdb_read user
A new user will be added during webapps_db installation from app-all
8.5. No additional actions for 8.5 are required.
If you want to add wfdb_read user to earlier versions, see the code:
$INSTALL_DIR/lib/mysql/bin/mysql -h 127.0.0.1 -u root -p$MYSQL_ROOT_PASS
CREATE USER '$WORKFUSION_MYSQL_READONLY_USER'@'%' IDENTIFIED BY '$WORKFUSION_MYSQL_READONLY_PASS';
GRANT SELECT ON $WORKFUSION_DB.* TO '$WORKFUSION_MYSQL_READONLY_USER'@'%';
GRANT SELECT ON mysql.proc TO '$WORKFUSION_MYSQL_READONLY_USER'@'%';
FLUSH PRIVILEGES;
log_info "change isolation level"
run_mysql_command """
-- on-login procedure:
use $WORKFUSION_DB;
-- ----------------------------------------------
drop procedure if exists change_isolation_level;
-- ----------------------------------------------
delimiter //
-- ----------------------------------------------
create procedure change_isolation_level
( in i_user_mask varchar(255)
) sql security definer
begin
if user() like i_user_mask
then
select 'Match pattern: change isolation to READ-COMMITTED' as Check_Status;
set session transaction isolation level read committed;
else
select 'No pattern matching, no isolation changes';
end if;
end;
//
-- ----------------------------------------------
delimiter ;
-- ----------------------------------------------
grant execute on procedure change_isolation_level to $WORKFUSION_MYSQL_READONLY_USER@'%';
grant select on $WORKFUSION_DB.* to $WORKFUSION_MYSQL_READONLY_USER@'%';
-- ----------------------------------------------
set global init_connect='CALL $WORKFUSION_DB.change_isolation_level(''$WORKFUSION_MYSQL_READONLY_USER@%'')';
"""
# update my.cnf and restart MySQL
sed -i "/\[mysqld\]/a init_connect=\"CALL $WORKFUSION_DB.change_isolation_level('$WORKFUSION_MYSQL_READONLY_USER@%')\"" \
$INSTALL_DIR/apps/mysql/etc/my.cnf
$INSTALL_DIR/apps/mysql/mysql.service restart
# check isolation for root
$INSTALL_DIR/lib/mysql/bin/mysql -h 127.0.0.1 -u root -p$MYSQL_ROOT_PASS
SELECT CURRENT_USER();
SHOW VARIABLES LIKE '%isolation%';
out: tx_isolation REPEATABLE-READ
# check isolation for read user
$INSTALL_DIR/lib/mysql/bin/mysql -h 127.0.0.1 -u $WORKFUSION_MYSQL_READONLY_USER -p$WORKFUSION_MYSQL_READONLY_PASS
SELECT CURRENT_USER();
SHOW VARIABLES LIKE '%isolation%';
out: tx_isolation READ-COMMITTED