Changes between Version 71 and Version 72 of SandBoxPac


Ignore:
Timestamp:
07/09/09 14:35:37 (16 years ago)
Author:
pacitu
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • SandBoxPac

    v71 v72  
    6262 
    6363 
    64 --------------------------------- 
    6564 
    66  * Кафе машината -  София, Сервиз "БЪЛГАРИЯ СЕРВИЗ" :  
    67    * ул. "Вежен" 25, тел.: 963-22-49;  
    68    * жк "Люлин-10" бл. 149-партер, тел.: 925-08-70, 925-13-22  
     65 ==  Backup Structure and Restoring a Backup == 
     66 === Backup Structure === 
     67 The backup script is executed every Sunday at 3 Am. And two CD's 
     68 * Backup catalog structure  
     69  * apache - the /etc/apache2/sites-enabled/ contents - this is the file with the apache configuration for the trac environment. 
     70  * build  - the /home/build/ contents - these are all the files needed to restore the hudson server, except the downloaded trunk of the repository. 
     71  * postgres - in here we keep the dump from the postgres database. 
     72  * s2s - the /home/s2s/ contents - these are all the files needed to restore the s2s server. 
     73  * scs - the /home/scs/ contents - these are all the files needed to restore the scs servers. 
     74  * site-packages - the /usr/lib/python2.5/site-packages/ contents - here is the trac installation and some of the plug-ins we're using, also every change to the trac's look and feel are stored here. 
     75 * Script 
     76{{{ 
     77#!sh 
     78#!/bin/bash 
     79dirname="/root/backup/`date +%Y-%m-%d`" 
    6980 
    70 --------------------------------- 
     81mkdir $dirname 
     82mkdir $dirname/scs 
     83mkdir $dirname/build 
     84mkdir $dirname/build/.hudson 
     85mkdir $dirname/s2s 
     86mkdir $dirname/apache 
     87mkdir $dirname/postgres 
    7188 
    72  * Sophie2 Server set-up 
    73    * Trac  
    74    * SVN  
    75    * Postgres + migrating the WBS 
    76    * Nexus 
    77    * Buld Server  
    78    * Hudson 
    79    * Testlink 
    80  
    81  * SCS_REPO_MAINTENANCE, SCS_ISSUE_TRACKER_MAINTENANCE, SCS_BACKUP 
    82  
    83  * New Server installation and set-up 
    84    * software RAID 
    85    * users + quotas 
    86    * vnc4server instances for all users 
    87    * Eclipse, Java 6, Maven 
    88  
    89  * Dzver port forwarding. 
    90  
    91  * Sophie2 web site with Dian. 
     89## Trac, testlink, svn and python site packages 
     90cp -R /home/scs/svn/ $dirname/scs 
     91cp -R /home/scs/trac/ $dirname/scs 
     92cp -R /home/scs/testlink/ $dirname/scs 
     93cp -R /home/scs/nexus/ $dirname/scs 
     94cp -R /usr/lib/python2.5/site-packages/ $dirname 
    9295 
    9396 
     97## Apache virtual host 
     98cp /etc/apache2/sites-available/trac $dirname/apache/ 
    9499 
     100## PstgreSQL database 
     101pg_dumpall -U scs -c -d > $dirname/postgres/pgdump 
    95102 
     103## Build server 
     104copy() { 
     105   for file in `ls "$1$2"` 
     106   do 
     107      if [ $file = 'Sophie' ] 
     108      then 
     109         file="Sophie 2.0" 
     110      fi 
     111      if [ `echo "$1$2$file" | grep /sophie2/ | wc -l` -eq 0 ] 
     112      then 
     113         if [ -d "$1$2$file" ] 
     114         then 
     115            mkdir "$dirname/build/$2$file" 
     116            copy "$1" "$2$file/" 
     117         else 
     118            cp "$1$2$file" "$dirname/build/$2$file" 
     119         fi 
     120      else 
     121      mkdir "$1$2$file" 
     122      fi 
     123   done 
     124} 
    96125 
    97 {{{ 
    98 #!C 
    99    [WebMethod] 
    100     public List<City> SearchStates(string userName, string password, string name) 
    101     { 
    102         IWorkspace workspace = Connect(userName, password); 
     126copy /home/build   /.hudson/ 
    103127 
    104         List<City> resCities = new List<City>(); 
    105         IFeatureClass statesClass = (workspace as IFeatureWorkspace).OpenFeatureClass("States"); 
    106         IFeatureClass capitalsClass = (workspace as IFeatureWorkspace).OpenFeatureClass("Capitals"); 
    107         int nameIndex = capitalsClass.FindField("CITY_NAME"); 
     128## S2S server 
     129cp -R /home/s2s/sophie2server $dirname/s2s 
    108130 
    109         IQueryFilter sfs = new QueryFilterClass(); 
    110         sfs.WhereClause = "STATE_ABBR = '" + name + "'"; 
    111         IFeatureCursor resCursor = statesClass.Search(sfs, true); 
     131tar -pczf "$dirname".tar.gz $dirname 
     132rm -Rf $dirname 
    112133 
    113         IFeature state = resCursor.NextFeature(); 
    114         while (state != null) 
    115         { 
    116              
    117             ISpatialFilter sfc = new SpatialFilterClass(); 
    118             IGeometry buffer = state.Shape; 
    119             sfc.Geometry = buffer; 
    120             sfc.SpatialRel = esriSpatialRelEnum.esriSpatialRelEnvelopeIntersects; 
     134#mkisofs -r -o  "$dirname".iso "$dirname".tar.gz 
     135#wodim  "$dirname".iso 
     136}}} 
    121137 
    122             IFeatureCursor resCursorCy = capitalsClass.Search(sfc, true); 
    123             IFeature capital = resCursorCy.NextFeature(); 
     138 After copying all the needed data for the back up the catalog is compressed to tar.gz so when we create the .iso there are no conflicts with long file names and the data can be stored to one DVD.  
    124139 
    125             while (capital != null) 
    126             { 
    127                 resCities.Add(new City(capital.get_Value(nameIndex) as string, 0, 0)); 
    128                 capital = resCursorCy.NextFeature(); 
    129             } 
     140=== Restoring a Backup === 
     141 Restoring the scs, s2s and apache are as simple as copying the contents of the back-up to the corresponding catalogs in the Server. The build restore is a bit more tricky  because you have to checkout the repository in the $HUDSON_HOME/".hudson/jobs/Sophie\ 2.0/sophie2/trunk" before the server can run properly. ( you also copy the contents of the catalog into the $HUDSON_HOME) The postgres database can be restored with the  "pg_restore -c -f $FILE" command executed as root. Finally the trac environment can be restored on the Sophie2 server in the same manner, but if we have to move the servers to another machine, then only the files for the trac look and feel should be copied all the other things should be installed properly.  
    130142 
    131             Marshal.ReleaseComObject(resCursorCy); 
    132             state = resCursor.NextFeature(); 
    133         } 
    134  
    135         Marshal.ReleaseComObject(resCursor); 
    136         return resCities; 
    137     } 
    138 }}}