Skip to content

Instantly share code, notes, and snippets.

@marrobi
Last active Dec 2, 2018
Embed
What would you like to do?
OpenCGA_InstallOpenCGA
RELEASE_URL=${1}
HD_INSIGHTS_SSH_DNS=${2}
HD_INSIGHTS_SSH_USER=${3}
HD_INSIGHTS_SSH_PASS=${4}
#setting up opencga VM
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install software-properties-common -y
#install java
sudo -- sh -c 'echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | debconf-set-selections && add-apt-repository -y ppa:webupd8team/java && apt-get update && apt-get install -y oracle-java8-installer && rm -rf /var/lib/apt/lists/* && rm -rf /var/cache/oracle-jdk8-installer'
#install redis, tomcat, maven and git
sudo add-apt-repository universe && sudo apt-get update && sudo apt-get install redis-server redis-tools tomcat8 maven git-core sshpass -y
#install mongodb
if service --status-all | grep -Fq 'mongod'; then
echo "mongo service already exists"
else
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list
sudo apt-get update
sudo apt-get install -y mongodb-org
sudo apt-get update
sudo apt-get upgrade -y
sudo systemctl enable mongod.service # start on boot
fi
#install solr
# check if installed
if service --status-all | grep -Fq 'solr'; then
echo "solr service already exists"
else
wget https://www-eu.apache.org/dist/lucene/solr/7.5.0/solr-7.5.0.tgz
tar xvfz solr-7.5.0.tgz
cd solr-7.5.0/bin
sudo ./install_solr_service.sh ../../solr-7.5.0.tgz
fi
if [ -d /opt/opencga ]; then
echo "opencga already exists"
else
cd ~
wget --no-check-certificate $RELEASE_URL -O opencga.tar.gz
#move opencga to /opt/opencga folder
# todo: delete if exists?
sudo mkdir /opt/opencga
sudo tar xvf opencga.tar.gz --strip-components=1 -C /opt/opencga #places build in ~/opencga
#sudo cp -r ~/opencga/
fi
if [ -f /var/lib/tomcat8/conf/Catalina/localhost/opencga.xml ]; then
echo "opencga tomcat config already exists"
else
#copy opencga build to tomcat server
sudo cp /opt/opencga/opencga*.war /var/lib/tomcat8/webapps/opencga.war
sudo chown -R tomcat8 /opt/opencga/ #give tomcat8 user ownership of opencga folder
wget -O /var/lib/tomcat8/conf/Catalina/localhost/opencga.xml https://gist.githubusercontent.com/marrobi/526faa8d372925a6b53119598dfa8abc/raw/a69caf8a95e56fc91df26d3c04d87688bdb3c05b/catalina%2520opencga.xml
fi
# Change hbase.client.keyvalue.maxsize to 0 in /etc/hbase/conf/hbase-site.xml on hadoop cluster to avoid 'KeyValue size too large' error
# by sshing to your (hdinsight cluster e.g. ssh sshuser@bartcga-ssh.azurehdinsight.net) and changing the xml (e.g. vi /etc/hbase/conf/hbase-site.xml)
# copy conf files from hdinsight cluster (from /etc/hadoop/conf & /etc/hbase/conf) to opencga VM
# place these files in /opt/opencga/conf/hadoop, by e.g.: (todo: change connection strings)
sshpass -p $HD_INSIGHTS_SSH_PASS scp -o StrictHostKeyChecking=no -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -r $HD_INSIGHTS_SSH_USER@$HD_INSIGHTS_SSH_DNS:/etc/hadoop/conf /opt/opencga/conf/hadoop
# same with /etc/hbase/conf, e.g.
sshpass -p $HD_INSIGHTS_SSH_PASS scp -o StrictHostKeyChecking=no -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -r $HD_INSIGHTS_SSH_USER@$HD_INSIGHTS_SSH_DNS:/etc/hbase/conf /opt/opencga/conf/hadoop
#reboot VM
sudo reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment