From Fedora Project Wiki

 
(20 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 +
This article describes the installation process of [[ResultsDB Overview|ResultsDB]] to be used together with [[AutoQA]].
 +
 
= Prerequisities =
 
= Prerequisities =
  
Installed Fedora 14 or RHEL 6, preferably in a virtual environment.
+
Installed Fedora 14+ or RHEL 6, preferably in a virtual environment.
  
= Installation =
+
= Deploying ResultsDB as Apache2/wsgi application =
 
 
Install and configure mysql
 
yum install mysql-server
 
chkconfig mysqld on
 
service mysqld start
 
/usr/bin/mysqladmin -u root password 'new-password'
 
 
 
mysql -u root -p
 
 
 
create database resultsdb;
 
grant usage on *.* to resultsdb@localhost identified by '9zWyNtmBmHcUe6Yn';
 
grant all privileges on resultsdb.* to resultsdb@localhost;
 
exit
 
 
 
Prepare virtualenv environment
 
yum install gcc sqlite-devel python-virtualenv
 
 
 
virtualenv tg2env
 
cd tg2env
 
source bin/activate
 
easy_install -i http://www.turbogears.org/2.1/downloads/current/index tg.devtools
 
 
 
Download ResultsDB from GIT
 
git clone git://git.fedorahosted.org/ResultsDB.git resultsdb
 
cd resultsdb/resultsdb
 
 
 
Install dependencies and setup the application
 
yum install python-pycurl python-fedora MySQL-python
 
python setup.py develop
 
paster setup-app development.ini
 
 
 
= ResultsDB =
 
 
 
Start the ResultsDB instance in [http://www.manpagez.com/man/1/screen/ screen]
 
screen -S resultsdb
 
paster serve development.ini --reload
 
 
 
Turbogears welcome screen should be now visible on [http://localhost:8081 http://localhost:8081]. Either press <code>Ctrl+ad</code> to send screen to background, or open another terminal.
 
  
== Test the XMLRPC interface ==
+
Make all the steps as 'root', if not specified otherwise.
python
 
  
import xmlrpclib
+
Install apache and mod_wsgi using [[dnf|DNF]] or [[yum|YUM]]:
s = xmlrpclib.ServerProxy("http://localhost:8081/xmlrpc", allow_none = 1)
+
  dnf|yum install httpd mod_wsgi
s.get_metadata("https://fedoraproject.org/wiki/User:Jskladan/Sandbox:Rpmlint_Testcase_Metadata")
 
 
 
Expected result:
 
{'required_keyval': ['pkg_name', 'envr', 'arch', 'owner']}
 
 
 
Exit Python shell
 
exit()
 
 
 
== Stop the application ==
 
 
 
If you used the screen terminal to run ResultsDB, reattach it using
 
screen -r resultsdb
 
or switch to the terminal window in which you started the application.
 
 
 
 
 
Press <code>Ctrl+c</code> to kill the running Turbogears application. Then stop the virtualenv
 
  deactivate
 
 
 
= Deploying ResultsDB as Apache2/wsgi application =
 
  
 
Install and configure mysql
 
Install and configure mysql
  yum install mysql-server
+
  dnf|yum install mysql-server mysql-devel git
 
  chkconfig mysqld on
 
  chkconfig mysqld on
 
  service mysqld start
 
  service mysqld start
Line 81: Line 25:
 
  exit
 
  exit
  
Setup baseline virtualenv
+
Setup base virtualenv  
  yum install python-pycurl python-fedora MySQL-python python-virtualenv gcc
+
  dnf|yum install python-pycurl python-fedora MySQL-python python-virtualenv gcc libcurl-devel
 
  mkdir -p /usr/local/pythonenv
 
  mkdir -p /usr/local/pythonenv
 
  cd /usr/local/pythonenv
 
  cd /usr/local/pythonenv
  virtualenv BASELINE
+
  virtualenv --system-site-packages resultsdb
  chown -R apache:apache BASELINE
+
  chown -R apache:apache resultsdb
  
 +
Clone the resultsdb git & initialize the base virtualenv
 
  mkdir git
 
  mkdir git
 
  chown apache:apache git
 
  chown apache:apache git
 
  sudo -u apache bash
 
  sudo -u apache bash
 
Clone the resultsdb git & initialize the baseline virtualenv
 
 
  cd git
 
  cd git
 
  git clone git://git.fedorahosted.org/ResultsDB.git resultsdb
 
  git clone git://git.fedorahosted.org/ResultsDB.git resultsdb
+
  source /usr/local/pythonenv/resultsdb/bin/activate
  source /usr/local/pythonenv/BASELINE/bin/activate
+
  easy_install -i http://www.turbogears.org/2.1/downloads/2.1.5/index tg.devtools
  easy_install -i http://www.turbogears.org/2.1/downloads/current/index tg.devtools
 
 
  cd /usr/local/pythonenv/git/resultsdb/resultsdb/
 
  cd /usr/local/pythonenv/git/resultsdb/resultsdb/
 
  python setup.py develop
 
  python setup.py develop
 
+
Edit the 'development.ini' file adding the password defined above
 +
sqlalchemy.url=mysql://resultsdb:'TOP_SECRET_PASSWORD'@localhost:3306/resultsdb
 +
Then
 +
paster setup-app development.ini
 
  exit
 
  exit
  source /usr/local/pythonenv/BASELINE/bin/activate
+
  source /usr/local/pythonenv/resultsdb/bin/activate
  
 
Install modwsgi deploy helper tool
 
Install modwsgi deploy helper tool
Line 110: Line 55:
 
  cd modwsgideploy
 
  cd modwsgideploy
 
  bzr branch http://bazaar.launchpad.net/~mcfletch/modwsgideploy/parameterized/
 
  bzr branch http://bazaar.launchpad.net/~mcfletch/modwsgideploy/parameterized/
  cd parametrized/trunk
+
  cd parameterized/trunk
 
  python setup.py develop
 
  python setup.py develop
 
   
 
   
 
Prepare the actual deployment data
 
Prepare the actual deployment data
 
  mkdir /usr/local/turbogears
 
  mkdir /usr/local/turbogears
 +
cd /usr/local/pythonenv/git/resultsdb/resultsdb/
 
  cp -r ../resultsdb /usr/local/turbogears/
 
  cp -r ../resultsdb /usr/local/turbogears/
 
  paster make-config resultsdb production.ini
 
  paster make-config resultsdb production.ini
  cp production.ini /usr/local/turbogears/resultsdb
+
  mv production.ini /usr/local/turbogears/resultsdb
 
  mkdir /usr/local/turbogears/resultsdb/python-eggs
 
  mkdir /usr/local/turbogears/resultsdb/python-eggs
 
+
  cd /usr/local/pythonenv/
#??? is this really necessary ???
 
  cd /usr/local/pythonenv/BASELINE/
 
virtualenv resultsdb
 
 
  chown -R apache:apache resultsdb
 
  chown -R apache:apache resultsdb
  
 
Use the modwsgi_deploy tool to create apache config files
 
Use the modwsgi_deploy tool to create apache config files
 
  cd /usr/local/turbogears/resultsdb
 
  cd /usr/local/turbogears/resultsdb
  paster modwsgi_deploy --logging -b /usr/local/pythonenv/BASELINE/
+
  paster modwsgi_deploy --logging -b /usr/local/pythonenv/resultsdb
 
deactivate
 
  
 
Apacheuser needs to own the deployed directory & files
 
Apacheuser needs to own the deployed directory & files
 
  chown -R apache:apache /usr/local/turbogears/resultsdb
 
  chown -R apache:apache /usr/local/turbogears/resultsdb
 +
 +
And we need to setup the links in virtualenv correctly for the /usr/local/turbogears/resultsdb
 +
cd  /usr/local/turbogears/resultsdb
 +
python setup.py develop
 +
deactivate
  
 
   
 
   
Line 153: Line 99:
 
     WSGIScriptAlias /resultsdb/ /usr/local/turbogears/resultsdb/apache/resultsdb.wsgi
 
     WSGIScriptAlias /resultsdb/ /usr/local/turbogears/resultsdb/apache/resultsdb.wsgi
 
  Change line to (notice the deleted slash at the end of the originally '/resultsdb/'):
 
  Change line to (notice the deleted slash at the end of the originally '/resultsdb/'):
      WSGIScriptAlias /resultsdb /usr/local/turbogears/resultsdb/apache/resultsdb.wsgi
+
    WSGIScriptAlias /resultsdb /usr/local/turbogears/resultsdb/apache/resultsdb.wsgi
 +
 
 +
Change /usr/local/turbogears/resultsdb/apache/resultsdb.wsgi (sometimes, the line is already OK, so just leave it there :))
 +
Original line:
 +
    site.addsitedir('/usr/local/pythonenv/resultsdb/resultsdb/lib/python2.6/site-packages')
 +
Changed line:
 +
    site.addsitedir('/usr/local/pythonenv/resultsdb/lib/python2.6/site-packages')
 
   
 
   
 
Restart the httpd service, and try to access http://url.of.your.server/resultsdb/ you should see the ResultsDB's "man" page.
 
Restart the httpd service, and try to access http://url.of.your.server/resultsdb/ you should see the ResultsDB's "man" page.
  
[[Category:ResultsDB]]
+
 
 +
== Populating MySQL database ==
 +
 
 +
source /usr/local/pythonenv/resultsdb/bin/activate
 +
cd /usr/local/turbogears/resultsdb
 +
paster setup-app production.ini
 +
deactivate
 +
 
 +
 
 +
Also, don't forget to populate the 'Testcase' table. If you intend to use ResultsDB with AutoQA, this should be enough:
 +
 
 +
INSERT INTO `Testcase`(`name`, `url`) VALUES ("not specified","https://fedoraproject.org/wiki/User:Jskladan/Sandbox:EMPTY_Testcase_Metadata")
 +
 
 +
= Developer Setup =
 +
 
 +
Make all the steps as a non-root user, if not specified otherwise.
 +
 
 +
Install and configure mysql
 +
sudo dnf|yum install mysql-server
 +
sudo chkconfig mysqld on
 +
sudo service mysqld start
 +
sudo /usr/bin/mysqladmin -u root password 'new-password'
 +
 
 +
mysql -u root -p
 +
 
 +
create database resultsdb;
 +
grant usage on *.* to resultsdb@localhost identified by '9zWyNtmBmHcUe6Yn';
 +
grant all privileges on resultsdb.* to resultsdb@localhost;
 +
exit
 +
 
 +
Prepare virtualenv environment
 +
sudo dnf|yum install gcc sqlite-devel python-virtualenv
 +
 
 +
virtualenv --system-site-packages tg2env
 +
cd tg2env
 +
source bin/activate
 +
easy_install -i http://www.turbogears.org/2.1/downloads/2.1.5/index tg.devtools
 +
 
 +
Download ResultsDB from GIT
 +
git clone git://git.fedorahosted.org/ResultsDB.git resultsdb
 +
cd resultsdb/resultsdb
 +
 
 +
Install dependencies and setup the application
 +
sudo dnf|yum install python-pycurl python-fedora MySQL-python
 +
python setup.py develop
 +
paster setup-app development.ini
 +
 
 +
Also, don't forget to populate the 'Testcase' table. If you intend to use ResultsDB with AutoQA, this should be enough:
 +
 
 +
INSERT INTO `Testcase`(`name`, `url`) VALUES ("not specified","https://fedoraproject.org/wiki/User:Jskladan/Sandbox:EMPTY_Testcase_Metadata")
 +
 
 +
== ResultsDB ==
 +
 
 +
Start the ResultsDB instance in [http://www.manpagez.com/man/1/screen/ screen]
 +
screen -S resultsdb
 +
paster serve development.ini --reload
 +
 
 +
Turbogears welcome screen should be now visible on [http://localhost:8081 http://localhost:8081]. Either press <code>Ctrl+ad</code> to send screen to background, or open another terminal.
 +
 
 +
=== Test the XMLRPC interface ===
 +
python
 +
 
 +
import xmlrpclib
 +
s = xmlrpclib.ServerProxy("http://localhost:8081/xmlrpc", allow_none = 1)
 +
s.get_metadata("https://fedoraproject.org/wiki/User:Jskladan/Sandbox:Rpmlint_Testcase_Metadata")
 +
 
 +
Expected result:
 +
{'required_keyval': ['pkg_name', 'envr', 'arch', 'owner']}
 +
 
 +
Exit Python shell
 +
exit()
 +
 
 +
=== Stop the application ===
 +
 
 +
If you used the screen terminal to run ResultsDB, reattach it using
 +
screen -r resultsdb
 +
or switch to the terminal window in which you started the application.
 +
 
 +
 
 +
Press <code>Ctrl+c</code> to kill the running Turbogears application. Then stop the virtualenv
 +
deactivate
 +
 
 +
[[Category:ResultsDB_Legacy]]
 +
[[Category:AutoQA]]

Latest revision as of 13:56, 5 October 2015

This article describes the installation process of ResultsDB to be used together with AutoQA.

Prerequisities

Installed Fedora 14+ or RHEL 6, preferably in a virtual environment.

Deploying ResultsDB as Apache2/wsgi application

Make all the steps as 'root', if not specified otherwise.

Install apache and mod_wsgi using DNF or YUM:

dnf|yum install httpd mod_wsgi

Install and configure mysql

dnf|yum install mysql-server mysql-devel git
chkconfig mysqld on
service mysqld start
/usr/bin/mysqladmin -u root password 'new-password'
mysql -u root -p
create database resultsdb;
grant usage on *.* to resultsdb@localhost identified by 'TOP_SECRET_PASSWORD';
grant all privileges on resultsdb.* to resultsdb@localhost;
exit

Setup base virtualenv

dnf|yum install python-pycurl python-fedora MySQL-python python-virtualenv gcc libcurl-devel
mkdir -p /usr/local/pythonenv
cd /usr/local/pythonenv
virtualenv --system-site-packages resultsdb
chown -R apache:apache resultsdb

Clone the resultsdb git & initialize the base virtualenv

mkdir git
chown apache:apache git
sudo -u apache bash
cd git
git clone git://git.fedorahosted.org/ResultsDB.git resultsdb
source /usr/local/pythonenv/resultsdb/bin/activate
easy_install -i http://www.turbogears.org/2.1/downloads/2.1.5/index tg.devtools
cd /usr/local/pythonenv/git/resultsdb/resultsdb/
python setup.py develop

Edit the 'development.ini' file adding the password defined above

sqlalchemy.url=mysql://resultsdb:'TOP_SECRET_PASSWORD'@localhost:3306/resultsdb

Then

paster setup-app development.ini
exit
source /usr/local/pythonenv/resultsdb/bin/activate

Install modwsgi deploy helper tool

cd ~/
easy_install bzr
mkdir modwsgideploy
cd modwsgideploy
bzr branch http://bazaar.launchpad.net/~mcfletch/modwsgideploy/parameterized/
cd parameterized/trunk
python setup.py develop

Prepare the actual deployment data

mkdir /usr/local/turbogears
cd /usr/local/pythonenv/git/resultsdb/resultsdb/
cp -r ../resultsdb /usr/local/turbogears/
paster make-config resultsdb production.ini
mv production.ini /usr/local/turbogears/resultsdb
mkdir /usr/local/turbogears/resultsdb/python-eggs
cd /usr/local/pythonenv/
chown -R apache:apache resultsdb

Use the modwsgi_deploy tool to create apache config files

cd /usr/local/turbogears/resultsdb
paster modwsgi_deploy --logging -b /usr/local/pythonenv/resultsdb 

Apacheuser needs to own the deployed directory & files

chown -R apache:apache /usr/local/turbogears/resultsdb

And we need to setup the links in virtualenv correctly for the /usr/local/turbogears/resultsdb

cd  /usr/local/turbogears/resultsdb
python setup.py develop
deactivate


Config files

Copy apache config file

cp /usr/local/turbogears/resultsdb/apache/resultsdb /etc/httpd/conf.d/resultsdb.conf

Edit /usr/local/turbogears/resultsdb/production.ini

[Default] -> debug = false
[app:main] -> full_stack = false
[app:main] -> set debug = false
[app:main] -> sqlalchemy.url = mysql://resultsdb:TOP_SECRET_PASSWORD@localhost:3306/resultsdb

<http://stackoverflow.com/questions/3579850/mod-wsgi-not-working-with-pinax-of-django>

add "WSGISocketPrefix /var/run/wsgi" (without quotes) to /etc/httpd/conf.d/wsgi.conf

Change /etc/httpd/conf.d/resultsdb.conf

Original line:
    WSGIScriptAlias /resultsdb/ /usr/local/turbogears/resultsdb/apache/resultsdb.wsgi
Change line to (notice the deleted slash at the end of the originally '/resultsdb/'):
    WSGIScriptAlias /resultsdb /usr/local/turbogears/resultsdb/apache/resultsdb.wsgi

Change /usr/local/turbogears/resultsdb/apache/resultsdb.wsgi (sometimes, the line is already OK, so just leave it there :))

Original line:
    site.addsitedir('/usr/local/pythonenv/resultsdb/resultsdb/lib/python2.6/site-packages')
Changed line:
    site.addsitedir('/usr/local/pythonenv/resultsdb/lib/python2.6/site-packages')

Restart the httpd service, and try to access http://url.of.your.server/resultsdb/ you should see the ResultsDB's "man" page.


Populating MySQL database

source /usr/local/pythonenv/resultsdb/bin/activate
cd /usr/local/turbogears/resultsdb
paster setup-app production.ini
deactivate


Also, don't forget to populate the 'Testcase' table. If you intend to use ResultsDB with AutoQA, this should be enough:

INSERT INTO Testcase(name, url) VALUES ("not specified","https://fedoraproject.org/wiki/User:Jskladan/Sandbox:EMPTY_Testcase_Metadata")

Developer Setup

Make all the steps as a non-root user, if not specified otherwise.

Install and configure mysql

sudo dnf|yum install mysql-server
sudo chkconfig mysqld on
sudo service mysqld start
sudo /usr/bin/mysqladmin -u root password 'new-password'
mysql -u root -p
create database resultsdb;
grant usage on *.* to resultsdb@localhost identified by '9zWyNtmBmHcUe6Yn';
grant all privileges on resultsdb.* to resultsdb@localhost;
exit

Prepare virtualenv environment

sudo dnf|yum install gcc sqlite-devel python-virtualenv
virtualenv --system-site-packages tg2env
cd tg2env
source bin/activate
easy_install -i http://www.turbogears.org/2.1/downloads/2.1.5/index tg.devtools

Download ResultsDB from GIT

git clone git://git.fedorahosted.org/ResultsDB.git resultsdb
cd resultsdb/resultsdb

Install dependencies and setup the application

sudo dnf|yum install python-pycurl python-fedora MySQL-python
python setup.py develop
paster setup-app development.ini

Also, don't forget to populate the 'Testcase' table. If you intend to use ResultsDB with AutoQA, this should be enough:

INSERT INTO Testcase(name, url) VALUES ("not specified","https://fedoraproject.org/wiki/User:Jskladan/Sandbox:EMPTY_Testcase_Metadata")

ResultsDB

Start the ResultsDB instance in screen

screen -S resultsdb
paster serve development.ini --reload

Turbogears welcome screen should be now visible on http://localhost:8081. Either press Ctrl+ad to send screen to background, or open another terminal.

Test the XMLRPC interface

python
import xmlrpclib
s = xmlrpclib.ServerProxy("http://localhost:8081/xmlrpc", allow_none = 1)
s.get_metadata("https://fedoraproject.org/wiki/User:Jskladan/Sandbox:Rpmlint_Testcase_Metadata")

Expected result:

{'required_keyval': ['pkg_name', 'envr', 'arch', 'owner']}

Exit Python shell

exit()

Stop the application

If you used the screen terminal to run ResultsDB, reattach it using

screen -r resultsdb

or switch to the terminal window in which you started the application.


Press Ctrl+c to kill the running Turbogears application. Then stop the virtualenv

deactivate