diff --git a/.travis.yml b/.travis.yml index a87f812..ac3d3e5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ services: - docker install: - docker build -t askomics-ie . - - docker run -d -p 6543:6543 askomics-ie + - docker run -d -p 6543:6543 -p 8890:8890 -e ASKO_files_dir='/tmp/askomics-ie' -e ASKO_database_path='/tmp/askomics-ie/database.db' -e ASKO_load_url='http://localhost:6543' -e SPARQL_UPDATE='true' -e GALAXY_USER_NAME='jdoe' -e GALAXY_USER_EMAIL='jdoe@example.com' -e ASKOMICS_API_KEY='jdoe' askomics-ie before_script: - sleep 1m script: diff --git a/Dockerfile b/Dockerfile index 0ce4be2..5565cf6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,23 +1,23 @@ -FROM askomics/virtuoso +FROM askomics/virtuoso:7.2.5.1 MAINTAINER Xavier Garnier 'xavier.garnier@irisa.fr' # Environment variables -ENV ASKOMICS="https://github.com/askomics/askomics.git" \ +ENV ASKOMICS_GIT_URL="https://github.com/askomics/askomics.git" \ ASKOMICS_DIR="/usr/local/askomics" \ - ASKOMICS_VERSION="17.12" \ + ASKOMICS_GIT_VERSION="19.01.3" \ SPARQL_UPDATE=true # Copy files -COPY monitor_traffic.sh /monitor_traffic.sh COPY start.sh /start.sh -COPY dump.template.nq /dump.template.nq # Install prerequisites, clone repository and install -RUN apk add --update bash make gcc g++ zlib-dev libzip-dev bzip2-dev xz-dev git python3 python3-dev nodejs nodejs-npm wget && \ - git clone ${ASKOMICS} ${ASKOMICS_DIR} && \ +RUN apk update && \ + apk del openssl openssl-dev && \ + apk add bash make gcc g++ zlib-dev libzip-dev bzip2-dev xz-dev git python3 python3-dev nodejs nodejs-npm wget openldap-dev linux-headers sqlite && \ + git clone ${ASKOMICS_GIT_URL} ${ASKOMICS_DIR} && \ cd ${ASKOMICS_DIR} && \ - git checkout -b ${ASKOMICS_VERSION} origin/${ASKOMICS_VERSION} && \ + git checkout ${ASKOMICS_GIT_VERSION} && \ npm install gulp -g && \ npm install --production && \ chmod +x startAskomics.sh && \ diff --git a/dump.template.nq b/dump.template.nq deleted file mode 100644 index c791035..0000000 --- a/dump.template.nq +++ /dev/null @@ -1,19 +0,0 @@ - . - . - . - "__USERNAME__" . - "__PASSWORD_HASH__" . - "true"^^ . - "false"^^ . - "__SALT__" . - - . - . - "__ASKOMICS_KEY_NAME__" . - "__ASKOMICS_API_KEY__" . - - - . - . - "__GALAXY_URL__" . - "__GALAXY_KEY__" . \ No newline at end of file diff --git a/monitor_traffic.sh b/monitor_traffic.sh deleted file mode 100644 index ab5ca35..0000000 --- a/monitor_traffic.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -while true; do - sleep 1m - if [ `netstat -t | grep -v CLOSE_WAIT | grep ':6543' | wc -l` -lt 3 ] - then - pkill python3 - fi -done diff --git a/start.sh b/start.sh index 12c05fe..a719e65 100644 --- a/start.sh +++ b/start.sh @@ -1,42 +1,23 @@ #! /bin/bash -# get user info -username="Galaxy" #FIXME: get the galaxy username -pw_hash="" # no password -salt="" # no salt +# Create the database with the Galaxy user +mkdir -p ${ASKO_files_dir} +sqlite3 ${ASKO_database_path} "CREATE TABLE IF NOT EXISTS users (user_id INTEGER PRIMARY KEY AUTOINCREMENT, username text, email text, password text, salt text, apikey text, admin boolean, blocked boolean);" +sqlite3 ${ASKO_database_path} "INSERT INTO users VALUES (NULL, '${GALAXY_USER_NAME}', '${GALAXY_USER_EMAIL}', '', '', '${ASKOMICS_API_KEY}', 'true', 'false')" -# sed the dump template -cp /dump.template.nq /dump.nq -sed -i "s@__USERNAME__@$username@g" /dump.nq -sed -i "s/__EMAIL__/$USER_EMAIL/g" /dump.nq -sed -i "s@__PASSWORD_HASH__@$pw_hash@g" /dump.nq -sed -i "s@__SALT__@$salt@g" /dump.nq +sqlite3 ${ASKO_database_path} "CREATE TABLE IF NOT EXISTS galaxy_accounts (galaxy_id INTEGER PRIMARY KEY AUTOINCREMENT, user_id INTEGER, url text, apikey text, FOREIGN KEY(user_id) REFERENCES users(user_id));" +sqlite3 ${ASKO_database_path} "INSERT INTO galaxy_accounts VALUES(NULL, 1, '${GALAXY_URL}', '${GALAXY_API_KEY}');" -sed -i "s@__ASKOMICS_KEY_ID__@galaxy_5Dvp@g" /dump.nq -sed -i "s@__ASKOMICS_KEY_NAME__@galaxy@g" /dump.nq -sed -i "s@__ASKOMICS_API_KEY__@$ASKOMICS_API_KEY@g" /dump.nq - -sed -i "s@__GALAXY_ID__@$galaxy_id@g" /dump.nq -sed -i "s@__GALAXY_URL__@$GALAXY_URL@g" /dump.nq -sed -i "s@__GALAXY_KEY__@$API_KEY@g" /dump.nq - -mkdir /data/toLoad -mv /dump.nq /data/toLoad - -# Link galaxy uplaoded datasets into askomics upload dir -mkdir -p $ASKO_files_dir/upload -ln -s /import $ASKO_files_dir/upload/$username - -# Monitor traffic -chmod +x /monitor_traffic.sh -/monitor_traffic.sh & +# Link galaxy uploaded datasets into askomics upload dir +mkdir -p ${ASKO_files_dir}/${GALAXY_USER_NAME} +ln -s /import ${ASKO_files_dir}/${GALAXY_USER_NAME}/upload # Start Virtuoso chmod +x /virtuoso.sh /virtuoso.sh & # Wait for virtuoso to be up -while ! wget -o /dev/null http://localhost:8890/conductor; do +while ! wget -O /dev/null http://localhost:8890/conductor; do sleep 1s done @@ -49,4 +30,5 @@ if [[ $PROXY_PREFIX != "" ]]; then fi # Start AskOmics -${ASKOMICS_DIR}/startAskomics.sh -r +cd ${ASKOMICS_DIR} +./startAskomics.sh -r