Changes between Version 14 and Version 15 of Doc/SCDB/Server


Ignore:
Timestamp:
Dec 2, 2009, 6:05:21 PM (16 years ago)
Author:
/O=GRID-FR/C=FR/O=CNRS/OU=LAL/CN=Michel Jouvin
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Doc/SCDB/Server

    v14 v15  
    1 = SCDB Server-side Customizations =
     1= SCDB Server Configuration =
    22[[TracNav]]
    33
     
    55
    66
    7 This page describes the server-side SCDB specific tools and how to customize them. It doesn't explain how to [wiki:Download/SCDB install] Quattor server and configure it for SCDB. Server-side tools consist in 2 scripts involved in configuration deployment and triggered by `ant deploy`.
     7This page describes the server side of SCDB, made of the SVN server and a Quattor deployment server, the specific components used and how to customize their configuration. It doesn't explain how to [wiki:Download/SCDB install] the SVN server and the Quattor server and how to configure them for SCDB.
    88
     9Server-side components of SCDB consist in 2 scripts involved in configuration deployment and triggered by `ant deploy`:
     10 * SVN post-commit [#SubversionHookScript hook script]
     11 * [#DeploymentScript Deployment script]
     12 
     13Both scripts are distributed as part of SCDB tools, inside [source:SCDB/trunk/src/hooks src/hooks] directory. See the the [wiki:Download/SCDB installation] documentation for more information.
    914
    1015== Subversion Hook Script ==
    1116
     17This script is trigger by `ant deploy` when creating the deployment tag. Its main role is to do several checks and if necessary to launch the [#DeploymentScript deployment script].
     18
    1219This script must be installed on the Subversion server (not necessarily the Quattor server), inside the `hooks` directory of the SCDB repository (the repository itself, not a working copy). For this you need write access to the directory containing the repository on the Subversion server.
    1320
    14 This script must be named `post-commit` and be executable. It is distributed as part of SCDB tools, inside [source:SCDB/tags/pro/src/hooks src/hooks] directory.
     21This script ''must be'' named `post-commit` and be executable by the account the SVN server is running under (typically the Apache account). The source file for this script is [source:SCDB/trunk/src/hooks/post-commit.py post-commit.py].
    1522
    16 This script requires a configuration file to be present, `/etc/quattor-deploy.conf`. The configuration file must contain only shell variable definition (`sh` syntax). The '''required''' variables are :
     23''Note: an obsolete version of this script was called `post-commit` (and is a shell script). All the information here doesn't apply to this obsolete version whose configuration file had a different format, despite the same name. When migrating from the obsolete version to the new one, the configuration file must be replaced.''
     24
     25This script requires a configuration file, `/etc/quattor-deploy.conf` (common with the [#DeploymentScript deployment script] when running on the same machine). All the configuration options supported and their default values are defined at the beginning of the script. The configuration file has several sections. One of them, `[scdb]`, is common to the hook script and the deployment script. The main options available and their default values are:
    1726{{{
    18 # Quattor server name
    19 QUATTORSRV="quattorsrv.lal.in2p3.fr"
     27[post-commit]
     28# Script launched by the script to actually do the deployment
     29deploy_script : /root/quattor/scripts/build-tag.py
     30# Name of the deployment server where to run the deploy_script. Used only with ssh.
     31# This can be a space-separated list (not yet implemented, see https://trac.lal.in2p3.fr/LCGQWG/ticket/46).
     32#deploy_server : quattorsrv.example.org
     33# Userid to use to run deploy_script
     34deploy_user : root
     35# notify_xxx are used to configure email notification in case of errors.
     36# If notif_from or notif_to is undefined, email notification is disabled
     37notif_mailer : localhost
     38#notif_from=Quattor Deployment <noreply@lal.in2p3.fr>
     39#notif_to=jouvin@lal.in2p3.fr
     40notif_subject_prefix : [Quattor-Deploy]
     41notif_subject : Failed to deploy revision %s of SCDB configuration
     42# Default should be appropriate. Set to false if your client doesn't handle properly returned output.
     43# When set to false, no message is printed on stdout, except if verbose is > 0.
     44report_error_to_svn: yes
     45# When false, ssh is used instead. This requires deploy_server to be defined too.
     46use_sudo : yes
     47# Log operations in /tmp/quattor-post-commit.log
     48verbose: 0
    2049
    21 # Recipients of status mail and location for checkout.
    22 NOTIFY="quattor-mgrs@lal.in2p3.fr"
     50[ssh]
     51cmd: /usr/bin/ssh
     52options: -o PasswordAuthentication=no
    2353
     54[sudo]
     55cmd: /usr/bin/sudo
     56options: -H
     57
     58[scdb]
     59# URL associated with the repository root
     60#repository_url: http://svn.example.com/scdb
     61# Branch where to create SCDB deployment tags
     62# Keep consistent with quattor.build.properties if not using default values.
     63tags_branch: /tags
     64# Branch corresponding to SCDB trunk (only branch allowed to deploy)
     65# Keep consistent with quattor.build.properties if not using default values.
     66trunk_branch: /trunk
    2467}}}
    2568
    26 Other supported variables are :
    27 {{{
    28 # Script on Quattor server to deploy new configuration
    29 # Default : DEPLOYSCRIPT=/root/quattor/scripts/build-tag.pl
    30 
    31 # User to run the deployment script
    32 # Default : DEPLOYUSER=root
    33 
    34 # Full paths to commands.
    35 # Defaults are appropriate for RHEL/SL Linux.
    36 # MAILER="/bin/mail"
    37 # SVNLOOK="/usr/bin/svnlook"
    38 # SSH="/usr/bin/ssh"
    39 
    40 # Use sudo rather than ssh between SVN server and quattor deployment server
    41 # Default: SSH
    42 # USE_SUDO=1
    43 
    44 # Default prefix for mail subject in case of error
    45 # Default : ERROR_PREFIX='[Quattor-Deploy]'
    46 }}}
    47 
    48 ''Note : if you support several SCDB repositories on the same Subversion server, you can place configuration file for hook script in the `hooks` directory of each repository. If the configuration file is present both in `hooks` directory and in `/etc`, `hooks` directory takes precedence.''
     69The only required options for which no default value is provided is `repository_url` in `[scdb]` section. It must match the root URL of your SVN repository (as returned by `svn info`).
    4970
    5071''Note on using `sudo`: recent versions of `sudo` disable the use of `sudo` without a tty by default. This '''must''' be change in order to use `sudo` in the context of the deployement script. To to this, run `visudo` and comment out line `Defaults    requiretty`.''
     
    5273== Deployment Script ==
    5374
    54 This script is called by the hook script and does the real work by updating local copy of SCDB repository with passed tag and calling standard `ant` tasks.
     75This script is launched by the [#SubversionHookScript hook script] and does the real work by updating local working copy of the SCDB repository to the tag to deploy and by calling appropriate `ant` tasks.
    5576
    56 It needs to be installed on the Quattor server and will be called through SSH by hook script (you need to configure a SSH key without password between your Subversion server and your Quattor server). The defaut location to install the script is `/root/quattor/scripts' but you can put it wherever you want as soon as you update the hook script accordingly. This script, [source:SCDB/tags/pro/src/hooks/build-tag.pl build-tag.pl], is provided as part of SCDB tools inside [source:SCDB/tags/pro/src/hooks src/hooks] directory.
     77It needs to be installed on the Quattor server and will be called through sudo or ssh by the hook script (you need to configure a SSH key without password between your Subversion server and your Quattor server to use ssh). The default location to install the script is `/root/quattor/scripts` but you can put it wherever you want as soon as you update the hook script configuration (`[post-commit]` section) accordingly. The source of this script is [source:SCDB/trunk/src/hooks/build-tag.py build-tag.py].
     78
     79''Note: an obsolete version of this script was called `build-tag.pl` (written in Perl). All the information here doesn't apply to this obsolete version whose configuration file had a different format. When migrating from the obsolete version to the new one, the configuration file must be replaced.''
     80
     81This script requires a configuration file, `/etc/quattor-deploy.conf` (common with the [#SubversionHookScript hook script] when running on the same machine). All the configuration options supported and their default values are defined at the beginning of the script. The configuration file has several sections. One of them, `[scdb]`, is common to the hook script and the deployment script. The main options available and their default values are:
    5782
    5883This script needs to find a file [source:SCDB/tags/pro/src/hooks/quattor.build.properties quattor.build.properties] in the parent directory of SCDB local cache (generally parent directory for the script location) and a configuration file `/etc/build-tag.conf`.
    5984
    60 `/etc/build-tag.conf` allows to customize [source:SCDB/tags/pro/src/hooks/build-tag.pl build-tag.pl] according to local needs. '''It must be present'''. This file must contain key/value pairs (with '=' between key and value, keys are not case sensitive). Supported configuration options are :
    61 
    62  * `debug` : display additional information if non zero.
    63  * `java_home` : path of Java virtual machine.
    64  * `java_version` : alternative to `java_home`. Must match a directory under `/usr/java`. Default : $JAVA_HOME if defined.
    65  * `svn_cache` : location to use for SCDB repository local cache. Default : `svncache` at same level as the directory where the script is installed.
    66  * `use_svn` : if non zero, force the use of `svn` command even if `jsvn` exists. Default : use `jsvn` from `svn_cache` if it is present. ''Note : using `jsvn` may affect performances.''
    67  * `tags_svn_url` ('''required''') : SVN URL for SCDB repository `tags` branch
    68 
    69 An `/etc/build-tag.conf` example is :
    70 {{{
    71 use_svn = 1
    72 java_version = jdk1.6.0
    73 tags_svn_url = http://grid280.lal.in2p3.fr/svn/quattor/tags
    74 }}}
    7585
    7686== Troubleshooting Server-side Scripts ==
     
    119129./post-commit REPOSITY_PATH REVISION
    120130}}}
     131
     132
     133== Archived Documentation ==
     134
     135The information in this section is kept here for reference. It documents the configuration file format of the obsolete hook script and deployment script.
     136
     137=== Hook script (obsolete) ===
     138
     139This script requires a configuration file to be present, `/etc/quattor-deploy.conf`. The configuration file must contain only shell variable definition (`sh` syntax). The '''required''' variables are :
     140{{{
     141# Quattor server name
     142QUATTORSRV="quattorsrv.lal.in2p3.fr"
     143
     144# Recipients of status mail and location for checkout.
     145NOTIFY="quattor-mgrs@lal.in2p3.fr"
     146
     147}}}
     148
     149Other supported variables are :
     150{{{
     151# Script on Quattor server to deploy new configuration
     152# Default : DEPLOYSCRIPT=/root/quattor/scripts/build-tag.pl
     153
     154# User to run the deployment script
     155# Default : DEPLOYUSER=root
     156
     157# Full paths to commands.
     158# Defaults are appropriate for RHEL/SL Linux.
     159# MAILER="/bin/mail"
     160# SVNLOOK="/usr/bin/svnlook"
     161# SSH="/usr/bin/ssh"
     162
     163# Use sudo rather than ssh between SVN server and quattor deployment server
     164# Default: SSH
     165# USE_SUDO=1
     166
     167# Default prefix for mail subject in case of error
     168# Default : ERROR_PREFIX='[Quattor-Deploy]'
     169}}}
     170
     171=== Deployment Script (obsolete) ===
     172
     173`/etc/build-tag.conf` allows to customize [source:SCDB/tags/pro/src/hooks/build-tag.pl build-tag.pl] according to local needs. '''It must be present'''. This file must contain key/value pairs (with '=' between key and value, keys are not case sensitive). Supported configuration options are :
     174
     175 * `debug` : display additional information if non zero.
     176 * `java_home` : path of Java virtual machine.
     177 * `java_version` : alternative to `java_home`. Must match a directory under `/usr/java`. Default : $JAVA_HOME if defined.
     178 * `svn_cache` : location to use for SCDB repository local cache. Default : `svncache` at same level as the directory where the script is installed.
     179 * `use_svn` : if non zero, force the use of `svn` command even if `jsvn` exists. Default : use `jsvn` from `svn_cache` if it is present. ''Note : using `jsvn` may affect performances.''
     180 * `tags_svn_url` ('''required''') : SVN URL for SCDB repository `tags` branch
     181
     182An `/etc/build-tag.conf` example is :
     183{{{
     184use_svn = 1
     185java_version = jdk1.6.0
     186tags_svn_url = http://grid280.lal.in2p3.fr/svn/quattor/tags
     187}}}