From 004a93ec8a9fd881937353b5c156b2a8b59b0c6c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Herv=C3=A9=20=20MENAGER?= <herve.menager@pasteur.fr>
Date: Mon, 8 Apr 2019 16:32:43 +0200
Subject: [PATCH] lots of different things, tests and Dind

* material to launch docker execution tests
* docker in docker setup
---
 Dockerfile             | 14 +++++++++++---
 concatenate-docker.cwl | 27 +++++++++++++++++++++++++++
 concatenate.cwl        | 24 ++++++++++++++++++++++++
 job_conf.xml           |  2 +-
 start.sh               |  2 ++
 tool_conf.xml          |  4 ++++
 tool_conf_test.xml     |  8 ++++++++
 7 files changed, 77 insertions(+), 4 deletions(-)
 create mode 100644 concatenate-docker.cwl
 create mode 100644 concatenate.cwl
 create mode 100644 start.sh
 create mode 100644 tool_conf_test.xml

diff --git a/Dockerfile b/Dockerfile
index 773ece6..f5dfc64 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,5 @@
-FROM ubuntu:18.04
+#FROM ubuntu:18.04
+FROM billyteves/ubuntu-dind:16.04
 WORKDIR /app
 RUN apt-get update && apt-get install -y \
   git \
@@ -8,7 +9,8 @@ RUN apt-get update && apt-get install -y \
   make \
   docker.io \
   wget \
-  curl
+  curl \ 
+  libpq-dev
 #RUN git clone --depth 1 --progress https://github.com/hmenager/galaxy.git /app/galaxy
 RUN git clone --depth 1 --progress https://github.com/common-workflow-language/galaxy.git /app/galaxy
 RUN git clone --depth 1 --single-branch --branch master --progress https://github.com/hmenager/workflow-is-cwl /app/workflow-is-cwl
@@ -16,6 +18,8 @@ RUN git clone --depth 1 --single-branch --branch assembly --progress https://git
 RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
 RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
 RUN apt-get update && apt-get install -y yarn
+#quickfix due to record not being in the right folder following rebase (04/03/2019)
+RUN mv /app/galaxy/lib/galaxy/dataset_collections/types/record.py /app/galaxy/lib/galaxy/model/dataset_collections/types/record.py
 RUN cd /app/galaxy && ./scripts/common_startup.sh 
 RUN cd /app/galaxy && ls database/*
 RUN cd /app/galaxy && ./create_db.sh
@@ -23,7 +27,11 @@ RUN cd /app/galaxy && ./manage_db.sh upgrade
 COPY job_conf.xml /app/galaxy/config/job_conf.xml
 COPY dependency_resolvers_conf.xml /app/galaxy/config/dependency_resolvers_conf.xml
 COPY galaxy.yml /app/galaxy/config/galaxy.yml
+#COPY tool_conf_test.xml /app/galaxy/config/tool_conf.xml
+#COPY concatenate.cwl /app/galaxy/tools/
+#COPY concatenate-docker.cwl /app/galaxy/tools/
 COPY tool_conf.xml /app/galaxy/config/tool_conf.xml
 COPY welcome.html /app/galaxy/static/welcome.html
-CMD ["sh", "/app/galaxy/run.sh"]
+COPY start.sh /app/start.sh
+CMD ["sh", "/app/start.sh"]
 EXPOSE 8080
diff --git a/concatenate-docker.cwl b/concatenate-docker.cwl
new file mode 100644
index 0000000..2d56299
--- /dev/null
+++ b/concatenate-docker.cwl
@@ -0,0 +1,27 @@
+class: CommandLineTool
+cwlVersion: v1.0
+baseCommand:
+  - cat
+inputs:
+  - id: files
+    type: 'File'
+    inputBinding:
+      position: 1
+    streamable: true
+outputs:
+  - id: result
+    type: File
+    outputBinding:
+      glob: result
+      outputEval: |
+        ${ self[0].format = inputs.files.format;
+           return self; }
+requirements:
+  - class: ResourceRequirement
+    ramMin: 100
+    coresMax: 1
+  - class: InlineJavascriptRequirement
+hints:
+  - class: DockerRequirement
+    dockerPull: 'alpine:3.7'
+stdout: result
diff --git a/concatenate.cwl b/concatenate.cwl
new file mode 100644
index 0000000..f6eec26
--- /dev/null
+++ b/concatenate.cwl
@@ -0,0 +1,24 @@
+class: CommandLineTool
+cwlVersion: v1.0
+baseCommand:
+  - cat
+inputs:
+  - id: files
+    type: 'File'
+    inputBinding:
+      position: 1
+    streamable: true
+outputs:
+  - id: result
+    type: File
+    outputBinding:
+      glob: result
+      outputEval: |
+        ${ self[0].format = inputs.files.format;
+           return self; }
+requirements:
+  - class: ResourceRequirement
+    ramMin: 100
+    coresMax: 1
+  - class: InlineJavascriptRequirement
+stdout: result
diff --git a/job_conf.xml b/job_conf.xml
index 6aeab9c..3caed62 100644
--- a/job_conf.xml
+++ b/job_conf.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <job_conf>
     <plugins>
-        <plugin id="local" type="runner" load="galaxy.jobs.runners.local:LocalJobRunner" workers="4"/>
+        <plugin id="local" type="runner" load="galaxy.jobs.runners.local:LocalJobRunner" workers="4" shell="none"/>
     </plugins>
     <destinations default="docker_local">
         <destination id="local" runner="local"/>
diff --git a/start.sh b/start.sh
new file mode 100644
index 0000000..2e00324
--- /dev/null
+++ b/start.sh
@@ -0,0 +1,2 @@
+service docker start
+sh /app/galaxy/run.sh
diff --git a/tool_conf.xml b/tool_conf.xml
index b916a35..28fa6a2 100644
--- a/tool_conf.xml
+++ b/tool_conf.xml
@@ -24,4 +24,8 @@
     <tool file="../../workflow-is-cwl_assembly/tools/Trimmomatic/Trimmomatic-v0.36.cwl" />
     <tool file="../../workflow-is-cwl_assembly/tools/Trinity/Trinity-V2.6.5.cwl" />
   </section>
+  <section id="textutil" name="Text Manipulation">
+    <tool file="filters/catWrapper.xml" />
+    <tool file="filters/wc_gnu.xml" />
+  </section>
 </toolbox>
diff --git a/tool_conf_test.xml b/tool_conf_test.xml
new file mode 100644
index 0000000..2cd56b2
--- /dev/null
+++ b/tool_conf_test.xml
@@ -0,0 +1,8 @@
+<?xml version='1.0' encoding='utf-8'?>
+<toolbox monitor="false">
+  <tool file="data_source/upload.xml" />
+  <section id="cwl_utils" name="Tests">
+    <tool file="concatenate.cwl" />
+    <tool file="concatenate-docker.cwl" />
+  </section>
+</toolbox>
-- 
GitLab