[Mapbender-commits] r9996 - trunk/mapbender/resources/db

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Thu Nov 8 08:52:15 PST 2018


Author: armin11
Date: 2018-11-08 08:52:15 -0800 (Thu, 08 Nov 2018)
New Revision: 9996

Modified:
   trunk/mapbender/resources/db/install_geoportal_mb28.sh
Log:
Some fixes for debian install script

Modified: trunk/mapbender/resources/db/install_geoportal_mb28.sh
===================================================================
--- trunk/mapbender/resources/db/install_geoportal_mb28.sh	2018-11-07 16:59:12 UTC (rev 9995)
+++ trunk/mapbender/resources/db/install_geoportal_mb28.sh	2018-11-08 16:52:15 UTC (rev 9996)
@@ -47,11 +47,19 @@
 ############################################################
 bbox_wgs84="6.05,48.9,8.6,50.96"
 ############################################################
+############################################################
+bbox_wgs84_space="6.05 48.9 8.6 50.96"
+############################################################
 # default services
 ############################################################
-wms_1_url="'http://geo4.service24.rlp.de/wms/dop_basis.fcgi?REQUEST=GetCapabilities&VERSION=1.1.1&SERVICE=WMS'"
-wms_2_url="'http://www.gdi-rp-dienste2.rlp.de/cgi-bin/mapserv?map=/data/umn/geoportal/relief_rp/rlp_relief.map&REQUEST=GetCapabilities&VERSION=1.1.1&SERVICE=WMS'"
-wms_3_url="'http://geo5.service24.rlp.de/wms/karte_rp.fcgi?REQUEST=GetCapabilities&VERSION=1.1.1&SERVICE=WMS'"
+#wms_1_url="'http://geo4.service24.rlp.de/wms/dop_basis.fcgi?REQUEST=GetCapabilities&VERSION=1.1.1&SERVICE=WMS'"
+#wms_2_url="'http://www.gdi-rp-dienste2.rlp.de/cgi-bin/mapserv?map=/data/umn/geoportal/relief_rp/rlp_relief.map&REQUEST=GetCapabilities&VERSION=1.1.1&SERVICE=WMS'"
+#wms_3_url="'http://geo5.service24.rlp.de/wms/karte_rp.fcgi?REQUEST=GetCapabilities&VERSION=1.1.1&SERVICE=WMS'"
+
+wms_1_url="'http://www.geoportal.rlp.de/mapbender/php/wms.php?layer_id=55468&REQUEST=GetCapabilities&VERSION=1.1.1&SERVICE=WMS'"
+wms_2_url="'http://map.krz.de/cgi-bin/mapserv7?map=/opt/gdi/wms/overview_600.map&REQUEST=GetCapabilities&VERSION=1.1.1&SERVICE=wms'"
+wms_3_url="'http://map.krz.de/cgi-bin/mapserv7?map=/opt/gdi/wms/overview_owl.map&VERSION=1.1.1&REQUEST=GetCapabilities&SERVICE=WMS'"
+
 # demo wms
 wms_4_url="'https://gis.mffjiv.rlp.de/cgi-bin/mapserv?map=/data/mapserver/mapfiles/institutions_0601.map&REQUEST=GetCapabilities&VERSION=1.1.1&SERVICE=WMS'"
 ############################################################
@@ -66,10 +74,11 @@
 ##################### demo service - 
 wms_6_register_cmd="/usr/bin/php -f ${installation_folder}mapbender/tools/registerOwsCli.php userId=3 guiId='service_container1_free' serviceType='wms' serviceAccessUrl=$wms_4_url"
 ############################################################
-typo3_database_name="typo3"
+typo3_database_name="typo3database"
 # typo3_database_port="xxxx" # actually the default port
-typo3_database_user="typo3"
-typo3_database_password="typo3password"
+# typo3_database_user - maximum 16 digits!!!
+typo3_database_user="typo3dbuser" 
+typo3_database_password="typo3databasepassword"
 ############################################################
 # 
 ############################################################
@@ -192,6 +201,7 @@
     svn co https://svn.osgeo.org/mapbender/trunk/mapbender
 fi
 if [ $checkout_mapbender_conf = 'true' ]; then
+    echo "checkout mapbender conf folder for geoportal ..."
     svn co http://www.gdi-rp-dienste.rlp.de/svn/de-rp/data/conf
 fi
 if  [ $checkout_custom_svn = 'true' ]; then
@@ -241,9 +251,10 @@
     echo 'done.'
 fi
 ############################################################
-# compress and create typo3
+# compress and create geoportal default conf from /data/conf
 ############################################################
 if [ $install_mapbender_conf = 'true' ]; then
+    echo "install default geoportal configuration files ..."
     cd ${installation_folder}svn/
     tar -czf conf.tar.gz conf/
     mv conf.tar.gz /tmp/
@@ -283,7 +294,7 @@
 # cleanup .svn relicts
 ############################################################
 echo -n 'delete .svn files ... '
-if [ $install_mapbender_source = 'true' ]; then
+if [ $install_mapbender_source = 'true' ]; then 
     cd ${installation_folder}mapbender/
     rm -rf $(find . -type d -name .svn)
 fi
@@ -314,7 +325,7 @@
 # mapbender db
 ############################################################
 if [ $install_mapbender_database = 'true' ]; then
-
+echo -n 'install mapbender database ... '
 # su postgres
 # createuser  -S -D -R -P mapbenderdbuser #mapbenderdbpassword
 # CREATE DATABASE yourdbname;
@@ -589,6 +600,14 @@
 su - postgres -c "psql -q -p $mapbender_database_port -d $mapbender_database_name -c 'GRANT ALL PRIVILEGES ON DATABASE $mapbender_database_name TO $mapbender_database_user'"
 su - postgres -c "psql -q -p $mapbender_database_port -d $mapbender_database_name -c 'GRANT SELECT, INSERT, UPDATE, DELETE ON DATABASE $mapbender_database_name TO $mapbender_database_user'"
 su - postgres -c "psql -q -p $mapbender_database_port -d $mapbender_database_name -c 'GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA mapbender TO $mapbender_database_user'"
+
+su - postgres -c "psql -q -p $mapbender_database_port -d $mapbender_database_name -c 'GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA mapbender TO $mapbender_database_user'"
+su - postgres -c "psql -q -p $mapbender_database_port -d $mapbender_database_name -c 'GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO $mapbender_database_user'"
+su - postgres -c "psql -q -p $mapbender_database_port -d $mapbender_database_name -c 'GRANT CREATE ON DATABASE mapbender TO $mapbender_database_user'"
+su - postgres -c "psql -q -p $mapbender_database_port -d $mapbender_database_name -c 'GRANT CREATE ON SCHEMA mapbender TO $mapbender_database_user'"
+
+
+#su - postgres -c "psql -q -p 5432 -d mapbender -c 'GRANT CREATE ON DATABASE mapbender TO mapbenderdbuser'"
 #####################
 # add precise coordinate transformation to proj and postgis extension
 #####################
@@ -611,6 +630,7 @@
 fi # end of installation of the mapbender database
 
 if [ $configure_mapbender = 'true' ]; then
+    echo 'configure mapbender ... '
     echo 'language compiling ... '
     cd ${installation_folder}mapbender/tools
     sh ./i18n_update_mo.sh
@@ -620,7 +640,7 @@
     # create folder to store generated metadata xml documents 
     mkdir ${installation_folder}mapbender/metadata
     #####################
-    echo -n 'change more permissones ... '
+    echo 'change more permissones ... '
     # alter owner of folders where webserver should be able to alter data
     chown -R www-data:www-data ${installation_folder}mapbender/http/tmp/
     chown -R www-data:www-data ${installation_folder}mapbender/log/
@@ -678,6 +698,8 @@
 EOF
     #####################
     # register initial services for default and extended search GUIs
+    #####################
+echo -n 'register initial default services ... '
     ##################### Geoportal-RLP
 eval $wms_1_register_cmd
 eval $wms_2_register_cmd
@@ -690,11 +712,11 @@
     #####################
 fi
 
-if [ $checkout_custom_svn = 'true' ] || [$checkout_mapbender_conf = 'true']; then
+if [ $checkout_mapbender_conf = 'true' ]; then
     # override information in custom conf files 
     # mapbender.conf
     #####################
-    echo -n 'adopt mapbender.conf ... '
+    echo -n 'adopt mapbender.conf from default geoportal conf files ... '
     #####################
     # alter connection type to use curl
     #####################
@@ -731,6 +753,7 @@
 
     #sed -i "s/%%INSTALLATIONFOLDER%%/$installation_folder/g" ${installation_folder}conf/mapbender.conf
     # copy conf files to right places
+    echo "copy mapbender.conf from ${installation_folder}/mapbender.conf to ${installation_folder}mapbender/conf/ ..."
     cp ${installation_folder}conf/mapbender.conf ${installation_folder}mapbender/conf/
     # alter other conf files
     sed -i "s#%%INSTALLATIONFOLDER%%#${installation_folder}#g" ${installation_folder}conf/geoportal.conf
@@ -741,17 +764,78 @@
     sed -i "s/dbname=geoportal /dbname=$mapbender_database_name /g" ${installation_folder}conf/extents_geoportal_rlp.map
     sed -i "s/user=postgres /user=$mapbender_database_user password=$mapbender_database_password /g" ${installation_folder}conf/extents_geoportal_rlp.map
     sed -i "s/port=5436 /port=$mapbender_database_port /g" ${installation_folder}conf/extents_geoportal_rlp.map
-    #sed -i "s/%%BBOXWGS84%%/$bbox_wgs84/g" ${installation_folder}conf/extents_geoportal_rlp.map
+    sed -i "s/%%http_proxy_host%%/$http_proxy_host/g" ${installation_folder}conf/extents_geoportal_rlp.map
+    sed -i "s/%%http_proxy_port%%/$http_proxy_port/g" ${installation_folder}conf/extents_geoportal_rlp.map
+    sed -i "s/%%BBOXWGS84SPACE%%/$bbox_wgs84_space/g" ${installation_folder}conf/extents_geoportal_rlp.map
     cp ${installation_folder}conf/extents_geoportal_rlp.map ${installation_folder}mapbender/tools/wms_extent/extents.map
     # conf file for invocation of metadata wms
     sed -i "s#%%INSTALLATIONFOLDER%%#${installation_folder}#g" ${installation_folder}conf/extent_service_geoportal_rlp.conf    
     sed -i "s/%%BBOXWGS84%%/$bbox_wgs84/g" ${installation_folder}conf/extent_service_geoportal_rlp.conf
     cp ${installation_folder}conf/extent_service_geoportal_rlp.conf ${installation_folder}mapbender/tools/wms_extent/extent_service.conf
+fi
+if [ $checkout_custom_svn = 'true' ]; then
+    # override information in custom conf files 
+    # mapbender.conf
+    #####################
+    echo -n 'adopt mapbender.conf from custom geoportal conf files ...'
+    #####################
+    # alter connection type to use curl
+    #####################
+    sed -i "s/define(\"CONNECTION\", \"http\");/#define(\"CONNECTION\", \"http\");/g" ${installation_folder}conf/mapbender.conf
+    sed -i "s/#define(\"CONNECTION\", \"curl\");/define(\"CONNECTION\", \"curl\");/g" ${installation_folder}conf/mapbender.conf
+    #####################
+    # define proxy settings
+    #####################
+    # sed -i "s///g" ${installation_folder}mapbender/conf/mapbender.conf
+    if [ $use_proxy = 'true' ]; then
+	    sed -i "s/define(\"CONNECTION_PROXY\", \"\");/define(\"CONNECTION_PROXY\", \"$http_proxy_host\");/g" ${installation_folder}conf/mapbender.conf
+	    sed -i "s/define(\"CONNECTION_PORT\", \"\");/define(\"CONNECTION_PORT\", \"$http_proxy_port\");/g" ${installation_folder}conf/mapbender.conf
+	    sed -i "s/define(\"NOT_PROXY_HOSTS\", \"<ip>,<ip>,<ip>\");/define(\"NOT_PROXY_HOSTS\", \"localhost,127.0.0.1\");/g" ${installation_folder}conf/mapbender.conf
+    fi
+    #####################
+    # set database connection
+    #####################
+    sed -i "s/%%DBSERVER%%/localhost/g" ${installation_folder}conf/mapbender.conf
+    sed -i "s/%%DBPORT%%/$mapbender_database_port/g" ${installation_folder}conf/mapbender.conf
+    sed -i "s/%%DBNAME%%/$mapbender_database_name/g" ${installation_folder}conf/mapbender.conf
+    sed -i "s/%%DBOWNER%%/$mapbender_database_user/g" ${installation_folder}conf/mapbender.conf
+    sed -i "s/%%DBPASSWORD%%/$mapbender_database_password/g" ${installation_folder}conf/mapbender.conf
+    sed -i "s#%%INSTALLATIONFOLDER%%#${installation_folder}#g" ${installation_folder}conf/mapbender.conf
+    sed -i "s/%%DOMAINNAME%%/$domain_name/g" ${installation_folder}conf/mapbender.conf
+    sed -i "s/%%WEBADMINMAIL%%/$webadmin_email/g" ${installation_folder}conf/mapbender.conf
+    #####################
+    # special users & groups%%INSTALLATIONFOLDER%%
+    #####################
+    sed -i "s/%%PUBLICUSERID%%/$mapbender_guest_user_id/g" ${installation_folder}conf/mapbender.conf
+    sed -i "s/%%PORTALADMINUSERID%%/1/g" ${installation_folder}conf/mapbender.conf
+    sed -i "s/%%ANONYMOUSUSER%%/$mapbender_guest_user_id/g" ${installation_folder}conf/mapbender.conf
+    sed -i "s/%%ANONYMOUSGROUP%%/$mapbender_guest_group_id/g" ${installation_folder}conf/mapbender.conf
+    sed -i "s/%%REGISTRATINGGROUP%%/$mapbender_subadmin_group_id/g" ${installation_folder}conf/mapbender.conf
+
+    #sed -i "s/%%INSTALLATIONFOLDER%%/$installation_folder/g" ${installation_folder}conf/mapbender.conf
+    # copy conf files to right places
+    cp ${installation_folder}conf/mapbender.conf ${installation_folder}mapbender/conf/
+    # alter other conf files
+    sed -i "s#%%INSTALLATIONFOLDER%%#${installation_folder}#g" ${installation_folder}conf/geoportal.conf
+    # copy conf file to right places
+    cp ${installation_folder}conf/geoportal.conf ${installation_folder}mapbender/conf/
+    # mapfile for metadata wms
+    sed -i "s#%%INSTALLATIONFOLDER%%#${installation_folder}#g" ${installation_folder}conf/extents_geoportal_rlp.map
+    sed -i "s/dbname=geoportal /dbname=$mapbender_database_name /g" ${installation_folder}conf/extents_geoportal_rlp.map
+    sed -i "s/user=postgres /user=$mapbender_database_user password=$mapbender_database_password /g" ${installation_folder}conf/extents_geoportal_rlp.map
+    sed -i "s/port=5436 /port=$mapbender_database_port /g" ${installation_folder}conf/extents_geoportal_rlp.map
+    sed -i "s/%%BBOXWGS84SPACE%%/$bbox_wgs84_space/g" ${installation_folder}conf/extents_geoportal_rlp.map
+    cp ${installation_folder}conf/extents_geoportal_rlp.map ${installation_folder}mapbender/tools/wms_extent/extents.map
+    # conf file for invocation of metadata wms
+    sed -i "s#%%INSTALLATIONFOLDER%%#${installation_folder}#g" ${installation_folder}conf/extent_service_geoportal_rlp.conf    
+    sed -i "s/%%BBOXWGS84%%/$bbox_wgs84/g" ${installation_folder}conf/extent_service_geoportal_rlp.conf
+    cp ${installation_folder}conf/extent_service_geoportal_rlp.conf ${installation_folder}mapbender/tools/wms_extent/extent_service.conf
     #typo3 configuration files
 fi
 ############################################################
 # configure and install typo3
 ############################################################
+echo -n 'configure and install typo3 ...'
 #grep debian mysql maintainer password from /etc/
 if [ $install_typo3_database = 'true' ]; then
     while IFS='=' read -r col1 col2
@@ -764,12 +848,12 @@
 
 # echo $mysql_debian_password
 cat << EOF > ${installation_folder}initialize_typo3_database.sql
-CREATE DATABASE typo3;
+CREATE DATABASE ${typo3_database_name};
 -- DROP USER '${typo3_database_user}'@'localhost';
 CREATE USER '${typo3_database_user}'@'localhost' IDENTIFIED BY '${typo3_database_password}';
-GRANT ALL PRIVILEGES ON typo3.* TO '${typo3_database_user}'@'localhost';
+GRANT ALL PRIVILEGES ON ${typo3_database_name}.* TO '${typo3_database_user}'@'localhost';
 GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,FILE,INDEX,ALTER,CREATE TEMPORARY TABLES,CREATE VIEW,EVENT,TRIGGER,SHOW VIEW,CREATE ROUTINE,ALTER ROUTINE,EXECUTE ON * . * TO '${typo3_database_user}'@'%' IDENTIFIED BY '${typo3_database_password}' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ;
--- GRANT ALL PRIVILEGES ON `typo3` . * TO '${typo3_database_user}'@'%';
+-- GRANT ALL PRIVILEGES ON `${typo3_database_name}` . * TO '${typo3_database_user}'@'%';
 FLUSH PRIVILEGES;
 EOF
 
@@ -782,13 +866,13 @@
 ############################################################
 # prepare typo3 database
 ############################################################
-mysql --user=debian-sys-maint --password=$mysql_debian_password -e "DROP DATABASE typo3;"
+mysql --user=debian-sys-maint --password=$mysql_debian_password -e "DROP DATABASE ${typo3_database_name};"
 # mysql --user=debian-sys-maint --password=$mysql_debian_password -e "CREATE DATABASE typo3;"
 mysql --user=debian-sys-maint --password=$mysql_debian_password < ${installation_folder}initialize_typo3_database.sql
 ############################################################
 # import typo3 database
 ############################################################
-mysql --user=debian-sys-maint --password=$mysql_debian_password typo3 < typo3_db.sql
+mysql --user=debian-sys-maint --password=$mysql_debian_password ${typo3_database_name} < typo3_db.sql
 
 fi
 
@@ -796,6 +880,7 @@
 #/data/portal/fileadmin/function/util.php
 #/data/portal/typo3conf/localconf.php
 if [ $configure_typo3 = 'true' ]; then
+        echo "configure typo3 conf files and put them in right folders ..."
 	sed -i "s/%%TYPO3DB%%/${typo3_database_name}/g" ${installation_folder}conf/util.php
 	sed -i "s/%%TYPO3DBUSER%%/${typo3_database_user}/g" ${installation_folder}conf/util.php
 	sed -i "s/%%TYPO3DBPASSWORD%%/${typo3_database_password}/g" ${installation_folder}conf/util.php
@@ -802,10 +887,11 @@
 
 	cp ${installation_folder}conf/util.php ${installation_folder}portal/fileadmin/function/
 
-	sed -i "s/%%TYPO3DBUSER%%/${typo3_database_user}/g" ${installation_folder}conf/localconf.conf
-	sed -i "s/%%TYPO3DBPASSWORD%%/${typo3_database_password}/g" ${installation_folder}conf/localconf.conf
+	sed -i "s/%%TYPO3DBUSER%%/${typo3_database_user}/g" ${installation_folder}conf/localconf.php
+	sed -i "s/%%TYPO3DBPASSWORD%%/${typo3_database_password}/g" ${installation_folder}conf/localconf.php
+        sed -i "s/%%TYPO3DB%%/${typo3_database_name}/g" ${installation_folder}conf/localconf.php
 
-	cp ${installation_folder}conf/localconf.conf ${installation_folder}portal/typo3conf/
+	cp ${installation_folder}conf/localconf.php ${installation_folder}portal/typo3conf/
 
 fi
 if [ $configure_apache = 'true' ]; then
@@ -1021,10 +1107,16 @@
 ############################################################
 # add privileges on search tables to mapbender database user from installation
 ############################################################
-echo "GRANT ALL ON TABLE wms_search_table TO mapbenderdbuser;" >> ${installation_folder}mapbender/resources/db/materialize_wms_view.sql
-echo "GRANT ALL ON TABLE wfs_search_table TO mapbenderdbuser;" >> ${installation_folder}mapbender/resources/db/materialize_wfs_view.sql
-echo "GRANT ALL ON TABLE dataset_search_table TO mapbenderdbuser;" >> ${installation_folder}mapbender/resources/db/materialize_dataset_view.sql
+echo "GRANT ALL ON TABLE wms_search_table TO $mapbender_database_user;" >> ${installation_folder}mapbender/resources/db/materialize_wms_view.sql
+echo "ALTER TABLE wms_search_table OWNER TO $mapbender_database_user;" >> ${installation_folder}mapbender/resources/db/materialize_wms_view.sql
+echo "ALTER TABLE wms_list OWNER TO $mapbender_database_user;" >> ${installation_folder}mapbender/resources/db/materialize_wms_view.sql
 
+echo "GRANT ALL ON TABLE wfs_search_table TO $mapbender_database_user;" >> ${installation_folder}mapbender/resources/db/materialize_wfs_view.sql
+echo "ALTER TABLE wfs_search_table OWNER TO $mapbender_database_user;" >> ${installation_folder}mapbender/resources/db/materialize_wfs_view.sql
+
+echo "GRANT ALL ON TABLE dataset_search_table TO $mapbender_database_user;" >> ${installation_folder}mapbender/resources/db/materialize_dataset_view.sql
+echo "ALTER TABLE dataset_search_table OWNER TO $mapbender_database_user;" >> ${installation_folder}mapbender/resources/db/materialize_dataset_view.sql
+############################################################
 if [ $configure_cronjobs = 'true' ]; then
 
 mkdir ${installation_folder}cronjobs/
@@ -1166,9 +1258,15 @@
 rm *.sql
 rm -R ${installation_folder}cronjobs
 rm ${installation_folder}cleanup_geoportal_installation.sh
-
+############################################################
+# drop postgresql data
+############################################################
 su - postgres -c "dropdb -p $mapbender_database_port $mapbender_database_name"
-
+############################################################
+# drop mysql data
+############################################################
+mysql --user=debian-sys-maint --password=$mysql_debian_password -e "DROP DATABASE ${typo3_database_name};"
+mysql --user=debian-sys-maint --password=$mysql_debian_password -e "DROP USER '${typo3_database_user}'@'localhost';"
 #restore old pg_hba.conf of main - default cluster
 cp /etc/postgresql/9.4/main/pg_hba.conf_backup /etc/postgresql/9.4/main/pg_hba.conf
 service postgresql restart



More information about the Mapbender_commits mailing list