Skip to content

Commit

Permalink
Karaf installation
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-dgi authored and Andrew Woods committed Sep 15, 2015
1 parent ad3fc28 commit 82d1da5
Show file tree
Hide file tree
Showing 7 changed files with 86 additions and 18 deletions.
4 changes: 3 additions & 1 deletion Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,21 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# config.vm.box_url = "https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box"

config.vm.network :forwarded_port, guest: 8080, host: 8080 # Tomcat
config.vm.network :forwarded_port, guest: 9080, host: 9080 # Fixity and Reindexing

config.vm.provider "virtualbox" do |v|
v.memory = 2048
end

shared_dir = "/vagrant"

config.vm.provision "shell", path: "./install_scripts/bootstrap.sh", args: shared_dir
config.vm.provision "shell", path: "./install_scripts/bootstrap.sh", args: shared_dir
config.vm.provision "shell", path: "./install_scripts/java.sh", args: shared_dir
config.vm.provision "shell", path: "./install_scripts/tomcat7.sh", args: shared_dir
config.vm.provision "shell", path: "./install_scripts/solr.sh", args: shared_dir
config.vm.provision "shell", path: "./install_scripts/fedora4.sh", args: shared_dir
config.vm.provision "shell", path: "./install_scripts/fuseki.sh", args: shared_dir
config.vm.provision "shell", path: "./install_scripts/karaf.sh", args: shared_dir
config.vm.provision "shell", path: "./install_scripts/fedora_camel_toolbox.sh", args: shared_dir

end
2 changes: 2 additions & 0 deletions install_scripts/config
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@ FUSEKI_DEPLOY=/var/lib/tomcat7/webapps

SOLR_VERSION=4.10.3
SOLR_HOME=/var/lib/tomcat7/solr

KARAF_VERSION=4.0.1
6 changes: 6 additions & 0 deletions install_scripts/fedora_camel_toolbox.script
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
feature:repo-add mvn:org.fcrepo.camel/fcrepo-camel-toolbox/LATEST/xml/features
feature:install fcrepo-indexing-solr
feature:install fcrepo-indexing-triplestore
feature:install fcrepo-audit-triplestore
feature:install fcrepo-reindexing
feature:install fcrepo-fixity
20 changes: 4 additions & 16 deletions install_scripts/fedora_camel_toolbox.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#############
######################
# Fedora Camel Toolbox
#############
######################

echo "Installing Fedora Camel Toolbox"

Expand All @@ -12,18 +12,6 @@ fi

cd $HOME_DIR

if [ ! -f "$DOWNLOAD_DIR/fcrepo-camel-webapp-at-is-it-rs-${FEDORA_VERSION}.war" ]; then
echo -n "Downloading Fedora Camel Toolbox..."
wget -q -O "$DOWNLOAD_DIR/fcrepo-camel-webapp-at-is-it-rs-${FEDORA_VERSION}.war" "https://github.com/fcrepo4-labs/fcrepo-camel-toolbox/releases/download/fcrepo-camel-toolbox-${FEDORA_TAG}/fcrepo-camel-webapp-at-is-it-rs-${FEDORA_VERSION}.war"
echo " done"
fi

cp "$DOWNLOAD_DIR/fcrepo-camel-webapp-at-is-it-rs-${FEDORA_VERSION}.war" /var/lib/tomcat7/webapps/fcrepo-camel-webapp.war
chown tomcat7:tomcat7 /var/lib/tomcat7/webapps/fcrepo-camel-webapp.war

SOLR_URL_ARG="localhost:8080/solr/collection1"
if ! grep -q ${SOLR_URL_ARG} /etc/default/tomcat7 ; then
echo "CATALINA_OPTS=\"\${CATALINA_OPTS} -Dsolr.base.url=${SOLR_URL_ARG}\"" >> /etc/default/tomcat7;
fi
/opt/karaf/bin/client < "$SHARED_DIR/install_scripts/fedora_camel_toolbox.script"

service tomcat7 restart
sed -i 's|solr.baseUrl=localhost:8983/solr/collection1|solr.baseUrl=localhost:8080/solr/collection1|' /opt/karaf/etc/org.fcrepo.camel.indexing.solr.cfg
2 changes: 1 addition & 1 deletion install_scripts/fuseki.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if [ -f "$SHARED_DIR/install_scripts/config" ]; then
fi

if [ ! -d $FUSEKI_BASE ]; then
mkdir $FUSEKI_BASE
mkdir -p $FUSEKI_BASE/configuration
chown -hR tomcat7:tomcat7 $FUSEKI_BASE
fi

Expand Down
66 changes: 66 additions & 0 deletions install_scripts/karaf.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
##############
# Apache Karaf
##############

echo "Installing Apache Karaf"

SHARED_DIR=$1

if [ -f "$SHARED_DIR/install_scripts/config" ]; then
. $SHARED_DIR/install_scripts/config
fi

cd $HOME_DIR

if [ ! -f "$DOWNLOAD_DIR/apache-karaf-$KARAF_VERSION.tar.gz" ]; then
echo -n "Downloading Apache Karaf..."
wget -q -O "$DOWNLOAD_DIR/apache-karaf-$KARAF_VERSION.tar.gz" "http://mirror.csclub.uwaterloo.ca/apache/karaf/"$KARAF_VERSION"/apache-karaf-"$KARAF_VERSION".tar.gz"
echo " done"
fi

if [ ! -d "/opt/apache-karaf-$KARAF_VERSION" ]; then
if [ ! -d "$HOME_DIR/apache-karaf-$KARAF_VERSION" ]; then
echo -n "Extracting Apache Karaf..."
tar zxf "$DOWNLOAD_DIR/apache-karaf-$KARAF_VERSION.tar.gz"
echo " done"
fi
if [ ! -d "/opt/apache-karaf-$KARAF_VERSION" ]; then
echo "Deploying Apache Karaf... "
mv "$HOME_DIR/apache-karaf-$KARAF_VERSION" /opt
echo " done"
fi
fi

if [ -L "/opt/karaf" ]; then
rm /opt/karaf
fi
echo "Symlinking Apache Karaf... "
ln -s "/opt/apache-karaf-$KARAF_VERSION" /opt/karaf
echo " done"

if [ ! -L "/etc/init.d/karaf-service" ]; then
echo "Installing Karaf as a service... "
# Run a setup script to add some feature repos and prepare it for running as a service
/opt/karaf/bin/start
sleep 60
/opt/karaf/bin/client < $SHARED_DIR/install_scripts/karaf_service.script
/opt/karaf/bin/stop

# Add it as a Linux service
ln -s /opt/karaf/bin/karaf-service /etc/init.d/
update-rc.d karaf-service defaults
echo " done"
fi

# Add the vagrant user's maven repository
if ! grep -q "$HOME_DIR/.m2/repository" /opt/karaf/etc/org.ops4j.pax.url.mvn.cfg ; then
echo "Adding vagrant user's Maven repository... "
sed -i "s|#org.ops4j.pax.url.mvn.localRepository=|org.ops4j.pax.url.mvn.localRepository=$HOME_DIR/.m2/repository|" /opt/karaf/etc/org.ops4j.pax.url.mvn.cfg
echo " done"
fi

# Start it
echo "Starting Karaf as a service... "
service karaf-service start
sleep 60
echo " done"
4 changes: 4 additions & 0 deletions install_scripts/karaf_service.script
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
feature:install wrapper
shell:sleep 1000
wrapper:install
logout

0 comments on commit 82d1da5

Please sign in to comment.