From b333f711c9037afb9d4505a56ea00ce59cceedf3 Mon Sep 17 00:00:00 2001 From: Christophe Antoniewski Date: Wed, 14 Feb 2018 11:15:37 +0100 Subject: [PATCH] deployment scripts for ansible and docker, doc and draft of test in prevision of .travis.yml --- README.md | 33 ++++++++++++++++++++++++++++++++- build_docker_image.sh | 24 ++++++++++++++++++++++++ install.sh | 5 +++-- test.sh | 34 ++++++++++++++++++++++++++++++++++ 4 files changed, 93 insertions(+), 3 deletions(-) create mode 100644 build_docker_image.sh create mode 100644 test.sh diff --git a/README.md b/README.md index 688c70d..7638281 100644 --- a/README.md +++ b/README.md @@ -1 +1,32 @@ -# metavisitor \ No newline at end of file +# metavisitor + +This is the repository for the automated deployment of a [Metavisitor](https://doi.org/10.1371/journal.pone.0168397) Galaxy server + +## Quick Start + +Tested on Ubuntu 14.04 - You must have root access (be sudoer) + +- Install git +``` +apt-get -y update && apt-get -y install git +``` +- Clone locally this repository +``` +git clone https://github.com/ARTbio/metavisitor.git +``` +- Navigate to metavisitor directory +``` +cd metavisitor +``` + +### For a ansible deployment of metavisitor +- run the `install.sh` script +``` +sh install.sh +``` +### For a Docker image built +- run the `build_docker_image.sh` script +``` +sh build_docker_image.sh +``` + diff --git a/build_docker_image.sh b/build_docker_image.sh new file mode 100644 index 0000000..eed81b7 --- /dev/null +++ b/build_docker_image.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +set -e +apt-get install -y python-pip python-dev python-setuptools git htop +echo "Upgrading pip to v 1.9" +pip install -U pip +pip --version +/usr/local/bin/pip install ansible==2.2 +ansible --version + +git clone https://github.com/ARTbio/GalaxyKickStart.git +rm -rf GalaxyKickStart/Dockerfile GalaxyKickStart/Dockerfile.test +mv Dockerfile Dockerfile.test GalaxyKickStart/ +rm -rf GalaxyKickStart/group_vars/metavisitor GalaxyKickStart/group_vars/test +mv group_vars/metavisitor group_vars/test GalaxyKickStart/group_vars/ +rm -rf GalaxyKickStart/extra-files/metavisitor GalaxyKickStart/extra-files/test +mv extra-files/metavisitor extra-files/test GalaxyKickStart/extra-files/ +rm -rf GalaxyKickStart/inventory_files/* +mv inventory_files/metavisitor inventory_files/test GalaxyKickStart/inventory_files/ + +cd GalaxyKickStart/ +ansible-galaxy install -r requirements_roles.yml -p roles/ -f +echo "Editing group_vars/all" +sed -i -e 's/galaxy_manage_trackster: true/galaxy_manage_trackster: false/' group_vars/all +docker build -t metavisitor . \ No newline at end of file diff --git a/install.sh b/install.sh index a7d9752..b681cb1 100644 --- a/install.sh +++ b/install.sh @@ -21,9 +21,10 @@ cd GalaxyKickStart/ ansible-galaxy install -r requirements_roles.yml -p roles/ -f echo "Editing group_vars/all" sed -i -e 's/galaxy_manage_trackster: true/galaxy_manage_trackster: false/' group_vars/all -ansible-playbook -i inventory_files/test galaxy.yml +ansible-playbook -i inventory_files/metavisitor galaxy.yml echo "Sleeping 15 sec before restarting Metavisitor Test Galaxy server" echo "zzzz zzzz..." sleep 15 supervisorctl restart galaxy: -echo "if galaxy:galaxy_web failed to restart with error termination, just do `killall uwsgi; supervisorctl restart galaxy:`" \ No newline at end of file +sleep 15 +supervisorctl status \ No newline at end of file diff --git a/test.sh b/test.sh new file mode 100644 index 0000000..3d695af --- /dev/null +++ b/test.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash +set -e +apt-get install -y python-pip python-dev python-setuptools git htop +echo "Upgrading pip to v 1.9" +pip install -U pip +pip --version +/usr/local/bin/pip install ansible==2.2 +ansible --version + +git clone https://github.com/ARTbio/GalaxyKickStart.git +rm -rf GalaxyKickStart/Dockerfile GalaxyKickStart/Dockerfile.test +mv Dockerfile Dockerfile.test GalaxyKickStart/ +rm -rf GalaxyKickStart/group_vars/metavisitor GalaxyKickStart/group_vars/test +mv group_vars/metavisitor group_vars/test GalaxyKickStart/group_vars/ +rm -rf GalaxyKickStart/extra-files/metavisitor GalaxyKickStart/extra-files/test +mv extra-files/metavisitor extra-files/test GalaxyKickStart/extra-files/ +rm -rf GalaxyKickStart/inventory_files/* +mv inventory_files/metavisitor inventory_files/test GalaxyKickStart/inventory_files/ + +cd GalaxyKickStart/ +ansible-galaxy install -r requirements_roles.yml -p roles/ -f +echo "Editing group_vars/all" +sed -i -e 's/galaxy_manage_trackster: true/galaxy_manage_trackster: false/' group_vars/all +ansible-playbook -i inventory_files/test galaxy.yml +echo "Sleeping 15 sec before restarting Metavisitor Test Galaxy server" +echo "zzzz zzzz..." +sleep 15 +supervisorctl restart galaxy: +sleep 15 +supervisorctl status + +service supervisor stop +sleep 5 +docker build -t metavisitor -f Dockerfile.test .