The Fedora web-application supports several deploy-time, system-level configuration options. These configuration elements can be set using a properties file or through system properties
Deployments
Three means of deploying Fedora have been verified
- Tomcat 10+ servlet container
- Jetty 12 servlet container
- Maven jetty:run plugin - for testing
Each of these deployment approaches has its own way of setting System Properties.
Tomcat 10+
On Debian Linux systems, the typical way of setting System Properties is to update the following file:
/etc/default/tomcat10
Within that file, new properties can be added per the example below:
JAVA_OPTS="${JAVA_OPTS} -Dfcrepo.home=/mnt/fedora-data"
Additional information regarding the configuration of System Properties in Tomcat 10+ can be found here.
Windows notes
Alternatively on Windows systems you can set the following file:
CATALINA_BASE/bin/setenv.bat (windows)
Within that file, new properties can be added per the example below:
set CATALINA_OPTS=%CATALINA_OPTS% -Dfcrepo.home=/mnt/fedora-data
Reverse Proxy
If you have a reverse proxy for serving HTTPS that uses Tomcat's HTTP port, you will also need to set up a RemoteIPValve in your server.xml in order for Tomcat to rewrite links with HTTPS.
To do this you will first need to make sure the X-Forwarded-Proto header is set in your server config (example with Apache):
<VirtualHost *:443>
RequestHeader set X-Forwarded-Proto "https"
ServerName dummy-host.example.com
SSLEngine on
SSLCertificateFile /etc/ssl/certs/localhost.crt
SSLCertificateKeyFile /etc/ssl/private/localhost.key
ProxyPreserveHost On
ProxyRequests Off
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
DocumentRoot "/opt/fedora/apache-tomcat-10/webapps/fcrepo-webapp"
</VirtualHost>
Then you will need to add a Valve to the localhost Engine in Tomcat's server.xml:
<Valve className="org.apache.catalina.valves.RemoteIpValve" remoteIpHeader="X-Forwarded-For" protocolHeader="X-Forwarded-Proto" />
Jetty 12
For systemd-based systems (RHEL, CentOS, Fedora, Ubuntu 16.04+, Debian 8+):
Create an environment file at /etc/sysconfig/jetty (RHEL/CentOS) or /etc/default/jetty (Debian/Ubuntu):
JETTY_HOME=/path/to/jetty
JETTY_BASE=/path/to/jetty-base
TMPDIR=/path/to/temp
JAVA_OPTIONS="-Djetty.home=/path/to/jetty \
-Djetty.base=/path/to/jetty-base \
-Djava.io.tmpdir=/path/to/temp \
-Dfcrepo.home=/path/to/fcrepo-home \
-Djava.security.auth.login.config=/path/to/jetty-base/etc/login.conf"
Then create a systemd service file at /etc/systemd/system/jetty.service:
[Unit]
Description=Jetty Web Server
After=network.target
[Service]
Type=simple
EnvironmentFile=/etc/sysconfig/jetty
ExecStart=/usr/bin/java ${JAVA_OPTIONS} -jar /path/to/jetty/start.jar
WorkingDirectory=/path/to/jetty-base
User=jetty
Restart=on-failure
[Install]
WantedBy=multi-user.target
Windows notes
Edit $JETTY_BASE/start.ini and add:
--exec -Dfcrepo.home=C:\fedora-data
Development and testing
System Properties can be set when using the Maven jetty:run plugin by passing them per the example below:
mvn -Dfcrepo.home=/mnt/fedora-data jetty:run