From fec42aaac9b8a402aa6992b7a0d5d15b3d870031 Mon Sep 17 00:00:00 2001 From: xgaia Date: Tue, 27 Aug 2019 11:08:44 +0200 Subject: [PATCH 1/3] upgrade to askomics 19.01.3 --- .travis.yml | 2 +- Dockerfile | 17 ++++++++--------- dump.template.nq | 19 ------------------- monitor_traffic.sh | 8 -------- start.sh | 42 ++++++++++++------------------------------ 5 files changed, 21 insertions(+), 67 deletions(-) delete mode 100644 dump.template.nq delete mode 100644 monitor_traffic.sh diff --git a/.travis.yml b/.travis.yml index a87f812..e344f39 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:19.01.3 before_script: - sleep 1m script: diff --git a/Dockerfile b/Dockerfile index 7fa81d5..7e9b964 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,24 +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 && \ + git clone ${ASKOMICS_GIT_URL} ${ASKOMICS_DIR} && \ cd ${ASKOMICS_DIR} && \ - git checkout ${ASKOMICS_VERSION} && \ - npm install gulp -g && \ + git checkout ${ASKOMICS_GIT_VERSION} && \ npm install --production && \ chmod +x startAskomics.sh && \ rm -rf /usr/local/askomics/venv && \ 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 From 646f2a0aa01574ffe645062e772215c3e858904c Mon Sep 17 00:00:00 2001 From: xgaia Date: Tue, 27 Aug 2019 11:34:24 +0200 Subject: [PATCH 2/3] sqlite --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 7e9b964..7ef8667 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,7 +14,7 @@ COPY start.sh /start.sh # Install prerequisites, clone repository and install 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 && \ + 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 ${ASKOMICS_GIT_VERSION} && \ From 4cba64be53cde3f86c1f38c8f2c45e0715c359be Mon Sep 17 00:00:00 2001 From: xgaia Date: Tue, 27 Aug 2019 11:45:53 +0200 Subject: [PATCH 3/3] fix travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e344f39..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 -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:19.01.3 + - 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: