Join The Quandu Bridge Club

THL Toolbox > Developers' Zone > Web Development > Deploying Files to the Server

Deploying Files to the Three Server Environments

Once you have made changes to or added files to the THL main site and committed them to the Subversion (SVN) repository, they need to be deployed to the server. In essence, the server has a checked out version of the repository just as you do on your computer, if you've made changes. Once you've committed those changes to the repository, you need to log onto the server and update its version of the repo to incorporate your changes. This is done in slightly different ways for development, staging, and production.


  1. after you have committed files to the dev directory in the svn repository, ssh into, using your username and pass, or using sds-deployer (if the latter, skip to step 3)
  2. run the command: sudo su sds-deployer (the password you used to log into should work for this)
  3. cd to: /usr/local/projects/ (This will bring you to the root level of the site.)
  4. From there navigate to the directory you want to update using the "cd" (change directory) command. In order to find out where one is, one can type "ls" list, which will list the contents of the directory one is currently located in.
  5. Once you are in the right directory, run "svn up" to update the folder.
  6. To update files in the Texts directory of THL's Cocoon app. The root folder is /usr/local/projects/thlib-texts/current/cocoon. One can run "ls" to find out the sub-directory one desires.


  1. Either copy the files from your local checkout of dev to your local checkout of staging or use the following PERL script tool that compares local dev repo with local staging repo and if the dev file is different or new, it copies it over to staging. NOTE: if you copy files manually, you CANNOT just copy an entire directory because that includes the .svn directory that is specific to that particular directory on dev; therefore, you have to copy only the files from the directory that contain code (that is, all the files OTHER than the .svn directory). NOTE: you must have PERL installed to run the PERL script. To check if you have PERL installed, open a command line dialog box and type perl -v; if it returns a message like "perl is not recognized as an internal or external command, operable file or batch file" then you don't have PERL installed. If you don't have PERL installed, see PERL installation instructions
    1. external link: PERL script to copy files from dev to staging
    2. Change lines 11 and 12 to the source and destination directory paths on your computer. The $devHome variable should be changed to the absolute location of your local version of the development repos \cocoon\texts\catalogs\xml folder and the $stagingHome should be set to the absolute location of the corresponding folder in your local version of the staging repos

# Development Home and Staging Home Locations 
$devHome = 'C:\wamp\tomcat\webapps\cocoon\texts\catalogs\xml\\'; # Change this to your local development repo's catalogxml location
$stagingHome = 'C:\thl-repos\staging\texts\catalogs\xml\\'; # Change this to your local staging repo's catalogxml location

    1. To run the program, open command line and then type the name of the PERL script file and the name of the subdirectory you want to update. For example kt/q

or kt/d/texts

or ngb/dg

  1. After you commit the files you modified or added locally to the staging directory in the svn repository, ssh into using username sds-deployer and the pw
  2. cd to: /usr/local/projects/
  3. run ls to find the desired directory
  4. Once you are in the right directory, run svn up
  5. the Texts directory is /usr/local/projects/thdl-texts/current/cocoon


  1. You need a version of subversion installed on your computer. We recommend the svn version by Slik at external link: (don't know if this works on Mac but it works in Windows)
  2. Update the production directory you have checked out locally and to which you want to push the files from staging
  3. Open command line and navigate to the production version of the folder. The directory path will differ according to how you have named the directories on your computer, but it will be something like: C:\Users\thl\My Documents\thdl-quandu\www
  4. Run the following command: svn info
  5. This will output something like this:

C:\Users\thl\My Documents\thdl-quandu\www\collections\texts\jiats>svn info
Path: .
external link:
Repository Root: external link:
Repository UUID: cb089a2a-0280-496d-81c1-fc8c1dff93ce
Revision: 18412
Node Kind: directory
Schedule: normal
Last Changed Author: ndg8f
Last Changed Rev: 18290
Last Changed Date: 2010-08-26 13:42:59 -0400 (Thu, 26 Aug 2010)

  1. Write down the value of the "Last Changed Rev"; in this case it is 18290
  2. On your computer, right-click on the folder on production to which you want to push the staging files and in the TortoiseSVN menu select "merge" (if you are using command line, figure out what the corresponding command is from the
  3. In TortoiseSVN for the merge type, select "merge a range of revisions" and then press the Next button
  4. URL to merge from: this is the repos URL for the STAGING directory you want to push to production. In TortoiseSVN, click "browse" and navigate to the STAGING directory
  5. Revision range to merge: add 1 to the "Last Changed Rev"; in this example, that is 18291. In the Revision range to merge box, enter: 18291-HEAD
  6. In TortoiseSVN press Next
  7. Merge depth: in TortoiseSVN, select the depth from the pulldown menu. Be sure to select the depth you want
  8. In TortoiseSVN, press the Test Merge button. This will tell you exactly what will happen if you run the merge. It will list the files that will be revised (added, updated, etc)
  9. If the result of the test merge is correct, then press Merge. This will merge the staging directory from the subversion repos to production directory you have checked out locally
  10. You must then commit the files (or the directory/directories) that have been revised in your local checkout of production to the repos, and then deploy them

Provided for unrestricted use by the external link: Tibetan and Himalayan Library