Copying Workspaces
Backing up Workspaces
The backing up of a workspace involves creating a tar.gz file which can be unpacked into a different workspace. This includes everything of the workspace, including users, groups, user assignment to groups, cases, etc. It’s much more robust than a simple workflow import.
To execute this, it is recommended to login as the root user of the server. Another option is to add your user to the apache group (or NGINX). That group is "apache" for Red Hat/CentOS/Fedora, "www-data" for Debian/Ubuntu, and "www" for SUSE/OpenSUSE.
Issue the following commands:
php processmaker workspace-backup [WORKSPACE-NAME] [BACKUP-FILE]
By default, the backup file will be created at:
INSTALL-DIRECTORY/shared/backups/workspace.tar
However, the location of the backup file can be specified with the optional [BACKUP-FILE] parameter. This parameter can include forward slashes "/" to specify a path in Linux/UNIX or backward slashes "\" to specify a path in Windows. If the path or filename contains spaces, enclose it in quotation marks. If using a relative path, then it will start from the location of the processmaker script. If no path is specified, then the file will be created in the INSTALL-DIRECTORY/shared/backups directory.
Examples
Backup the default "workflow" workspace on a Linux/UNIX server to the location /opt/processmaker/shared/backups/workflow.tar:
php processmaker workspace-backup workflow
Backup the "sales" workspace on a Linux/UNIX server to the location /home/fred/store/pm_sales.tar:
php processmaker workspace-backup sales /home/fred/store/pm_sales.tar
Backup the "Finance" workspace to the location /opt/store/Finance/FinanceBackup.tar, using a relative path:
php processmaker workspace-backup Finance ../store/FinanceBackup.tar
For more information about examples and options, more information can be found here.
Restoring Workspaces
Now that we have our file we can unpack that tar.gz file onto any workspace or server necessary. To execute this use the following command:
php processmaker workspace-restore [BACKUP-FILE] [WORKSPACE-NAME]
If it is not located in the shared/backups directory, or it doesn't have a .tar extension, then specify the path. Remember to enclose it within double quotes if the file name or path contains spaces.
By default, the backup will be restored to the same workspace name and use the same database names as the original. To overwrite an existing workspace, use the -o or --overwrite option. For example, to overwrite the existing "workflow" workspace:
php processmaker workspace-restore -o workflow
To restore to a different workspace name, specify the optional [WORKSPACE-NAME] parameter. The files from the backup workspace will be copied into the INSTALL-DIRECTORY/shared/sites/[WORKSPACE-NAME]/ directory.
Examples
To restore a workspace from the INSTALL-DIRECTORY/shared/backups/workflow.tar backup file in Linux:
php processmaker workspace-restore workflow
To copy the contents of the "workflow" workspace stored in the backup file at shared/backups/workflow.tar to a new workspace named "finance":
php processmaker workspace-restore workflow.tar finance
After logging into the new workspace for the first time, a dialog box will appear, asking that the Enterprise license file be uploaded for the workspace.
To restore a workspace from a backup file that has multiple workspaces, use the -wWORKSPACE or --workspace=WORKSPACE option to specify which workspace should be restored. For example, to restore the "finance" workspace from the file /root/pmBackup.tar and overwrite the existing "accounting" workspace:
php processmaker workspace-restore -o --workspace=finance /root/pmBackup.tar accounting
or:
php processmaker workspace-restore -o -wfinance /root/pmBackup.tar accounting
For help using the processmaker workspace-restore command:
php processmaker help workspace-restore
The -m option can be used to restore workspaces from multiple backup files (created with the -s option). Specify the name of the backup file, but do not include the numbers at the end of the file name. For example, if restoring from three backup files named pmbackup.tar.00, pmbackup.tar.01 and pmbackup.tar.02, then issue the command:
php processmaker workspace-restore -m pmbackup.tar
After Restoring a Workspace
Once a workspace has been restored, a few additional commands need to be executed. The first being a command to repair the cache of cases in the APP_CACHE_VIEW table with the command:
php processmaker cacheview-repair [WORKSPACE]
If no workspace is specified, then the cache will be repaired for all workspaces.
If this command is not executed, the number of cases listed under the Home menu will not be correct.
In addition, if restoring from a different a workspace from a different version of ProcessMaker, the following command must be executed to update the case schema used by the new version of IFS Workflow:
php processmaker migrate-new-cases-lists [WORKSPACE]
For example, to migrate the case schema for the "workflow" and "development workspaces on a Linux server:
php processmaker migrate-new-cases-lists workflow development
Copyright© 2024 IFS AB. Copying prohibited. All rights reserved.