Skip to content

Instantly share code, notes, and snippets.

@jermnelson
Last active September 7, 2023 20:11
Show Gist options
  • Save jermnelson/3b2a9a8d63704711a06300c830f8e045 to your computer and use it in GitHub Desktop.
Save jermnelson/3b2a9a8d63704711a06300c830f8e045 to your computer and use it in GitHub Desktop.
Configurations for Multiple Instances of FOLIO Order import tool

Following the directions in FOLIO Order Import Tool code repository's README, this gist contains the configuration servlet properties XML files for two instances, one for FOLIO production and one for FOLIO stage environments.

Setup

A docker image is generated from the Dockerfile in this GIST with the following files being copied:

  1. The order.war file to sul-prod.war and sul-stage.war
  2. The Context XML files, sul-prod.xml and sul-stage.war for each environment
  3. Specific property configuration files for stage and production, import-sul-prod.properties and import-sul-stage.properties (NOTE: these files are not included in this GIST as they contain Okapi login information)
  4. Docker image is launched with port 8080 published

Apache2 runs as a service on the VM.

  1. Apache2 Reverse Proxy set-up in VirtualHost directive (attached conf file has SSL details obscured) to proxy to running Docker container running on port 8080

Problem

With this setup, the Contexts for the sul-prod and sul-stage are present when the server is live:

Root Server Display with two context

However, when clicking on either of these context, the following directory view is shown instead of the running instance of the FOLIO Order Import Tool:

SUL Prod Context Directory View

# Deploy WAR file to Jetty container
# WAR should be in directory ./target as generated by mvn install
# Application requires import.properties file at ${JETTY_BASE}/order/import.properties
FROM jetty:10
COPY --chown=jetty:jetty target/order.war ${JETTY_HOME}/webapps/sul-prod.war
COPY --chown=jetty:jetty target/order.war ${JETTY_HOME}/webapps/sul-stage.war
COPY --chown=jetty:jetty import-sul-stage.properties ${JETTY_BASE}/order/import-sul-stage.properties
COPY --chown=jetty:jetty docker-config/sul-stage.xml ${JETTY_BASE}/webapps/
COPY --chown=jetty:jetty import-sul-prod.properties ${JETTY_BASE}/order/import-sul-prod.properties
COPY --chown=jetty:jetty docker-config/sul-prod.xml ${JETTY_BASE}/webapps/
COPY --chown=jetty:jetty docker-config/order-all.xml ${JETTY_HOME}/webapps/
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "https://www.eclipse.org/jetty/configure_10_0.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="contextPath">/sul-prod</Set>
<Set name="war">/usr/local/jetty/webapps/sul-prod.war</Set>
<Set name="extractWAR">true</Set>
<Get name="ServletContext">
<Call name="setAttribute">
<Arg>config</Arg>
<Arg>/var/lib/jetty/order/import-sul-prod.properties</Arg>
</Call>
</Get>
</Configure>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "https://www.eclipse.org/jetty/configure_10_0.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="contextPath">/sul-stage</Set>
<Set name="war">/usr/local/jetty/webapps/sul-stage.war</Set>
<Get name="ServletContext">
<Call name="setAttribute">
<Arg>config</Arg>
<Arg>/var/lib/jetty/order/import-sul-stage.properties</Arg>
</Call>
</Get>
</Configure>
# ************************************
# Vhost template in module puppetlabs-apache
# Managed by Puppet
# ************************************
#
<VirtualHost *:443>
ServerName sul-folio-orders-dev.stanford.edu
## Vhost docroot
DocumentRoot "/var/www/html"
## Directories, there should at least be a declaration for /var/www/html
<Location "/">
Options -MultiViews
Require all granted
RequestHeader set X-Forwarded-Proto "https" env=HTTPS
ProxyPass http://localhost:8080/
ProxyPassReverse http://localhost:8080/
</Location>
<Location "/server-status">
Require ip 127.0.0.1 ::1
</Location>
## Logging
ErrorLog "/var/log/apache2/sul-folio-orders-dev_error_ssl.log"
ServerSignature Off
CustomLog "/var/log/apache2/sul-folio-orders-dev_access_ssl.log" combined
## Header rules
## as per http://httpd.apache.org/docs/2.2/mod/mod_headers.html#header
Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains"
ProxyPreserveHost On
## Server aliases
ServerAlias sul-folio-orders-dev
## SSL directives
SSLEngine on
SSLCertificateFile "/etc/ssl/certs/**.crt"
SSLCertificateKeyFile "/etc/ssl/private/**.key"
SSLCertificateChainFile "/etc/ssl/certs/**ca-bundle"
SSLProtocol All -SSLv2 -SSLv3 -TLSv1 -TLSv1.1
SSLCipherSuite ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA:ECDHE-ECDSA-AES128-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA256:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA
SSLCACertificatePath "/etc/ssl/certs"
## Custom fragment
RewriteEngine On
RewriteRule ^$ /import [L]
</VirtualHost>
@jermnelson
Copy link
Author

Thanks @wafschneider! I was able to get the Lehigh tool working on a single VM using two Docker containers, each with different properties file running on different ports. The key was having two VirtualHost directives in the Apache2 configuration with different ServerNames.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment