diff --git a/highspec/startup.sh b/highspec/startup.sh new file mode 100644 index 0000000000000000000000000000000000000000..338922643a9e1b77035ef9c5c5cf2208f4c6b55d --- /dev/null +++ b/highspec/startup.sh @@ -0,0 +1,76 @@ +#!/bin/bash + +CURRDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# update yum +yum update -y + +# install dependencies +wget $PBZIP_BASE_URL/$PBZIP_PACKAGE +yum install $BASIC_DEPENDENCIES $PBZIP_PACKAGE -y +rm $PBZIP_PACKAGE + +# get Neo4J +wget $NEO4J_DOWNLOAD_URL +tar -xvf artifact.php?name=$NEO4J_SETUP_FILE +rm artifact.php?name=$NEO4J_SETUP_FILE -f +mv $NEO4J_VERSION /var/lib/ + +export NEO4J_HOME=/var/lib/$NEO4J_VERSION + +# get apoc plugin +wget $APOC_URL +mv $APOC_VERSION $NEO4J_HOME/plugins/ + +### make few config changes for Neo4J +for line in `cat $CURRDIR/neo4j.conf`; do + sed -i -e "1i$line\\" $NEO4J_HOME/conf/neo4j.conf +done + +# provide ownership to ec2-user user +chown -R ec2-user:ec2-user $NEO4J_HOME + +# get the SSD device name +device=$(lsblk | grep nvme0n1 | cut -d' ' -f1) + +# create an ext4 partition on the disk +mkfs.ext4 -E nodiscard -m0 /dev/$device + +# create a mount point +mountpoint=/media/disk1 +sudo mkdir -p $mountpoint + +# mount the device +mount -o discard /dev/$device $mountpoint + +# provide ownership to ec2-user user +chown -R ec2-user:ec2-user $mountpoint + +# get compressed graph db from S3 +echo "Getting compressed graph db from S3 - START" +date +aws s3 cp s3://ebi-pdbe/neo4j/graph.db.tgz $mountpoint/ +date +echo "Getting compressed graph db from S3 - END" + +# create directories for neo4j data +mkdir -p $mountpoint/neo4j_data/databases/graph.db +mkdir -p $mountpoint/neo4j_data/dbms +graphdb_path=$mountpoint/neo4j_data/databases/graph.db +mv $mountpoint/graph.db.tgz $mountpoint/neo4j_data/databases/graph.db/ + +# uncompress graph data +echo "Uncompress graph db - START" +cd $mountpoint/neo4j_data/databases/graph.db +date +pbzip2 -dc graph.db.tgz | tar x +date +rm graph.db.tgz +echo "Uncompress graph db - END" + +# Change Neo4J config to pick data from new location +sed -i -e '1idbms.directories.data='${mountpoint}'/neo4j_data\' $NEO4J_HOME/conf/neo4j.conf + +echo "Starting Neo4J" +sudo -u ec2-user $NEO4J_HOME/bin/neo4j start + diff --git a/highspec/userdata_script b/highspec/userdata_script new file mode 100644 index 0000000000000000000000000000000000000000..b96eff682162c212e6c8870ac3b1b22affd313e7 --- /dev/null +++ b/highspec/userdata_script @@ -0,0 +1,9 @@ +#!/bin/bash + +yum update -y +yum install git -y + +git clone https://gitlab.ebi.ac.uk/sreenath/pdbe-neo4j-aws.git +cd pdbe-neo4j-aws +chmod -R 755 . +./setup.sh highspec diff --git a/playground/userdata_script b/playground/userdata_script new file mode 100644 index 0000000000000000000000000000000000000000..a800d61fb496cbcbb4995a98e9156d52a7f42b73 --- /dev/null +++ b/playground/userdata_script @@ -0,0 +1,9 @@ +#!/bin/bash + +yum update -y +yum install git -y + +git clone https://gitlab.ebi.ac.uk/sreenath/pdbe-neo4j-aws.git +cd pdbe-neo4j-aws +chmod -R 755 . +./setup.sh playground