Commit be21a96a authored by Matthieu Muffato's avatar Matthieu Muffato
Browse files

Added a script to deploy guiHive

parent a5cc5d66
#!/bin/sh
GUIHIVE_URL='http://www.github.com/Ensembl/guiHive'
EHIVE_URL='http://www.github.com/Ensembl/ensembl-hive'
DEPLOY_LOCATION="$(dirname "$0")"
EHIVE_CLONE_LOCATION="${DEPLOY_LOCATION}/clones/ensembl-hive"
GUIHIVE_CLONE_LOCATION="${DEPLOY_LOCATION}/clones/guiHive"
GUIHIVE_VERSIONS_DIR="${DEPLOY_LOCATION}"/versions
EHIVE_VERSIONS_DIR="${DEPLOY_LOCATION}"/ensembl-hive
# Any failure will cause the script to exit
trap "echo 'An error occurred. Deployment aborted'; exit 1" EXIT
set -e
reference_clone () {
# $git_url $target_dir
echo "get reference clone for $2 from $1"
if [ -d "$2" ]
then
GIT_DIR="$2" git fetch
else
git clone --mirror "$1" "$2"
fi
}
reference_clone "$EHIVE_URL" "$EHIVE_CLONE_LOCATION"
reference_clone "$GUIHIVE_URL" "$GUIHIVE_CLONE_LOCATION"
## "Safe" functions that can deal with pre-incarnations of the target
safe_clone () {
# safe_clone $branch $URL $dest
rm -rf "$3"
mkdir -p "$3"
GIT_DIR="$2" GIT_WORK_TREE="$3" git checkout -qf "$1"
}
safe_symlink () {
# safe_symlink $source $target
rm -rf "$2"
ln -s "$1" "$2"
}
## Higher-level functions that wrap the safe functions
add_guihive_version () {
echo "checkout $1: guiHive $2 and eHive $3"
safe_clone "$2" "$GUIHIVE_CLONE_LOCATION" "${GUIHIVE_VERSIONS_DIR}/$1"
safe_clone "$3" "$EHIVE_CLONE_LOCATION" "${EHIVE_VERSIONS_DIR}/$1"
rm -rf "${EHIVE_VERSIONS_DIR}/$1/docs"
rm -rf "${EHIVE_VERSIONS_DIR}/$1/wrappers"
}
link_guihive_version () {
echo "checkout $1: guiHive =$2 and eHive sql_$1"
safe_symlink "$2" "${GUIHIVE_VERSIONS_DIR}/$1"
safe_clone "sql_schema_$((${1}+1))_start^" "$EHIVE_CLONE_LOCATION" "${EHIVE_VERSIONS_DIR}/$1"
rm -rf "${EHIVE_VERSIONS_DIR}/$1/docs"
rm -rf "${EHIVE_VERSIONS_DIR}/$1/wrappers"
}
## List of versions
# $db_version guihive_branch ehive_branch
add_guihive_version "56" "db_version/56" "version/2.0"
add_guihive_version "62" "db_version/62" "version/2.2"
add_guihive_version "73" "db_version/73" "version/2.3"
add_guihive_version "77" "db_version/77" "master"
# $db_version $aliased_db_version
link_guihive_version "63" "62"
link_guihive_version "64" "73"
link_guihive_version "65" "73"
link_guihive_version "66" "73"
link_guihive_version "67" "73"
link_guihive_version "68" "73"
link_guihive_version "69" "73"
link_guihive_version "70" "73"
link_guihive_version "71" "73"
link_guihive_version "72" "73"
link_guihive_version "74" "73"
link_guihive_version "75" "73"
link_guihive_version "76" "77"
trap - EXIT
......@@ -23,17 +23,6 @@
use strict;
use warnings;
# ## The last added version is the one used here
# BEGIN {
# my $last_version = `ls -t $ENV{GUIHIVE_BASEDIR}/versions/ | head -n 1`;
# chomp $last_version;
# unshift @INC, $ENV{GUIHIVE_BASEDIR} . "versions/$last_version/ensembl-hive/modules";
# unshift @INC, $ENV{GUIHIVE_BASEDIR} . "versions/$last_version/scripts/lib";
# require Bio::EnsEMBL::Hive::DBSQL::DBAdaptor;
# require Bio::EnsEMBL::Hive::DBSQL::SqlSchemaAdaptor;
# require Bio::EnsEMBL::Hive::Utils::URL;
# }
## The servers should have already set the PERL5LIB to point to the latest hive API in versions
use Bio::EnsEMBL::Hive::DBSQL::DBAdaptor;
use Bio::EnsEMBL::Hive::DBSQL::SqlSchemaAdaptor;
......
......@@ -42,20 +42,33 @@ else {
"http://golang.org/doc/install");
}
# EHIVE_ROOT_DIR
print " Checking EHIVE_ROOT_DIR environmental variable: ";
my $ehive_root_dir_envar = $ENV{EHIVE_ROOT_DIR};
chomp $ehive_root_dir_envar;
if ($ehive_root_dir_envar) {
print "[$ehive_root_dir_envar] ... OK\n";
} else {
not_met_dep( "EHIVE_ROOT_DIR",
"echo \$EHIVE_ROOT_DIR",
"The EHIVE_ROOT_DIR has to be defined in the session where the guiHive server is running",
"Set this env variable to the root dir of your hive code"
);
print " Checking if some versions have been deployed: ";
eval {
-d "versions" or die;
-d "ensembl-hive" or die;
opendir my $dir, "versions" or die "Cannot open directory: $!";
my @files1 = readdir $dir;
closedir $dir;
die if scalar(@files1) <= 2; # There is always "." and ".."
opendir $dir, "ensembl-hive" or die "Cannot open directory: $!";
my @files2 = readdir $dir;
closedir $dir;
my %f1 = map {$_ => 1} @files1;
my %f2 = map {$_ => 1} @files2;
die if grep {!$f1{$_}} @files2;
die if grep {!$f2{$_}} @files1;
delete $f1{'.'};
delete $f1{'..'};
print "[".join('/', keys %f1)."] ... OK\n";
};
if ($@) {
not_met_dep("Deployed versions",
"ls ensembl-hive/ versions/",
"You need to setup guiHive and eHive versions before running the server",
"bash guihive-deploy.sh");
}
###########################
## eHive ##
###########################
......@@ -86,34 +99,6 @@ if ($subvers >= 8) {
);
}
print " Checking Ensembl API installation";
eval {
require Bio::EnsEMBL::Registry;
};
if ($@) {
not_met_dep( "Ensembl",
"perl -MBio::EnsEMBL::Registry -e ''",
"The ensembl API checkout is not found in the system. eHive depends on the core API. BioPerl or any other Ensembl checkout are not needed",
"See http://www.ensembl.org/info/docs/api/api_installation.html"
);
} else {
print " ... OK\n";
}
## Hive code
print " Checking eHive API installation";
eval {
require Bio::EnsEMBL::Hive;
};
if ($@) {
not_met_dep( "Hive",
"perl -MBio::EnsEMBL::Hive -e ''",
"The hive API checkout is not found in the system",
"See http://www.ensembl.org/info/docs/eHive.html"
);
} else {
print " ... OK\n";
}
print "\nCHECKING EHIVE DEPENDENCIES:\n";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment