From 9ef0a24a6fdb9d3dd2c6e2889aeccd64c125e103 Mon Sep 17 00:00:00 2001
From: Ludovic Claude <ludovic.claude54@gmail.com>
Date: Mon, 1 May 2017 19:19:55 +0200
Subject: [PATCH] Modernise release management

---
 .bumpversion.cfg                              | 14 +++
 .pre-commit-config.yaml                       |  8 ++
 Dockerfile                                    | 43 +++++----
 LICENSE                                       | 17 +++-
 README.md                                     | 18 +++-
 after-git-clone.sh                            |  3 +
 after-update.sh                               |  3 +
 build.sh                                      |  8 +-
 docker/runner/README.md                       | 12 +--
 docker/runner/config/application.tmpl         | 16 ++--
 docker/runner/run.sh                          |  4 +-
 docker_push.sh                                | 32 -------
 hbp.yml                                       | 94 +++++++++++++++++++
 pom.xml                                       |  2 +-
 publish.sh                                    | 89 ++++++++++++++++++
 slack.json                                    |  1 +
 .../PersistenceConfiguration.java             | 18 ++--
 src/main/java/eu/hbp/mip/utils/DataUtil.java  | 12 +--
 .../resources/data/exareme_algorithms.json    |  2 +-
 tests/integration/algorithmsFactory/test.sh   |  2 +-
 tests/post-test-run.sh                        |  8 +-
 tests/pre-test-run.sh                         | 22 ++---
 22 files changed, 317 insertions(+), 111 deletions(-)
 create mode 100644 .bumpversion.cfg
 create mode 100644 .pre-commit-config.yaml
 create mode 100755 after-git-clone.sh
 create mode 100755 after-update.sh
 delete mode 100755 docker_push.sh
 create mode 100644 hbp.yml
 create mode 100755 publish.sh
 create mode 100644 slack.json

diff --git a/.bumpversion.cfg b/.bumpversion.cfg
new file mode 100644
index 000000000..226f068d6
--- /dev/null
+++ b/.bumpversion.cfg
@@ -0,0 +1,14 @@
+[bumpversion]
+current_version = 2.0.0
+commit = True
+tag = True
+tag_name = {new_version}
+parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)-(?P<package>\d+)
+serialize = {major}.{minor}.{patch}-{package}
+
+[bumpversion:file:pom.xml]
+search = <version>{current_version}</version><!-- BUMP_VERSION -->
+
+[bumpversion:file:Dockerfile]
+
+[bumpversion:file:hbp.yml]
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 000000000..eee6314bc
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,8 @@
+- repo: git://github.com/pre-commit/pre-commit-hooks
+  sha: v0.7.1
+  hooks:
+    - id: trailing-whitespace
+    - id: end-of-file-fixer
+    - id: check-merge-conflict
+    - id: check-added-large-files
+    - id: check-yaml
diff --git a/Dockerfile b/Dockerfile
index aed589bde..4196234ab 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,36 +1,39 @@
-FROM java:openjdk-8u92-jdk-alpine
+FROM openjdk:8u121-jre-alpine
+MAINTAINER Mirco Nasuti <mirco.nasuti@chuv.ch>
 
-MAINTAINER mirco.nasuti@chuv.ch
+ARG BUILD_DATE
+ARG VCS_REF
+ARG VERSION
 
-ENV DOCKERIZE_VERSION=v0.2.0
+ENV DOCKERIZE_VERSION=v0.4.0
 
 RUN apk add --update ca-certificates wget \
-    && rm -rf /var/cache/apk/* /tmp/* \
     && update-ca-certificates \
     && wget -O /tmp/dockerize.tar.gz https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-${DOCKERIZE_VERSION}.tar.gz \
     && tar -C /usr/local/bin -xzvf /tmp/dockerize.tar.gz \
-    && rm -rf /tmp/dockerize.tar.gz
+    && rm -rf /var/cache/apk/* /tmp/*
 
 COPY docker/runner/config/application.tmpl /config/application.tmpl
 COPY docker/runner/README.md docker/runner/run.sh /
 
-ENV PORTAL_BACKEND_VERSION=1.1
+ENV PORTAL_BACKEND_VERSION=2.0.0
 
 COPY target/portal-backend-$PORTAL_BACKEND_VERSION.jar backend.jar
 
-# org.label-schema.build-date=$BUILD_DATE
-# org.label-schema.vcs-ref=$VCS_REF
-LABEL org.label-schema.schema-version="1.0" \
-        org.label-schema.license="AGPLv3" \
-        org.label-schema.name="portal-backend" \
-        org.label-schema.description="Java backend for the MIP portal" \
-        org.label-schema.url="https://mip.humanbrainproject.eu" \
-        org.label-schema.vcs-type="git" \
-        org.label-schema.vcs-url="https://github.com/LREN-CHUV/portal-backend" \
-        org.label-schema.vendor="LREN CHUV" \
-        org.label-schema.docker.dockerfile="Dockerfile" \
-        org.label-schema.memory-hint="2048"
-
 EXPOSE 8080
 
-CMD ["./run.sh"]
+ENTRYPOINT ["/run.sh"]
+
+LABEL org.label-schema.build-date=$BUILD_DATE \
+      org.label-schema.name="hbpmip/portal-backend" \
+      org.label-schema.description="Java backend for the MIP portal" \
+      org.label-schema.url="https://mip.humanbrainproject.eu" \
+      org.label-schema.vcs-type="git" \
+      org.label-schema.vcs-ref=$VCS_REF \
+      org.label-schema.vcs-url="https://github.com/LREN-CHUV/portal-backend" \
+      org.label-schema.version="$VERSION" \
+      org.label-schema.vendor="LREN CHUV" \
+      org.label-schema.license="AGPLv3" \
+      org.label-schema.docker.dockerfile="Dockerfile" \
+      org.label-schema.memory-hint="2048" \
+      org.label-schema.schema-version="1.0"
diff --git a/LICENSE b/LICENSE
index 2ac9d7ccd..3f6f8acee 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,3 +1,17 @@
+Original developer’s Attribution Information
+____________________________________________
+
+Attribution Copyright Notice: © 2016-2017 LREN CHUV.
+Attribution Phrase: Powered by the Medical Informatics Platform of the Human Brain Project
+Attribution URL: https://mip.humanbrainproject.eu
+
+All trademarks, service marks and/or trade names contained within the Attribution
+Information distributed with the covered code are the exclusive property of their
+owners and may only be used with the permission of their owners, or under
+circumstances otherwise permitted by law or as expressly set out in this License.
+
+---
+
                     GNU AFFERO GENERAL PUBLIC LICENSE
                        Version 3, 19 November 2007
 
@@ -65,7 +79,7 @@ License.
 
   "Copyright" also means copyright-like laws that apply to other kinds
 of works, such as semiconductor masks.
- 
+
   "The Program" refers to any copyrightable work licensed under this
 License.  Each licensee is addressed as "you".  "Licensees" and
 "recipients" may be individuals or organizations.
@@ -660,4 +674,3 @@ specific requirements.
 if any, to sign a "copyright disclaimer" for the program, if necessary.
 For more information on this, and how to apply and follow the GNU AGPL, see
 <http://www.gnu.org/licenses/>.
-
diff --git a/README.md b/README.md
index 3bbf48727..c47cd7e00 100644
--- a/README.md
+++ b/README.md
@@ -1,10 +1,10 @@
-## Backend for the MIP portal
-
-[![License](https://img.shields.io/badge/license-AGPL--3.0-blue.svg)](https://www.gnu.org/licenses/agpl-3.0.html)
-[![Codacy Badge](https://api.codacy.com/project/badge/Grade/087c83d0601a46c7a4dd91f2e5935a5a)](https://www.codacy.com/app/mirco-nasuti/portal-backend?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=LREN-CHUV/portal-backend&amp;utm_campaign=Badge_Grade)
+[![CHUV](https://img.shields.io/badge/CHUV-LREN-AF4C64.svg)](https://www.unil.ch/lren/en/home.html) [![License](https://img.shields.io/badge/license-AGPL--3.0-blue.svg)](https://www.gnu.org/licenses/agpl-3.0.html)
+[![Codacy Badge](https://api.codacy.com/project/badge/Grade/05ba08087da24b3980475f88e1a591b7)](https://www.codacy.com/app/hbp-mip/portal-backend?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=LREN-CHUV/portal-backend&amp;utm_campaign=Badge_Grade)
 [![DockerHub](https://img.shields.io/badge/docker-hbpmip%2Fportal--backend-008bb8.svg)](https://hub.docker.com/r/hbpmip/portal-backend/)
 [![CircleCI](https://circleci.com/gh/LREN-CHUV/portal-backend/tree/master.svg?style=svg)](https://circleci.com/gh/LREN-CHUV/portal-backend/tree/master)
 
+# Backend for the MIP portal
+
 ## Usage
 
 * Build a versioned image: `./build.sh`
@@ -14,9 +14,17 @@
 
 * See here: https://hub.docker.com/r/hbpmip/portal-backend/
 
+## Build
+
+Run: `./build.sh`
+
+## Publish on Docker Hub
+
+Run: `./publish.sh`
+
 ## License
 
-Copyright © 2016 LREN CHUV
+Copyright © 2016-2017 LREN CHUV
 
 Licensed under the GNU Affero General Public License, Version 3.0 (the "License");
 you may not use this file except in compliance with the License.
diff --git a/after-git-clone.sh b/after-git-clone.sh
new file mode 100755
index 000000000..2f72056fb
--- /dev/null
+++ b/after-git-clone.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+pre-commit install
diff --git a/after-update.sh b/after-update.sh
new file mode 100755
index 000000000..2f72056fb
--- /dev/null
+++ b/after-update.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+pre-commit install
diff --git a/build.sh b/build.sh
index ef6b40804..4573daa4a 100755
--- a/build.sh
+++ b/build.sh
@@ -13,8 +13,6 @@ get_script_dir () {
      pwd
 }
 
-export WORKSPACE=$(get_script_dir)
-
 if pgrep -lf sshuttle > /dev/null ; then
   echo "sshuttle detected. Please close this program as it messes with networking and prevents builds inside Docker to work"
   exit 1
@@ -26,4 +24,8 @@ else
   CAPTAIN="sudo captain"
 fi
 
-$CAPTAIN build
+BUILD_DATE=$(date --iso-8601=seconds) \
+  VCS_REF=$(git describe --tags --dirty) \
+  VERSION=$(git describe --tags --dirty) \
+  WORKSPACE=$(get_script_dir) \
+  $CAPTAIN build
diff --git a/docker/runner/README.md b/docker/runner/README.md
index 2831fc1f5..49c72eaec 100644
--- a/docker/runner/README.md
+++ b/docker/runner/README.md
@@ -21,12 +21,12 @@ Environment variables:
 * META_DB_USER: User to use when connecting to the metadata database
 * META_DB_PASSWORD: Password to use when connecting to the metadata database
 
-* SCIENCE_DB_URL: JDBC URL to connect to the science database
-* SCIENCE_DB_SCHEMA: Database schema, default value is "public"
-* SCIENCE_DB_SERVER: optional, address of the science database server. Used to wait for the database to be up and running.
-* SCIENCE_DB_USER: User to use when connecting to the science database
-* SCIENCE_DB_PASSWORD: Password to use when connecting to the science database
-* SCIENCE_DB_MAIN_TABLE: Table that contains the scientific data to use, default value is adni_merge
+* FEATURES_DB_URL: JDBC URL to connect to the features database
+* FEATURES_DB_SCHEMA: Database schema, default value is "public"
+* FEATURES_DB_SERVER: optional, address of the features database server. Used to wait for the database to be up and running.
+* FEATURES_DB_USER: User to use when connecting to the features database
+* FEATURES_DB_PASSWORD: Password to use when connecting to the features database
+* FEATURES_DB_MAIN_TABLE: Table that contains the scientific data to use, default value is adni_merge
 
 * CONTEXT_PATH:  context path appended to all services running in this container. Default to "/services"
 
diff --git a/docker/runner/config/application.tmpl b/docker/runner/config/application.tmpl
index 6e5eb6791..ac7ed4cef 100644
--- a/docker/runner/config/application.tmpl
+++ b/docker/runner/config/application.tmpl
@@ -14,12 +14,12 @@ spring:
     username: {{ default .Env.META_DB_USER "postgres" }}
     password: {{ .Env.META_DB_PASSWORD }}
     driver-class-name: org.postgresql.Driver
-  scienceDatasource:
-      url: {{ default .Env.SCIENCE_DB_URL "jdbc:postgresql://172.22.0.1:5433/science" }}
-      schema: {{ default .Env.SCIENCE_DB_SCHEMA "public" }}
-      main-table: {{ default .Env.SCIENCE_DB_MAIN_TABLE "adni_merge" }}
-      username: {{ default .Env.SCIENCE_DB_USER "postgres" }}
-      password: {{ .Env.SCIENCE_DB_PASSWORD }}
+  featuresDatasource:
+      url: {{ default .Env.FEATURES_DB_URL "jdbc:postgresql://172.22.0.1:5433/features" }}
+      schema: {{ default .Env.FEATURES_DB_SCHEMA "public" }}
+      main-table: {{ default .Env.FEATURES_DB_MAIN_TABLE "adni_merge" }}
+      username: {{ default .Env.FEATURES_DB_USER "postgres" }}
+      password: {{ .Env.FEATURES_DB_PASSWORD }}
       driver-class-name: org.postgresql.Driver
   jpa:
     hibernate:
@@ -86,5 +86,5 @@ services:
 akka:
   woken:
     host: {{ default .Env.WOKEN_HOST "woken" }}
-    port: {{ default .Env.WOKEN_PORT "8088" }}
-    path: {{ default .Env.WOKEN_PATH "/user/entrypoint" }}
+    port: {{ default .Env.WOKEN_AKKA_PORT "8088" }}
+    path: {{ default .Env.WOKEN_AKKA_PATH "/user/entrypoint" }}
diff --git a/docker/runner/run.sh b/docker/runner/run.sh
index 5da303862..3654d5cbe 100755
--- a/docker/runner/run.sh
+++ b/docker/runner/run.sh
@@ -7,7 +7,7 @@ fi
 if [ ! -z "$META_DB_SERVER" ]; then
   OPTS="$OPTS -wait tcp://$META_DB_SERVER -timeout 60s"
 fi
-if [ ! -z "$SCIENCE_DB_SERVER" ]; then
-  OPTS="$OPTS -wait tcp://$SCIENCE_DB_SERVER -timeout 60s"
+if [ ! -z "$FEATURES_DB_SERVER" ]; then
+  OPTS="$OPTS -wait tcp://$FEATURES_DB_SERVER -timeout 60s"
 fi
 dockerize $OPTS java -jar backend.jar
diff --git a/docker_push.sh b/docker_push.sh
deleted file mode 100755
index 7fa7eedb6..000000000
--- a/docker_push.sh
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/usr/bin/env bash
-set -e
-
-get_script_dir () {
-     SOURCE="${BASH_SOURCE[0]}"
-
-     while [ -h "$SOURCE" ]; do
-          DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
-          SOURCE="$( readlink "$SOURCE" )"
-          [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
-     done
-     cd -P "$( dirname "$SOURCE" )"
-     pwd
-}
-
-export WORKSPACE=$(get_script_dir)
-
-if pgrep -lf sshuttle > /dev/null ; then
-  echo "sshuttle detected. Please close this program as it messes with networking and prevents builds inside Docker to work"
-  exit 1
-fi
-
-if groups $USER | grep &>/dev/null '\bdocker\b'; then
-  CAPTAIN="captain"
-else
-  CAPTAIN="sudo captain"
-fi
-
-$CAPTAIN push --branch-tags=false --commit-tags=true portal-backend
-sed "s/USER/${USER^}/" $WORKSPACE/docker/runner/slack.json > $WORKSPACE/target/slack.json
-curl -k -X POST --data-urlencode payload@$WORKSPACE/target/slack.json https://hbps1.chuv.ch/slack/dev-activity
-rm -f $WORKSPACE/target/slack.json
diff --git a/hbp.yml b/hbp.yml
new file mode 100644
index 000000000..32c424582
--- /dev/null
+++ b/hbp.yml
@@ -0,0 +1,94 @@
+description: "Backend for the MIP portal"
+
+long_description: |
+  Backend for the MIP portal
+
+authors:
+  - author: Mirco Nasuti
+    author_email:
+      - mirco.nasuti@chuv.ch
+    organisation: LREN-CHUV
+    organisation_badge: https://img.shields.io/badge/CHUV-LREN-AF4C64.svg
+  - author: Ludovic Claude
+    author_email:
+      - ludovic.claude@chuv.ch
+      - ludovic.claude54@gmail.com
+      - ludovic.claude54@googlemail.com
+      - ludovic.claude@laposte.net
+    organisation: LREN-CHUV
+    organisation_badge: https://img.shields.io/badge/CHUV-LREN-AF4C64.svg
+  - author: Than Luu-tho
+    author_email:
+      - Thanh.Luu-Tho@chuv.ch
+    organisation: LREN-CHUV
+    organisation_badge: https://img.shields.io/badge/CHUV-LREN-AF4C64.svg
+
+platform: MIP
+component:
+  mip_building_block: web-analytics
+  nature: server
+
+license:
+  name: GNU Affero General Public License, Version 3.0
+  badge: https://img.shields.io/badge/license-AGPL--3.0-blue.svg
+  url: https://github.com/LREN-CHUV/portal-backend/blob/master/LICENSE
+
+code_repositories:
+  - name: chuv-gitlab
+    visibility: private
+    url: https://___.chuv.ch/web-analytics/portal-backend/
+    git_clone: https://___.chuv.ch/web-analytics/portal-backend.git
+  - name: github/LREN-CHUV
+    visibility: public
+    url: https://github.io/LREN-CHUV/portal-backend/
+    git_clone: https://github.io/LREN-CHUV/portal-backend.git
+  - name: github/HBPMedical
+    visibility: public
+    url: https://github.io/HBPMedical/portal-backend/
+    git_clone: https://github.io/HBPMedical/portal-backend.git
+
+code_quality_checks:
+  codacy:
+    badge: https://api.codacy.com/project/badge/Grade/05ba08087da24b3980475f88e1a591b7
+    url: "https://www.codacy.com/app/hbp-mip/portal-backend?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=LREN-CHUV/portal-backend&amp;utm_campaign=Badge_Grade"
+
+testing:
+  unit_testing:
+    source: src/test/java
+    command: ./test.sh
+
+release_management:
+  current_version: 2.0.0
+  current_code_release: https://github.com/HBPMedical/portal-backend/archive/2.0.0.zip
+  current_binary_release: https://pypi.python.org/pypi/portal-backend/2.0.0
+  release_script: 'publish.sh'
+
+continuous_integration:
+  - name: CircleCI
+    description: "Check style and execute unit tests"
+    url: https://circleci.com/gh/LREN-CHUV/portal-backend/tree/master
+    badge: https://circleci.com/gh/LREN-CHUV/portal-backend/tree/master.svg?style=svg
+    actions:
+      - build
+      - unit_tests
+
+distribution:
+  docker_hub:
+    name: hbpmip/portal-backend
+    current_tag: 2.0.0
+    url: https://hub.docker.com/r/hbpmip/portal-backend/
+    badge: https://img.shields.io/badge/docker-hbpmip%2Fportal--backend-008bb8.svg
+    command: docker pull hbpmip/portal-backend:2.0.0
+
+planning:
+  github:
+    name: Issues on Github
+    url: https://github.com/LREN-CHUV/portal-backend/issues
+  trello:
+    name: "[plans] Web front end"
+    url: https://trello.com/b/lr3NS4W6/plans-web-front-end
+
+related_projects:
+  - name: portal-frontend
+    mip_building_block: web-analytics
+    relationship: other-depends-on
diff --git a/pom.xml b/pom.xml
index 5e7fa773d..34879a537 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
 
     <groupId>eu.hbp.mip</groupId>
     <artifactId>portal-backend</artifactId>
-    <version>1.1</version>
+    <version>2.0.0</version><!-- BUMP_VERSION -->
     <packaging>jar</packaging>
 
     <name>portal-backend</name>
diff --git a/publish.sh b/publish.sh
new file mode 100755
index 000000000..b53435806
--- /dev/null
+++ b/publish.sh
@@ -0,0 +1,89 @@
+#!/usr/bin/env bash
+set -e
+
+get_script_dir () {
+     SOURCE="${BASH_SOURCE[0]}"
+
+     while [ -h "$SOURCE" ]; do
+          DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
+          SOURCE="$( readlink "$SOURCE" )"
+          [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
+     done
+     cd -P "$( dirname "$SOURCE" )"
+     pwd
+}
+
+export WORKSPACE=$(get_script_dir)
+
+if pgrep -lf sshuttle > /dev/null ; then
+  echo "sshuttle detected. Please close this program as it messes with networking and prevents builds inside Docker to work"
+  exit 1
+fi
+
+if groups $USER | grep &>/dev/null '\bdocker\b'; then
+  CAPTAIN="captain"
+else
+  CAPTAIN="sudo captain"
+fi
+
+count=$(git status --porcelain | wc -l)
+if test $count -gt 0; then
+  git status
+  echo "Not all files have been committed in Git. Release aborted"
+  exit 1
+fi
+
+select_part() {
+  local choice=$1
+  case "$choice" in
+      "Patch release")
+          bumpversion patch
+          ;;
+      "Minor release")
+          bumpversion minor
+          ;;
+      "Major release")
+          bumpversion major
+          ;;
+      *)
+          read -p "Version > " version
+          bumpversion --new-version=$version all
+          ;;
+  esac
+}
+
+git pull --tags
+# Look for a version tag in Git. If not found, ask the user to provide one
+[ $(git tag --points-at HEAD | wc -l) == 1 ] || (
+  latest_version=$(git describe --abbrev=00 || \
+    (bumpversion --dry-run --list patch | grep current_version | sed -r s,"^.*=",,) || echo '0.0.1')
+  echo
+  echo "Current commit has not been tagged with a version. Latest known version is $latest_version."
+  echo
+  echo 'What do you want to release?'
+  PS3='Select the version increment> '
+  options=("Patch release" "Minor release" "Major release" "Release with a custom version")
+  select choice in "${options[@]}";
+  do
+    select_part "$choice"
+    break
+  done
+  updated_version=$(bumpversion --dry-run --list patch | grep current_version | sed -r s,"^.*=",,)
+  read -p "Release version $updated_version? [y/N] > " ok
+  if [ "$ok" != "y" ]; then
+    echo "Release aborted"
+    exit 1
+  fi
+)
+
+git push
+git push --tags
+updated_version=$(bumpversion --dry-run --list patch | grep current_version | sed -r s,"^.*=",,)
+
+#  WARNING: Requires captain 1.1.0 to push user tags
+BUILD_DATE=$(date --iso-8601=seconds) VCS_REF=$updated_version VERSION=$updated_version \
+  $CAPTAIN push portal-backend --branch-tags=false --commit-tags=false --tag $updated_version
+sed "s/USER/${USER^}/" $WORKSPACE/docker/runner/slack.json > $WORKSPACE/target/slack.json
+sed -i.bak "s/VERSION/$updated_version/" $WORKSPACE/target/slack.json
+curl -k -X POST --data-urlencode payload@$WORKSPACE/target/slack.json https://hbps1.chuv.ch/slack/dev-activity
+rm -f $WORKSPACE/target/slack.json
diff --git a/slack.json b/slack.json
new file mode 100644
index 000000000..8f25bd423
--- /dev/null
+++ b/slack.json
@@ -0,0 +1 @@
+{"channel": "#dev-activity", "username": "webhookbot", "text": "USER pushed a new version of hbpmip/portal-backend:VERSION to Docker hub", "icon_emoji": ":whale:"}
diff --git a/src/main/java/eu/hbp/mip/configuration/PersistenceConfiguration.java b/src/main/java/eu/hbp/mip/configuration/PersistenceConfiguration.java
index 64c5ce3ad..804444e0e 100644
--- a/src/main/java/eu/hbp/mip/configuration/PersistenceConfiguration.java
+++ b/src/main/java/eu/hbp/mip/configuration/PersistenceConfiguration.java
@@ -26,8 +26,8 @@ import javax.sql.DataSource;
 @EntityScan(basePackages = "eu.hbp.mip.model")
 public class PersistenceConfiguration {
 
-    @Value("#{'${spring.scienceDatasource.main-table:adni_merge}'}")
-    private String scienceMainTable;
+    @Value("#{'${spring.featuresDatasource.main-table:adni_merge}'}")
+    private String featuresMainTable;
 
     @Primary
     @Bean(name = "portalDatasource")
@@ -42,9 +42,9 @@ public class PersistenceConfiguration {
         return DataSourceBuilder.create().build();
     }
 
-    @Bean(name = "scienceDatasource")
-    @ConfigurationProperties(prefix="spring.scienceDatasource")
-    public DataSource scienceDataSource() {
+    @Bean(name = "featuresDatasource")
+    @ConfigurationProperties(prefix="spring.featuresDatasource")
+    public DataSource featuresDataSource() {
         return DataSourceBuilder.create().build();
     }
 
@@ -57,9 +57,9 @@ public class PersistenceConfiguration {
 
     @Bean
     @Autowired
-    @Qualifier("scienceJdbcTemplate")
-    public JdbcTemplate scienceJdbcTemplate() {
-        return new JdbcTemplate(scienceDataSource());
+    @Qualifier("featuresJdbcTemplate")
+    public JdbcTemplate featuresJdbcTemplate() {
+        return new JdbcTemplate(featuresDataSource());
     }
 
     @Bean(name = "entityManagerFactory")
@@ -83,7 +83,7 @@ public class PersistenceConfiguration {
     @Bean(name = "dataUtil")
     @Scope("singleton")
     public DataUtil dataUtil() {
-        return new DataUtil(scienceJdbcTemplate(), scienceMainTable);
+        return new DataUtil(featuresJdbcTemplate(), featuresMainTable);
     }
 
 }
diff --git a/src/main/java/eu/hbp/mip/utils/DataUtil.java b/src/main/java/eu/hbp/mip/utils/DataUtil.java
index a99a9b963..87ff932f8 100644
--- a/src/main/java/eu/hbp/mip/utils/DataUtil.java
+++ b/src/main/java/eu/hbp/mip/utils/DataUtil.java
@@ -17,12 +17,12 @@ public class DataUtil {
     private static final int TABLESAMPLE_SEED = 42;
 
     private JdbcTemplate jdbcTemplate;
-    private String scienceMainTable;
+    private String featuresMainTable;
 
-    public DataUtil(JdbcTemplate jdbcTemplate, String scienceMainTable)
+    public DataUtil(JdbcTemplate jdbcTemplate, String featuresMainTable)
     {
         this.jdbcTemplate = jdbcTemplate;
-        this.scienceMainTable = scienceMainTable;
+        this.featuresMainTable = featuresMainTable;
     }
 
     @Cacheable("varsdata")
@@ -39,7 +39,7 @@ public class DataUtil {
             int nb_samples = Math.min(nbRows, MAX_NB_SAMPLES);
             int samplingPercentage = 100 * nb_samples / nbRows;
             List<Object> queryResult = jdbcTemplate.queryForList(
-                    "SELECT " + var + " FROM "+scienceMainTable+" " +
+                    "SELECT " + var + " FROM "+featuresMainTable+" " +
                             "TABLESAMPLE SYSTEM ("+ samplingPercentage +") REPEATABLE ( "+ TABLESAMPLE_SEED +" )", Object.class);
             for (Object value : queryResult)
             {
@@ -62,14 +62,14 @@ public class DataUtil {
     {
         return jdbcTemplate.queryForObject(
                 "SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS " +
-                        "WHERE table_name = '"+scienceMainTable+"'", Long.class);
+                        "WHERE table_name = '"+featuresMainTable+"'", Long.class);
     }
 
     @Cacheable("rowscount")
     public long countDatasetRows()
     {
         return jdbcTemplate.queryForObject(
-                "SELECT COUNT(*) FROM "+scienceMainTable, Long.class);
+                "SELECT COUNT(*) FROM "+featuresMainTable, Long.class);
     }
 
 }
diff --git a/src/main/resources/data/exareme_algorithms.json b/src/main/resources/data/exareme_algorithms.json
index 3fc6a3471..e885b6200 100644
--- a/src/main/resources/data/exareme_algorithms.json
+++ b/src/main/resources/data/exareme_algorithms.json
@@ -11,4 +11,4 @@
       "polynominal": false
     }
   }
-}
\ No newline at end of file
+}
diff --git a/tests/integration/algorithmsFactory/test.sh b/tests/integration/algorithmsFactory/test.sh
index 6e21e6285..b8d0c939b 100755
--- a/tests/integration/algorithmsFactory/test.sh
+++ b/tests/integration/algorithmsFactory/test.sh
@@ -14,4 +14,4 @@ echo "exp1: $response"
 response=$(curl -s http://backend:8080/services/experiments -X POST -H "Content-Type: application/json" -d @expQuery2.json)
 echo "exp2: $response"
 response=$(curl -s http://backend:8080/services/experiments -X POST -H "Content-Type: application/json" -d @expQuery3.json)
-echo "exp3: $response"
\ No newline at end of file
+echo "exp3: $response"
diff --git a/tests/post-test-run.sh b/tests/post-test-run.sh
index fffdd77f5..cd30147d6 100755
--- a/tests/post-test-run.sh
+++ b/tests/post-test-run.sh
@@ -9,8 +9,8 @@ fi
 if [ $(docker ps | grep portal-db-test | wc -l) -gt 0 ]; then
   docker kill portal-db-test
 fi
-if [ $(docker ps | grep science-db-test | wc -l) -gt 0 ]; then
-  docker kill science-db-test
+if [ $(docker ps | grep features-db-test | wc -l) -gt 0 ]; then
+  docker kill features-db-test
 fi
 if [ $(docker ps | grep meta-db-test | wc -l) -gt 0 ]; then
   docker kill meta-db-test
@@ -25,8 +25,8 @@ fi
 if [ $(docker ps -a | grep portal-db-test | wc -l) -gt 0 ]; then
   docker rm -f portal-db-test
 fi
-if [ $(docker ps -a | grep science-db-test | wc -l) -gt 0 ]; then
-  docker rm -f science-db-test
+if [ $(docker ps -a | grep features-db-test | wc -l) -gt 0 ]; then
+  docker rm -f features-db-test
 fi
 if [ $(docker ps -a | grep meta-db-test | wc -l) -gt 0 ]; then
   docker rm -f meta-db-test
diff --git a/tests/pre-test-run.sh b/tests/pre-test-run.sh
index ee10e2488..01e97cc7e 100755
--- a/tests/pre-test-run.sh
+++ b/tests/pre-test-run.sh
@@ -10,8 +10,8 @@ fi
 if [ $(docker ps | grep portal-db-test | wc -l) -gt 0 ]; then
   docker kill portal-db-test
 fi
-if [ $(docker ps | grep science-db-test | wc -l) -gt 0 ]; then
-  docker kill science-db-test
+if [ $(docker ps | grep features-db-test | wc -l) -gt 0 ]; then
+  docker kill features-db-test
 fi
 
 
@@ -24,15 +24,15 @@ fi
 if [ $(docker ps -a | grep portal-db-test | wc -l) -gt 0 ]; then
   docker rm -f portal-db-test
 fi
-if [ $(docker ps -a | grep science-db-test | wc -l) -gt 0 ]; then
-  docker rm -f science-db-test
+if [ $(docker ps -a | grep features-db-test | wc -l) -gt 0 ]; then
+  docker rm -f features-db-test
 fi
 
 
 # Run databases containers
 
 echo "Running databases containers..."
-docker run --name science-db-test -p 65432:5432 -v $(pwd)/tests/science-db/sql:/docker-entrypoint-initdb.d/ -e POSTGRES_USER=postgres -d postgres:9.5.3
+docker run --name features-db-test -p 65432:5432 -v $(pwd)/tests/features-db/sql:/docker-entrypoint-initdb.d/ -e POSTGRES_USER=postgres -d postgres:9.5.3
 docker run --name meta-db-test -p 65433:5432 -v $(pwd)/tests/meta-db/sql:/docker-entrypoint-initdb.d/ -e POSTGRES_USER=postgres -d postgres:9.5.3
 docker run --name portal-db-test -p 65434:5432 -e POSTGRES_USER=postgres -d postgres:9.5.3
 
@@ -40,17 +40,17 @@ docker run --name portal-db-test -p 65434:5432 -e POSTGRES_USER=postgres -d post
 # Get gateway IP
 
 echo "Searching gateway IP..."
-GATEWAY_IP=$(docker inspect science-db-test | grep \"Gateway\":\ \" | sed 's/.*Gateway\":\ \"\([^-]*\)\",/\1/' | head -n 1)
+GATEWAY_IP=$(docker inspect features-db-test | grep \"Gateway\":\ \" | sed 's/.*Gateway\":\ \"\([^-]*\)\",/\1/' | head -n 1)
 echo "Gateway IP: $GATEWAY_IP"
 
 
 # Wait for databases to be ready
 
-echo "Waiting for science-db to start..."
+echo "Waiting for features-db to start..."
 if [ "$CIRCLECI" = true ] ; then
   sleep 10
 else
-  until [ $(docker exec science-db-test psql -U postgres -c "\q" 2>&1 | wc -l) -eq 0 ]; do
+  until [ $(docker exec features-db-test psql -U postgres -c "\q" 2>&1 | wc -l) -eq 0 ]; do
       printf '.'
       sleep 1
   done
@@ -90,9 +90,9 @@ docker run --name backend-test -p 65440:8080 \
 -e "META_DB_URL=jdbc:postgresql://$GATEWAY_IP:65433/postgres" \
 -e "META_DB_SERVER=$GATEWAY_IP:65433/postgres" \
 -e "META_DB_USER=postgres" \
--e "SCIENCE_DB_URL=jdbc:postgresql://$GATEWAY_IP:65432/postgres" \
--e "SCIENCE_DB_SERVER=$GATEWAY_IP:65432/postgres" \
--e "SCIENCE_DB_USER=postgres" \
+-e "FEATURES_DB_URL=jdbc:postgresql://$GATEWAY_IP:65432/postgres" \
+-e "FEATURES_DB_SERVER=$GATEWAY_IP:65432/postgres" \
+-e "FEATURES_DB_USER=postgres" \
 -e "CONTEXT_PATH=/services" \
 -e "AUTHENTICATION=0" \
 -d hbpmip/portal-backend:latest
-- 
GitLab