Deployment Script Examples - Precisely_EnterWorks - EnterWorks - 11.0

EnterWorks Guide

Product type
Software
Portfolio
Verify
Product family
EnterWorks
Product
Precisely EnterWorks
Precisely EnterWorks > EnterWorks
Version
11.0
Language
English
Product name
Precisely EnterWorks
Title
EnterWorks Guide
Copyright
2024
First publish date
2007
Last updated
2025-01-07
Published on
2025-01-07T07:44:20.997352

The following scripts are examples of deployment scripts that can be used as a starting point.

In simple environments where it will likely be necessary to deploy binaries (which require services restarts) less frequently than non-binaries. In these such environments, a simple set of scripts can be defined:

deploy.bat – calls the non-binaries scripts and deploys the binaries and runs the necessary configuration scripts:

copy MyJarFile.jar F:\Enterworks\lib\Services\lib
copy MyJarFile.jar F:\Enterworks\EnableServer\tomcat\webapps\webcm\WEB-INF\lib
call deployFilesOnly.bat
REM Load SQL Scripts
ECHO update sQL from DEV
pause
REM call deploySqlOnly.bat
call F:\Enterworks\bin\DeployServicesJar.bat
pause

It is a good practice to end the scripts with a pause command so the command window does not close until you have had a chance to review the output status of each command.

deployFilesOnly.bat – copies the non-binary files and can be run without having to restart services:

copy *.jsp F:\Enterworks\EnableServer\tomcat\webapps\webcm\custom
copy coreLanguageScripts\*.* F:\Enterworks\EnableServer\tomcat\webapps\webcm\shared\core\scripts\i18n
copy core2LanguageScripts\*.* F:\Enterworks\EnableServer\tomcat\webapps\webcm\shared\core2\scripts\i18n
copy channelReadinessLanguageScripts\*.* F:\Enterworks\enable-mean\angular-ui\ng\channel-readiness\languages
pause

deploySqlFilesOnly.bat – invokes the SQL Server commands to load any SQL scripts into the EPIM database. This script must be run on a server that has the SQL Server Management Studio client installed:

REM Load SQL Scripts
sqlcmd -S dbServerName -d EPIM -U epimsys -P password -i project_script1.sql -o project_script1.out
sqlcmd -S dbServerName -d EPIM -U epimsys -P password -i project_script2.sql -o project_script2.out
sqlcmd -S dbServerName -d EPIM -U epimsys -P password -i project_script3.sql -o project_script3.out
sqlcmd -S dbServerName -d EPIM -U epimsys -P password -i project_script4.sql -o project_script4.out

For more complex environments where the file structure and even which components are installed are different on each target (such as separate servers for WEB and APP), a self-identifying script can be defined. Such scripts may take a while to develop, but they can be re-used from one deployment to the next and refined with each subsequent deployment:

REM Deploy Files for [project] Vendor Portal Update 3/4/2016
REM
REM This script copies all files needed for the [project] Vendor Portal
REM update. REM It must be run on the server to which the files are being copied and
REM from the directory containing this script (all file references are
REM relative). It should be run on each server comprising the environment
REM for both the Vendor Portal and the Internal PIM. REM
REM Default to E: drive. Set to C: drive if on local machine for testing

set DRIVE=C:
IF "%COMPUTERNAME%"=="PANICILLIN" GOTO :SKIP_EDRIVE
set DRIVE=E:

:SKIP_EDRIVE
echo Drive=%DRIVE%

REM It recognizes the target by host name. If the host names change,
REM this script needs to be updated. The current hosts are:
REM
REM PIMDEV2 - DEV Vendor Portal Server
REM VPWEBTEST - TEST Vendor Portal WEB Server
REM VPAPPTEST - TEST Vendor Portal APP Server
REM VPWEB - PROD Vendor Portal WEB Server
REM VPAPP - PROD Vendor Portal APP Server
REM PIMDEV - DEV Internal PIM
REM MPWEBTEST - TEST Internal PIM WEB Server
REM MPAPPTEST - TEST Internal PIM APP Server
REM MPWEB - PROD Internal PIM WEB Server
REM MPAPP - PROD Internal PIM APP Server
REM

set host=%COMPUTERNAME%
echo .%host%. if "%host%"=="PANICILLIN" GOTO :VPDEV
if "%host%"=="PIMDEV2" GOTO :VPDEV
if "%host%"=="VPWEBTEST" GOTO :VPWEB
if "%host%"=="VPAPPTEST" GOTO :VPAPP
if "%host%"=="VPWEB" GOTO :VPWEB
if "%host%"=="VPAPP" GOTO :VPAPP
if "%host%"=="PIMDEV" GOTO :MPDEV
if "%host%"=="MPWEBTEST" GOTO :MPWEB
if "%host%"=="MPAPPTEST" GOTO :MPAPP
if "%host%"=="MPWEB" GOTO :MPWEB
if "%host%"=="MPAPP" GOTO :MPAPP
echo Host %host% not expected DEV, APP or WEB server. Deployment aborted. GOTO :END

REM Set the flags used to determine what files to copy/delete

:VPDEV
SET serverType=DEV
SET enableType=VP
GOTO :CopyFiles

:VPWEB
SET serverType=WEB
SET enableType=VP
GOTO :CopyFiles

:VPAPP
SET serverType=APP
SET enableType=VP
GOTO :CopyFiles

:MPDEV
SET serverType=DEV
SET enableType=MP
GOTO :CopyFiles

:MPWEB
SET serverType=WEB
SET enableType=MP
GOTO :CopyFiles

:MPAPP
SET serverType=APP
SET enableType=MP
GOTO :CopyFiles

:CopyFiles
ECHO Server Type = %serverType%

REM *****************************************************************************
REM
REM JBoss Master File Deployment
REM
REM *****************************************************************************

REM Master JBOSS on DEV and WEB only
if "%serverType%"=="APP" GOTO :SkipMaster
copy [Project].jar %DRIVE%\Enterworks\EnableServer\jbossMaster\server\default\lib
copy Services.jar %DRIVE%\Enterworks\EnableServer\jbossMaster\server\default\lib

REM Remove Obsolete files
DEL %DRIVE%\Enterworks\EnableServer\jbossMaster\server\default\lib\groovy-all-2.3.7.jar

:SkipMaster
REM *****************************************************************************
REM
REM JBoss Slave1, Slave2 File Deployment
REM
REM
*****************************************************************************

REM Slave 1&2 ON DEV and APP only

if "%serverType%"=="WEB" GOTO :SkipSlave1And2
copy [project].jar %DRIVE%\Enterworks\EnableServer\jbossSlave1\server\default\lib
copy [Project].jar %DRIVE%\Enterworks\EnableServer\jbossSlave2\server\default\lib
copy Services.jar %DRIVE%\Enterworks\EnableServer\jbossSlave1\server\default\lib
copy Services.jar %DRIVE%\Enterworks\EnableServer\jbossSlave2\server\default\lib

if "%enableType%"=="MP" GOTO :MPCopyMigration
copy VendorPortalMigration.msf %DRIVE%\Enterworks\shared\migration
copy VendorPortalMigration.zip %DRIVE%\Enterworks\shared\migration
GOTO :EndCopyMigration

:MPCopyMigration
copy InternalPIMMigration.msf %DRIVE%\Enterworks\shared\migration
copy InternalPIMMigration.zip %DRIVE%\Enterworks\shared\migration

:EndCopyMigration
REM Remove Obsolete files
DEL %DRIVE%\Enterworks\EnableServer\jbossSlave1\server\default\lib\groovy-all-2.3.7.jar
DEL %DRIVE%\Enterworks\EnableServer\jbossSlave2\server\default\lib\groovy-all-2.3.7.jar

:SkipSlave1And2
REM *****************************************************************************
REM
REM JBoss Slave3 File Deployment
REM
REM*****************************************************************************

REM Slave 3 ON APP only

if "%serverType%"=="DEV" GOTO :SkipSlave3
if "%serverType%"=="WEB" GOTO :SkipSlave3
copy [Project].jar %DRIVE%\Enterworks\EnableServer\jbossSlave3\server\default\lib
copy Services.jar %DRIVE%\Enterworks\EnableServer\jbossSlave3\server\default\lib

REM Remove Obsolete files

DEL %DRIVE%\Enterworks\EnableServer\jbossSlave3\server\default\lib\groovy-all-2.3.7.jar
:SkipSlave3

REM *****************************************************************************
REM
REM JBoss Slave4
File Deployment
REM
REM *****************************************************************************

REM Slave 4 ON WEB only

if "%serverType%"=="DEV" GOTO :SkipSlave4
if "%serverType%"=="APP" GOTO :SkipSlave4
copy [Project].jar %DRIVE%\Enterworks\EnableServer\jbossSlave4\server\default\lib
copy Services.jar %DRIVE%\Enterworks\EnableServer\jbossSlave4\server\default\lib

REM Remove Obsolete files

DEL %DRIVE%\Enterworks\EnableServer\jbossSlave4\server\default\lib\groovy-all-2.3.7.jar

:SkipSlave4
REM *****************************************************************************
REM
REM Tomcat File Deployment
REM
REM *****************************************************************************

REM Tomcat ON DEV and WEB only

if "%serverType%"=="APP" GOTO :SkipTomcat
copy *.jsp %DRIVE%\Enterworks\EnableServer\tomcat\webapps\webcm\custom
copy [Project].jar %DRIVE%\Enterworks\EnableServer\tomcat\webapps\webcm\WEB-INF\lib
copy Services.jar %DRIVE%\Enterworks\EnableServer\tomcat\webapps\webcm\WEB-INF\lib

REM Remove Obsolete files

DEL %DRIVE%\Enterworks\EnableServer\tomcat\webapps\webcm\WEB-INF\lib\groovy-all-2.3.7.jar

:SkipTomcat

REM *****************************************************************************
REM
REM EPX File Deployment
REM
REM *****************************************************************************

REM EPX on DEV and APP only

if "%serverType%"=="WEB" GOTO :SkipEPX

REM Remove Obsolete files

del %DRIVE%\Enterworks\EPX\bin\agents\%host%\FtpBIC.jar 
del %DRIVE%\Enterworks\EPX\bin\agents\client\EPX_%host%\FtpBIC.jar 
DEL %DRIVE%\Enterworks\EPX\lib\groovy-all-2.3.7.jar

REM Copy Files

copy [Project].jar %DRIVE%\Enterworks\EPX\lib
copy Services.jar %DRIVE%\Enterworks\EPX\lib
copy FtpBic.config %DRIVE%\Enterworks\EPX\bin\agents\%host%
copy FTPBicGroovy.jar %DRIVE%\Enterworks\EPX\bin\agents\%host%
copy *.groovy %DRIVE%\Enterworks\EPX\groovy\bic

REM Create new directories

if "%enableType%"=="MP" GOTO :SKIP_VP_DIRECTORIES
IF EXIST %DRIVE%\Enterworks\[Project]\VendorFiles GOTO :SKIP_VENDOR_FILES
mkdir %DRIVE%\Enterworks\[Project]\VendorFiles

:SKIP_VENDOR_FILES
IF EXIST %DRIVE%\Enterworks\[Project]\VendorFiles\Drop GOTO :SKIP_VENDOR_FILES_DROP
mkdir %DRIVE%\Enterworks\[Project]\VendorFiles\Drop

:SKIP_VENDOR_FILES_DROP
IF EXIST %DRIVE%\Enterworks\[Project]\VendorFiles\epaCUBE GOTO :SKIP_EPACUBE
mkdir %DRIVE%\Enterworks\[Project]\VendorFiles\epaCUBE

:SKIP_EPACUBE
IF EXIST %DRIVE%\Enterworks\[Project]\VendorFiles\Invalid GOTO :SKIP_VENDOR_FILES_INVALID
mkdir %DRIVE%\Enterworks\[Project]\VendorFiles\Invalid

:SKIP_VENDOR_FILES_INVALID
IF EXIST %DRIVE%\Enterworks\[Project]\VendorFiles\MultiVendorDrop GOTO :SKIP_VENDOR_FILES_MULTI_VENDOR_DROP
mkdir %DRIVE%\Enterworks\[Project]\VendorFiles\MultiVendorDrop

:SKIP_VENDOR_FILES_MULTI_VENDOR_DROP
IF EXIST %DRIVE%\Enterworks\[Project]\VendorFiles\Reports GOTO :SKIP_VENDOR_FILES_REPORTS
mkdir %DRIVE%\Enterworks\[Project]\VendorFiles\Reports

:SKIP_VENDOR_FILES_REPORTS
IF EXIST %DRIVE%\Enterworks\[Project]\VendorFiles\Staging GOTO :SKIP_VENDOR_FILES_STAGING
mkdir %DRIVE%\Enterworks\[Project]\VendorFiles\Staging

:SKIP_VENDOR_FILES_STAGING
:SKIP_VP_DIRECTORIES
:SkipEPX
Pause