From fa20df0d807073840e7e392156d5ef1029336eb2 Mon Sep 17 00:00:00 2001 From: Dan Scott Date: Fri, 19 Oct 2012 15:23:28 -0400 Subject: [PATCH] Generate Apache config files for increased portability Continue weaning ourselves off of hardcoded paths such as /openils in config files. Also, install the Apache config example files into a docs directory instead of just leaving them in the source tree. Similarly, remove some hardcoded paths from eg_db_config.pl. At the same time, drop the '.pl' suffix from the scripts that we're touching, and make the Apache startup script a little less generic in name. The change from "startup.pl" to "eg_startup" and from "eg_db_config.pl" to "eg_db_config" also results in updates to installation and upgrading documentation. Signed-off-by: Dan Scott Signed-off-by: Mike Rylander --- .../examples/apache/{eg.conf => eg.conf.in} | 32 +++++++++---------- Open-ILS/examples/apache/eg_startup.in | 29 +++++++++++++++++ .../{eg_vhost.conf => eg_vhost.conf.in} | 20 ++++++------ Open-ILS/examples/apache/startup.pl | 29 ----------------- Open-ILS/src/Makefile.am | 27 ++++++++++++++-- .../{eg_db_config.pl => eg_db_config.in} | 4 +-- docs/installation/server_installation.txt | 14 ++++---- docs/installation/server_upgrade.txt | 8 ++--- 8 files changed, 93 insertions(+), 70 deletions(-) rename Open-ILS/examples/apache/{eg.conf => eg.conf.in} (85%) create mode 100755 Open-ILS/examples/apache/eg_startup.in rename Open-ILS/examples/apache/{eg_vhost.conf => eg_vhost.conf.in} (97%) delete mode 100755 Open-ILS/examples/apache/startup.pl rename Open-ILS/src/support-scripts/{eg_db_config.pl => eg_db_config.in} (98%) diff --git a/Open-ILS/examples/apache/eg.conf b/Open-ILS/examples/apache/eg.conf.in similarity index 85% rename from Open-ILS/examples/apache/eg.conf rename to Open-ILS/examples/apache/eg.conf.in index a0b27846c1..d095e15b2a 100644 --- a/Open-ILS/examples/apache/eg.conf +++ b/Open-ILS/examples/apache/eg.conf.in @@ -2,11 +2,11 @@ LogLevel info # - log locally -CustomLog /var/log/apache2/access.log combined -ErrorLog /var/log/apache2/error.log +# CustomLog /var/log/apache2/access.log combined +# ErrorLog /var/log/apache2/error.log # - log to syslog -# CustomLog "|/usr/bin/logger -p local7.info" common -# ErrorLog "|logger -p local7.error" +CustomLog "|/usr/bin/logger -p local7.info" common +ErrorLog syslog:local7 # ---------------------------------------------------------------------------------- @@ -14,7 +14,7 @@ ErrorLog /var/log/apache2/error.log # ---------------------------------------------------------------------------------- # - needed by CGIs -PerlRequire /etc/apache2/startup.pl +PerlRequire /etc/apache2/eg_startup PerlChildInitHandler OpenILS::WWW::Reporter::child_init PerlChildInitHandler OpenILS::WWW::SuperCat::child_init PerlChildInitHandler OpenILS::WWW::AddedContent::child_init @@ -24,7 +24,7 @@ PerlChildInitHandler OpenILS::WWW::AutoSuggest::child_init # ---------------------------------------------------------------------------------- # Set some defaults for our working directories # ---------------------------------------------------------------------------------- - + Order allow,deny Allow from all @@ -33,7 +33,7 @@ PerlChildInitHandler OpenILS::WWW::AutoSuggest::child_init # ---------------------------------------------------------------------------------- # XUL directory # ---------------------------------------------------------------------------------- - + Options Indexes FollowSymLinks AllowOverride None Order allow,deny @@ -44,17 +44,17 @@ PerlChildInitHandler OpenILS::WWW::AutoSuggest::child_init # ---------------------------------------------------------------------------------- # Remove the language portion from the URL # ---------------------------------------------------------------------------------- -AliasMatch ^/opac/.*/skin/(.*)/(.*)/(.*) /openils/var/web/opac/skin/$1/$2/$3 -AliasMatch ^/opac/.*/extras/slimpac/(.*) /openils/var/web/opac/extras/slimpac/$1 -AliasMatch ^/opac/.*/extras/selfcheck/(.*) /openils/var/web/opac/extras/selfcheck/$1 +AliasMatch ^/opac/.*/skin/(.*)/(.*)/(.*) @localstatedir@/web/opac/skin/$1/$2/$3 +AliasMatch ^/opac/.*/extras/slimpac/(.*) @localstatedir@/web/opac/extras/slimpac/$1 +AliasMatch ^/opac/.*/extras/selfcheck/(.*) @localstatedir@/web/opac/extras/selfcheck/$1 # ---------------------------------------------------------------------------------- # System config CGI scripts go here # ---------------------------------------------------------------------------------- -Alias /cgi-bin/offline/ "/openils/var/cgi-bin/offline/" - +Alias /cgi-bin/offline/ "@localstatedir@/cgi-bin/offline/" + AddHandler cgi-script .cgi .pl AllowOverride None Options None @@ -68,8 +68,8 @@ Alias /cgi-bin/offline/ "/openils/var/cgi-bin/offline/" # ---------------------------------------------------------------------------------- # Updates folder # ---------------------------------------------------------------------------------- -Alias /updates/ "/openils/var/updates/pub/" - +Alias /updates/ "@localstatedir@/updates/pub/" + ForceType cgi-script @@ -106,7 +106,7 @@ ExpiresByType text/css "access plus 50 minutes" #Listen 443 NameVirtualHost *:443 - DocumentRoot "/openils/var/web" + DocumentRoot "@localstatedir@/web" ServerName localhost:443 ServerAlias 127.0.0.1:443 SSLEngine on @@ -143,7 +143,7 @@ NameVirtualHost *:443 ServerName localhost:80 ServerAlias 127.0.0.1:80 - DocumentRoot /openils/var/web/ + DocumentRoot @localstatedir@/web/ DirectoryIndex index.xml index.html index.xhtml # - absorb the shared virtual host settings Include eg_vhost.conf diff --git a/Open-ILS/examples/apache/eg_startup.in b/Open-ILS/examples/apache/eg_startup.in new file mode 100755 index 0000000000..d1e80f9e6e --- /dev/null +++ b/Open-ILS/examples/apache/eg_startup.in @@ -0,0 +1,29 @@ +#!/usr/bin/perl +use OpenSRF::AppSession; + +# default ingress value for all Apache/mod_perl clients +OpenSRF::AppSession->ingress('apache'); + +use OpenILS::WWW::Exporter qw( @sysconfdir@/opensrf_core.xml ); +use OpenILS::WWW::SuperCat qw( @sysconfdir@/opensrf_core.xml ); +use OpenILS::WWW::AddedContent qw( @sysconfdir@/opensrf_core.xml ); +use OpenILS::WWW::Proxy ('@sysconfdir@/opensrf_core.xml'); +use OpenILS::WWW::Vandelay qw( @sysconfdir@/opensrf_core.xml ); +use OpenILS::WWW::TemplateBatchBibUpdate qw( @sysconfdir@/opensrf_core.xml ); +use OpenILS::WWW::EGWeb; +use OpenILS::WWW::PasswordReset ('@sysconfdir@/opensrf_core.xml'); +use OpenILS::WWW::IDL2js ('@sysconfdir@/opensrf_core.xml'); +use OpenILS::WWW::FlatFielder; + +# - Uncoment the following 2 lines to make use of the IP redirection code +# - The IP file should to contain a map with the following format: +# - actor.org_unit.shortname +# - e.g. LIB123 10.0.0.1 10.0.0.254 + +#use OpenILS::WWW::Redirect qw(@sysconfdir@/opensrf_core.xml); +#OpenILS::WWW::Redirect->parse_ips_file('@sysconfdir@/lib_ips.txt'); + + + +1; + diff --git a/Open-ILS/examples/apache/eg_vhost.conf b/Open-ILS/examples/apache/eg_vhost.conf.in similarity index 97% rename from Open-ILS/examples/apache/eg_vhost.conf rename to Open-ILS/examples/apache/eg_vhost.conf.in index b797832571..26b0485d01 100644 --- a/Open-ILS/examples/apache/eg_vhost.conf +++ b/Open-ILS/examples/apache/eg_vhost.conf.in @@ -35,7 +35,7 @@ RedirectMatch 301 ^/opac/extras/slimpac/advanced.html$ /opac/en-US/extras/slimpa # ---------------------------------------------------------------------------------- # Configure the gateway # ---------------------------------------------------------------------------------- -OSRFGatewayConfig /openils/conf/opensrf_core.xml +OSRFGatewayConfig @sysconfdir@/opensrf_core.xml # Translator memcache server. Default is localhost # OSRFTranslatorCacheServer 127.0.0.1:11211 @@ -349,7 +349,7 @@ RewriteRule .? - [E=locale:%{HTTP:Accept-Language}] # ---------------------------------------------------------------------------------- # Module for processing staff-client offline scripts lives here # ---------------------------------------------------------------------------------- - + AddHandler cgi-script .pl AllowOverride None Options +ExecCGI @@ -545,7 +545,7 @@ RewriteRule ^/conify/([a-z]{2}-[A-Z]{2})/global/(.*)$ /conify/global/$2 [E=local # OpenURL 0.1 searching based on OpenSearch -RewriteMap openurl prg:/openils/bin/openurl_map.pl +RewriteMap openurl prg:@bindir@/openurl_map.pl RewriteCond %{QUERY_STRING} (^.*$) RewriteRule ^/openurl$ ${openurl:%1} [NE,PT] @@ -560,7 +560,7 @@ RewriteRule ^/openurl$ ${openurl:%1} [NE,PT] allow from all PerlSetVar OILSWebBasePath "/eg" - PerlSetVar OILSWebWebDir "/openils/var/web" + PerlSetVar OILSWebWebDir "@localstatedir@/web" PerlSetVar OILSWebDefaultTemplateExtension "tt2" # Enable Template-Toolkit error debugging messages (apache error log) @@ -583,18 +583,18 @@ RewriteRule ^/openurl$ ${openurl:%1} [NE,PT] # select their preferred locale from a locale picker in the TPAC. # #PerlAddVar OILSWebLocale "en" - #PerlAddVar OILSWebLocale "/openils/var/data/locale/messages.en.po" + #PerlAddVar OILSWebLocale "@localstatedir@/data/locale/messages.en.po" #PerlAddVar OILSWebLocale "en_ca" - #PerlAddVar OILSWebLocale "/openils/var/data/locale/en-CA.po" + #PerlAddVar OILSWebLocale "@localstatedir@/data/locale/en-CA.po" #PerlAddVar OILSWebLocale "fr_ca" - #PerlAddVar OILSWebLocale "/openils/var/data/locale/fr-CA.po" + #PerlAddVar OILSWebLocale "@localstatedir@/data/locale/fr-CA.po" # Set the default locale: defaults to en-US #PerlAddVar OILSWebDefaultLocale "fr_ca" # Templates will be loaded from the following paths in reverse order. - PerlAddVar OILSWebTemplatePath "/openils/var/templates" - #PerlAddVar OILSWebTemplatePath "/openils/var/templates_localskin" + PerlAddVar OILSWebTemplatePath "@localstatedir@/templates" + #PerlAddVar OILSWebTemplatePath "@localstatedir@/templates_localskin" #------------------------------------------------- # Added Content Configuration @@ -647,7 +647,7 @@ RewriteRule ^/openurl$ ${openurl:%1} [NE,PT] PerlSetVar OILSWebContextLoader "OpenILS::WWW::EGKPacLoader" - PerlSetVar KPacConfigFile "/openils/conf/kpac.xml.example" + PerlSetVar KPacConfigFile "@sysconfdir@/kpac.xml.example" ExpiresActive On ExpiresByType text/html "access plus 5 seconds" diff --git a/Open-ILS/examples/apache/startup.pl b/Open-ILS/examples/apache/startup.pl deleted file mode 100755 index f7755b6f35..0000000000 --- a/Open-ILS/examples/apache/startup.pl +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/perl -use OpenSRF::AppSession; - -# default ingress value for all Apache/mod_perl clients -OpenSRF::AppSession->ingress('apache'); - -use OpenILS::WWW::Exporter qw( /openils/conf/opensrf_core.xml ); -use OpenILS::WWW::SuperCat qw( /openils/conf/opensrf_core.xml ); -use OpenILS::WWW::AddedContent qw( /openils/conf/opensrf_core.xml ); -use OpenILS::WWW::Proxy ('/openils/conf/opensrf_core.xml'); -use OpenILS::WWW::Vandelay qw( /openils/conf/opensrf_core.xml ); -use OpenILS::WWW::TemplateBatchBibUpdate qw( /openils/conf/opensrf_core.xml ); -use OpenILS::WWW::EGWeb; -use OpenILS::WWW::PasswordReset ('/openils/conf/opensrf_core.xml'); -use OpenILS::WWW::IDL2js ('/openils/conf/opensrf_core.xml'); -use OpenILS::WWW::FlatFielder; - -# - Uncoment the following 2 lines to make use of the IP redirection code -# - The IP file should to contain a map with the following format: -# - actor.org_unit.shortname -# - e.g. LIB123 10.0.0.1 10.0.0.254 - -#use OpenILS::WWW::Redirect qw(/openils/conf/opensrf_core.xml); -#OpenILS::WWW::Redirect->parse_ips_file('/openils/conf/lib_ips.txt'); - - - -1; - diff --git a/Open-ILS/src/Makefile.am b/Open-ILS/src/Makefile.am index 9d1c5346b8..0efce63214 100644 --- a/Open-ILS/src/Makefile.am +++ b/Open-ILS/src/Makefile.am @@ -14,7 +14,6 @@ ## Process this file with automake to generate Makefile.in -export INCDIR = "$(INCLUDEDIR)/openils/" export STAFF_CLIENT_BUILD_ID = `/bin/cat @top_srcdir@/Open-ILS/xul/staff_client/build/BUILD_ID` export DEF_LDFLAGS = -L. -L$(TMP) -L$(OPENSRF_LIBS) export DEF_CFLAGS = -D_LARGEFILE64_SOURCE -pipe -g -Wall -O2 -fPIC -I@top_srcdir@/include -I$(LIBXML2_HEADERS) -I$(APACHE2_HEADERS) -I$(APR_HEADERS) -I$(LIBXML2_HEADERS)/libxml -I$(TMP) -I$(OPENSRF_HEADERS) @@ -140,14 +139,22 @@ gen_scripts = \ @srcdir@/extras/import/marc2sre.pl \ @srcdir@/extras/import/parallel_pg_loader.pl \ $(supportscr)/authority_control_fields.pl \ + $(supportscr)/eg_db_config \ $(supportscr)/marc_export +gen_docs = \ + $(examples)/apache/eg.conf \ + $(examples)/apache/eg_vhost.conf \ + $(examples)/apache/eg_startup + bin_SCRIPTS = $(core_scripts) $(gen_scripts) $(reporter_scripts) $(installautojs) CLEANFILES = $(gen_scripts) data_DATA = $(core_data) $(reporter_data) +doc_DATA = $(gen_docs) + # Take care of which subdirectories to build, and which extra files to include in a distribution. SUBDIRS = $(OILSCORE_DIRS) $(OILSWEB_DIR) $(OILSPYTHON_DIR) $(OILSJAVA_DIR) @@ -158,6 +165,7 @@ EXTRA_DIST = @srcdir@/perlmods \ @top_srcdir@/Open-ILS/xsl \ @srcdir@/cgi-bin \ $(gen_scripts) \ + $(gen_docs) \ @srcdir@/extras/eg_config do_subst = $(SED) \ @@ -167,6 +175,7 @@ do_subst = $(SED) \ -e 's,[@]exec_prefix[@],$(exec_prefix),g' \ -e 's,[@]includedir[@],$(includedir),g' \ -e 's,[@]libdir[@],$(libdir),g' \ + -e 's,[@]localstatedir[@],$(localstatedir),g' \ -e 's,[@]prefix[@],$(prefix),g' \ -e 's,[@]sysconfdir[@],$(sysconfdir),g' @@ -209,10 +218,23 @@ $(supportscr)/authority_control_fields.pl: Makefile $(supportscr)/authority_cont $(do_subst) $(supportscr)/authority_control_fields.pl.in > "$@" chmod 755 "$@" +$(supportscr)/eg_db_config: Makefile $(supportscr)/eg_db_config.in + $(do_subst) $(supportscr)/eg_db_config.in > "$@" + chmod 755 "$@" + $(supportscr)/marc_export: Makefile $(supportscr)/marc_export.in $(do_subst) $(supportscr)/marc_export.in > "$@" chmod 755 "$@" +$(examples)/apache/eg.conf: Makefile $(examples)/apache/eg.conf.in + $(do_subst) $(examples)/apache/eg.conf.in > "$@" + +$(examples)/apache/eg_vhost.conf: Makefile $(examples)/apache/eg_vhost.conf.in + $(do_subst) $(examples)/apache/eg_vhost.conf.in > "$@" + +$(examples)/apache/eg_startup: Makefile $(examples)/apache/eg_startup.in + $(do_subst) $(examples)/apache/eg_startup.in > "$@" + #perl-install and string-templates-install ilscore-install: @echo $@ @@ -251,4 +273,5 @@ reporter-install: sed -i 's|SYSCONFDIR|@sysconfdir@|g' '$(DESTDIR)@bindir@/clark-kent.pl' sed -i 's|SYSCONFDIR|@sysconfdir@|g' '$(DESTDIR)@bindir@/find_orphaned_reports.pl' - +docs-install: gen_docs + $(MKDIR_P) $(DESTDIR)$(docdir) diff --git a/Open-ILS/src/support-scripts/eg_db_config.pl b/Open-ILS/src/support-scripts/eg_db_config.in similarity index 98% rename from Open-ILS/src/support-scripts/eg_db_config.pl rename to Open-ILS/src/support-scripts/eg_db_config.in index 665cedf348..f7103233d1 100755 --- a/Open-ILS/src/support-scripts/eg_db_config.pl +++ b/Open-ILS/src/support-scripts/eg_db_config.in @@ -339,7 +339,7 @@ DESCRIPTION OPTIONS --config-file - specifies the opensrf.xml file. Defaults to /openils/conf/opensrf.xml + specifies the opensrf.xml file. Defaults to @sysconfdir@/opensrf.xml --build-db-file specifies the script that creates the database schema. Defaults to @@ -347,7 +347,7 @@ OPTIONS --offline-file specifies the offline database settings file required by the offline - data uploader. Defaults to /openils/conf/offline-config.pl + data uploader. Defaults to @sysconfdir@/offline-config.pl COMMANDS --update-config diff --git a/docs/installation/server_installation.txt b/docs/installation/server_installation.txt index aa193624da..6765cbde0f 100644 --- a/docs/installation/server_installation.txt +++ b/docs/installation/server_installation.txt @@ -203,7 +203,7 @@ services, and administration interfaces. Issue the following commands as the ------------------------------------------------------------------------------ cp Open-ILS/examples/apache/eg.conf /etc/apache2/sites-available/ cp Open-ILS/examples/apache/eg_vhost.conf /etc/apache2/ -cp Open-ILS/examples/apache/startup.pl /etc/apache2/ +cp Open-ILS/examples/apache/eg_startup /etc/apache2/ # Now set up SSL mkdir /etc/apache2/ssl cd /etc/apache2/ssl @@ -214,7 +214,7 @@ cd /etc/apache2/ssl ------------------------------------------------------------------------------ cp Open-ILS/examples/apache/eg.conf /etc/httpd/conf.d/ cp Open-ILS/examples/apache/eg_vhost.conf /etc/httpd/ -cp Open-ILS/examples/apache/startup.pl /etc/httpd/ +cp Open-ILS/examples/apache/eg_startup /etc/httpd/ # Now set up SSL mkdir /etc/httpd/ssl cd /etc/httpd/ssl @@ -301,7 +301,7 @@ destination file. The backup version of the destination file has a tilde (`~`) appended to the file name, so if you have forgotten the Jabber users and domains, you can retrieve the settings from the backup version of the files. -`eg_db_config.pl`, described in the following section, sets the database +`eg_db_config`, described in the following section, sets the database connection information in `opensrf.xml` for you. Creating the Evergreen database @@ -383,7 +383,7 @@ with the values you want for the *egadmin* Evergreen administrator account: [source, bash] ------------------------------------------------------------------------------ -perl Open-ILS/src/support-scripts/eg_db_config.pl --update-config \ +perl Open-ILS/src/support-scripts/eg_db_config --update-config \ --service all --create-database --create-schema --create-offline \ --user --password --hostname --port \ --database --admin-user --admin-pass @@ -403,7 +403,7 @@ installed on a dedicated server. PostgreSQL 9.1 and later ^^^^^^^^^^^^^^^^^^^^^^^^ To create the database instance on a remote database server running PostgreSQL -9.1 or later, simply use the `--create-database` flag on `eg_db_config.pl`. +9.1 or later, simply use the `--create-database` flag on `eg_db_config`. For PostgreSQL 9.0 ^^^^^^^^^^^^^^^^^^ @@ -421,7 +421,7 @@ To create the database instance on a remote database server running PostgreSQL psql -vdb_name= -vcontrib_dir=`pg_config --sharedir`/contrib -f create_database.sql ------------------------------------------------------------------------------ -Then you can issue the `eg_db_config.pl` command as above _without_ the +Then you can issue the `eg_db_config` command as above _without_ the `--create-database` argument to create your schema and configure your configuration files. @@ -487,7 +487,7 @@ Once you have installed and started Evergreen, test your connection to Evergreen via `srfsh`. As the *opensrf* Linux account, issue the following commands to start `srfsh` and try to log onto the Evergreen server using the *egadmin* Evergreen administrator user name and password that you set using the -`eg_db_config.pl` command: +`eg_db_config` command: [source, bash] ------------------------------------------------------------------------------ diff --git a/docs/installation/server_upgrade.txt b/docs/installation/server_upgrade.txt index 0a535fca22..ffec2331e3 100644 --- a/docs/installation/server_upgrade.txt +++ b/docs/installation/server_upgrade.txt @@ -128,7 +128,7 @@ Copying these configuration files will remove any customizations you have made t [source, bash] ------------------------------------------------------------------------- cd /home/opensrf/Evergreen-ILS-2.3.3 -perl Open-ILS/src/support-scripts/eg_db_config.pl --update-config --service all \ +perl Open-ILS/src/support-scripts/eg_db_config --update-config --service all \ --create-offline --database evergreen --host localhost --user evergreen --password evergreen ------------------------------------------------------------------------- + @@ -140,11 +140,11 @@ indexterm:[Apache] Copying these Apache configuration files will remove any customizations you have made to them. Remember to redo your customizations after copying them. For example, if you purchased an SSL certificate, you will need to edit eg.conf to point to the appropriate SSL certificate files. + -.. Update _/etc/apache2/startup.pl_ by copying the example from _Open-ILS/examples/apache/startup.pl_. +.. Update _/etc/apache2/eg_startup_ by copying the example from _Open-ILS/examples/apache/eg_startup_. + [source, bash] ---------------------------------------------------------- -cp /home/opensrf/Evergreen-ILS-2.3.3/Open-ILS/examples/apache/startup.pl /etc/apache2/startup.pl +cp /home/opensrf/Evergreen-ILS-2.3.3/Open-ILS/examples/apache/eg_startup /etc/apache2/eg_startup ---------------------------------------------------------- + .. Update /etc/apache2/eg_vhost.conf by copying the example from Open-ILS/examples/apache/eg_vhost.conf. @@ -154,7 +154,7 @@ cp /home/opensrf/Evergreen-ILS-2.3.3/Open-ILS/examples/apache/startup.pl /etc/ap cp /home/opensrf/Evergreen-ILS-2.3.3/Open-ILS/examples/apache/eg_vhost.conf /etc/apache2/eg_vhost.conf ---------------------------------------------------------- + -.. Update /etc/apache2/sites-available/eg.conf by copying the example from Open-ILS/ examples/apache/eg.conf. +.. Update /etc/apache2/sites-available/eg.conf by copying the example from Open-ILS/examples/apache/eg.conf. + [source, bash] ---------------------------------------------------------- -- 2.43.2