From c9f8cd864a2b72e7330b8095691fa5c16fea83aa Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Fri, 30 Aug 2019 11:14:50 +0200 Subject: Dockerfile and start script added --- application.rb | 4 +- docker/Dockerfile | 73 +++++++++++++++++++++++++++++++++++ docker/start.sh | 12 ++++++ docker/swagger.html | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 194 insertions(+), 2 deletions(-) create mode 100644 docker/Dockerfile create mode 100755 docker/start.sh create mode 100644 docker/swagger.html diff --git a/application.rb b/application.rb index ef059b2..fb03a72 100644 --- a/application.rb +++ b/application.rb @@ -21,7 +21,7 @@ PUBCHEM_CID_URI = PUBCHEM_URI.split("/")[0..-3].join("/")+"/compound/" configure :production, :development do STDOUT.sync = true $logger = Logger.new(STDOUT) - $logger.level = Logger::DEBUG + #$logger.level = Logger::DEBUG end before do @@ -42,7 +42,7 @@ before do if request.path =~ /predict/ @accept = request.env['HTTP_ACCEPT'].split(",").first response['Content-Type'] = @accept - halt 400, "Mime type #{@accept} is not supported." unless @accept == "text/html" || "*/*" + halt 400, "Mime type #{@accept} is not supported." unless @accept == "text/html" or @accept == "*/*" @version = File.read("VERSION").chomp else @accept = request.env['HTTP_ACCEPT'].split(",").first diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..a606b9a --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,73 @@ +FROM archlinux/base +MAINTAINER in-silico toxicology Gmbh + +RUN pacman-db-upgrade +RUN pacman -Syyu --noconfirm +RUN pacman -S --noconfirm \ + base-devel \ + boost-libs \ + cmake \ + eigen3 \ + fontconfig \ + gcc-fortran \ + git \ + gsl \ + jre10-openjdk-headless \ + r \ + ruby \ + swig \ + python-pip \ + catdoc \ + wget +RUN pacman -Scc --noconfirm + +RUN R -e "install.packages('Rserve', repos='http://rforge.net/')" +RUN pip install xlsx2csv +RUN useradd -ms /bin/bash ist + +# mongodb has been removed from main repositories +USER ist +WORKDIR /home/ist +RUN mkdir data +RUN mkdir src +WORKDIR /home/ist/src +RUN wget https://aur.archlinux.org/cgit/aur.git/snapshot/mongodb-bin.tar.gz +RUN tar -xvzf mongodb-bin.tar.gz +WORKDIR /home/ist/src/mongodb-bin +RUN makepkg -s --noconfirm + +# installation requires root +USER root +RUN pacman -U --noconfirm /home/ist/src/mongodb-bin/mongodb-bin*.pkg.tar.xz + +# install lazar-gui gem +RUN echo 'gem: --no-document' > /etc/gemrc + +#RUN gem install lazar-gui +RUN gem install lazar +RUN gem install qsar-report +RUN gem install sinatra haml sass rdiscount unicorn + +USER ist +WORKDIR /home/ist +RUN rm -r src + +# lazar-gui +RUN git clone https://git.in-silico.ch/lazar-gui +WORKDIR lazar-gui +RUN git checkout prerelease + +# SWAGGER for API +WORKDIR /home/ist +RUN git clone https://github.com/swagger-api/swagger-ui.git +COPY swagger.html /home/ist/swagger-ui/dist/index.html + +# TODO adjust to lazar-gui gem path +RUN ln -s /home/ist/swagger-ui/dist/swagger-ui-bundle.js /home/ist/lazar-gui/public/swagger-ui-bundle.js +RUN ln -s /home/ist/swagger-ui/dist/swagger-ui-standalone-preset.js /home/ist/lazar-gui/public/swagger-ui-standalone-preset.js +RUN ln -s /home/ist/swagger-ui/dist/swagger-ui.css /home/ist/lazar-gui/public/swagger-ui.css + +# start script +COPY start.sh /home/ist/start.sh + +ENTRYPOINT ["/home/ist/start.sh"] diff --git a/docker/start.sh b/docker/start.sh new file mode 100755 index 0000000..ad40a0e --- /dev/null +++ b/docker/start.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +# start basic services +mongod --bind_ip 127.0.0.1 --dbpath ~/data & +R CMD Rserve --vanilla & + +# import data +ruby -e "require 'lazar'; include OpenTox; Import.public_data" + +# start lazar service +cd $HOME/lazar-gui +unicorn -p 8088 -E production diff --git a/docker/swagger.html b/docker/swagger.html new file mode 100644 index 0000000..239e4f1 --- /dev/null +++ b/docker/swagger.html @@ -0,0 +1,107 @@ + + + + + + Swagger UI + + + + + + + + +
+ + + + + + -- cgit v1.2.3