diff --git a/Dockerfile b/Dockerfile index 3d63a4baa5f9811dad24f7059f2bae72d80ce8ba..14c911996d760f4d1d210e0999e19733bab82473 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 cb7bcae57aeba0c5842f9853ec151d43e23cf80c..b3012233933cfdc2921fd388571d84db092ff308 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 7953acfa090980d46ebf4936d4fa77a94e7eefbf..5461d6dff105bd055d1e3906946f7c0f40efb080 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 d15bb6c5aaa102e702f3886aedf30509e3767efe..e4e2878589c0568502e2912a1fb9b3af265b8a1d 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