[Mapbender-commits] r9986 - trunk/mapbender/resources/db
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Mon Oct 29 08:36:38 PDT 2018
Author: armin11
Date: 2018-10-29 08:36:38 -0700 (Mon, 29 Oct 2018)
New Revision: 9986
Modified:
trunk/mapbender/resources/db/install_geoportal_mb28.sh
Log:
Add backend authentication and some other things
Modified: trunk/mapbender/resources/db/install_geoportal_mb28.sh
===================================================================
--- trunk/mapbender/resources/db/install_geoportal_mb28.sh 2018-10-29 11:02:21 UTC (rev 9985)
+++ trunk/mapbender/resources/db/install_geoportal_mb28.sh 2018-10-29 15:36:38 UTC (rev 9986)
@@ -20,7 +20,7 @@
#
############################################################
use_ssl="false"
-domain_name="www.geoportal.test.de"
+domain_name="localhost:8083"
not_proxy_hosts="localhost,127.0.0.1"
############################################################
#
@@ -31,6 +31,14 @@
mapbender_subadmin_default_user_id="3"
mapbender_subadmin_default_group_id="23"
############################################################
+# backend authentication
+############################################################
+typo3backend_user="typo3"
+typo3backend_password="typo3_password"
+#
+phppgadmin_user="postgresadmin"
+phppgadmin_password="postgresadmin_password"
+############################################################
#
############################################################
installation_folder="/data/"
@@ -37,11 +45,15 @@
############################################################
#
############################################################
+bbox_wgs84="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'"
+# 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'"
############################################################
##################### Geoportal-RLP
wms_1_register_cmd="/usr/bin/php -f ${installation_folder}mapbender/tools/registerOwsCli.php userId=1 guiId='Geoportal-RLP' serviceType='wms' serviceAccessUrl=$wms_1_url"
@@ -51,6 +63,8 @@
wms_4_register_cmd="/usr/bin/php -f ${installation_folder}mapbender/tools/registerOwsCli.php userId=1 guiId='Geoportal-RLP_erwSuche2' serviceType='wms' serviceAccessUrl=$wms_1_url"
wms_5_register_cmd="/usr/bin/php -f ${installation_folder}mapbender/tools/registerOwsCli.php userId=1 guiId='Geoportal-RLP_erwSuche2' serviceType='wms' serviceAccessUrl=$wms_2_url"
############################################################
+##################### 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_port="xxxx" # actually the default port
@@ -59,13 +73,13 @@
############################################################
#
############################################################
-use_proxy="false"
+use_proxy="true"
-http_proxy_host="proxyip"
-http_proxy_port="proxyport"
+http_proxy_host="proxyip" # TODO: adopt!!!
+http_proxy_port="proxyport" # TODO: adopt!!!
-https_proxy_host="proxyip"
-https_proxy_port="proxyport"
+https_proxy_host="proxyip" # TODO: adopt!!!
+https_proxy_port="proxyport" # TODO: adopt!!!
############################################################
# what should be done
############################################################
@@ -87,8 +101,11 @@
############################################################
configure_cronjobs="true"
############################################################
-#
+# other svn to checkout - installation specific
############################################################
+checkout_custom_svn="true"
+custom_svn_url="http://www.gdi-rp-dienste.rlp.de/svn/de-rp-landau/data"
+############################################################
# set some environment variables
############################################################
if [ $use_proxy = 'true' ]; then
@@ -110,6 +127,11 @@
echo "Acquire::http::Proxy \"http://$http_proxy_host:$http_proxy_port\";" > /etc/apt/apt.conf
fi
# first line should be: Acquire::http::Proxy "http://$http_proxy_host:$http_proxy_port";
+ # for subversion alter /etc/subversion/servers - alter following lines
+ # # http-proxy-host = defaultproxy.whatever.com
+ # sed -i "s/# http-proxy-host = defaultproxy.whatever.com/http-proxy-host = $http_proxy_host/g" /etc/subversion/servers
+ # sed -i "s/# http-proxy-port = 7000/http-proxy-port = $http_proxy_port/g" /etc/subversion/servers
+ # # http-proxy-port = 7000
fi
############################################################
if [ $install_system_packages = 'true' ]; then
@@ -123,7 +145,6 @@
# after install - 1.9GB!!!
############################################################
#
-#
############################################################
# set some environment variables
############################################################
@@ -155,7 +176,26 @@
if [ $checkout_mapbender_svn = 'true' ]; then
svn co https://svn.osgeo.org/mapbender/trunk/mapbender
fi
+
+if [ $checkout_custom_svn = 'true' ]; then
+ svn co $custom_svn_url
+fi
############################################################
+# adopt configuration files and copy them to right folder - if exists
+############################################################
+############################################################
+# mapbender
+############################################################
+#cp /data/mapbender.conf /data/mapbender/conf/
+#cp /data/geoportal.conf /data/mapbender/conf/
+#cp /data/extents_geoportal_rlp.map /data/mapbender/tools/wms_extent/extents.map
+#cp /data/extent_service_geoportal_rlp.conf /data/mapbender/tools/wms_extent/extent_service.conf
+############################################################
+# typo3
+############################################################
+
+
+############################################################
# compress and create mapbender
############################################################
if [ $install_mapbender_source = 'true' ]; then
@@ -184,6 +224,33 @@
echo 'done.'
fi
############################################################
+# compress and create custom conf files
+############################################################
+if [ $checkout_custom_svn = 'true' ]; then
+ cd ${installation_folder}svn/
+ tar -czf custom.tar.gz data/
+ mv custom.tar.gz /tmp/
+ cd ${installation_folder}
+ mv /tmp/custom.tar.gz .
+ tar -xzf custom.tar.gz
+ cd ${installation_folder}data/conf/
+ rm -rf $(find . -type d -name .svn)
+ cd ${installation_folder}data/portal
+ rm -rf $(find . -type d -name .svn)
+ cd ${installation_folder}data/mapbender/
+ rm -rf $(find . -type d -name .svn)
+ cd ${installation_folder}
+ cp -r -a ${installation_folder}data/conf ${installation_folder}
+ cp -r -a ${installation_folder}data/portal ${installation_folder}
+ cp -r -a ${installation_folder}data/mapbender ${installation_folder}
+ rm -R ${installation_folder}data/
+ #svn info $custom_svn_url"/conf" | grep Revision | grep -Eo '[0-9]{1,}' > ${installation_folder}conf/lastinstalled
+ rm custom.tar.gz
+ echo 'done.'
+fi
+
+
+############################################################
# cleanup .svn relicts
############################################################
echo -n 'delete .svn files ... '
@@ -378,7 +445,9 @@
INSERT INTO gui_mb_group (fkey_gui_id, fkey_mb_group_id) VALUES ('admin_wfs_metadata', ${mapbender_subadmin_group_id});
INSERT INTO gui_mb_group (fkey_gui_id, fkey_mb_group_id) VALUES ('admin_ows_scheduler', ${mapbender_subadmin_group_id});
INSERT INTO gui_mb_group (fkey_gui_id, fkey_mb_group_id) VALUES ('admin_metadata', ${mapbender_subadmin_group_id});
+#INSERT INTO gui_mb_group (fkey_gui_id, fkey_mb_group_id) VALUES ('admin1', ${mapbender_subadmin_group_id});
+
INSERT INTO gui_mb_group (fkey_gui_id, fkey_mb_group_id) VALUES ('Geoportal-RLP', ${mapbender_guest_group_id});
INSERT INTO gui_mb_group (fkey_gui_id, fkey_mb_group_id) VALUES ('Geoportal-RLP_erwSuche2', ${mapbender_guest_group_id});
@@ -488,7 +557,6 @@
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'"
-
#####################
# add precise coordinate transformation to proj and postgis extension
#####################
@@ -585,9 +653,69 @@
##################### Geoportal-RLP_erwSuche2
eval $wms_4_register_cmd
eval $wms_5_register_cmd
+ ##################### demo service
+eval $wms_6_register_cmd
#####################
fi
+if [ $checkout_custom_svn = 'true' ]; then
+ # override information in custom conf files
+ # mapbender.conf
+ #####################
+ echo -n 'adopt mapbender.conf ... '
+ #####################
+ # 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/%%BBOXWGS84%%/$bbox_wgs84/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
############################################################
@@ -778,11 +906,79 @@
############################################################
#
############################################################
+############################################################
+# configure phppgadmin
+############################################################
+echo -n 'adopt phppgadmin default apache24 configuration'
+cp /etc/apache2/conf-available/phppgadmin.conf /etc/apache2/conf-available/phppgadmin.conf_backup_geoportal
+cat << EOF > /etc/apache2/conf-available/phppgadmin.conf
+Alias /phppgadmin /usr/share/phppgadmin
+
+<Directory /usr/share/phppgadmin>
+
+DirectoryIndex index.php
+AllowOverride None
+
+# Only allow connections from localhost:
+
+AuthType Digest
+AuthName "phppgadmin"
+AuthDigestProvider file
+AuthUserFile ${installation_folder}access/.phppgadmin
+Require valid-user
+
+<IfModule mod_php5.c>
+ php_flag magic_quotes_gpc Off
+ php_flag track_vars On
+ #php_value include_path .
+</IfModule>
+<IfModule !mod_php5.c>
+ <IfModule mod_actions.c>
+ <IfModule mod_cgi.c>
+ AddType application/x-httpd-php .php
+ Action application/x-httpd-php /cgi-bin/php
+ </IfModule>
+ <IfModule mod_cgid.c>
+ AddType application/x-httpd-php .php
+ Action application/x-httpd-php /cgi-bin/php
+ </IfModule>
+ </IfModule>
+</IfModule>
+
+</Directory>
+
+EOF
+############################################################
+# configure typo3backend
+############################################################
+echo -n 'adopt typo3backend configuration'
+cat << EOF > /etc/apache2/conf-available/typo3backend.conf
+<Directory ${installation_folder}portal/typo3>
+<Files index.php>
+ Order allow,deny
+ Allow from all
+ AuthType Digest
+ AuthName "typo3backend"
+ AuthDigestProvider file
+ AuthUserFile ${installation_folder}access/.typo3backend
+ Require valid-user
+</Files>
+</Directory>
+EOF
+############################################################
+# activate apache conf and reload
+############################################################
a2ensite geoportal-apache
a2dissite 000-default
+a2enconf typo3backend
service apache2 restart
-
fi #end of apache configuration
+############################################################
+# 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
if [ $configure_cronjobs = 'true' ]; then
@@ -859,6 +1055,18 @@
fi
############################################################
+# initially monitor registrated services and add them to catalogue (materialize search tables)
+############################################################
+eval $croncmd11
+eval $croncmd8
+eval $croncmd9
+eval $croncmd10
+############################################################
+# things after cli
+############################################################
+chown -R www-data:www-data ${installation_folder}mapbender/log/
+
+############################################################
# create script to uninstall all files and clear databases
############################################################
echo -n 'create shell script to clean folders and databases'
@@ -868,6 +1076,7 @@
rm -R ${installation_folder}mapbender
rm -R ${installation_folder}portal
rm -R ${installation_folder}svn
+rm -R ${installation_folder}conf
rm ${installation_folder}geoportal_database_adoption_1.sql
rm ${installation_folder}geoportal_database_adoption_2.sql
@@ -888,6 +1097,10 @@
echo "Backup version of file exists - overwrite it with the original one"
cp /etc/apache2/apache2.conf_backup_geoportal /etc/apache2/apache2.conf
fi
+if [ -e "/etc/apache2/phppgadmin.conf_backup_geoportal" ]; then
+ echo "Backup version of file exists - overwrite it with the original one"
+ cp /etc/apache2/conf-available/phppgadmin.conf_backup_geoportal /etc/apache2/conf-available/phppgadmin.conf
+fi
rm *.tar.gz*
rm *.sql
rm -R ${installation_folder}cronjobs
@@ -905,21 +1118,24 @@
#####################
# TODO 's:
############################################################
-# Integrate default wms in default gui - register and authorize them
+# Alter other configuration files
############################################################
############################################################
-# Initially monitor ows
+# checkout install specific files and database content
############################################################
############################################################
-# Initially create materialized search views - see cronjobs
+# after installation create authentication files for backends
############################################################
+phppgadmin_realm="phppgadmin"
+digest_phppgadmin="$( printf "%s:%s:%s" "$phppgadmin_user" "$phppgadmin_realm" "$phppgadmin_password" |
+ md5sum | awk '{print $1}' )"
+printf "%s:%s:%s\n" "$phppgadmin_user" "$phppgadmin_realm" "$digest_phppgadmin" >> ${installation_folder}"access/.phppgadmin"
+############################################################
+typo3backend_realm="typo3backend"
+digest_typo3backend="$( printf "%s:%s:%s" "$typo3backend_user" "$typo3backend_realm" "$typo3backend_password" |
+ md5sum | awk '{print $1}' )"
+printf "%s:%s:%s\n" "$typo3backend_user" "$typo3backend_realm" "$digest_typo3backend" >> ${installation_folder}"access/.typo3backend"
-############################################################
-# Alter other configuration files
-############################################################
-############################################################
-# checkout install specific files and database content
-############################################################
date
More information about the Mapbender_commits
mailing list