Mysql2::Error: Unknown MySQL server host 'expvipdb'

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Mysql2::Error: Unknown MySQL server host 'expvipdb'

Michał T. Lorenc
Hi,

I used docker-compose up and it gave me Mysql2::Error: Unknown MySQL server host 'expvipdb' (-2) with the following docker-compose.yml file:


    expvip:
        build: .
        restart: always
        ports:
            - "80:80"
        links:
            - expvipdb
            - exvip_mongo
        volumes:
            - ./data/:/db
    
    expvipdb:
      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:
        - expvipdb
      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

and the Dockerfile for exvip looks like this:

    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 git clone -b load_preferences_file https://github.com/homonecloco/expvip-web.git  && \
        cd expvip-web && \
        sed -i.bak "s|localhost|expvipdb|" config/database.yml && \
        sed -i.bak "s|:num_threads: 1|:num_threads: 4|" config/sequenceserver.conf && \
        sed -i.bak "s|/Volumes/homonecloco/References|/db|" config/sequenceserver.conf && \
        gem install bundler && \
        bundle install && \
        rake db:migrate


This is the [config/database.yml](https://github.com/homonecloco/expvip-web/blob/master/config/database.yml) file:

    default: &default
      adapter: mysql2
      encoding: utf8
      database: expvipdb
      username: expvipUSR
      password: expvipPWD
      host: expvipdb
      port: 3306
    
    development:
      <<: *default
      database: "wheat_expression_dev"
    #  database: "expvip_berries"
    # Warning: The database defined as "test" will be erased and
    # re-generated from your development database when you run "rake".
    # Do not set this db to the same as development or production.
    test:
      <<: *default
      database: "wheat_expression_test"
    
    #production:
    #  <<: *default
    #  database: "wheat_expression_prd"
    
    #production:
    #  <<: *default
    #  database: db/production.sqlite3

What did I miss?

Thank you in advance

Michal

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/0e051df5-2a66-49a4-9369-07cff408bf2d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Mysql2::Error: Unknown MySQL server host 'expvipdb'

Walther Diechmann
my docker-compose’s always have

networks:
        db:
        web:

and my containers always identify the networks like:

services:
        expvip:
                networks:
                        - web
                        - db

        expvipdb:
                networks:
                        - db

not sure if that helps?


cheers,
Walther
               

> Den 2. aug. 2018 kl. 04.48 skrev Michał T. Lorenc <[hidden email]>:
>
> Hi,
>
> I used docker-compose up and it gave me Mysql2::Error: Unknown MySQL server host 'expvipdb' (-2) with the following docker-compose.yml file:
>
>
>     expvip:
>         build: .
>         restart: always
>         ports:
>             - "80:80"
>         links:
>             - expvipdb
>             - exvip_mongo
>         volumes:
>             - ./data/:/db
>    
>     expvipdb:
>       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:
>         - expvipdb
>       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
>
> and the Dockerfile for exvip looks like this:
>
>     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 git clone -b load_preferences_file https://github.com/homonecloco/expvip-web.git  && \
>         cd expvip-web && \
>         sed -i.bak "s|localhost|expvipdb|" config/database.yml && \
>         sed -i.bak "s|:num_threads: 1|:num_threads: 4|" config/sequenceserver.conf && \
>         sed -i.bak "s|/Volumes/homonecloco/References|/db|" config/sequenceserver.conf && \
>         gem install bundler && \
>         bundle install && \
>         rake db:migrate
>
>
> This is the [config/database.yml](https://github.com/homonecloco/expvip-web/blob/master/config/database.yml) file:
>
>     default: &default
>       adapter: mysql2
>       encoding: utf8
>       database: expvipdb
>       username: expvipUSR
>       password: expvipPWD
>       host: expvipdb
>       port: 3306
>    
>     development:
>       <<: *default
>       database: "wheat_expression_dev"
>     #  database: "expvip_berries"
>     # Warning: The database defined as "test" will be erased and
>     # re-generated from your development database when you run "rake".
>     # Do not set this db to the same as development or production.
>     test:
>       <<: *default
>       database: "wheat_expression_test"
>    
>     #production:
>     #  <<: *default
>     #  database: "wheat_expression_prd"
>    
>     #production:
>     #  <<: *default
>     #  database: db/production.sqlite3
>
> What did I miss?
>
> Thank you in advance
>
> Michal
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
> To post to this group, send email to [hidden email].
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/0e051df5-2a66-49a4-9369-07cff408bf2d%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
> --
> Denne besked er blevet skannet af
> ALCO Mailscan, og menes at være fri for vira og spam. mener du at det er en spam mail er du velkomme til at trykker pålinket herunder.
>
> Klik her for at rapportere denne besked som spam.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/D3419E9A-0008-45A1-B493-690658AAFD61%40diechmann.net.
For more options, visit https://groups.google.com/d/optout.