Uauy-Lab/expvip-web

SequenceServer::DATABASE_DIR_NOT_SET: Database dir not set.

Closed this issue · 9 comments

Hi,
I the following Dockerfile:

FROM debian:stretch-backports
RUN apt-get update  && apt-get install -y --no-install-recommends \
        build-essential \
        ruby ruby-dev \
        curl wget \
        gnupg \
        git \
        ncbi-blast+ \
        libmariadbclient-dev \
        libsqlite3-dev \
        zlib1g-dev && \
        apt-get autoremove -y && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - && \
        apt-get update  && apt-get install -y --no-install-recommends \
        nodejs npm && \
        apt-get autoremove -y && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

ENV EXPVIP_VERSION Release-2018-07-17

RUN wget -c https://github.com/homonecloco/expvip-web/archive/${EXPVIP_VERSION}.tar.gz  && \
    tar xfvz ${EXPVIP_VERSION}.tar.gz && \
    cd expvip-web-${EXPVIP_VERSION} && \
    gem install bundler && \
    bundle install && \
    sed -i.bak "s|localhost|expvip_db|" config/database.yml && \
    rake db:migrate

and here is the docker-compose.yml file:

expvip:
    build: .
    restart: always
    ports:
        - "80:80"
    links:
        - expvip_db
        - exvip_mongo
    volumes:
        - ./data/:/data

expvip_db:
  image: mariadb
  restart: always
  environment:
    - MYSQL_ROOT_PASSWORD=admin
    - MYSQL_DATABASE=expvip
    - MYSQL_USER=expvipUSR
    - MYSQL_PASSWORD=expvipPWD
  ports:
    - "3306:3306"
  volumes:
    - ./mysql/:/docker-entrypoint-initdb.d

phpmyadmin:
  image: phpmyadmin/phpmyadmin
  restart: always
  links:
    - expvip_db
  ports:
    - 8183:80
  environment:
    PMA_USER: root
    PMA_PASSWORD: admin
    PMA_ARBITRARY: 1

exvip_mongo:
    image: mongo
    restart: always
    ports:
      - 27017:27017
    volumes:
      - ./mongo/:/mongo

When I ran docker-compose up I got this error:

rake aborted!
SequenceServer::DATABASE_DIR_NOT_SET: Database dir not set.
/var/lib/gems/2.3.0/bundler/gems/sequenceserver-68e2054febe7/lib/sequenceserver.rb:123:in `init_database'
/var/lib/gems/2.3.0/bundler/gems/sequenceserver-68e2054febe7/lib/sequenceserver.rb:40:in `init'
/expvip-web-Release-2018-07-17/config/routes.rb:45:in `block in <top (required)>'
/var/lib/gems/2.3.0/gems/actionpack-5.1.6/lib/action_dispatch/routing/route_set.rb:436:in `instance_exec'
/var/lib/gems/2.3.0/gems/actionpack-5.1.6/lib/action_dispatch/routing/route_set.rb:436:in `eval_block'
/var/lib/gems/2.3.0/gems/actionpack-5.1.6/lib/action_dispatch/routing/route_set.rb:418:in `draw'
/expvip-web-Release-2018-07-17/config/routes.rb:3:in `<top (required)>'
/var/lib/gems/2.3.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:286:in `load'
/var/lib/gems/2.3.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:286:in `block in load'
/var/lib/gems/2.3.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:258:in `load_dependency'
/var/lib/gems/2.3.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:286:in `load'
/var/lib/gems/2.3.0/gems/railties-5.1.6/lib/rails/application/routes_reloader.rb:55:in `block in load_paths'
/var/lib/gems/2.3.0/gems/railties-5.1.6/lib/rails/application/routes_reloader.rb:55:in `each'
/var/lib/gems/2.3.0/gems/railties-5.1.6/lib/rails/application/routes_reloader.rb:55:in `load_paths'
/var/lib/gems/2.3.0/gems/railties-5.1.6/lib/rails/application/routes_reloader.rb:18:in `reload!'
/var/lib/gems/2.3.0/gems/railties-5.1.6/lib/rails/application/routes_reloader.rb:41:in `block in updater'
/var/lib/gems/2.3.0/gems/activesupport-5.1.6/lib/active_support/file_update_checker.rb:81:in `execute'
/var/lib/gems/2.3.0/gems/railties-5.1.6/lib/rails/application/routes_reloader.rb:42:in `updater'
/var/lib/gems/2.3.0/gems/railties-5.1.6/lib/rails/application/routes_reloader.rb:31:in `execute_if_updated'
/var/lib/gems/2.3.0/gems/railties-5.1.6/lib/rails/application/finisher.rb:128:in `block in <module:Finisher>'
/var/lib/gems/2.3.0/gems/railties-5.1.6/lib/rails/initializable.rb:30:in `instance_exec'
/var/lib/gems/2.3.0/gems/railties-5.1.6/lib/rails/initializable.rb:30:in `run'
/var/lib/gems/2.3.0/gems/railties-5.1.6/lib/rails/initializable.rb:59:in `block in run_initializers'
/var/lib/gems/2.3.0/gems/railties-5.1.6/lib/rails/initializable.rb:58:in `run_initializers'
/var/lib/gems/2.3.0/gems/railties-5.1.6/lib/rails/application.rb:353:in `initialize!'
/expvip-web-Release-2018-07-17/config/environment.rb:5:in `<top (required)>'
/var/lib/gems/2.3.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `require'
/var/lib/gems/2.3.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `block in require'
/var/lib/gems/2.3.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:258:in `load_dependency'
/var/lib/gems/2.3.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `require'
/var/lib/gems/2.3.0/gems/railties-5.1.6/lib/rails/application.rb:329:in `require_environment!'
/var/lib/gems/2.3.0/gems/railties-5.1.6/lib/rails/application.rb:445:in `block in run_tasks_blocks'
/var/lib/gems/2.3.0/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)

What did I miss?

Thank you in advance,

Michal

Hi,
I haven't tried to make a docker image, so I don't know how to automate the process, but the error is coming because you haven't run sequence server by itself. The gem that I'm using is a modified version of this project. This is what enables the blast search. The first time you run it, it generates the file .sequenceserver.conf in your $HOME directory. My file looks something like this:

---
:num_threads: 1
:port: 4567
:host: 0.0.0.0
:bin: "/home/homonecloco/.sequenceserver/ncbi-blast-2.2.31+/bin"
:database_dir: "/data/references"
:devel: false

The bin folder is where you have the executables of blast. The path in here is from the ncbi-blast binaries that sequence server downloads by itself, but you can have the binaries wherever you want, so you can install them in the docker image and fix this file. The database_dir is a folder where I have all the fasta files with the mRNA sequences with the same ID's that are in the reference. Something important is that the name of each database must match the names of the references in the database, so it can link the blast database with the current displayed transcriptome.

Best,
Ricardo.

Hi Ricardo,
Before I run rake db:migrate should I run ./sequenceserver without any parameters and then modify .sequenceserver.conf?

Thank you in advance.

Michal

you can just create the .sequenceserver.conf. I think that sequencesrver runs the wizard to create it if it is absent. So for a non-interactive session, I think having the file beforehead is better. You can run do your blast databases in the folder with the references before you start doing anything with rails, to have a clear distinction.

I think in Docker you do not have a home directory. Is there a way to modify the code in order to allow to use e.g. bundle exec bin/sequenceserver -database_dir=/dbs --num_threads=4 or to provide a parameter to sequenceserver where the config file has been saved?

Ah... yes, there is a way to do this change.... I'm reading the source code of sequence server, and I think it is a small change. I'll try to add this feature.

Can you try the branch homonecloco/expvip-web/load_preferences_file ? you need to add the config.sequenceserver_config in the configuration for your environment (right now, I added a path to development.rb). It is pointing to the configuration file config/sequencserver.conf. Please modify them according to your needs.

I'll try it out.

Did you have any luck with this branch?

Please re-open if you still have issues with this, but I had been using the modifications from the branch and will come on the next release.