Skip to content

Instantly share code, notes, and snippets.

@sdumitriu
Forked from josch/phenotips_tomcat.sh
Last active March 19, 2019 19:28
Show Gist options
  • Save sdumitriu/4be7d0d6811ba5e6213fedcb55cf0e14 to your computer and use it in GitHub Desktop.
Save sdumitriu/4be7d0d6811ba5e6213fedcb55cf0e14 to your computer and use it in GitHub Desktop.
Setting up phenotips on Ubuntu Xenial with Tomcat
#!/bin/sh
set -exu
directory=ubuntu-xenial-robot
debootstrap --variant=minbase --include=dbus,systemd-sysv xenial "$directory" http://archive.ubuntu.com/ubuntu/
systemd-nspawn --boot --directory="$directory" &
pid=$!
sleep 10 # wait for the system to boot
machinectl shell "$directory" /bin/sh -- -c "
set -exu
apt update
apt install --yes tomcat8
"
mkdir -p "$directory"/var/lib/tomcat8/webapps/phenotips
if [ ! -e phenotips-war-1.3.7.war ]; then
curl https://nexus.phenotips.org/nexus/content/repositories/releases/org/phenotips/phenotips-war/1.3.7/phenotips-war-1.3.7.war > phenotips-war-1.3.7.war
fi
echo 0f1b9e1bea6ad479e46a6fbda253ad45 phenotips-war-1.3.7.war | md5sum --check
unzip -d "$directory"/var/lib/tomcat8/webapps/phenotips phenotips-war-1.3.7.war
mkdir -p "$directory"/var/lib/phenotips/solr/
if [ ! -e solr-configuration-1.3.7.jar ]; then
curl https://nexus.phenotips.org/nexus/content/repositories/releases/org/phenotips/solr-configuration/1.3.7/solr-configuration-1.3.7.jar > solr-configuration-1.3.7.jar
fi
echo 0af9a309462f11dd974b6d3a6ab5fa68 solr-configuration-1.3.7.jar | md5sum --check
unzip -d "$directory"/var/lib/phenotips/solr solr-configuration-1.3.7.jar
machinectl shell "$directory" /bin/chown -- -R tomcat8:tomcat8 /var/lib/phenotips
sed -i -r -e 's/^(\s*JAVA_OPTS.*-Xmx)([^" ]+)(.*)/\12g\3/' "$directory/etc/default/tomcat8"
machinectl poweroff "$directory"
wait $pid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment