== EDEN CONTINUOUS INTEGRATION == CI Server results: * http://82.71.213.53/eden/admin/result Setup Notes & Discussions (to be ported to Wiki): * https://docs.google.com/document/d/1T29cF3kkK4lIAVdiATfE8a-tLm_Tyh3_dIh6FJWY7sU/edit To run the test suite manually: {{{ 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 [SysAdmin/Jenkins Jenkins] which could be configured to run this. - or we could setup an Eden instance to manage this via Scheduler for more control & storing results in a database for graphical reports === COMPLETE DISCUSSIONS AND BACKLOG OF THE CI SERVER === https://docs.google.com/document/d/1T29cF3kkK4lIAVdiATfE8a-tLm_Tyh3_dIh6FJWY7sU/edit === URL TO ACCESS RESULTS === http://82.71.213.53/RESULTS === 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) {{{#!sh 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 : {{{#!sh sudo /sbin/reboot }}} '''Note''' : There will be a downtime of a few minutes after you execute this command * Cherokee Restart {{{#!sh sudo /etc/init.d/cherokee restart }}} * Web2Py SSL Restart {{{#!sh sudo /etc/init.d/uwsgi start }}} === Start Test Suite Manually On the CI Server=== {{{#!sh sudo sh /etc/cron.custom/web2pystarter }}} Open another console then: {{{#!sh 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: {{{#!sh 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 [SysAdmin/Jenkins 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 {{{ #!div style="font-size: 80%" {{{#!sh #!/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 ==== {{{#!sh psql -d sahana -U kunal }}} ==== How to Restart Postgresql Server (You can give it a shot, if psql fails to connect) ==== {{{#!sh 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)''' : {{{#!sh 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):''' {{{#!sh chmod -R 777 /home/web2py }}} * '''start web2py''' {{{#!sh cd ~web2py python web2py.py -a root }}} * '''reboot server''' {{{#!sh sudo /sbin/reboot }}} * '''Restart Cherokee''' {{{#!sh sudo /etc/init.d/cherokee restart }}} * '''Restart Web2Py SSL''' {{{#!sh sudo /etc/init.d/uwsgi start }}} * '''Recreate Sahana DB''' : {{{#!sh 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''' : {{{#!sh 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 {{{#!sh xvfb-run -a *test commands here* }}} For example : {{{#!sh 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 {{{#!sh 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.