Version 7 (modified by 14 years ago) ( diff ) | ,
---|
Table of Contents
Jenkins: CI
We use Jenkins to do Continous Integration by running our Selenium Functional tests:
There is a Windows 7 slave running:
- Firefox
- IE8
- Chrome
- Opera
The CI server also hosts the Application. There are 3 separate server environments for Eden, each with it's own Apache virtual host:
- http://sqlite.eden.sahanafoundation.org /home/web2py/applications/sqlite
- http://mysql.eden.sahanafoundation.org /home/web2py/applications/mysql
- http://postgesql.eden.sahanafoundation.org /home/web2py/applications/postgresql
Selenium Grid 1.0.8 is installed in /home/selenium (not using the Selenium plugin for Jenkins)
- Configuration: /home/selenium/grid_configuration.yml
Update scripts
Before each test run, we use scripts to prepare the environments:
- Update the code
- Clean the database
(NB We don't use the Bzr plugin for Jenkins)
sudo -H -u jenkins /home/update_sqlite.sh
cd /home/web2py/applications/sqlite bzr pull rm -rf /home/web2py/applications/sqlite/databases/* rm -rf /home/web2py/applications/sqlite/errors/* rm -rf /home/web2py/applications/sqlite/sessions/* cp -f /home/web2py/applications/sqlite/deployment-templates/models/000_config.py /home/web2py/applications/sqlite/models sed -i 's|EDITING_CONFIG_FILE = False|EDITING_CONFIG_FILE = True|' /home/web2py/applications/sqlite/models/000_config.py sed -i 's|127.0.0.1:8000|sqlite.eden.sahanafoundation.org|' /home/web2py/applications/sqlite/models/000_config.py sed -i 's|#deployment_settings.ui.navigate_away_confirm = False|deployment_settings.ui.navigate_away_confirm = False|' /home/web2py/applications/sqlite/models/000_config.py cd ~web2py python web2py.py -S sqlite -M -R applications/sqlite/static/scripts/tools/noop.py sed -i 's|deployment_settings.base.migrate = True|deployment_settings.base.migrate = False|' /home/web2py/applications/sqlite/models/000_config.py sed -i 's|deployment_settings.base.prepopulate = True|deployment_settings.base.prepopulate = False|' /home/web2py/applications/sqlite/models/000_config.py sudo /etc/init.d/apache2 restart
sudo -H -u jenkins /home/update_mysql.sh
cd /home/web2py/applications/mysql bzr pull rm -rf /home/web2py/applications/mysql/databases/* rm -rf /home/web2py/applications/mysql/errors/* rm -rf /home/web2py/applications/mysql/sessions/* sudo /usr/bin/mysqladmin -f drop sahana sudo /usr/bin/mysqladmin create sahana cp -f "/home/web2py/applications/mysql/deployment-templates/models/000_config.py" "/home/web2py/applications/mysql/models" sed -i 's|EDITING_CONFIG_FILE = False|EDITING_CONFIG_FILE = True|' "/home/web2py/applications/mysql/models/000_config.py" sed -i 's|127.0.0.1:8000|mysql.eden.sahanafoundation.org|' "/home/web2py/applications/mysql/models/000_config.py" sed -i 's|database.db_type = "sqlite"|database.db_type = "mysql"|' "/home/web2py/applications/mysql/models/000_config.py" sed -i 's|database.username = "sahana"|database.username = "root"|' "/home/web2py/applications/mysql/models/000_config.py" sed -i 's|database.password = "password"|database.password = "eden"|' "/home/web2py/applications/mysql/models/000_config.py" sed -i 's|#deployment_settings.ui.navigate_away_confirm = False|deployment_settings.ui.navigate_away_confirm = False|' "/home/web2py/applications/mysql/models/000_config.py" cd ~web2py #sudo -H -u web2py python web2py.py -S mysql -M -R applications/mysql/static/scripts/tools/noop.py python web2py.py -S mysql -M -R applications/mysql/static/scripts/tools/noop.py sed -i 's|deployment_settings.base.migrate = True|deployment_settings.base.migrate = False|' "/home/web2py/applications/mysql/models/000_config.py" sed -i 's|deployment_settings.base.prepopulate = True|deployment_settings.base.prepopulate = False|' "/home/web2py/applications/mysql/models/000_config.py" sudo /etc/init.d/apache2 restart
sudo -H -u jenkins /home/update_postgresql.sh
cd /home/web2py/applications/postgresql bzr pull rm -rf /home/web2py/applications/postgresql/databases/* rm -rf /home/web2py/applications/postgresql/errors/* rm -rf /home/web2py/applications/postgresql/sessions/* sudo /bin/su -c - postgres "dropdb sahana" && true sudo /bin/su -c - postgres "createdb -O sahana sahana" sudo /bin/su -c - postgres "createlang plpgsql -d sahana" sudo /bin/su -c - postgres "psql -q -d sahana -f /usr/share/postgresql/8.4/contrib/postgis-1.5/postgis.sql" sudo /bin/su -c - postgres "psql -q -d sahana -f /usr/share/postgresql/8.4/contrib/postgis-1.5/spatial_ref_sys.sql" cp -f "/home/web2py/applications/postgresql/deployment-templates/models/000_config.py" "/home/web2py/applications/postgresql/models" sed -i 's|EDITING_CONFIG_FILE = False|EDITING_CONFIG_FILE = True|' "/home/web2py/applications/postgresql/models/000_config.py" sed -i 's|127.0.0.1:8000|postgresql.eden.sahanafoundation.org|' "/home/web2py/applications/postgresql/models/000_config.py" sed -i 's|deployment_settings.gis.spatialdb = False|deployment_settings.gis.spatialdb = True|' "/home/web2py/applications/postgresql/models/000_config.py" sed -i 's|database.db_type = "sqlite"|database.db_type = "postgres"|' "/home/web2py/applications/postgresql/models/000_config.py" sed -i 's|database.password = "password"|database.password = "eden"|' "/home/web2py/applications/postgresql/models/000_config.py" sed -i 's|#deployment_settings.ui.navigate_away_confirm = False|deployment_settings.ui.navigate_away_confirm = False|' "/home/web2py/applications/postgresql/models/000_config.py" cd ~web2py #sudo -H -u web2py python web2py.py -S postgresql -M -R applications/postgresql/static/scripts/tools/noop.py python web2py.py -S postgresql -M -R applications/postgresql/static/scripts/tools/noop.py sudo /bin/su -c - postgres "psql -q -d sahana -f ~web2py/applications/geometry.sql" sudo /bin/su -c - postgres "psql -q -d sahana -f ~web2py/applications/autopopulate.sql" sed -i 's|deployment_settings.base.migrate = True|deployment_settings.base.migrate = False|' "/home/web2py/applications/postgresql/models/000_config.py" sed -i 's|deployment_settings.base.prepopulate = True|deployment_settings.base.prepopulate = False|' "/home/web2py/applications/postgresql/models/000_config.py" sudo /etc/init.d/apache2 restart
SQL scripts
These SQL scripts are used by update_postgresql.sh to setup PostGIS
/home/web2py/applications/geometry.sql
UPDATE public.gis_location SET wkt = 'POINT (' || lon || ' ' || lat || ')' WHERE gis_feature_type = 1; SELECT AddGeometryColumn( 'public', 'gis_location', 'the_geom', 4326, 'GEOMETRY', 2 ); UPDATE public.gis_location SET the_geom = ST_SetSRID(ST_GeomFromText(wkt), 4326);
/home/web2py/applications/autopopulate.sql
CREATE OR REPLACE FUNCTION s3_update_geometry() RETURNS "trigger" AS $BODY$ DECLARE BEGIN if (NEW.wkt != '') then NEW.the_geom = SetSRID(GeomFromText(NEW.wkt), 4326); end if; RETURN NEW; END; $BODY$ LANGUAGE 'plpgsql' VOLATILE; ALTER FUNCTION s3_update_geometry() OWNER TO sahana; CREATE TRIGGER s3_locations_update BEFORE INSERT ON gis_location FOR EACH ROW EXECUTE PROCEDURE s3_update_geometry();