Remote Deployment Process - Java
Deployment Process
Determine
if a valid argument has been passed in
Only
continue if downloadOnly, postDownload, fullDeployment, handleSuccess,
checkHash, verifyApplications passed through.
Lock
file to stop deployment from running more than once
Create
deployment_lock_file.txt if it does not exist.
Create
lock on file.
If
lock is already held, log an error message and stop the deployment.
Create
Directories
If
needed, create directories for applied and backup to store previous war
files and copies of downloaded files.
Create
temporary directory to store downloaded files.
Figure
out which files/scripts to download
Download
manifest.xml file
If
no manifest.xml file downloaded, log an error message and stop the
deployment.
Read
manifest file to determine what server to download from and create
DownloadServer object
Read
manifest file to determine what application files/SQL scripts to be
downloaded. Create list of ApplicationFile and SqlScript objects to store
information about the files.
Confirm
manifest file has not been run
Look
for row in Deployment Files table with same file name and sha2sum as the
following:
manifest.xml
file
All
files in ApplicationFile list
All
files in SqlScript list
If
there is a match of sh2sum values, log an error message and stop the
deployment.
Download
files from server and store on local server in temporary location
Use
jsch to download files via SFTP
Use
password protected private key for authentication
For
each object in the ApplicationFile list and SqlScript list, download the
file.
Confirm
that war files are complete (no partial downloads, no missing files)
Use
sha2 checksums.
Grab
expected values from applicable ApplicationFile or SqlScript object.
If
sh2sum values do not match, log an error message and stop the deployment.
Back-up
database
Run
existing dbbackup.sh script using process builder.
If
exit value from process is not 0, log exit code and stop the deployment.
Run
SQL scripts
Iterate
through list of SqlScript.
Open
each file and create string with contents.
Execute
statement using username and password provided in the SqlScript object.
If
sql scripts are unable to run, log an error message and stop the
deployment.
Move
current war files to archive directory
Iterate
through the list of ApplicationFile
Find
the war file in the webapps directory that has the same name.
Utilize
FileUtils.copyFile function to move current war files from Tomcat webapp
directory to archive directory
Delete
war files/application directory
Iterate
through the list of ApplicationFile
Remove
war file and directory with the same name as the file name under
webapps. Remove files under work directory with directory of same name.
Place
new war files from temporary location to tomcat directory
Iterate
through the list of ApplicationFile
Utilize
FileUtils.copyFile function to move file name in ApplicationFile to
Tomcat webapp directory
Restart
Tomcat
Run
‘service tomcat restart’ command using process builder.
Verify
Applications
Run
tests to check if touchscreen and back office applications are up.
Pull
version from ApplicationFile object to check that the correct version of
the application is up.
This
process will run up to 10 times with an increased amount of wait,
additional five seconds, between each unsuccessful try.
Deployment
Clean-Up
Create
tar.gz file with contents of download directory
Remove
tar.gz files older than 3 months old
Remove
log files older than 3 months old
Remove
temporary download directory
Create
row in Deployment File table for the following:
manifest.xml
All
files in ApplicationFile List
All
files in SqlScript list
Release
file lock
Release
lock on deployment_lock_file.txt so the next deployment can run.
Process Documentation
Log
deployment process
Use
log4j
Log
files will be stored in their own log directory located in the home
directory of the deployment user.
Send
information to webservice on fcadmin (or different server later on)
Information
will be stored in an event logger table and include information on
serial number, community, stage, result, message, and date.
Report
results back to FullCount
Send
information to webservice on fcadmin
Information
will be stored in an event logger table and include information on
serial number, community, stage, result, message, and date.
Error Handling
Handle
situation where war files/SQL scripts cannot be downloaded
Handle
situation where war files/SQL scripts are partially downloaded
Handle
situation where SQL script is unable to execute
Handle
situation where war files/SQL scripts take much longer than expected to
download.
Set
some kind of upper limit for how long a download can take.
If
download is estimated to finish in 3 days, that is effectively a failure,
so we should kill it and try again.
Handle
situation where war files/SQL scripts cannot be saved (i.e. no disk
space).
Handle
situation where SQL script is taking longer than expected to execute.
Set
some kind of upper limit for how long a SQL script can take to execute.
Handle
situation where database backup fails.
Handle
situation where archiving old WAR files fails.
|
|
Full Deployment
|
Download Only
|
Check Hash
|
Post Download
|
Post SQL Scripts
|
Verify Applications
|
Handle Success
|
|
Determine Valid Argument
|
X
|
X
|
X
|
X
|
X
|
X
|
X
|
|
Lock File
|
X
|
X
|
X
|
X
|
X
|
X
|
X
|
|
Create Directories
|
X
|
X
|
X
|
X
|
X
|
X
|
X
|
|
Load Manifest File
|
X
|
X
|
X
|
X
|
X
|
X
|
X
|
|
Confirm Deployment Not Run
|
X
|
X
|
X
|
X
|
X
|
|
X
|
|
Download Deployment Files
|
X
|
X
|
|
|
|
|
|
|
Check Hash Values
|
X
|
|
X
|
X
|
|
|
|
|
Back-Up Database
|
X
|
|
|
X
|
|
|
|
|
Run SQL Scripts
|
X
|
|
|
X
|
|
|
|
|
Move Files For Deployment
|
X
|
|
|
X
|
X
|
|
|
|
Restart Tomcat
|
X
|
|
|
X
|
X
|
|
|
|
Verify Applications Up
|
X
|
|
|
X
|
X
|
X
|
X
|
|
Deployment Clean-Up
|
X
|
|
|
X
|
X
|
|
X
|
|
Release Lock File
|
X
|
X
|
X
|
X
|
X
|
X
|
X
|
Resources Section
This is being used to download files from our central server
to the remote server
This is being used to verify that the applications are up
This is being used to create an archive with all the
download files, specifically the TarArchive information.
This is being used to move files around on the server.
Related Articles
Run Remote Deployment Process - Java
Remote Server Configuration This has already been completed for all existing remote servers. Java 1.8 installed Tomcat located at /srv/tomcat XE database installed and running with fc_obj_owner user Directory /home/deployment exists Database backup ...
Overview of Deployment Process for Remote Servers
Overview of Deployment Process for Remote Servers Introduction The process for updating the Touchscreen and Back Office applications is known as the deployment process. The deployment process is only used for updating applications and databases on ...
Post Central Deployment Tasks
Post Central Deployment Tasks Objectives Complete necessary post-deployment tasks Prerequisites Access to Redmine Access to production database Access to fcadmin Access to deployment test server Instructions Send release docs Release docs are located ...
Remote Server Decommission Process
Remote Server Decommission Process The purpose of this document is to track the process for decommissioning a FullCount remote server as part of the transition for the client to be centrally hosted or if the client is leaving FullCount. The first ...
Central Deployment Process
Run SQL scripts in http://sourcecontrol.fullcount.net/repos/internal/trunk/at-fullcount-model/src/main/resources/sql/nextDeploy Pause TeamCity test for fullcount-uptime-production-overnight. Download release war file from archiva for all ...