Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

By default, Fedora comes configured to write binary resources (i.e. files) to the file system and RDF resources (i.e. objects) to a database. For testing, a file-based objects database may be usefulAll of Fedora's content and metadata are stored on disk in an OCFL storage root. For performance reasons, Fedora maintains a cache of system and user metadata in a rebuildable database. For quickly spinning up Fedora in a testing / experimental context, a default H2 database is available by default. However, for production installations, it is recommended to use a MariaDB,  MySQL or PostgresSQL object storePostgreSQL database. Below are the steps to use MySQL or PostgreSQL, as well as Docker instructions if you choose to run your database in a Docker container.

MySQL

  1. Install an instance of MySQL and create a database called fcrepo and a user account that can access it
  2. Run Fedora with the following JAVA_OPTS:

Docker-based Database Setup

The following instructions detail how to run your database in a Docker container.

MariaDB

The following instructions use the database username of "fcrepo-user" and password of "fcrepo-pw". You will want to change these to something more secure.

No Format
docker run --name f6-mariadb -e MYSQL_ROOT_PASSWORD=root-pw -e MYSQL_DATABASE=fcrepo -e MYSQL_USER=fcrepo-user -e MYSQL_PASSWORD=fcrepo-pw -p 3306:3306 -d mariadb:10.5.3

..when done with the database:
docker stop f6-mariadb
docker rm f6-mariadb

In order for Fedora to connect with a database configured as above, the Fedora should be started with the following system properties:

No Format
-Dfcrepo.db.url=jdbc:mariadb://localhost:3306/fcrepo 
-Dfcrepo.db.user=fcrepo-user 
-Dfcrepo.db.password=fcrepo-pw

PostgreSQL

The following instructions use the database username of "fcrepo-user" and password of "fcrepo-pw". You will want to change these to something more secure.

No Format
docker run --name f6-postgres -e POSTGRES_USER=fcrepo-user -e POSTGRES_PASSWORD=fcrepo-pw -e POSTGRES_DB=fcrepo -p 5432:5432 -d postgres:12.3

..when done with the database:
docker stop f6-postgres
docker rm f6-postgres

In order for Fedora to connect with a database configured as above, the Fedora should be started with the following system properties:

No Format
-Dfcrepo.db.url=jdbc:postgresql://localhost:5432/fcrepo 
-Dfcrepo.db.user=fcrepo-user 
-Dfcrepo.db.password=fcrepo-pw

MySQL

The following instructions use the database username of "fcrepo-user" and password of "fcrepo-pw". You will want to change these to something more secure.

No Format
docker run --name f6-mysql -e MYSQL_ROOT_PASSWORD=root-pw -e MYSQL_DATABASE=fcrepo -e MYSQL_USER=fcrepo-user -e MYSQL_PASSWORD=fcrepo-pw -p 3306:3306 -d mysql:8.0

..when done with the database:
docker stop f6-mysql
docker rm f6-mysql

In order for Fedora to connect with a database configured as above, the Fedora should be started with the following system properties:

No Format
-Dfcrepo.db.url=jdbc:mysql://localhost:3306/fcrepo 
-Dfcrepo.db.user=fcrepo-user 
-Dfcrepo.db.password=fcrepo-pw

Native Database Setup

MariaDB

  1. Install an instance of MariaDB and create a database called fcrepo and a user account that can access it
  2. Run Fedora with the following JAVA_OPTS:
Code Block
JAVA_OPTS
Code Block
JAVA_OPTS="${JAVA_OPTS} -Dfcrepo.modeshape.configuration=classpath:/config/jdbc-mysql/repository.json"
JAVA_OPTS="${JAVA_OPTS} -Dfcrepo.mysql.username=<username>"
JAVA_OPTS="${JAVA_OPTS} -Dfcrepo.mysqldb.password=<password>url=jdbc:mariadb://localhost:3306/fcrepo"
JAVA_OPTS="${JAVA_OPTS} -Dfcrepo.mysqldb.hostuser=<default=localhost><username>"
JAVA_OPTS="${JAVA_OPTS} -Dfcrepo.mysqldb.portpw=<default=3306><password>"

Note,  the the fcrepo database  database must be manually created, but the tables will be automatically created.

PostgreSQL

  1. Install an instance of PostgreSQL and create a database called fcrepo and a user account that can access it
  2. Run Fedora with the following JAVA_OPTS:
Code Block
JAVA_OPTS="${JAVA_OPTS} -Dfcrepo.modeshapedb.configurationurl=classpathjdbc:postgresql:/config/jdbc-postgresql/repository.json/localhost:5432/fcrepo"
JAVA_OPTS="${JAVA_OPTS} -Dfcrepo.postgresqldb.usernameuser=<username>"
JAVA_OPTS="${JAVA_OPTS} -Dfcrepo.postgresqldb.password=<password>pw=<password>"

Note, the fcrepo database must be manually created, but the tables will be automatically created.

MySQL

  1. Install an instance of MySQL and create a database called fcrepo and a user account that can access it
  2. Run Fedora with the following JAVA_OPTS:
Code Block
JAVA_OPTS="${JAVA_OPTS} -Dfcrepo.db.url=jdbc:mysql://localhost:3306/fcrepo"
JAVA_OPTS="${JAVA_OPTS} -Dfcrepo.postgresqldb.hostuser=<default=localhost><username>"
JAVA_OPTS="${JAVA_OPTS} -Dfcrepo.postgresqldb.portpw=<default=5432><password>"

Note, the  the fcrepo database  database must be manually created, but the tables will be automatically created.


Database Setup

MySQL and MariaDB

To create a new database and user in MySQL, assuming a username of user1 and a password of xyz:

Code Block
$ mysql -u root -p
> create database fcrepo;
> create user 'user1'@'localhost' IDENTIFIED BY 'xyz';
> GRANT ALL PRIVILEGES ON fcrepo.* to 'user1'@'localhost';
> \q

PostgreSQL

To create a new database and user in PostgreSQL, assuming a username of user1 and a password of xyz:

...