Skip to content

Instantly share code, notes, and snippets.

@dannylamb
Last active April 29, 2020 18:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dannylamb/fc910f4d1730f21191f384d533502e24 to your computer and use it in GitHub Desktop.
Save dannylamb/fc910f4d1730f21191f384d533502e24 to your computer and use it in GitHub Desktop.
Updates Islandora 8 from 1.0.0 to 1.1.0
#!/bin/bash
# Update drupal core
cd /var/www/html/drupal
composer -n update drupal/core webflo/drupal-core-require-dev "symfony/*" --with-dependencies
# Update islandora dependencies in composer.json
sed -i 's/"islandora\/islandora_defaults": "1.0.0"/"islandora\/islandora_defaults": "1.1.0"/' composer.json
sed -i 's/"islandora\/openseadragon": "1.0.0"/"islandora\/openseadragon": "1.1.0"/' composer.json
sed -i 's/"islandora\/carapace": "1.0.0"/"islandora\/carapace": "3.0.0"/' composer.json
sed -i '/islandora_defaults/ a \ \ \ \ \ \ \ \ "drupal\/rest_oai_pmh": "^1.0"\,' composer.json
sed -i '/islandora_defaults/ a \ \ \ \ \ \ \ \ "islandora-rdm\/islandora_fits": "dev-master"\,' composer.json
# Explicitly add auto_entitylabel back in, b/c otherwise it will get removed and break your site.
# YMMV here but I had to do this.
sed -i '/islandora_defaults/ a \ \ \ \ \ \ \ \ "drupal\/auto_entitylabel": "2.1.0-beta1"\,' composer.json
# Actually get the new modules and update the lockfile.
composer -n update
drush -y updb
drush -y en islandora_text_extraction_defaults islandora_fits islandora_breadcrumbs islandora_oaipmh islandora_iiif
drush -y fim islandora_core_feature,islandora_text_extraction_defaults
drush cset -y --input-format=yaml islandora_iiif.settings iiif_server http://future.islandora.ca:8080/cantaloupe/iiif/2
drush cset -y --input-format=yaml openseadragon.settings manifest_view iiif_manifest
drush -y -l future.islandora.ca --userid=1 mim --group=islandora
##########
# Fedora #
##########
cd ~
wget https://github.com/fcrepo4/fcrepo4/releases/download/fcrepo-5.1.0/fcrepo-webapp-5.1.0.war
mv fcrepo-webapp-5.1.0.war /var/lib/tomcat8/webapps/fcrepo.war
############
# Crayfish #
############
cd /var/www/html/Crayfish
git fetch origin
git checkout 1.1.1
for dir in ./*/; do (cd $dir; composer update); done
###########
# Houdini #
###########
cd Houdini
# Point apache config to new entrypoint
sed -i 's|/src|/public|g' /etc/apache2/conf-available/Houdini.conf
# Set convert executable
sed -i 's|/usr/local/bin/convert|convert|g' config/services.yaml
#Set crayfish_commons.yml to this:
cat << EOF > config/packages/crayfish_commons.yaml
crayfish_commons:
fedora_base_uri: http://127.0.0.1:8080/fcrepo/rest
syn_config: /var/www/html/Crayfish/Houdini/syn-settings.xml
syn_enabled: True
EOF
#Set monolog.yml to this:
cat << EOF > config/packages/monolog.yaml
monolog:
handlers:
houdini:
type: rotating_file
path: /var/log/islandora/houdini.log
level: DEBUG
max_files: 1
EOF
#Clear houdini cache with:
php bin/console cache:clear
#############
# Hypercube #
#############
cd ../Hypercube
apt-get -y install poppler-utils
sed -i 's/executable\: tesseract/tesseract_executable\: tesseract/g' cfg/config.yaml
sed -i '/executable\: tesseract/a \ \ pdftotext_executable\: pdftotext' cfg/config.yaml
############
# CrayFits #
############
cat << EOF > /etc/apache2/conf-available/CrayFits.conf
Alias "/crayfits" "/var/www/html/CrayFits/public"
<Directory "/var/www/html/CrayFits/public">
FallbackResource /crayfits/index.php
Require all granted
DirectoryIndex index.php
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
</Directory>
EOF
ln -s /etc/apache2/conf-available/CrayFits.conf /etc/apache2/conf-enabled
cd /var/www/html
git clone https://github.com/roblib/CrayFits.git
cd CrayFits
mkdir var
composer install
chmod -R 755 .
service apache2 restart
# Install FITS
mkdir /opt/fits
cd /opt/fits
wget https://github.com/harvard-lts/fits/releases/download/1.4.1/fits-1.4.1.zip
unzip fits-1.4.1.zip
# Install FITS ws
curl -o /var/lib/tomcat8/webapps/fits.war http://projects.iq.harvard.edu/files/fits/files/fits-1.2.0.war
# Configure FITS ws
echo "" >> /var/lib/tomcat8/conf/catalina.properties
echo "# FITS" >> /var/lib/tomcat8/conf/catalina.properties
echo "fits.home=/opt/fits" >> /var/lib/tomcat8/conf/catalina.properties
sed -i 's/shared\.loader.*/&,\$\{fits.home\}\/lib\/\*\.jar/' /var/lib/tomcat8/conf/catalina.properties
service tomcat8 restart
##########
# Alpaca #
##########
sed -i "s/http:\/\/repo1.maven.org\/maven2/https:\/\/repo1.maven.org\/maven2/g" /opt/karaf/etc/org.ops4j.pax.url.mvn.cfg
rm /opt/karaf/deploy/ca.islandora*
/opt/karaf/bin/client "feature:uninstall islandora-connector-derivative"
/opt/karaf/bin/client "feature:uninstall islandora-indexing-fcrepo"
/opt/karaf/bin/client "feature:uninstall islandora-indexing-triplestore"
/opt/karaf/bin/client "feature:uninstall islandora-http-client"
/opt/karaf/bin/client "feature:repo-remove mvn:ca.islandora.alpaca/islandora-karaf/1.0.1/xml/features"
/opt/karaf/bin/client "feature:repo-add mvn:ca.islandora.alpaca/islandora-karaf/1.0.3/xml/features"
/opt/karaf/bin/client "feature:install islandora-http-client"
/opt/karaf/bin/client "feature:install islandora-indexing-triplestore"
/opt/karaf/bin/client "feature:install islandora-indexing-fcrepo"
/opt/karaf/bin/client "feature:install islandora-connector-derivative"
cat << EOF > /opt/karaf/deploy/ca.islandora.alpaca.connector.fits.blueprint.xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- managed by ansible -->
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
xsi:schemaLocation="
http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0 http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.1.0.xsd
http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd">
<cm:property-placeholder id="properties" persistent-id="ca.islandora.alpaca.connector.fits" update-strategy="reload" >
<cm:default-properties>
<cm:property name="error.maxRedeliveries" value="5"/>
<cm:property name="in.stream" value="activemq:queue:islandora-connector-fits"/>
<cm:property name="derivative.service.url" value="http://127.0.0.1/crayfits"/>
</cm:default-properties>
</cm:property-placeholder>
<reference id="broker" interface="org.apache.camel.Component" filter="(osgi.jndi.service.name=fcrepo/Broker)"/>
<bean id="http" class="org.apache.camel.component.http4.HttpComponent"/>
<bean id="https" class="org.apache.camel.component.http4.HttpComponent"/>
<camelContext id="IslandoraConnectorFits" xmlns="http://camel.apache.org/schema/blueprint">
<package>ca.islandora.alpaca.connector.derivative</package>
</camelContext>
</blueprint>
EOF
cat << EOF > /opt/karaf/deploy/ca.islandora.alpaca.connector.homarus.blueprint.xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- managed by ansible -->
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
xsi:schemaLocation="
http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0 http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.1.0.xsd
http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd">
<cm:property-placeholder id="properties" persistent-id="ca.islandora.alpaca.connector.homarus" update-strategy="reload" >
<cm:default-properties>
<cm:property name="error.maxRedeliveries" value="5"/>
<cm:property name="in.stream" value="activemq:queue:islandora-connector-homarus"/>
<cm:property name="derivative.service.url" value="http://127.0.0.1/homarus/convert"/>
</cm:default-properties>
</cm:property-placeholder>
<reference id="broker" interface="org.apache.camel.Component" filter="(osgi.jndi.service.name=fcrepo/Broker)"/>
<bean id="http" class="org.apache.camel.component.http4.HttpComponent"/>
<bean id="https" class="org.apache.camel.component.http4.HttpComponent"/>
<camelContext id="IslandoraConnectorHomarus" xmlns="http://camel.apache.org/schema/blueprint">
<package>ca.islandora.alpaca.connector.derivative</package>
</camelContext>
</blueprint>
EOF
cat << EOF > /opt/karaf/deploy/ca.islandora.alpaca.connector.houdini.blueprint.xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- managed by ansible -->
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
xsi:schemaLocation="
http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0 http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.1.0.xsd
http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd">
<cm:property-placeholder id="properties" persistent-id="ca.islandora.alpaca.connector.houdini" update-strategy="reload" >
<cm:default-properties>
<cm:property name="error.maxRedeliveries" value="5"/>
<cm:property name="in.stream" value="activemq:queue:islandora-connector-houdini"/>
<cm:property name="derivative.service.url" value="http://127.0.0.1/houdini/convert"/>
</cm:default-properties>
</cm:property-placeholder>
<reference id="broker" interface="org.apache.camel.Component" filter="(osgi.jndi.service.name=fcrepo/Broker)"/>
<bean id="http" class="org.apache.camel.component.http4.HttpComponent"/>
<bean id="https" class="org.apache.camel.component.http4.HttpComponent"/>
<camelContext id="IslandoraConnectorHoudini" xmlns="http://camel.apache.org/schema/blueprint">
<package>ca.islandora.alpaca.connector.derivative</package>
</camelContext>
</blueprint>
EOF
cat << EOF > /opt/karaf/deploy/ca.islandora.alpaca.connector.ocr.blueprint.xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- managed by ansible -->
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
xsi:schemaLocation="
http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0 http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.1.0.xsd
http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd">
<cm:property-placeholder id="properties" persistent-id="ca.islandora.alpaca.connector.ocr" update-strategy="reload" >
<cm:default-properties>
<cm:property name="error.maxRedeliveries" value="5"/>
<cm:property name="in.stream" value="activemq:queue:islandora-connector-ocr"/>
<cm:property name="derivative.service.url" value="http://127.0.0.1/hypercube"/>
</cm:default-properties>
</cm:property-placeholder>
<reference id="broker" interface="org.apache.camel.Component" filter="(osgi.jndi.service.name=fcrepo/Broker)"/>
<bean id="http" class="org.apache.camel.component.http4.HttpComponent"/>
<bean id="https" class="org.apache.camel.component.http4.HttpComponent"/>
<camelContext id="IslandoraConnectorOCR" xmlns="http://camel.apache.org/schema/blueprint">
<package>ca.islandora.alpaca.connector.derivative</package>
</camelContext>
</blueprint>
EOF
# Import everything in from islandora_defaults except...
# block.block.carapace*
# media.type.document
# rdf.mapping.media.document
# field.field.media.document.*
# core.entity_view_display.media.document.*
# core.entity_form_display.media.document.*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment