Changes between Version 11 and Version 12 of SysAdmin/Jenkins


Ignore:
Timestamp:
06/14/12 10:27:47 (9 years ago)
Author:
Fran Boon
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • SysAdmin/Jenkins

    v11 v12  
    2525 * Clean the database
    2626
    27 (NB We don't use the Bzr plugin for Jenkins)
    28 
    2927sudo -H -u jenkins /home/update_sqlite.sh
    3028{{{
    3129cd /home/web2py/applications/sqlite
    32 bzr pull
     30git pull
     31rm -rf /home/web2py/applications/sqlite/compiled
    3332rm -rf /home/web2py/applications/sqlite/databases/*
    3433rm -rf /home/web2py/applications/sqlite/errors/*
    3534rm -rf /home/web2py/applications/sqlite/sessions/*
    36 cp -f /home/web2py/applications/sqlite/deployment-templates/models/000_config.py /home/web2py/applications/sqlite/models
     35rm -rf /home/web2py/applications/sqlite/tests/selenium/results/*
     36cp -f /home/web2py/applications/sqlite/private/templates/default/000_config.py /home/web2py/applications/sqlite/models
    3737sed -i 's|EDITING_CONFIG_FILE = False|EDITING_CONFIG_FILE = True|' /home/web2py/applications/sqlite/models/000_config.py
     38sed -i 's|deployment_settings.base.prepopulate = 1|deployment_settings.base.prepopulate = 27|' /home/web2py/applications/sqlite/models/000_config.py
    3839sed -i 's|127.0.0.1:8000|sqlite.eden.sahanafoundation.org|' /home/web2py/applications/sqlite/models/000_config.py
    3940sed -i 's|#deployment_settings.ui.navigate_away_confirm = False|deployment_settings.ui.navigate_away_confirm = False|' /home/web2py/applications/sqlite/models/000_config.py
     
    4142python web2py.py -S sqlite -M -R applications/sqlite/static/scripts/tools/noop.py
    4243sed -i 's|deployment_settings.base.migrate = True|deployment_settings.base.migrate = False|' /home/web2py/applications/sqlite/models/000_config.py
    43 sed -i 's|deployment_settings.base.prepopulate = True|deployment_settings.base.prepopulate = False|' /home/web2py/applications/sqlite/models/000_config.py
     44sed -i 's|deployment_settings.base.prepopulate = 27|deployment_settings.base.prepopulate = 0|' /home/web2py/applications/sqlite/models/000_config.py
     45python web2py.py -S sqlite -R applications/sqlite/static/scripts/tools/compile.py
    4446
    4547sudo /etc/init.d/apache2 restart
     
    4951{{{
    5052cd /home/web2py/applications/mysql
    51 bzr pull
     53git pull
     54rm -rf /home/web2py/applications/mysql/compiled
    5255rm -rf /home/web2py/applications/mysql/databases/*
    5356rm -rf /home/web2py/applications/mysql/errors/*
    5457rm -rf /home/web2py/applications/mysql/sessions/*
     58rm -rf /home/web2py/applications/mysql/tests/selenium/results/*
    5559sudo /usr/bin/mysqladmin -f drop sahana
    5660sudo /usr/bin/mysqladmin create sahana
    57 cp -f "/home/web2py/applications/mysql/deployment-templates/models/000_config.py" "/home/web2py/applications/mysql/models"
     61cp -f "/home/web2py/applications/mysql/private/template/default/000_config.py" "/home/web2py/applications/mysql/models"
    5862sed -i 's|EDITING_CONFIG_FILE = False|EDITING_CONFIG_FILE = True|' "/home/web2py/applications/mysql/models/000_config.py"
     63sed -i 's|deployment_settings.base.prepopulate = 1|deployment_settings.base.prepopulate = 27|' "/home/web2py/applications/mysql/models/000_config.py"
    5964sed -i 's|127.0.0.1:8000|mysql.eden.sahanafoundation.org|' "/home/web2py/applications/mysql/models/000_config.py"
    6065sed -i 's|database.db_type = "sqlite"|database.db_type = "mysql"|' "/home/web2py/applications/mysql/models/000_config.py"
     
    6671python web2py.py -S mysql -M -R applications/mysql/static/scripts/tools/noop.py
    6772sed -i 's|deployment_settings.base.migrate = True|deployment_settings.base.migrate = False|' "/home/web2py/applications/mysql/models/000_config.py"
    68 sed -i 's|deployment_settings.base.prepopulate = True|deployment_settings.base.prepopulate = False|' "/home/web2py/applications/mysql/models/000_config.py"
     73sed -i 's|deployment_settings.base.prepopulate = 27|deployment_settings.base.prepopulate = 0|' "/home/web2py/applications/mysql/models/000_config.py"
     74python web2py.py -S mysql -R applications/mysql/static/scripts/tools/compile.py
     75
    6976sudo /etc/init.d/apache2 restart
    7077}}}
     
    7380{{{
    7481cd /home/web2py/applications/postgresql
    75 bzr pull
     82git pull
     83rm -rf /home/web2py/applications/postgresql/compiled
    7684rm -rf /home/web2py/applications/postgresql/databases/*
    7785rm -rf /home/web2py/applications/postgresql/errors/*
    7886rm -rf /home/web2py/applications/postgresql/sessions/*
     87rm -rf /home/web2py/applications/postgresql/tests/selenium/results/*
    7988sudo /bin/su -c - postgres "dropdb sahana" && true
    8089sudo /bin/su -c - postgres "createdb -O sahana sahana"
     
    8291sudo /bin/su -c - postgres "psql -q -d sahana -f /usr/share/postgresql/8.4/contrib/postgis-1.5/postgis.sql"
    8392sudo /bin/su -c - postgres "psql -q -d sahana -f /usr/share/postgresql/8.4/contrib/postgis-1.5/spatial_ref_sys.sql"
    84 cp -f "/home/web2py/applications/postgresql/deployment-templates/models/000_config.py" "/home/web2py/applications/postgresql/models"
     93cp -f "/home/web2py/applications/postgresql/private/templates/default/000_config.py" "/home/web2py/applications/postgresql/models"
    8594sed -i 's|EDITING_CONFIG_FILE = False|EDITING_CONFIG_FILE = True|' "/home/web2py/applications/postgresql/models/000_config.py"
     95sed -i 's|deployment_settings.base.prepopulate = 1|deployment_settings.base.prepopulate = 27|' "/home/web2py/applications/postgresql/models/000_config.py"
    8696sed -i 's|127.0.0.1:8000|postgresql.eden.sahanafoundation.org|' "/home/web2py/applications/postgresql/models/000_config.py"
    8797sed -i 's|deployment_settings.gis.spatialdb = False|deployment_settings.gis.spatialdb = True|' "/home/web2py/applications/postgresql/models/000_config.py"
     
    92102#sudo -H -u web2py python web2py.py -S postgresql -M -R applications/postgresql/static/scripts/tools/noop.py
    93103python web2py.py -S postgresql -M -R applications/postgresql/static/scripts/tools/noop.py
    94 sudo /bin/su -c - postgres "psql -q -d sahana -f ~web2py/applications/geometry.sql"
    95 sudo /bin/su -c - postgres "psql -q -d sahana -f ~web2py/applications/autopopulate.sql"
    96104sed -i 's|deployment_settings.base.migrate = True|deployment_settings.base.migrate = False|' "/home/web2py/applications/postgresql/models/000_config.py"
    97 sed -i 's|deployment_settings.base.prepopulate = True|deployment_settings.base.prepopulate = False|' "/home/web2py/applications/postgresql/models/000_config.py"
     105sed -i 's|deployment_settings.base.prepopulate = 27|deployment_settings.base.prepopulate = 0|' "/home/web2py/applications/postgresql/models/000_config.py"
     106python web2py.py -S postgresql -R applications/postgresql/static/scripts/tools/compile.py
     107
    98108sudo /etc/init.d/apache2 restart
    99 }}}
    100 
    101 == SQL scripts ==
    102 These SQL scripts are used by update_postgresql.sh to setup PostGIS
    103 
    104 /home/web2py/applications/geometry.sql
    105 {{{
    106 UPDATE public.gis_location SET wkt = 'POINT (' || lon || ' ' || lat || ')' WHERE gis_feature_type = 1;
    107 SELECT AddGeometryColumn( 'public', 'gis_location', 'the_geom', 4326, 'GEOMETRY', 2 );
    108 UPDATE public.gis_location SET the_geom = ST_SetSRID(ST_GeomFromText(wkt), 4326);
    109 }}}
    110 
    111 /home/web2py/applications/autopopulate.sql
    112 {{{
    113 CREATE OR REPLACE FUNCTION s3_update_geometry()
    114   RETURNS "trigger" AS
    115 $BODY$
    116   DECLARE
    117   BEGIN
    118 
    119     if (NEW.wkt != '') then
    120         NEW.the_geom = SetSRID(GeomFromText(NEW.wkt), 4326);
    121         end if;
    122 
    123     RETURN NEW;
    124   END;
    125 $BODY$
    126   LANGUAGE 'plpgsql' VOLATILE;
    127 ALTER FUNCTION s3_update_geometry() OWNER TO sahana;
    128 CREATE TRIGGER s3_locations_update
    129   BEFORE INSERT
    130   ON gis_location
    131   FOR EACH ROW
    132   EXECUTE PROCEDURE s3_update_geometry();
    133109}}}
    134110