Skip to content

Commit

Permalink
Add simple deployment example using docker compose
Browse files Browse the repository at this point in the history
  • Loading branch information
Xarthisius committed Jul 11, 2016
1 parent d881368 commit a9cf6ff
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 2 deletions.
35 changes: 35 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
FROM ubuntu:xenial

RUN apt-get update && \
apt-get install -qy software-properties-common python-software-properties && \
apt-get update && apt-get install -qy \
build-essential \
wget \
python \
libffi-dev \
libssl-dev \
libjpeg-dev \
zlib1g-dev \
libpython-dev && \
apt-get clean && rm -rf /var/lib/apt/lists/*

RUN wget https://bootstrap.pypa.io/get-pip.py && python get-pip.py

WORKDIR /girder_worker
COPY setup.py /girder_worker/setup.py
COPY requirements.txt /girder_worker/requirements.txt
COPY README.rst /girder_worker/README.rst
COPY examples /girder_worker/examples
COPY scripts /girder_worker/scripts
COPY girder_worker /girder_worker/girder_worker

RUN pip install -r requirements.txt -e .

RUN useradd -D --shell=/bin/bash && useradd -m worker
RUN sed -i girder_worker/worker.local.cfg \
-e '/^broker/ s/guest@localhost/%(RABBITMQ_USER)s:%(RABBITMQ_PASS)s@%(RABBITMQ_HOST)s/'
RUN girder-worker-config set girder_worker tmp_root /tmp

USER worker

ENTRYPOINT ["python", "-m", "girder_worker"]
15 changes: 15 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: '2'


services:
broker:
image: rabbitmq:3
env_file: ./docker.env

worker:
build:
context: .
dockerfile: Dockerfile
links:
- broker:broker
env_file: ./docker.env
5 changes: 5 additions & 0 deletions docker.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
RABBITMQ_DEFAULT_USER=user
RABBITMQ_DEFAULT_PASS=password
RABBITMQ_USER=user
RABBITMQ_PASS=password
RABBITMQ_HOST=broker
4 changes: 2 additions & 2 deletions girder_worker/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from girder_worker.format import (
converter_path, get_validator_analysis, Validator)
from ConfigParser import ConfigParser
from ConfigParser import SafeConfigParser
from executors.python import run as python_run
from executors.workflow import run as workflow_run
from networkx import NetworkXNoPath
Expand All @@ -16,7 +16,7 @@

# Read the configuration files
_cfgs = ('worker.dist.cfg', 'worker.local.cfg')
config = ConfigParser()
config = SafeConfigParser(os.environ)
config.read([os.path.join(PACKAGE_DIR, f) for f in _cfgs])

# Maps task modes to their implementation
Expand Down

0 comments on commit a9cf6ff

Please sign in to comment.