This page provides instructions for restore of FlexDeploy from previous backup, perhaps to undo an upgrade.

If you are using automated installer, then backups for folders and files is located at $FLEXDEPLOY_HOME/upgrade/upgrade_backups/<MMDDYYYY>/. There would be tomcat, artifacts, plugins sub-folders here.


Step 1. Stop the FlexDeploy server. Use StopFlexDeploy.sh on Linux and StopFlexDeploy.bat on Windows. This will stop Tomcat and InfluxDB.


Step 2. Restore FlexDeploy schemas, Artifact Repository, Plugins directory and apache-tomcat-flexdeploy folder.

First drop schemas (sqlplus, SQL Developer, or other database tools) and then import from backup.

Drop Schemas

drop user fd cascade;
drop user ff cascade;
drop user fd_admin cascade;

Import data from backup directory (PostgreSQL)

pg_restore --host ${HOST} --port ${PORT} --schema FD --username postgres -W --verbose --format d --file ${PATH/TO/BACKUP}/FD flexdeploy
pg_restore --host ${HOST} --port ${PORT} --schema FF --username postgres -W --verbose --format d --file ${PATH/TO/BACKUP}/FF flexdeploy
pg_restore --host ${HOST} --port ${PORT} --schema FD_ADMIN --username postgres -W --verbose --format d --file ${PATH/TO/BACKUP}/FD_ADMIN flexdeploy

Import data from backup schema (PostgreSQL)

sudo su - postgres
psql --host ${HOST} --port ${PORT} -d flexdeploy 

alter schema FD_bak rename to FD
alter schema FF_bak rename to FF
alter schema FD_ADMIN_bak rename to FD_ADMIN

Import data from backup (Oracle)

# You will need to setup environment variables before running expdp. For example,
 
export ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1
export ORACLE_SID=fd01
 
impdp system directory=DATA_PUMP_DIR dumpfile=fd_bkup.dmp schemas=FD,FF,FD_ADMIN

Restore Artifact Repository

Now restore artifact repository. The location of the artifact repository can be identified by looking at value of -Dflexagon.fd.repository.root in setenvoverride.sh/setenv.sh or setenvoverride.bat/setenv.bat file.

cd <artifact repository location>
rm -rf *
tar -xvzf <path to artifacts backup>/artifacts.tar.gz

Restore Plugins Directory

Now restore plugins folder. The location of the plugins folder can be identified by looking at value of -Dflexagon.fd.install.root in setenvoverride.sh/setenv.sh or setenvoverride.bat/setenv.bat file. plugins folder is sub-folder for this install root (aka server working directory).

cd <server working directory>
cd plugins
rm -rf *
tar -xvzf <path to plugins backup>/plugins.tar.gz

Restore apache-tomcat-flexdeploy Directory

Restore tomcat folder from backup.

# Assuming FLEXDEPLOY_HOME environment variable is set, it should be parent folder of apache-tomcat-flexdeploy
export FLEXDEPLOY_HOME=/u01/flexdeploy
cd $FLEXDEPLOY_HOME
mv apache-tomcat-flexdeploy/ apache-tomcat-flexdeploy-before-restore/
mv <path to tomcat backup/apache-tomcat-flexdeploy/ apache-tomcat-flexdeploy/

Step 3 . Start FlexDeploy by running the following script

FLEXDEPLOY_HOME/apache-tomcat-flexdeploy/bin/StartFlexDeploy.sh (StartFlexDeploy.bat on Windows)