Meego Wiki
Views

Quality/QA-tools/QADashboard/Setting up the production environment

From MeeGo wiki
< Quality | QA-tools | QADashboard(Difference between revisions)
Jump to: navigation, search
m
m
 
Line 113: Line 113:
=== Getting data from Bugzilla ===
=== Getting data from Bugzilla ===
-
TODO: Document Bugzilla exporter setup and usage
+
QA Dashboard environment includes a script which pulls data from bugzilla and pushes it to qa-dashboard.
 +
 
 +
* Usage:
 +
<code>
 +
$ cd export/bugzilla
 +
$ bundle install
 +
$ vi bugzilla_config.yml    #use your editor of choice to define bugzilla settings
 +
$ vi qa-dashboard_config.yml #and qa-dashboard settings
 +
$ ruby bugzilla_export.rb start
 +
</code>
 +
 
 +
* The script starts a background process and writes logs to <tt>bugzilla_exportd.output</tt>
 +
* If you need to stop the script, it can be done with <tt>ruby bugzilla_export.rb stop</tt>

Latest revision as of 21:08, 30 June 2011

Contents

Overview

Running and deploying QA Dashboard relies heavily on automated deployment scripts and version control repository. At high level, deployment process is following:

  1. Log in to your workstation and update QA Dashboard working tree
  2. Run Capistrano deployment script on your workstation
  3. Capistrano script connects to the production server and updates the deployment by
    1. Connecting to version control system from production server and updating the source code on the production server
    2. Installing node package dependencies
    3. Restarting the application on production server

Setting up the local environment for deployments

QA Dashboard uses Capistrano to automate the deployments. The main benefit is to eliminate the risks of human errors and to enable easy and repeatable rollbacks. See Capistrano documentation for the details

Install development environment

You should first set up the development environment on your workstation before continuing. Capistrano is run from your development environment

Installing Capistrano

Capistrano requires Ruby. If you do not have Ruby installed please follow the "Install Ruby" instructions here.

$ gem install capistrano

Setting up the production server

Install dependencies

The same dependencies are needed in the production server as in development environment. Follow the instructions in Quality/QA-tools/QADashboard/Setting_up_the_development_environment to:

  1. Install Node.js
  2. Install Node Package Manager
  3. Install mongodb

Create virtual host for QA Dashboard

(example using nginx)

Write a following virtual host declaration to /etc/nginx/sites-available/qa-dashboard

server {
    listen 80;
    server_name qa-dashboard.qa.leonidasoy.fi;
    location / {
        proxy_pass  http://localhost:3030;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
        proxy_set_header X-Real-IP  $remote_addr;
    }
}

Restart nginx

sudo service nginx restart

Deploying QA Dashboard

Enable public key authentication for your deployment account

Set up public key authentication:

  1. Generate yourself as SSH key pair if you don't have one: $ ssh-keygen
  2. Add your public key to authorized_keys file of your production environment user:
    $ ssh your.production.user@your.production.host 'mkdir .ssh; echo '`cat ~/.ssh/id_rsa.pub`' >> ~/.ssh/authorized_keys'
  3. Try logging in: ssh your.production.user@your.production.host

Modify settings

QA Dashboard authentication settings are defined in settings.json that is deployed with Capistrano.

LDAP Authentication

TODO

MySQL Authentication

TODO

Modify Capistrano scripts and setup deployment

QA Dashboard uses following scripts to configure Capistrano

  • config/deploy.rb
  • config/deploy/staging.rb
  • config/deploy/production.rb

You might want to review all the files, but usually it's enough to update only config/deploy/production.rb according to your needs (servers, deployment account, ssh options). You can also create new deployment environment just by copying the production.rb, to e.g. internal.rb and modify it.

When you deploy for first time you need to run setup command, which creates creates the folder hierarchy and the symbolic links required by Capistrano.
Once the Capistrano is updated according to your needs you need to run setup command, which creates creates the folder hierarchy and the symbolic links required by Capistrano. After that the server can be started.

$ cap production deploy:setup # or cap internal deploy:setup, if you created a new deployment environment
$ cap production deploy:start # starts the server

Deploying QA Dashboard

Once the setup is complete, the deployment is as easy as it gets

$ cap production deploy

Setting up the data flow

QA Dashboard naturally needs data to be shown. This data usually comes from QA Reports and Bugzilla.

Getting data from QA Reports

Instructions for setting up the data synchronization is described in QA Reports installation guide.

Getting data from Bugzilla

QA Dashboard environment includes a script which pulls data from bugzilla and pushes it to qa-dashboard.

  • Usage:

$ cd export/bugzilla
$ bundle install
$ vi bugzilla_config.yml     #use your editor of choice to define bugzilla settings
$ vi qa-dashboard_config.yml #and qa-dashboard settings
$ ruby bugzilla_export.rb start

  • The script starts a background process and writes logs to bugzilla_exportd.output
  • If you need to stop the script, it can be done with ruby bugzilla_export.rb stop
Personal tools