Scope
- Version Control Systems are frequently used in software development. They can be applied as a basis for managed deployment of job related objects, however, they are not focused on this purpose and therefore do not support specific deployment strategies.
- This article provides some considerations and recommendations on deployment strategies based. Users will have to determine the applicability of deployment strategies on their own.
- SOS dows not claim any preferences for specific Version Control System. At the time of writing no specific functionality is available that would make e.g. Git more useful for deployments than Subversion or Team Foundation Server. Therefore this article is not about comparing or recommending specific products, instead it will use Git and Subversion to explain the repository operations for deployments.
Prerequisites
Requirements
- Deployment includes to consistently deploy all job related objects, i.e. jobs, job chains, process classes, locks etc., that are referenced by each other and that make up a release.
- Deployments consider configuration items, path names, ports, folders, that are applicable to all environments and configuration items that are specific for an individual environment.
- Deployments can be carried out for a number of environments. Some users might use development, integration and production environments, other users might add sandbox or user acceptance test environments.
- Deployments are caried out for releases, not for changes of individual files. Version control is not a replacement for creating backups of your job environments.
- Capability to rollback to a previous release: Should a problem be detected e.g. in a production environment and not enough time be available for thorough analysis, then the option is to rollback immediately to a consistent previous branch of job related objects.
Environments
- Three environments are required for managed deployments:
- Development
- Modifications to job related objects are carried out in this environment.
- Integration
- No modifications are applied to job related objects.
- Configuration items are specific for this environment.
- Production
- No modifications are applied to job related objects.
- Configuration items are specific for this environment.
- Development
- The purpose of the integration environment is to carry out tests of deployed objects. This includes testing the completeness and accuracy of deployed objects.
- Should you want to skip this environment then tests would have to be performed in a production environment which is not a recommended strategy.
Handling of Version Control Systems
- Repositories
- Repositories are logical units in a Version Control System to store Branches of objects that can be assigned permissions for access by different users and groups.
- Branches
- A Branch corresponds to the current status of the job related objects that have been added to the repository by Commit operations.
- Only one Branch at a time should be used for job deployment. Multiple branches are frequently used to organize the contributions of a number of developers who work in parallel on the same sources. It is not a recommended scenario for job development to have multiple engineers work in parallel on the same jobs.
- Branches can be tagged, e.g. assigned a Release number.
- Commits
- Commits include to submit a fully functional and deployable copy of job related objects to a repository.
- Commits are not intended for backup of job developer working copies of job related objects.
- Releases
- Releases are tagged Branches that are not modified after deployment.
- Release numbers can be applied according to individual conventions. Semantic Versioning is a frequently used standard for release numbering (Major.Minor.Patch).
Use Cases
- Initial Deployment
- Update Management
- Keine selektiven Updates auf Verzeichnisebene
- Updates auf Verzeichnisebene: nein, da sonst Problem mit globalen Ressourcen, z.B. global locks, globale Prozessklassen
- Update immer auf live folder
- Keine selektiven Updates auf Änderungshistorie
- Es wird immer der aktuelle Stand des Repository übernommen, nicht ein bestimmter Revisionsstand
- Keine selektiven Updates auf Verzeichnisebene
- Disziplin:
- wenn derjenige, der in Integration testet, nicht wissen kann, was genau in der Lieferung enthalten ist, dann kann er nicht prüfen, ob er ggf. zu viele oder falsche Objekte erhalten hat
- Know How Auftrennnung: der Entwickler kennt Locks, der Tester kennt einen Testfall für Concurrency (nicht die Objekte, die das implementieren)
- Umgebungsspezifische Dateien
- Dürfen nicht committed werden
Deployment
Deployment Process Flow
The deployments from test to integration to production make use of the following steps
- copy the configuration files from one stage to the other
- do not copy the files that are used exclusively for testing in your test environment
- do not copy mock files
Just copying files probably is not sufficient. There are differences in the configuration that have to be considered.
- host names for process classes are different
- Solution: Having a set of process classes on each stage that will not be part of the deployment procedure. This configuration will be handled directly on the specific stage.
- different input for file order sources
- Solution: Having different file order sources on each stage that will not be part of the deployment procedure. This configuration will be handled directly on the specific stage.
- different values for parameters, e.g. database connection strings are different
- Make use of include files.
- Make use of environment variables that will be substituted at run time.
Using a version control software for deployment
When deploying configuration files it is more than just copying files from a to b. When working with sources a version control software migth be helpful. With a version control system
- you can rollback to an older version if neccessary
- changes are documented
- You have to commit changes that are relevant for other environments like integration or production
- You can exclude test configuration files by not adding them to the repository
This table describes the deployment with Git and Subversion.
Subversion | Git | ||
---|---|---|---|
Find the Subversion documentation from | The full Git documentation can be found here | ||
Pre Conditions | |||
Subversion Server Find the documentation „how to install a subversion server“ from http://svnbook.red-bean.com/en/1.8/svn.serverconfig.html | Git central repository. You can create a central repository with Navigate to a folder live where you want to locate the Git repository e.g. c:\temp\git_repro\live
| ||
Subversion client installed on local machine | Git client installed on local machine | ||
Subversion Projectarchive | |||
All files to be deployes are located in the live folder of a JobScheduler installation. | Creating a working copy in your Please note that after the import the | Creating a working copy in your live folder from the git repository | |
| navigate to your config folder move all files to a temporary folder
move all files back to the
| ||
| The files are now in the Subversion project archive. You can verify this with the command
| The files are now in the Git repository. You can verify this with cloning the repository to one more folder
| |
Delete the files from the live folder Execute the command checkout to get the files from the project archive to the live folder
| |||
Working with the project archive | You can have several working copies of the To synchronize changes in the working copy with the project folder there are two commands | You can have several working copies of the To synchronize changes in the working copy with the project folder there are three commands | |
Read the current version from the project archive (update) The update command reads changes from the project archive and merge them into the working copy.
| Read the current version from the repository (pull)
| ||
The Please note that before commiting changes a update command is neccessary especially when a commit from another working copy has been executed.
| The push command writes committed changes from the working copy to the repository
| ||
Making changes | Changes are applied to the working copy by use of JOE or a text editor software. When all changes for certain approach has been done the changes can be commited to the project archive. Before carrying out the
| Changes are applied to the working copy by use of JOE or a text editor software.
| |
Deployment | There are two possible architectures to organize the deployment:
| ||
Consider environment specific parameters and configurations
When doing the deployment it is possible that parameter values are not valid in integration/production environments, e.g. the names of files, folders, printers etc.
Use environment variables that accept different values in development, integration and production environments. For
- File order sources
- Directories in file names
<job_chain name="job_chain1"> <file_order_source directory="${file_input_dir}\input" regex=".*"/> ... </job_chain>
Use include files to specify parameter values:
<order> <params> <include live_file="myorder.params.xml" node=""/> .. </order>
where the file myorder.params.xml could look like this:
<params > <param name="par1" value="value1"/> <param name="par2" value="value2"/> </params>
Use different script include files for development, integration and production environments:
<job order="yes"> <script language="shell"> <include live_file="include_scriptfile.sh"/> </script> <run_time /> </job>
How to handle different include files for parameters and scripts
- create a folder include_files (parallel to the
live
folder) - create subfolders for dev, int and prod
- create the same subfolders under dev, int and prod as in the
live
folder - create the include files in the subfolders for dev, int and prod
- create a projectarchive wich contains the folder include_file
- create a working copy with the import, delete and checkout command (see above).
- When committing the include_files folder you should also commit the live folder (and vica versa) to have consistency between both folders.
- When deploying to int export the include_files/int folder to the live folder at int
- When deploying to prod export the include_files/prod folder to the live folder at prod
As you have a working copy in the live folder of dev, the include files from dev will be deployed when exporting the dev live folder. But with the second export from the include_files folder, the dev files will be overwritten with the correct version. An alternative approach is that also the live folder in dev is not a working copy but will be actualized with an export command from the dev working copy.
The quality of the development environment
When having some test configuration files in the development environment you should take care not to commit them to the repository. To achieve this, no add
command should be executed on these files. You also can add these files to an ignore list (available with Git and Subversion). You should take into account that each configuration item that has been committed to the repository will be deployed to the integration or production environments some time later.
Rollback to a previous version
To rollback to a previous version
- identify the release to which you want to fall back
- With Subversion/Git commands get the files of the release
- Publish these files to int/prod