wiki:SysAdmin/ContinuousIntegration

Version 5 (modified by spM, 12 years ago) ( diff )

--

EDEN CONTINUOUS INTEGRATION

URL TO ACCESS RESULTS

http://82.71.213.53/eden/admin/result

LOGIN DETAILS

ssh youraccount@82.71.213.53

Password: *

Location of Cron Job Automation file to run Test Framework:

/etc/cron.custom/testsuite

  • What this does currently :
    • Prepares Server
    • Pulls latest codes from web2py/web2py (update web2py)
    • Pulls latest codes from flavour/eden (update Eden)
    • Deletes prepopulated data
    • Loads all models
    • Fixes permissions of the web2py folder
    • Runs Automated Test Suite
    • Runs Smoke Tests
    • Runs Roles Tests

Edit cron times:

(Currently set to run Test Suite every 6 hours every day of every week of every month of every year)

crontab -e

Location of Web2Py and Eden Directory

  • web2py
    • /home/web2py
  • Eden
    • /home/web2py/applications/eden

Overall Restart

If 82.71.213.53 goes down with these errors:

  • Internal Error
  • Server Maintenance
  • Connection Timeout by every web browser
  • Unresolvable Ticket Error

Simply type these services restart commands in consoles:

  • Server Reboot :
    sudo /sbin/reboot
    

Note : There will be a downtime of a few minutes after you execute this command

  • Cherokee Restart
    sudo /etc/init.d/cherokee restart
    
  • Web2Py SSL Restart
    sudo /etc/init.d/uwsgi start
    

Start Test Suite Manually On the CI Server

sudo sh /etc/cron.custom/web2pystarter

Open another console then:

sudo sh /etc/cron.custom/testsuite

This first updates Eden and Web2py from Github, then runs the functional tests followed by smoke tests.

To just run smoke tests:

cd /home/web2py
xvfb-run -a python web2py.py -S eden -M -R applications/eden/modules/tests/suite.py -A --html-path /home/web2py/applications/eden/static/test_smoke/ --suite smoke --force-debug --link-depth 16 -V 4

We also have an install of Jenkins which should ideally be configured to run this.

Shell Script to Start The Test Suite On The CI Server

Simply run this shell script to start Functional selenium test, followed by Smoke test and then finally the Role test. You can comment out the lines you don't want to run.

  • Save the Code given below in a file (say, named as startSuite)
  • Add Execution permission to the file
    • chmod +x /location/to/script/startSuite
  • Execute the shell script
    • sudo sh /location/to/script/startSuite
#!/bin/sh
########
# Cron Script to run Sahana Eden Test Suite
########
#Server preparation
sudo /etc/init.d/cherokee restart
sudo /etc/init.d/uwsgi start

# Pull latest codes from web2py/web2py (update  web2py)
cd /home/web2py
sudo git stash
sudo git pull upstream master

# Pull latest codes from flavour/eden (update Eden)
cd /home/web2py/applications/eden
sudo git stash
sudo git pull upstream master

# Delete prepopulated data
rm -f /home/web2py/applications/eden/databases/*

# Re pre pop db and fix permissions
cd /home/web2py
python web2py.py -S eden -M -R applications/eden/static/scripts/tools/noop.py
chown -R web2py /home/web2py

# Run Automated Test Suite
cd /home/web2py
xvfb-run -a python web2py.py -S eden -M -R applications/eden/modules/tests/suite.py -A --html-path /home/web2py/applications/eden/static/test_automated/ -V 2

# Run Smoke Test (on linkdepth 16)
cd /home/web2py
xvfb-run -a python web2py.py -S eden -M -R applications/eden/modules/tests/suite.py -A --html-path /home/web2py/applications/eden/static/test_smoke/ --suite smoke --force-debug --link-depth 16 -V 3

# Run Roles Test
cd /home/web2py
xvfb-run -a python web2py.py -S eden -M -R applications/eden/modules/tests/suite.py -A --suite roles --html-path /home/web2py/applications/eden/static/test_roles/

Postgresql Instance Details for CI Server

Database name: sahana

Database user: kunal

Database user password: eden

Host: localhost

Port: 5432

How to Connect to Sahana Database from the console

psql -d sahana -U kunal

How to Restart Postgresql Server (You can give it a shot, if psql fails to connect)

sudo su - postgres
/usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data >logfile 2>&1 &

Other Useful Linux command sets

  • Pre-populate database (any type of db) :
    cd ~web2py
    sudo python web2py.py -S eden -M -R applications/eden/static/scripts/tools/noop.py
    
  • chmod directory recursively (chmod everything inside dir with -R):
    chmod -R 777 /home/web2py
    
  • start web2py
    cd ~web2py
    python web2py.py -a root
    
  • reboot server
    sudo /sbin/reboot
    
  • Restart Cherokee
    sudo /etc/init.d/cherokee restart
    
  • Restart Web2Py SSL
    sudo /etc/init.d/uwsgi start
    
  • Recreate Sahana DB :
    psql -U postgres -c "drop database sahana"
    psql -U postgres -c "create database sahana"
    psql -U postgres -c "GRANT ALL PRIVILEGES ON DATABASE sahana to kunal" #Assuming kunal is the name of the postgresql username which will be used by Sahana Eden instance
    psql -d sahana -U kunal
    
  • Setup Cron :
    crontab -e
    

Note : You can refer to examples of crontab expressions here : http://code.google.com/p/ncrontab/wiki/CrontabExamples

  • start Window based applications (x11):
    • If the GUI window of the application is of no intrest to you
      xvfb-run -a *test commands here*
      
      For example :
      xvfb-run -a python web2py.py -S eden -M -R applications/eden/modules/tests/suite.py -A -V 2
      
      Note: Xvfb basically makes a virtual display which isn't displayed anywhere. Xserver itself actually requires a real display
    • If you want to see the GUI interface of the application
      • If your machine you use to ssh into the server, has X Server installed, then you can access the GUI window by using the -X flag when loggin into the server
        ssh -X youraccount@82.71.213.53
        
        And now, if you simply execute any application which has a Xserver attached to it, it will be displayed on your screen.

Attachments (4)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.