With the post we are setting up a SVN based deployment synchronizer for WSO2 clustered setup. For this example we will be using the WSO2 Enterprise Service Bus (ESB) cluster and configuring the deployment synchronizer (or from now we will call dep-sync) for the servers.
So, as per the deployment scenario above we will start configuring the SVN based deployment synchronizer.
Setting up SVN (local and remote)
Well, in order to have have SVN based dep-sync we need SVN! so, we need to setup svn (please note this step is required if you already do not have a SVN server). The link below shows you how to setup svn in a remote server
To setup SVN locally;
1. Install SVN on server
$ sudo -i
# apt-get install subversion
# yum install mod_dav_svn subversion
2. To create a SVN repository locally
svnadmin create <path_to_local_svn_repo>/<repo_name>
example: svnadmin create /tmp/localsvnrepo/myrepo
3. Now, open file <path_to_local_repo>/<repo_name>/conf/svnserve.conf and configure the following;
anon-access = none (Specifies what kind of access anonymous users have; in this case, none)
auth-access = write (Specifies what authenticated users can do; in this case, they can write, which also includes reading)
password-db = passwd (Specifies the source of authentication; in this case, the file named passwd, which resides in the same directory as svnserve.conf)
4. Open file <path_to_local_repo>/<repo_name>/conf/passwd and configure the following;
So, that does it for setting up SVN on remote/local servers. We start configuring dep-sync on the cluster.
Configure Manager Node
Cluster manager operates as the manager of the cluster nodes executing inserts and updates to different services in the cluster, by doing so the manager updates its configurations and needs to update the svn server as well. So when the SVN servers get updated and manager sends out a cluster message saying configuration has changes the workers will update there own configuration with the new changes. So, how do we configure the manager to update the SVN? for this example we have an remote SVN repository location as http://samplesvn.nu1silva.com/myrepo and a local SVN repository location as /tmp/localsvnrepo/myrepo. We need to update <CARBON_HOME>/repository/conf/carbon.xml.
Configuration for remote repository
Configuration for local repository
Configure Worker Nodes
The worker nodes do not update the svn repository hence there configuration differs from just <AutoCommit>false</AutoCommit>.
Detailed information about the configurations are shown below;
- Enable the DepSync feature: <Enabled>true</Enabled>
- Automatically commit local repository changes to the central repository (only enable this on the manager node, which is the node that receives server admin requests as per our deployment pattern): <AutoCommit>true</AutoCommit>
- Automatically update the local repository with changes from the central repository: <AutoCheckout>true</AutoCheckout>
- Specify the repository type (in this case, Subversion): <RepositoryType>svn</RepositoryType>
- Specify the location of the repository with the access protocol: <SvnUrl>file://<PathToRepository>/<RepoName>/</SvnUrl>
- Specify the user name you defined in the last section: <SvnUser>repouser</SvnUser>
- Specify the password you defined in the last section: <SvnPassword>repopassword</SvnPassword>
- Enable tenant-specific configurations if needed: <SvnUrlAppendTenantId>true</SvnUrlAppendTenantId>