From 762c2502832b9a5a986946db4ffb206d09ccd29a Mon Sep 17 00:00:00 2001 From: Alessandro Cerioni <acerioni@grandlyon.com> Date: Mon, 24 Jun 2019 00:11:10 +0200 Subject: [PATCH] Adding the very first version of the HTTP API --- Dockerfile | 5 ++--- docker-compose-tools.yml | 10 +++++----- docker-compose-workers.yml | 16 ++++++++++++++++ requirements.txt | 3 +++ 4 files changed, 26 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3d63a4b..14c9119 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,9 +6,8 @@ COPY requirements.txt . RUN pip install -r requirements.txt -COPY main.py ./ -#COPY config.yaml . -#COPY es_template.py . COPY lib/*.py ./lib/ COPY workers/*.py ./workers/ COPY tools/*.py ./tools/ +COPY main.py ./ +COPY api.py ./ diff --git a/docker-compose-tools.yml b/docker-compose-tools.yml index cb7bcae..b301223 100644 --- a/docker-compose-tools.yml +++ b/docker-compose-tools.yml @@ -6,28 +6,28 @@ services: image: data-grandlyon-com-indexer command: python tools/delete-queues.py --host rabbitmq --exchange download_data_grandlyon_com_index volumes: - - ./config.yaml:/app/config.yaml:ro + - ${PWD}/config.yaml:/app/config.yaml:ro delete-indices: build: . image: data-grandlyon-com-indexer command: python tools/delete-indices.py volumes: - - ./config.yaml:/app/config.yaml:ro + - ${PWD}/config.yaml:/app/config.yaml:ro setup-indices: build: . image: data-grandlyon-com-indexer command: python tools/setup-indices.py volumes: - - ./config.yaml:/app/config.yaml:ro + - ${PWD}/config.yaml:/app/config.yaml:ro field-type-detector: build: . image: data-grandlyon-com-indexer command: python tools/field-type-detector.py volumes: - - ./config.yaml:/app/config.yaml:ro + - ${PWD}/config.yaml:/app/config.yaml:ro - working-directory:/app/output main: @@ -35,7 +35,7 @@ services: image: data-grandlyon-com-indexer command: python main.py --host rabbitmq --exchange download_data_grandlyon_com_index --loglevel DEBUG volumes: - - ./config.yaml:/app/config.yaml:ro + - ${PWD}/config.yaml:/app/config.yaml:ro - working-directory:/app/output volumes: diff --git a/docker-compose-workers.yml b/docker-compose-workers.yml index 7953acf..5461d6d 100644 --- a/docker-compose-workers.yml +++ b/docker-compose-workers.yml @@ -60,6 +60,22 @@ services: - working-directory:/app/output restart: unless-stopped + api: + build: . + image: data-grandlyon-com-indexer + environment: + LOGLEVEL: DEBUG + RMQ_HOST: rabbitmq + RMQ_EXCHANGE: download_data_grandlyon_com_index + command: gunicorn --workers=2 --bind=0.0.0.0:8000 --preload api:api + volumes: + - ${PWD}/config.yaml:/app/config.yaml:ro + - working-directory:/app/output + ports: + - 8000:8000 + restart: unless-stopped + + volumes: rabbitmq: working-directory: diff --git a/requirements.txt b/requirements.txt index d15bb6c..e4e2878 100644 --- a/requirements.txt +++ b/requirements.txt @@ -14,3 +14,6 @@ psycopg2-binary>=2.7.0 sqlalchemy>=1.2.0,<1.3.0 python-slugify nltk +flask +gunicorn +apscheduler -- GitLab