Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: removed one-click run

The Fedora web-application supports several deploy-time, system-level configuration options. These configuration elements are set via the definition of System Propertiescan be set using a properties file or through system properties.

Panel

Table of Contents
See: Best Practices - Fedora Configuration

...

Code Block
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):

No Format
<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-8.5.66/webapps/fcrepo-webapp"
</VirtualHost>

Then you will need to add a Valve to the localhost Engine in Tomcat's server.xml:

No Format
        <Valve className="org.apache.catalina.valves.RemoteIpValve"
               protocolHeader="X-Forwarded-Proto" />

Anchor
jetty
jetty
Jetty 9

On Debian Linux systems, one way of setting System Properties is to update the following file:

...

Code Block
mvn -Dfcrepo.home=/mnt/fedora-data jetty:run

One-Click Run

One option is to use the "one click" application, which comes with an embedded Jetty servlet. This can be optionally built by running:

Code Block
mvn install -pl fcrepo-webapp -P one-click

...

Code Block
java -jar ./fcrepo-webapp/target/fcrepo-webapp-<version>-jetty-console.jar

...

Code Block
java -Dfcrepo.home=/data/fedora-home -jar fcrepo-webapp-6.0.0-SNAPSHOT-jetty-console.jar

...

Two ways of  passing configuration:  property file or command-line argument 

Before we enumerate the configurable properties and their defaults it should be noted that there are two ways of passing this configuration to your Fedora instance.  As noted above you can use the -D<param.name>=<param.value> syntax.   Optionally you can pass all the parameters at once by putting them in a java properties file and passing the path of the file as a command line argument.  For example, to pass two parameters at once using a property file,  by file simply create a file with any arbitrary name  and path such as  "my_fcrepo.properties".  Then add your parameters as you would in any Java properties file, like this:

Code Block
# add any number of properties below
fcrepo.home: my_fcrepo_home_directory
fcrepo.autoversioning.enabled: true

Then pass these parameters to Fedora like this: 

Code Block
java -Dfcrepo.config-file=my_fcrepo.properties -jar fcrepo-webapp-6.0.0-SNAPSHOT-jetty-console.jar

IMPORTANT NOTE ON PROPERTY PRECEDENCE

You may pass parameters simultaneously via the command-line params as well as by property file.  However,  please keep in mind that command-line parameter values will overwrite any values defined in your properties file.  So using the above mentioned property file as an example

Code Block
java -Dfcrepo.config-file=my_fcrepo.properties -jar fcrepo-webapp-6.0.0-SNAPSHOT-jetty-console.jar

will have an fcrepo.home value of "my_fcrepo_home_directory"  whereas

Code Block
java -Dfcrepo.home=overridden_fcrepo_home -Dfcrepo.config-file=my_fcrepo.properties -jar fcrepo-webapp-6.0.0-SNAPSHOT-jetty-console.jar

will have an fcrepo.home value of "overridden_fcrepo_home".

Table of Configurable Properties

There are a number of configuration elements that can be optionally be set when starting the Fedora web-application, noted below within brackets: <>. 

...

fcrepo.spring.configuration

The  path to the spring configuration.  While it is generally not recommended to use this option,  in some cases you may need to make adjustments to the default spring configuration.   This can be set to a path (relative to the current working directory or absolute) to which Fedora repository content will be written.   

...

This specifies the ports used by the embedded JMS-based message broker for OpenWire protocol. Note: If you have multiple instances of Fedora running,  this property must be set to avoid messaging port conflicts.

...

This specifies the ports used by the embedded JMS-based message broker for STOMP protocol.  Note: If you have multiple instances of Fedora running,  this property must be set to avoid messaging port conflicts.

...

This parameter allows you to set the database connection url.  In general the format is as follows:

Code Block
jdbc:<database_type>://<database_host>:<database_port>/<database_name> 

Fedora currently supports H2, PostgresQL 12.3, MariaDB 10.5.3, and MySQL 8.0

So using the default ports for the supported databases here are the values we typically use: 

...

MariaDB:  jdbc:mariadb://localhost:3306/fcrepo

MySQL:  jdbc:mysql://localhost:3306/fcrepo

...

fcrepo.velocity.runtime.log

...

This results in every change to Fedora resources being persisted in the OCFL "mutable-head" extension, as opposed in a new OCFL version. (default is "true")

No Format
    <!-- Containment Index DB -->
    <bean id="containmentIndexDataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
      <property name="driverClassName" value="org.h2.Driver" />
      <property name="url" value="jdbc:h2:mem:index" />
    </bean>

Within Fedora's fcrepo-config.xml file, the value of "url" can be changed to support a wide range of connection modes and connection settings. Reference

No Format
-Dfcrepo.session.timeout=<milliseconds>

This sets the duration for which a transaction will stay active before auto-rolling back. Defaults to 180000 ms, or 3 minutes

No Format
-Dfcrepo.persistence.defaultDigestAlgorithm=[sha512|sha256]

This sets the default digest algorithm on ingested binary resources (default: sha512)

...

The OCFL persistence configurations mentioned above have a number of more detailed configuration elements that can optionally be set.

Some common elements relate to the directories in which application information is persisted. As mentioned above, if no fcrepo.home property is set then application information will be persisted in the current working directory under the directory "fcrepo/". There will then be several directories within "fcrepo/":

No Format
fcrepo/data/staging
fcrepo/data/ocfl-root
fcrepo/data/ocfl-temp

To set the location of the fcrepo.home directory ("fcrepo/"), use the following system property:

No Format
-Dfcrepo.home=<some_directory>

For a more granular approach, the three directories within fcrepo.home can individually be set with their respective properties:

No Format
-Dfcrepo.ocfl.staging=<some_staging_directory>
-Dfcrepo.ocfl.root=<some_root_directory>
-Dfcrepo.ocfl.temp=<some_temp_directory>
No Format
fcrepo.activemq.directory

Contains the reliable messaging information maintained by ActiveMQ.

Databases

By default, Fedora uses h2 for storing internal indices derived from the persistent application state.  Alternatively, Fedora can be configured to use MySQL,  MariaDB or PostgresQL instead.  Insert the values appropriate to your database configuration in the parameters specified below in brackets (<>). 

No Format
-Dfcrepo.db.url=jdbc:<database_type>://<database_host>:<database_port>/<database_name> -Dfcrepo.db.user=<database_username> -Dfcrepo.db.password=<database_password>

Below is are examples for mysql, mariadb, and postgresql using the default ports.

No Format
-Dfcrepo.db.url=jdbc:mysql://localhost:3306/fcrepo -Dfcrepo.db.user=<database_username> -Dfcrepo.db.password=<database_password>
-Dfcrepo.db.url=jdbc:mariadb://localhost:3306/fcrepo -Dfcrepo.db.user=<database_username> -Dfcrepo.db.password=<database_password>
-Dfcrepo.db.url=jdbc:postgresql://localhost:5432/fcrepo -Dfcrepo.db.user=<database_username> -Dfcrepo.db.password=<database_password>

Configuration Chain

The standard configuration chain is as follows:

...

Click here for a complete list of configurable properties.