Changes between Version 36 and Version 37 of InstallationGuidelines/Linux/Server/CherokeePostgreSQL


Ignore:
Timestamp:
03/14/12 16:22:05 (10 years ago)
Author:
Fran Boon
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • InstallationGuidelines/Linux/Server/CherokeePostgreSQL

    v36 v37  
    629629sed -i 's|deployment_settings.database.db_type = "sqlite"|deployment_settings.database.db_type = "postgres"|' ~web2py/applications/eden/models/000_config.py
    630630sed -i "s|deployment_settings.database.password = \"password\"|deployment_settings.database.password = \"$password\"|" ~web2py/applications/eden/models/000_config.py
    631 sed -i 's|deployment_settings.gis.spatialdb = False|deployment_settings.gis.spatialdb = True|' ~web2py/applications/eden/models/000_config.py
     631# Spatial DAL not yet in Trunk Web2Py
     632#sed -i 's|deployment_settings.gis.spatialdb = False|deployment_settings.gis.spatialdb = True|' ~web2py/applications/eden/models/000_config.py
    632633
    633634# Create the Tables & Populate with base data
     
    637638sudo -H -u web2py python web2py.py -S eden -M -R applications/eden/static/scripts/tools/noop.py
    638639
    639 # PostGIS the Sahana DB
    640 cat << EOF > "/tmp/geometry.sql"
    641 UPDATE public.gis_location SET wkt = 'POINT (' || lon || ' ' || lat || ')' WHERE gis_feature_type = 1;
    642 SELECT AddGeometryColumn( 'public', 'gis_location', 'the_geom', 4326, 'GEOMETRY', 2 );
    643 GRANT ALL ON geometry_columns TO sahana;
    644 UPDATE public.gis_location SET the_geom = ST_SetSRID(ST_GeomFromText(wkt), 4326);
    645 EOF
    646 su -c - postgres "psql -q -d sahana -f /tmp/geometry.sql"
    647 cat << EOF > "/tmp/autopopulate.sql"
    648 CREATE OR REPLACE FUNCTION s3_update_geometry()
    649   RETURNS "trigger" AS \$$
    650   DECLARE
    651   BEGIN
    652     if (NEW.wkt != '') then
    653         NEW.the_geom = SetSRID(GeomFromText(NEW.wkt), 4326);
    654         end if;
    655 
    656     RETURN NEW;
    657   END;
    658 \$$  LANGUAGE 'plpgsql' VOLATILE;
    659 ALTER FUNCTION s3_update_geometry() OWNER TO sahana;
    660 CREATE TRIGGER s3_locations_update
    661   BEFORE INSERT
    662   ON gis_location
    663   FOR EACH ROW
    664   EXECUTE PROCEDURE s3_update_geometry();
    665 
    666 EOF
    667 su -c - postgres "psql -q -d sahana -f /tmp/autopopulate.sql"
    668 
    669640# Configure for Production
    670641sed -i 's|deployment_settings.base.prepopulate = 1|deployment_settings.base.prepopulate = 0|' ~web2py/applications/eden/models/000_config.py