Changes between Version 2 and Version 3 of ExpressoTestCenter/environment


Ignore:
Timestamp:
05/26/10 15:27:03 (14 years ago)
Author:
luiz-fernando
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ExpressoTestCenter/environment

    v2 v3  
     1[[PageOutline(1-3, Conteúdo)]] 
     2 
    13Estou realizando os passos abaixo apenas para validar a ideia inicial do ambiente. Para isso criei uma máquina virtual e partindo de uma instalação básica do Debian 5.0.4 estou usando o seguinte roteiro: 
     4 
     5= Pré-requisitos = 
     6  * Debian 5.0.4 
     7  * Test Link 1.9beta4 
     8  * Trac 0.11.7 com plugin xmlrpc-r8009 
     9 
     10= Instalar Debian 5.0.4 em uma maquina virtual com os seguintes módulos = 
     11  * Base system  
     12  * Web server 
     13 
     14== Instalar os seguintes pacotes usando apt-get install == 
     15  * ssh 
     16  * unzip 
     17  * php5 
     18  * postgresql 
     19  * php5-pgsql 
     20  * php5-gd 
     21  * php5-ldap 
     22  * slapd 
     23  * subversion 
     24  * libapache2-svn 
     25  * python-genshi 
     26  * python-setuptools 
     27  * python-subversion 
     28  * python-psycopg 
     29  * libapache2-mod-python 
     30  * libapache2-mod-wsgi 
     31 
     32== Criar senha padrão do usuário postgres == 
     33{{{ 
     34    $ su postgres 
     35    $ psql 
     36    $ alter user postgres password 'postgres'; 
     37    $ exit 
     38}}} 
     39 
     40== Preparar subversion para uso do Trac == 
     41{{{ 
     42    $ mkdir -p /services/svn/repositories 
     43    $ svnadmin create /services/svn/repositories/trac 
     44    $ chown -R www-data.www-data /services/svn/repositories 
     45    $ find /services/svn/repositories/ -type d|xargs chmod g+sw 
     46}}} 
     47 
     48=== Criar arquivo /etc/apache2/subversion.conf com === 
     49{{{ 
     50    <Location /svn> 
     51        DAV svn 
     52        SVNParentPath /services/svn/repositories 
     53    </Location> 
     54}}} 
     55 
     56=== Adicionar ao final do /etc/apache2/apache2.conf === 
     57{{{ 
     58    Include /etc/apache2/subversion.conf          
     59}}} 
     60 
     61= Copiar arquivos de instalação para maquina virtual = 
     62{{{ 
     63    $ scp testlink-1.9beta4.zip Trac-0.11.7.tar.gz xmlrpcplugin-r8009.zip root@172.16.9.137:/tmp 
     64}}} 
     65 
     66== Descompactar arquivos no /tmp da maquina virtual == 
     67{{{ 
     68    $ unzip testlink-1.9beta4.zip 
     69    $ tar zxvf Trac-0.11.7.tar.gz 
     70    $ unzip xmlrpcplugin-r8009.zip 
     71}}} 
     72 
     73== Renomear diretorio do testlink e copiar para diretório do apache == 
     74{{{ 
     75    $ mv testlink-1.9beta4 testlink 
     76    $ mv testlink /var/www 
     77    $ chmod 777 -R /var/www/testlink 
     78    $ apachectl restart 
     79}}} 
     80 
     81= Instalação do Testlink = 
     82 
     83== Abrir browser apontando para host da maquina virtual == 
     84  1. http://172.16.9.136/testlink 
     85  2. Selecionar "New instalation" 
     86  3. Aceitar a licença de uso 
     87  4. Verificação da instalação dos pré-requisitos 
     88  5. Preencher formulário para escolha do BD com os seguintes dados: 
     89    a. '''Type''': Postgres 
     90    b. '''Host''': localhost 
     91    c. '''Database name''': testlinkdb 
     92    d. '''Table prefix''': <deixar em branco> 
     93    e. '''Database admin login''': postgres 
     94    f. '''Database admin password''': postgres 
     95    g. '''Testlink db login''': testlink 
     96    h. '''Testlink db password''': testlink 
     97  6. Verificação da instalação - deve estar tudo OK nesse ponto 
     98    a. http://172.16.9.136/testlink e logar com admin/admin 
     99 
     100== Integração com o Trac == 
     101  1. Editar /var/www/testlink/cfg/trac.cfg.php colocando as seguintes informações: 
     102 
     103{{{ 
     104    /** Trac Project Root */ 
     105    define('BUG_TRACK_DB_HOST', 'http://172.16.9.137/trac/'); 
     106 
     107    define('BUG_TRACK_XMLRPC_HOST', 'http://admin:admin@172.16.9.137'); 
     108 
     109    /** @var array Mapping TL test project name vs trac project url */ 
     110    $g_interface_bugs_project_name_mapping = array( 
     111        'Expresso' => 'expresso', 
     112    ); 
     113}}} 
     114 
     115  2. Criar arquivo /var/www/testlink/custom_config.inc.php com o seguinte conteúdo: 
     116 
     117{{{ 
     118    <?php 
     119        $g_interface_bugs = 'TRAC'; 
     120    ?> 
     121}}} 
     122 
     123  3. Editar arquivo /var/www/testlink/lib/bugtracking/int_trac.php e substituir 
     124{{{  
     125    $this->xmlrpcClient = new IXR_Client($this->dbHost . '/xmlrpc'); 
     126}}} 
     127por 
     128{{{ 
     129    $this->xmlrpcClient = new IXR_Client(BUG_TRACK_XMLRPC_HOST); 
     130}}} 
     131 
     132  4. Editar arquivo /var/www/testlink/third_party/xml-rpc/class-IXR.php e adicionar as linhas em negrito: 
     133 
     134{{{ 
     135function query() { 
     136    $args = func_get_args(); 
     137    $method = array_shift($args); 
     138    $request = new IXR_Request($method, $args); 
     139    $length = $request->getLength(); 
     140    $xml = $request->getXml(); 
     141    $r = "\r\n"; 
     142    $credentials = ""; 
     143    if ($this->user != "") { 
     144        $credentials = base64_encode($this->user . ":" . $this->pass); 
     145    } 
     146    $request = "POST {$this->path} HTTP/1.0$r"; 
     147    $request .= "Host: {$this->server}$r"; 
     148    if ($credentials != "") { 
     149        $request .= "Authorization: Basic {$credentials}$r"; 
     150    } 
     151 
     152    function IXR_Client($server, $path = false, $port = 80, $timeout = false) { 
     153        if (!$path) { 
     154            // Assume we have been given a URL instead 
     155            $bits = parse_url($server); 
     156            $this->server = $bits['host']; 
     157            $this->port = isset($bits['port']) ? $bits['port'] : 80; 
     158            $this->user = isset($bits['user']) ? $bits['user'] : ''; 
     159            $this->pass = isset($bits['pass']) ? $bits['pass'] : ''; 
     160}}} 
     161 
     162= Instalação do Trac = 
     163{{{ 
     164    $ cd /tmp/Trac-0.11.7 
     165    $ python ./setup.py install 
     166    $ mkdir -p /services/trac/projects 
     167    $ trac-admin /services/trac/projects/expresso initenv 
     168        Project Name: Expresso 
     169        Database Connection: <deixar o default: sqlite:db/trac.db] 
     170        Repository: svn 
     171        Path repository: /services/svn/repositories/trac 
     172    $ chown -R www-data.www-data /services/trac/ 
     173    $ find /services/trac/ -type d|xargs chmod g+sw 
     174    $ htpasswd -cm /services/trac/projects/expresso/.htpasswd admin 
     175    $ trac-admin /services/trac/projects/expresso/ 
     176        permission add admin TRAC_ADMIN 
     177        quit 
     178}}} 
     179 
     180== Testar trac modo stand-alone == 
     181{{{ 
     182    $ tracd --port 8000 /services/trac/projects/expresso 
     183}}} 
     184 
     185== Criar arquivo /etc/apache2/trac.conf com o seguinte conteúdo == 
     186{{{ 
     187    <Location /trac> 
     188        SetHandler mod_python 
     189        PythonInterpreter main_interpreter 
     190        PythonHandler trac.web.modpython_frontend 
     191        PythonOption PYTHON_EGG_CACHE /tmp/python_egg_cache 
     192        PythonOption TracUriRoot /trac 
     193        PythonOption TracEnvParentDir /services/trac/projects/ 
     194        AuthType Basic 
     195        AuthName "trac-expresso" 
     196        AuthUserFile /services/trac/projects/expresso/.htpasswd 
     197        Require valid-user 
     198    </Location> 
     199}}} 
     200 
     201=== Adicionar ao final do /etc/apache2/apache2.conf === 
     202{{{ 
     203    Include /etc/apache2/trac.conf          
     204}}} 
     205 
     206== Instalar plugin XMLRPC == 
     207{{{ 
     208    $ cd /tmp/xmlrpcplugin/trunk 
     209    $ python setup.py bdist_egg 
     210    $ cp dist/*.egg /services/trac/projects/expresso/plugins/ 
     211}}} 
     212 
     213  1. Editar arquivo /services/trac/projects/expresso/conf/trac.ini e adicionar ao seu final: 
     214{{{ 
     215    [components] 
     216    tracrpc.* = enabled 
     217}}} 
     218 
     219  2. Reiniciar apache 
     220{{{ 
     221    $ apachectl restart 
     222}}} 
     223 
     224  3. Acessar Trac 
     225    a. http://172.16.9.136/trac  
     226    b. Entrar com usuário/senha criado com o comando htpasswd no passo 4 
     227    c. Escolher projeto Expresso 
     228    d. Clicar em Admin  
     229    e. Selecionar Permissions 
     230    f. Na seção "Grant Permission" colocar as informações e clicar em Add 
     231      i. Subject: anonymous 
     232      ii. Action: XML_RPC 
     233    
     234 
     235 
     236 
     237 
     238 
     239 
     240 
     241 
     242 
     243 
     244 
     245----------------------------------------------------------- 
     246 
     2471.22 SSL 
     248cd /etc/ssl/private 
     249openssl genrsa -des3 -out debby.key 1024 
     2501.22.1 entrar senha e confirmar 
     251 
     2521.23 cd /etc/ssl/certs 
     253openssl req -new -x509 -days 365 -key ../private/debby.key -out debby.crt 
     2541.23.1 entrar senha do passo anterior 
     2551.23.2 Country Name: BR 
     2561.23.3 Province: RS 
     2571.23.4 Locality name: POA 
     2581.23.5 Organization name: Serpro 
     2591.23.6 Organizational Unit Name: unit 
     2601.23.7 Common Name: admin 
     2611.23.8 Email: admin@sepro.gov.br 
     262 
     2631.24 cd /etc/ssl/private 
     264cp debby.key debby.key.org 
     265openssl rsa -in debby.key.org -out debby.key 
     266-> entrar senha do passo anterior 
     267chmod 400 debby.key debby.key.org 
     268 
     2691.25 cd /etc/apache2/mods-enabled/ 
     270ln -s ../mods-available/ssl.load 
     271ln -s ../mods-available/ssl.conf 
     272 
     2731.26 Editar ports.conf e comentar linhas abaixo: 
     274#NameVirtualHost *:443 
     275#Listen 443 
     276 
     2771.27 Criar arquivo /etc/apache2/ssl.conf com: 
     278<VirtualHost _default_> 
     279    DocumentRoot "/var/www" 
     280    SSLEngine on 
     281    SSLCertificateFile /etc/ssl/certs/debby.crt 
     282    SSLCertificateKeyFile /etc/ssl/private/debby.key 
     283</VirtualHost> 
     2841.27.1 Adicionar ao final do /etc/apache2/apache2.conf 
     285  Include /etc/apache2/ssl.conf          
     286 
     2871.28 mkdir -p /services/apache/debby/html 
     288 
     289 
     2901.30 Editar ssl.conf: 
     291<VirtualHost _default_> 
     292    <Location /> 
     293        AuthType Basic 
     294        AuthName "Requires authentication" 
     295        AuthUserFile /services/apache/debby/htpasswd 
     296        Require valid-user 
     297    </Location> 
     298 
     299    DocumentRoot "/services/apache/debby/html" 
     300    SSLEngine on 
     301    SSLCertificateFile /etc/ssl/certs/debby.crt 
     302    SSLCertificateKeyFile /etc/ssl/private/debby.key 
     303</VirtualHost> 
     304 
     305 
     306 
     307 
     308------------------------------------------------------------------ 
     309DICAS: 
     3101.1 Editar arquivo /etc/apt/sources.list e descomentar linha abaixo: 
     311 
     312   deb http://ftp.br.debian.org/debian/ lenny main 
     313 
     314 
     315 
     316--------------------------------------- 
     317Referências: 
     318 
     319* http://cogo.wordpress.com/2008/10/28/apache-ssl-subversion-trac-howto/ 
     320* TestLink: Manual do Usuário 
     321* Trac INSTALL instructions file 
     322* http://trac.edgewall.org/wiki/TracInstall 
     323* http://trac-hacks.org/wiki/XmlRpcPlugin 
     324* http://51elliot.blogspot.com/2009/01/trac-testlink-and-xml-rpc.html 
     325 
     326 
     327 
     328 
     329 
     330 
     331 
     332 
     333 
     334 
     335 
     336 
     337 
     338 
     339 
     340 
     341 
     342 
     343 
     344 
    2345 
    3346