Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add compose file #10

Open
iimog opened this issue Apr 20, 2016 · 2 comments
Open

Add compose file #10

iimog opened this issue Apr 20, 2016 · 2 comments
Assignees

Comments

@iimog
Copy link
Member

iimog commented Apr 20, 2016

No description provided.

@iimog
Copy link
Member Author

iimog commented Mar 6, 2017

Problem are one time commands like the chado_load container and docker exec build_installation.sh.
A simple compose file that just starts the 5 containers and needs manual installation steps can be easily created. Will start a new branch for that.

@iimog iimog mentioned this issue Jul 30, 2018
@iimog iimog self-assigned this Jul 30, 2018
@iimog
Copy link
Member Author

iimog commented Aug 14, 2018

After some experimentation I realized that this is not as easily done as I hoped. Problems are:

  1. We rely on the old --link feature which also exposed environment variables from the linked container. This is not how it works nowadays with docker-compose.
  2. We use both specific installation containers and docker exec calls for initial setup. This is also not something currently supported by docker-compose.

To fix those issues the docker images have to be changed to not rely on those linked env variables. Also the initialization steps can be incorporated in a custom command script that checks whether initialization has already been done (and skips it in this case) and then runs the current command. This way the command does the initialization if required but remains idempotent. The same applies for the provisioning container (tbroteam/generic_chado_db_reload). This could check whether there is something to do and otherwise just exit 0.

Despite those issues I managed to get things running with docker-compose albeit not very smoothly:

  1. create a folder named tbro_compose (you can name it otherwise but beware: the network and container names are derived from this directory name).
  2. inside this folder create the file docker-compose.yml with the content as shown below (at the end of this command).
  3. run docker-compose up -d (inside the tbro_compose directory)
  4. initialize the database with docker run --rm -i -t --link tbro_compose_chado_db_1:CHADO --name "TBro_load_chadol" --network tbro_compose_default -e CHADO_ENV_DB_PW=tbro -e CHADO_PORT_5432_TCP_ADDR=CHADO -e CHADO_PORT_5432_TCP_PORT=5432 -e CHADO_ENV_DB_USER=tbro -e CHADO_ENV_DB_NAME=chado tbroteam/generic_chado_db_reload
  5. initialize tbro docker-compose exec tbro /home/tbro/build_installation.sh
  6. initialize worker docker-compose exec worker /home/tbro/worker_build_installation.sh
  7. (optional) load demo data: docker run --rm -i -t --link tbro_compose_chado_db_1:CHADO --link tbro_compose_worker_db_1:WORKER --link tbro_compose_worker_ftp_1:WORKERFTP --name "TBro_demo_official" --network tbro_compose_default -e CHADO_ENV_DB_PW=tbro -e CHADO_PORT_5432_TCP_ADDR=CHADO -e CHADO_PORT_5432_TCP_PORT=5432 -e CHADO_ENV_DB_USER=tbro -e CHADO_ENV_DB_NAME=chado tbroteam/tbro_demo

Content of docker-compose.yml:

version: '3'
services:
  chado_db:
    image: postgres:9.6
    environment:
      POSTGRES_USER: tbro
      POSTGRES_PASSWORD: tbro
      POSTGRES_DB: chado
  worker_db:
    image: postgres:9.6
    environment:
      POSTGRES_USER: worker
      POSTGRES_PASSWORD: worker
      POSTGRES_DB: worker
  worker_ftp:
    image: tbroteam/tbro_worker_ftp
    environment:
      FTP_USER: tbro
      FTP_PW: worker
  worker:
    image: tbroteam/tbro_worker
    links:
      - "worker_db:WORKER"
    environment:
      WORKER_ENV_DB_NAME: worker
      WORKER_ENV_DB_USER: worker
      WORKER_ENV_DB_PW: worker
      WORKER_PORT_5432_TCP_PORT: 5432
  tbro:
    image: tbroteam/tbro_apache
    ports:
    - "80:80"
    depends_on:
      - chado_db
    links:
      - "worker_db:WORKER"
      - "chado_db:CHADO"
    environment:
      WORKER_ENV_DB_NAME: worker
      WORKER_ENV_DB_USER: worker
      WORKER_ENV_DB_PW: worker
      WORKER_PORT_5432_TCP_PORT: 5432
      WORKER_PORT_5432_TCP_ADDR: WORKER
      CHADO_ENV_DB_NAME: chado
      CHADO_ENV_DB_USER: tbro
      CHADO_ENV_DB_PW: tbro
      CHADO_PORT_5432_TCP_PORT: 5432
      CHADO_PORT_5432_TCP_ADDR: CHADO

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant