docker-compose.yml 3.6 KB
Newer Older
1
# Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute
nwillhoft's avatar
nwillhoft committed
2
# Copyright [2016-2021] EMBL-European Bioinformatics Institute
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#      http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# This is a Dockerfile to run eHive scripts (init_pipeline.pl, beekeeper.pl, runWorker.pl) in a container
#

19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
version: '3.3'

## What follows is a docker-compose file that can be used in two different ways:
#
# (1) to deploy a local "composition" of multiple containers (using "docker-compose up" and "docker-compose down")
#
# (2) to deploy a Docker Stack of services on a Docker Swarm of nodes
#
#
## A loose example of how to deploy a fully Docker-containerized eHive system on a Docker Swarm:
#
# export DHOST_NAME="public_hostname_of_your_master_Docker_Engine"  # on all Docker Engines participating in the Swarm
#
# docker swarm init                         # on the master Docker Engine
#
# docker swarm join --token SWMTKN-...      # (with the token obtained from the previous command) on the slave Docker Engines
#
# docker stack deploy --compose-file docker-compose.yml dockerized_hive_example     # to deploy
#
## You can start connecting via DB interface or guiHive once you see that the database has been created (i.e. start_pipe stops failing and runs successfully)
#
# docker service scale worker=2             # use scaling to submit some workers (they are not running by default)


services:
    blackboard:
        image: mysql/mysql-server:5.5
        ports:
            - "8306:3306"
        environment:
            - MYSQL_RANDOM_ROOT_PASSWORD=1
            - MYSQL_USER=ensrw
            - MYSQL_PASSWORD=ensrw_password
            - 'MYSQL_DATABASE=%'
#        restart: always
        deploy:
            replicas: 1
            restart_policy:
                condition: any
        
    start_pipe:
        depends_on:
            - blackboard
        image: ensemblorg/ensembl-hive
        environment:
            - 'PIPE_CONFIG=Bio::EnsEMBL::Hive::Examples::LongMult::PipeConfig::LongMult_conf'
            - 'MYSQL_SERVER_URL=mysql://ensrw:ensrw_password@${DHOST_NAME}:8306'
        command: 'bash -c "db_cmd.pl -url $$MYSQL_SERVER_URL/ -exec mysqladmin -prepend ping && init_pipeline.pl $$PIPE_CONFIG -pipeline_url $$MYSQL_SERVER_URL/test_long_mult_inside -hive_force_init 1"'
#        restart: 'on-failure:20'
        deploy:
            replicas: 1
            restart_policy:
                condition: 'on-failure'

    worker:
        depends_on:
            - blackboard
            - start_pipe
        image: ensemblorg/ensembl-hive
        environment:
            - 'MYSQL_DB_URL=mysql://ensrw:ensrw_password@${DHOST_NAME}:8306/test_long_mult_inside'
        command: 'bash -c "runWorker.pl -url $$MYSQL_DB_URL"'
#        restart: 'no'
        deploy:
            replicas: 0
            restart_policy:
                condition: none

    guihive_server:
        depends_on:
            - blackboard
            - start_pipe
        image: ensemblorg/guihive
        ports:
            - "8080:8080"
#        restart: always
        deploy:
            replicas: 0
            restart_policy:
                condition: any