├── .gitignore ├── install_scripts ├── external-content-allowed-paths.txt ├── hawtio.sh ├── backup_restore.sh ├── config ├── fedora_camel_toolbox.script ├── mysql.sh ├── fedora.sh ├── fedora_camel_toolbox.sh └── fcrepo-config.xml ├── Vagrantfile ├── .github └── PULL_REQUEST_TEMPLATE.md ├── backup_restore_scripts ├── generate_and_load.sh ├── restore_runner.sh └── hot_backup_runner.sh └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | .vagrant 2 | downloads 3 | *~ 4 | -------------------------------------------------------------------------------- /install_scripts/external-content-allowed-paths.txt: -------------------------------------------------------------------------------- 1 | http:// 2 | https:// 3 | file:/// 4 | -------------------------------------------------------------------------------- /install_scripts/hawtio.sh: -------------------------------------------------------------------------------- 1 | ###################### 2 | # Fedora Camel Toolbox 3 | ###################### 4 | 5 | echo "Installing Hawt.io" 6 | 7 | /opt/karaf/bin/client -u karaf -h localhost -a 8101 "feature:repo-add hawtio 2.5.0" 8 | /opt/karaf/bin/client -u karaf -h localhost -a 8101 "feature:install hawtio" 9 | 10 | -------------------------------------------------------------------------------- /install_scripts/backup_restore.sh: -------------------------------------------------------------------------------- 1 | ########################### 2 | #Backup and Restore scripts 3 | ########################### 4 | 5 | echo "Installing backup restore scripts to ~/backup_restore directory" 6 | mkdir /home/vagrant/backup_restore 7 | cp /vagrant/backup_restore_scripts/* /home/vagrant/backup_restore 8 | chown -R vagrant:vagrant /home/vagrant/backup_restore -------------------------------------------------------------------------------- /install_scripts/config: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Contain Environment variables for installs 4 | # 5 | 6 | HOME_DIR="/home/vagrant" 7 | 8 | SHARED_DIR="/vagrant" 9 | 10 | DOWNLOAD_DIR="$SHARED_DIR/downloads" 11 | if [ ! -d $DOWNLOAD_DIR ]; then 12 | mkdir $DOWNLOAD_DIR 13 | fi 14 | 15 | FEDORA_VERSION=5.1.1 16 | FEDORA_TAG=5.1.1 17 | 18 | # Configure a JDBC backend, switching this will require destroying and re-provisioning vagrant 19 | FEDORA_JDBC_STORE=file 20 | #FEDORA_JDBC_STORE=mysql 21 | 22 | -------------------------------------------------------------------------------- /install_scripts/fedora_camel_toolbox.script: -------------------------------------------------------------------------------- 1 | feature:repo-add mvn:org.apache.activemq/activemq-karaf/5.14.1/xml/features 2 | feature:repo-add mvn:org.apache.camel.karaf/apache-camel/2.20.4/xml/features 3 | feature:repo-add mvn:org.fcrepo.camel/toolbox-features/5.0.0/xml/features 4 | feature:install fcrepo-service-activemq 5 | feature:install fcrepo-service-camel 6 | feature:install fcrepo-ldpath 7 | feature:install fcrepo-fixity 8 | feature:install fcrepo-indexing-solr 9 | feature:install fcrepo-indexing-triplestore 10 | feature:install fcrepo-reindexing 11 | feature:install fcrepo-serialization 12 | feature:install fcrepo-audit-triplestore 13 | -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | # Vagrantfile API/syntax version. Don't touch unless you know what you're doing! 2 | VAGRANTFILE_API_VERSION = "2" 3 | 4 | Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 5 | # All Vagrant configuration is done here. The most common configuration 6 | # options are documented and commented below. For a complete reference, 7 | # please see the online documentation at vagrantup.com. 8 | 9 | config.vm.hostname = "fedora4" 10 | 11 | config.vm.box = "fcrepo/fcrepo-base" 12 | 13 | config.vm.network :forwarded_port, guest: 8080, host: 8080 # Tomcat 14 | config.vm.network :forwarded_port, guest: 8181, host: 8181 # Hawtio 15 | config.vm.network :forwarded_port, guest: 9080, host: 9080 # Fixity and Reindexing 16 | 17 | config.vm.provider "virtualbox" do |v| 18 | v.memory = 2048 19 | end 20 | 21 | shared_dir = "/vagrant" 22 | 23 | config.vm.provision "fedora", type: "shell", path: "./install_scripts/fedora.sh", args: shared_dir 24 | config.vm.provision "backup_restore", type: "shell", path: "./install_scripts/backup_restore.sh", args: shared_dir 25 | config.vm.provision "fedora_camel_toolbox", type: "shell", path: "./install_scripts/fedora_camel_toolbox.sh", args: shared_dir 26 | config.vm.provision "hawtio", type: "shell", path: "./install_scripts/hawtio.sh", args: shared_dir 27 | 28 | end 29 | -------------------------------------------------------------------------------- /install_scripts/mysql.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "Installing MySQL." 4 | 5 | apt-get -y update 6 | 7 | debconf-set-selections <<< 'mysql-server mysql-server/root_password password fedoraMySQL' 8 | debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password fedoraMySQL' 9 | apt-get -y install mysql-server 10 | sleep 2 11 | echo 'DROP DATABASE IF EXISTS fcrepo; CREATE DATABASE fcrepo; grant all privileges on fcrepo.* to "fedora_user"@"localhost"; SET PASSWORD for "fedora_user"@"localhost" = PASSWORD("fedora_passwd"); flush privileges;' | mysql -u root -p'fedoraMySQL' 12 | 13 | if [ -f "/var/lib/tomcat7/webapps/fcrepo/WEB-INF/classes/config/jdbc-mysql/repository.json" ]; then 14 | sed -i 's/"org.fcrepo.auth.common.BypassSecurityServletAuthenticationProvider"/"org.fcrepo.auth.common.ServletContainerAuthenticationProvider"/' /var/lib/tomcat7/webapps/fcrepo/WEB-INF/classes/config/jdbc-mysql/repository.json 15 | else 16 | print "CAN'T SEE THE REPOSITORY CONFIGURATION FILES!!" 17 | exit 18 | fi 19 | 20 | if ! grep -q "fcrepo.modeshape.configuration" /etc/default/tomcat7 ; then 21 | echo $'\n' >> /etc/default/tomcat7 22 | echo "CATALINA_OPTS=\"\${CATALINA_OPTS} -Dfcrepo.mysql.username=fedora_user -Dfcrepo.mysql.password=fedora_passwd -Dfcrepo.mysql.host=localhost -Dfcrepo.mysql.port=3306\"" >> /etc/default/tomcat7 23 | MODESHAPE_CONFIG="classpath:/config/jdbc-mysql/repository.json" 24 | fi 25 | 26 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | **The title of this pull-request should be a brief description of what the pull-request fixes/improves/changes. Ideally 50 characters or less.** 2 | * * * 3 | 4 | **JIRA Ticket**: (link) 5 | 6 | * Other Relevant Links (Mailing list discussion, related pull requests, etc.) 7 | 8 | # What does this Pull Request do? 9 | A brief description of what the intended result of the PR will be and/or what problem it solves. 10 | 11 | # What's new? 12 | A in-depth description of the changes made by this PR. Technical details and possible side effects. 13 | 14 | Example: 15 | * Changes x feature to such that y 16 | * Added x 17 | * Removed y 18 | 19 | # How should this be tested? 20 | 21 | A description of what steps someone could take to: 22 | * Reproduce the problem you are fixing (if applicable) 23 | * Test that the Pull Request does what is intended. 24 | * Please be as detailed as possible. 25 | * Good testing instructions help get your PR completed faster. 26 | 27 | 28 | # Additional Notes: 29 | Any additional information that you think would be helpful when reviewing this PR. 30 | 31 | Example: 32 | * Does this change require documentation to be updated? 33 | * Does this change add any new dependencies? 34 | * Does this change require any other modifications to be made to the repository (ie. Regeneration activity, etc.)? 35 | * Could this change impact execution of existing code? 36 | 37 | # Interested parties 38 | Tag (@ mention) interested parties or, if unsure, @fcrepo/committers 39 | -------------------------------------------------------------------------------- /backup_restore_scripts/generate_and_load.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Creates objects in the repository and loads them with unique datastreams. 4 | # The number of backups in defined in $OBJ and the size of the datastream is defined in $DSZ. 5 | 6 | BASE=http://localhost:8080/fcrepo/rest/test 7 | BATCH=$RANDOM 8 | 9 | # Number of objects to load 10 | OBJ=30 11 | # Datastream Size 12 | DSZ=$(( 1024 * 1024 * 1 )) # 1 MB 13 | 14 | if [ ! -d tmp ]; then 15 | mkdir tmp 16 | fi 17 | mkdir tmp/$BATCH 18 | 19 | # Generate Datastreams 20 | N=0 21 | echo `date +%T` "$BATCH: generating $OBJ datastreams" 22 | START=`date +%s` 23 | while [ $N -lt $OBJ ]; do 24 | N=$(( $N + 1 )) 25 | if [ ! -f tmp/$BATCH/$N ]; then 26 | openssl rand -base64 $DSZ > tmp/$BATCH/$N 27 | fi 28 | done 29 | END=`date +%s` 30 | echo `date +%T` "$BATCH: done in" $(( $END - $START )) "seconds" 31 | 32 | # Signal parent process to notify completion of generation phase 33 | kill -USR1 $PPID 34 | 35 | # Create objects and load generated datastreams 36 | N=0 37 | echo "$BATCH:" `date +%T` "creating $OBJ datastreams" 38 | START=`date +%s` 39 | while [ $N -lt $OBJ ]; do 40 | N=$(( $N + 1 )) 41 | if [ $(( $N % 10 )) = 0 ]; then 42 | echo "$BATCH: ." 43 | fi 44 | curl -u fedoraAdmin:secret3 -s -X PUT $BASE/$BATCH/$N?mixin=fedora:object > /dev/null 45 | curl -u fedoraAdmin:secret3 -s -H "Content-Type: text/plain" -X PUT -T tmp/$BATCH/$N $BASE/$BATCH/$N/ds1 > /dev/null 46 | done 47 | echo 48 | END=`date +%s` 49 | echo `date +%T` "$BATCH: done in" $(( $END - $START )) "seconds" 50 | 51 | # Remove temporary files 52 | rm -rf tmp/$BATCH 53 | 54 | # Delete cURL for the current batch 55 | N=0 56 | echo `date +%T` "$BATCH: appending curl command to delete batch: $BATCH" 57 | file_path=`pwd`/batch-delete-commands.sh 58 | echo "curl -u fedoraAdmin:secret3 -s -X DELETE $BASE/$BATCH" >> $file_path 59 | -------------------------------------------------------------------------------- /install_scripts/fedora.sh: -------------------------------------------------------------------------------- 1 | ############ 2 | # Fedora 3 | ############ 4 | 5 | echo "Installing Fedora." 6 | 7 | SHARED_DIR=$1 8 | 9 | if [ -f "$SHARED_DIR/install_scripts/config" ]; then 10 | . $SHARED_DIR/install_scripts/config 11 | fi 12 | 13 | WEBAPP="fcrepo-webapp-${FEDORA_VERSION}.war" 14 | RELEASES="https://github.com/fcrepo/fcrepo/releases/download/fcrepo-${FEDORA_TAG}" 15 | 16 | cd $HOME_DIR 17 | 18 | mkdir /var/lib/tomcat7/fcrepo4-data 19 | chown tomcat7:tomcat7 /var/lib/tomcat7/fcrepo4-data 20 | chmod g-w /var/lib/tomcat7/fcrepo4-data 21 | 22 | if [ ! -f "$DOWNLOAD_DIR/$WEBAPP" ]; then 23 | echo -n "Downloading Fedora... $RELEASES/$WEBAPP" 24 | curl -L -s -o "$DOWNLOAD_DIR/$WEBAPP" "$RELEASES/$WEBAPP" 25 | echo " done" 26 | fi 27 | 28 | cp "$DOWNLOAD_DIR/$WEBAPP" /var/lib/tomcat7/webapps/fcrepo.war 29 | chown tomcat7:tomcat7 /var/lib/tomcat7/webapps/fcrepo.war 30 | 31 | if [ "${FEDORA_JDBC_STORE}" = "mysql" ]; then 32 | . $SHARED_DIR/install_scripts/mysql.sh 33 | fi 34 | 35 | 36 | if [ -z "${MODESHAPE_CONFIG}" ]; then 37 | MODESHAPE_CONFIG="classpath:/config/servlet-auth/repository.json" 38 | fi 39 | 40 | if ! grep -q "fcrepo.modeshape.configuration" /etc/default/tomcat7 ; then 41 | echo $'\n' >> /etc/default/tomcat7; 42 | echo "CATALINA_OPTS=\"\${CATALINA_OPTS} -Dfcrepo.modeshape.configuration=${MODESHAPE_CONFIG}\"" >> /etc/default/tomcat7; 43 | fi 44 | 45 | if [ ! -f "$HOME_DIR/external-content-allowed-paths.txt" ]; then 46 | cp "$SHARED_DIR/install_scripts/external-content-allowed-paths.txt" $HOME_DIR 47 | fi 48 | 49 | echo "CATALINA_OPTS=\"\${CATALINA_OPTS} -Dfcrepo.external.content.allowed=${HOME_DIR}/external-content-allowed-paths.txt\"" >> /etc/default/tomcat7; 50 | echo "CATALINA_OPTS=\"\${CATALINA_OPTS} -Dfcrepo.properties.management=relaxed\"" >> /etc/default/tomcat7; 51 | 52 | if [ ! -f "$HOME_DIR/fcrepo-config.xml" ]; then 53 | cp "$SHARED_DIR/install_scripts/fcrepo-config.xml" $HOME_DIR 54 | fi 55 | 56 | if ! grep -q "fcrepo.spring.configuration" /etc/default/tomcat7 ; then 57 | echo "CATALINA_OPTS=\"\${CATALINA_OPTS} -Dfcrepo.spring.configuration=file://${HOME_DIR}/fcrepo-config.xml\"" >> /etc/default/tomcat7; 58 | fi 59 | 60 | service tomcat7 restart 61 | -------------------------------------------------------------------------------- /backup_restore_scripts/restore_runner.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Restores fcrepo home backups created by hot_backup_runner.sh script. 4 | # When NON_INTERACTIVE mode is not included as a command line parameter 5 | # the user will have an opportunity to manually inspect the repository. 6 | 7 | NON_INTERACTIVE=false 8 | 9 | # Check parameters and print usage 10 | if [ "$#" -ge 1 ]; then 11 | if [ "$1" != "NON_INTERACTIVE" ] || [ "$#" -gt 1 ]; then 12 | echo "Usage:" 13 | echo "./restore_runner.sh [NON_INTERACTIVE](optional)" 14 | echo "NON_INTERACTIVE mode will skip waiting for user input after completing each restore." 15 | echo 16 | echo "Example:" 17 | echo "./restore_runner.sh" 18 | echo "./restore_runner.sh NON_INTERACTIVE" 19 | exit 1 20 | fi 21 | NON_INTERACTIVE=true 22 | fi 23 | 24 | # Stop tomcat and backup current state 25 | sudo service tomcat7 stop 26 | sudo mv /var/lib/tomcat7/fcrepo4-data{,.bak} 27 | 28 | cd ~/backup_restore 29 | 30 | if [ ! -d processed_backups ]; then 31 | mkdir processed_backups 32 | fi 33 | 34 | # Restore and verify successful repository start for each backup in the backups directory 35 | backup_failed=false 36 | backup_found=false 37 | for backup in $(ls -A backups); do 38 | backup_found=true 39 | echo "Testing backup: $backup"; 40 | sudo cp -r backups/$backup /var/lib/tomcat7/fcrepo4-data 41 | sudo chown -R tomcat7:tomcat7 /var/lib/tomcat7/fcrepo4-data 42 | sudo service tomcat7 start 43 | status=`curl -s -o /dev/null -I -w "%{http_code}" -u fedoraAdmin:secret3 http://localhost:8080/fcrepo/rest` 44 | new_file_name=$backup 45 | message="Backup restored successfully!" 46 | if [ "$status" != "200" ]; then 47 | backup_failed=true 48 | new_file_name=$backup"_failed" 49 | message="Backup restore failed!" 50 | fi 51 | echo $message 52 | mv backups/$backup processed_backups/$new_file_name 53 | if ! $NON_INTERACTIVE; then 54 | read -p "Press ENTER to continue to restore next backup!" 55 | fi 56 | sudo service tomcat7 stop 57 | sudo rm -rf /var/lib/tomcat7/fcrepo4-data 58 | done 59 | 60 | if ! $backup_found; then 61 | echo "No backups found in the ./backups directory!" 62 | fi 63 | 64 | if $backup_found; then 65 | echo "Finished restoring and verifying all backups!" 66 | echo "All backups are moved to processed_backups directory." 67 | fi 68 | 69 | if $backup_failed; then 70 | echo "Some backups failed to restore the repository!" 71 | echo "Failed backups are marked with a _failed suffix in the processed_backups directory." 72 | fi 73 | 74 | # Restore original repository state 75 | sudo mv /var/lib/tomcat7/fcrepo4-data{.bak,} 76 | sudo service tomcat7 start 77 | status=`curl -s -o /dev/null -I -w "%{http_code}" -u fedoraAdmin:secret3 http://localhost:8080/fcrepo/rest` 78 | message="Restored original fcrepo home and started fcrepo successfully" 79 | if [ "$status" != "200" ]; then 80 | message="Restoring original fcrepo home failed!" 81 | fi 82 | echo $message 83 | echo 84 | -------------------------------------------------------------------------------- /backup_restore_scripts/hot_backup_runner.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Spawns parallel processes to create objects and datastreams using generate_and_load.sh script. 4 | # Create hot backups of the fcrepo home while the data load processes ingest objects and datastreams. 5 | 6 | # Check parameters and print usage 7 | if [ "$#" -ne 3 ]; then 8 | echo "Usage:" 9 | echo "./hot_backup_runner.sh [Number_of_parallel_dataloads_to_run] /path/to/fcrepo_home [backup_interval_in_seconds]" 10 | echo "Example:" 11 | echo "./hot_backup_runner.sh 3 /var/lib/tomcat7/fcrepo_data 10" 12 | exit 1 13 | fi 14 | 15 | # Number of parallel processes to run 16 | BATCHES=$1 17 | # Path of the fcrepo home 18 | FCREPO_HOME=$2 19 | # Backup frequency in seconds (while load scripts run) 20 | BACKUP_INTERVAL=$3 21 | 22 | # Has any child load process completed data generation 23 | dataload_started=false 24 | catch_signal_usr1 () { dataload_started=true ;} 25 | trap catch_signal_usr1 USR1 26 | 27 | # Kill all child process on control + c 28 | function ctrl_c() { 29 | for pid in ${pids[@]}; do 30 | if ps -p $pid &> /dev/null; then 31 | kill $pid 32 | fi 33 | done 34 | echo "Terminated!" 35 | exit 36 | } 37 | trap ctrl_c INT 38 | 39 | # Backup original fcrepo home 40 | if [ ! -d ~/backup_restore/fcrepo_home.ORIGINAL ]; then 41 | cp -r $FCREPO_HOME ~/backup_restore/fcrepo_home.ORIGINAL 42 | fi 43 | 44 | # Start child processes to load data 45 | i=0 46 | while [[ $i -lt $BATCHES ]] 47 | do 48 | echo "Creating loader batch $i" >> hot_backup_runner.log 49 | nohup bash generate_and_load.sh >> hot_backup_runner.log & 50 | 51 | # Store all child pids in an array 52 | pids[$i]=$! 53 | 54 | i=$((i + 1)) 55 | done 56 | 57 | if [ ! -d backups ]; then 58 | mkdir backups 59 | fi 60 | 61 | # Create backups until all the loader child processes have terminated. 62 | first_loop=true 63 | batches_running=true 64 | while [ "$batches_running" = true ] ; do 65 | batches_running=false 66 | # Set batches_running to true if any of the child pid still exist 67 | for pid in ${pids[@]}; do 68 | if ps -p $pid &> /dev/null; then 69 | batches_running=true 70 | fi 71 | done 72 | 73 | if $first_loop; then 74 | printf "Waiting for data generation to complete and loading to begin" 75 | fi 76 | 77 | # Wait for data loading to begin at least in a single child process 78 | while ! $dataload_started ; do sleep 1; printf "." ; done 79 | 80 | if $first_loop; then 81 | echo 82 | echo "Staring backups!" 83 | fi 84 | 85 | # Copy fcrepo home to backups directory 86 | if $batches_running ; then 87 | backup_suffix=`date +"%Y%m%d%H%M%S"` 88 | start=`date +%s` 89 | cp -r $FCREPO_HOME ./backups/fcrepo_home.bkp.$backup_suffix 90 | echo "Backup created: ./backups/fcrepo_home.bkp.$backup_suffix" 91 | echo "Backup created: ./backups/fcrepo_home.bkp.$backup_suffix" >> hot_backup_runner.log 92 | end=`date +%s` 93 | backup_duration=$((END - START)) 94 | sleep $(( BACKUP_INTERVAL - backup_duration )) >> /dev/null 2>&1 95 | fi 96 | first_loop=false 97 | done 98 | -------------------------------------------------------------------------------- /install_scripts/fedora_camel_toolbox.sh: -------------------------------------------------------------------------------- 1 | ###################### 2 | # Fedora Camel Toolbox 3 | ###################### 4 | 5 | echo "Installing Fedora Camel Toolbox" 6 | 7 | SHARED_DIR=$1 8 | 9 | if [ -f "$SHARED_DIR/install_scripts/config" ]; then 10 | . $SHARED_DIR/install_scripts/config 11 | fi 12 | 13 | cd $HOME_DIR 14 | 15 | sed -i 's@http://repo1.maven.org@https://repo1.maven.org@' /opt/karaf/etc/org.ops4j.pax.url.mvn.cfg 16 | 17 | /opt/karaf/bin/client -u karaf -h localhost -a 8101 -f "$SHARED_DIR/install_scripts/fedora_camel_toolbox.script" 18 | 19 | # ActiveMQ 20 | if [ ! -f "/opt/karaf/etc/org.fcrepo.camel.service.activemq.cfg" ]; then 21 | /opt/karaf/bin/client -u karaf -h localhost -a 8101 "feature:install fcrepo-service-activemq" 22 | fi 23 | 24 | # LDPath 25 | if [ ! -f "/opt/karaf/etc/org.fcrepo.camel.ldpath.cfg" ]; then 26 | /opt/karaf/bin/client -u karaf -h localhost -a 8101 "feature:install fcrepo-ldpath" 27 | fi 28 | sed -i 's|fcrepo.authUsername=$|fcrepo.authUsername=fedoraAdmin|' /opt/karaf/etc/org.fcrepo.camel.ldpath.cfg 29 | sed -i 's|fcrepo.authPassword=$|fcrepo.authPassword=secret3|' /opt/karaf/etc/org.fcrepo.camel.ldpath.cfg 30 | 31 | 32 | # Solr indexing 33 | if [ ! -f "/opt/karaf/etc/org.fcrepo.camel.indexing.solr.cfg" ]; then 34 | /opt/karaf/bin/client -u karaf -h localhost -a 8101 "feature:install fcrepo-indexing-solr" 35 | fi 36 | sed -i 's|solr.baseUrl=http://localhost:8983/solr/collection1|solr.baseUrl=http://localhost:8080/solr/collection1|' /opt/karaf/etc/org.fcrepo.camel.indexing.solr.cfg 37 | sed -i 's|error.maxRedeliveries=10|error.maxRedeliveries=1|' /opt/karaf/etc/org.fcrepo.camel.indexing.solr.cfg 38 | sed -i 's|solr.commitWithin=10000|solr.commitWithin=1000|' /opt/karaf/etc/org.fcrepo.camel.indexing.solr.cfg 39 | 40 | # Triplestore indexing 41 | if [ ! -f "/opt/karaf/etc/org.fcrepo.camel.indexing.triplestore.cfg" ]; then 42 | /opt/karaf/bin/client -u karaf -h localhost -a 8101 "feature:install fcrepo-indexing-triplestore" 43 | fi 44 | sed -i 's|error.maxRedeliveries=10|error.maxRedeliveries=1|' /opt/karaf/etc/org.fcrepo.camel.indexing.triplestore.cfg 45 | 46 | # Audit service 47 | if [ ! -f "/opt/karaf/etc/org.fcrepo.camel.audit.cfg" ]; then 48 | /opt/karaf/bin/client -u karaf -h localhost -a 8101 "feature:install fcrepo-audit-triplestore" 49 | fi 50 | 51 | # Fixity service 52 | sleep 10 53 | if [ ! -f "/opt/karaf/etc/org.fcrepo.camel.fixity.cfg" ]; then 54 | /opt/karaf/bin/client -u karaf -h localhost -a 8101 "feature:install fcrepo-fixity" 55 | sleep 10 56 | fi 57 | 58 | # Serialization service 59 | if [ ! -f "/opt/karaf/etc/org.fcrepo.camel.serialization.cfg" ]; then 60 | /opt/karaf/bin/client -u karaf -h localhost -a 8101 "feature:install fcrepo-serialization" 61 | fi 62 | 63 | # Reindexing service 64 | if [ ! -f "/opt/karaf/etc/org.fcrepo.camel.reindexing.cfg" ]; then 65 | /opt/karaf/bin/client -u karaf -h localhost -a 8101 "feature:install fcrepo-reindexing" 66 | fi 67 | sed -i 's|rest.host=localhost$|rest.host=0.0.0.0|' /opt/karaf/etc/org.fcrepo.camel.reindexing.cfg 68 | 69 | sed -i 's|fcrepo.authUsername=$|fcrepo.authUsername=fedoraAdmin|' /opt/karaf/etc/org.fcrepo.camel.service.cfg 70 | sed -i 's|fcrepo.authPassword=$|fcrepo.authPassword=secret3|' /opt/karaf/etc/org.fcrepo.camel.service.cfg 71 | 72 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # fcrepo-vagrant 2 | Fedora Vagrant Virtual Machine 3 | 4 | ## Requirements 5 | 6 | * [Vagrant](https://www.vagrantup.com/) 7 | * [VirtualBox](https://www.virtualbox.org/) 8 | 9 | ## Usage 10 | 11 | 1. Install Vagrant and VirtualBox 12 | 2. `git clone https://github.com/fcrepo-exts/fcrepo-vagrant.git` 13 | 3. `cd fcrepo-vagrant` 14 | 4. `vagrant up` 15 | 16 | You can shell into the machine with `vagrant ssh` or `ssh -p 2222 vagrant@localhost` 17 | 18 | ## Environment 19 | 20 | * Ubuntu 14.04 64-bit machine with: 21 | * [Tomcat 7](http://tomcat.apache.org) 22 | * Available at: [http://localhost:8080/manager/html](http://localhost:8080/manager/html) 23 | * Manager username = "fedora4", password = "fedora4" 24 | * [Fedora 5.x](http://fedorarepository.org) 25 | * Available at: [http://localhost:8080/fcrepo](http://localhost:8080/fcrepo) 26 | * Authentication/Authorization configuration detailed below 27 | * [Solr 4.10.3](http://lucene.apache.org/solr/) 28 | * Available at: [http://localhost:8080/solr](http://localhost:8080/solr), for indexing & searching your content. 29 | * Installed in `/var/lib/tomcat7/solr` 30 | * [Apache Karaf 4.0.5](http://karaf.apache.org/) 31 | * Installed in `/opt/karaf` 32 | * Installed as a service `apache-karaf` 33 | * [Fuseki 2.3.1](http://jena.apache.org/documentation/fuseki2/) 34 | * Available at: [http://localhost:8080/fuseki](http://localhost:8080/fuseki), for querying and updating. 35 | * Installed in `/etc/fuseki` 36 | * Dataset Path name `/test` 37 | * Persistent storage `/etc/fuseki/databases/test\_data` 38 | * [Fcrepo-camel-toolbox 5.x](https://github.com/fcrepo-exts/fcrepo-camel-toolbox) 39 | * Installed in karaf 40 | * [Hawtio 2.5.0](https://hawt.io/) 41 | * Available at [http://localhost:8181/hawtio](http://localhost:8181/hawtio) 42 | * Access via username = "karaf", password = "karaf" 43 | * Installed in karaf 44 | 45 | ### Fedora Configuration 46 | WebAC authorization is enabled on this Fedora installation. 47 | The following three Fedora user accounts are available: 48 | * user account `testuser`, with password `password1` 49 | * user account `adminuser`, with password `password2` 50 | * admin account `fedoraAdmin` with the password `secret3` 51 | 52 | ### Using the backup and restore scripts 53 | The scripts at the ~/backup_restore directory can be used to test backing up and restoring the Fedora repository for consistency. 54 | 55 | The following command will cause 50 parallel processes to load data to the repository while creating snapshots of fcrepo home directory every 2 seconds. 56 | 57 | ``` 58 | cd ~/backup_restore/ 59 | ./hot_backup_runner.sh 50 /var/lib/tomcat7/fcrepo4-data 2 60 | ``` 61 | 62 | This will restore the backups created from the `hot_backup_runner.sh` and test if the repository starts successfully. 63 | 64 | ``` 65 | ./restore_runner.sh NON_INTERACTIVE 66 | ``` 67 | 68 | To manually inspect the state of the repository, the command can be run without the NON_INTERACTIVE option. This 69 | will cause the script to pause for user input after each restore operation. 70 | 71 | ``` 72 | ./restore_runner.sh 73 | ``` 74 | ## Customizations 75 | 76 | The applications installed on this Vagrant box have been customized to showcase features. Some of the configuration of these applications may not be recommended for production installations. 77 | Application customizations are found in the [install_scripts](install_scripts) directory. 78 | 79 | ### Fedora Customizations 80 | 81 | Beyond the configuration noted in the [Fedora Configuration](#fedora-configuration) section, the installed Fedora application is standard. 82 | 83 | ### Camel Toolbox Customizations 84 | 85 | The following services have been configured with Fedora credentials: 86 | * Solr indexer 87 | * Triplestore indexer 88 | * Fixity service 89 | * Serialization service 90 | * Reindexing service 91 | 92 | The Solr indexer has been configured to communicate with Solr running on port 8080, instead of the default 8983. 93 | 94 | The triplestore indexer has been configured to NOT include any `Prefer` headers. The production default is to limit the triples to be indexed by omitting `ldp:contains` triples. 95 | 96 | The reindexing service has been configured to bind to the host, `0.0.0.0`, instead of the default `localhost`. This allows the reindexing service to be accessible from outside of the Vagrant VM, i.e. from the host machine. See [camel-jetty documentation](http://camel.apache.org/jetty.html), search for: "Usage of localhost". 97 | 98 | ### Hawtio 99 | 100 | Hawtio is a pluggable management console for Java stuff which supports any kind of JVM, any kind of container (Tomcat, Jetty, Wildfly, Karaf, etc), and any kind of Java technology and middleware. It has a Camel plugin, that allows you to gain insight into your running Camel applications. 101 | 102 | ## Support 103 | 104 | If you receive the following error: 105 | ``` 106 | There are errors in the configuration of this machine, Please fix the following errors and try again: 107 | 108 | vm: 109 | * The box 'ubuntu/trusty64' could not be found. 110 | ``` 111 | 112 | Edit the file **Vagrantfile**, find the lines: 113 | ``` 114 | # Below needed for Vagrant versions < 1.6.x 115 | # config.vm.box_url = "https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box" 116 | ``` 117 | and un-comment the **config.vm.box\_url** line, save the file and retry. 118 | 119 | #### Port 9080 (reindexing service) unavailable after vagrant up 120 | 121 | It might happen that during the first `vagrant up` the reindexing service is not installed and the port 9080 is inaccessible (try `telnet localhost 9080`). To fix this run `vagrant provision` and check again. If it still does not work, install the services manually: 122 | ``` 123 | vagrant ssh 124 | cd /opt/karaf/bin 125 | ./client 2 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 25 | 26 | 27 | 32 | 38 | 39 | 43 | 44 | 45 | 46 | 47 | 48 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 69 | 70 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | /** = servletContainerAuthFilter,delegatedPrincipalProvider,headerProvider,webACFilter 115 | 116 | 117 | 118 | 119 | 122 | 123 | 124 | 128 | 131 | 132 | 135 | 142 | 143 | 146 | 149 | 150 | 157 | 158 | 159 | 160 | 161 | 165 | 168 | 169 | 170 | 171 | 172 | 173 | 176 | 177 | 179 | 180 | 181 | 185 | 186 | 187 | 188 | 189 | 190 | 193 | 198 | 199 | 200 | 203 | 204 | 205 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 227 | 228 | 229 | 230 | 231 | 232 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | --------------------------------------------------------------------------------