diff --git a/Docker/Dockerfile b/Dockerfile similarity index 83% rename from Docker/Dockerfile rename to Dockerfile index c46cb72b..b03a89a9 100644 --- a/Docker/Dockerfile +++ b/Dockerfile @@ -14,9 +14,10 @@ RUN pip install --upgrade pip RUN pip install -r requirements.docker.txt RUN pip install -e . -RUN chmod +x Docker/entrypoint.sh +COPY /entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh #CMD ["uvicorn", "API.main:app", "--reload", "--host", "0.0.0.0", "--port", "8000"] -ENTRYPOINT ["Docker/entrypoint.sh"] +ENTRYPOINT ["/entrypoint.sh"] HEALTHCHECK CMD curl -f http://localhost:8000 || exit 1 diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..45b76ded --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,34 @@ +version: '3.8' + +services: + + app: + build: . + ports: + - 8000:8000 + volumes: + - .:/app + depends_on: + - redis + + worker: + build: . + command: celery --app API.api_worker worker --loglevel=INFO + volumes: + - .:/app + depends_on: + - app + - redis + + redis: + image: redis:6-alpine + + worker-dashboard: + build: . + command: celery --app API.api_worker flower --port=5550 --broker=redis://redis:6379/ + ports: + - 5550:5550 + depends_on: + - app + - redis + - worker \ No newline at end of file diff --git a/Docker/entrypoint.sh b/entrypoint.sh similarity index 93% rename from Docker/entrypoint.sh rename to entrypoint.sh index da1b9d3e..9d0b563d 100644 --- a/Docker/entrypoint.sh +++ b/entrypoint.sh @@ -1,5 +1,4 @@ -#!/usr/bin/env bash - +#!/bin/sh if [[ -z "${GALAXY_API_CONFIG_FILE}" ]]; then printf "Error: GALAXY_API_CONFIG_FILE environment variable missing.. Exiting!" exit 1 diff --git a/requirements.docker.txt b/requirements.docker.txt index 8ad35583..9d0a5f1b 100644 --- a/requirements.docker.txt +++ b/requirements.docker.txt @@ -1,6 +1,6 @@ aiofiles==0.7.0 asgiref==3.3.4 -click==8.0.1 +click==8.0.3 fastapi==0.65.2 h11==0.12.0 importlib-metadata==4.5.0 @@ -28,5 +28,8 @@ orjson==3.6.7 boto3==1.24.38 Fiona==1.8.21 fastapi-versioning==0.10.0 -#gdal and ogr2ogr is required on the machine to run rawdata endpoint -#gdal == 3.3.2 +redis==4.3.4 +celery==5.2.7 +flower==1.2.0 +#gdal and ogr2ogr is required on the machine to run rawdata endpoint +# gdal == 3.3.2 diff --git a/src/config.txt.sample b/src/config.txt.sample index 98174af1..a178dcc7 100644 --- a/src/config.txt.sample +++ b/src/config.txt.sample @@ -43,20 +43,24 @@ env=dev #export_path=exports/ # used to store export path #api_host=http://127.0.0.1 #api_port=8000 -#max_area=100000 # max area to support for rawdata input -#use_connection_pooling=True +#max_area=100000 # max area to support for rawdata input +#use_connection_pooling=True #log_level=info #options are info,debug,warning,error #env=dev # default is prod , supported values are dev and prod #shp_limit=6000 # in mb default is 4096 #[EXPORT_UPLOAD] -#FILE_UPLOAD_METHOD=disk # options are s3,disk -#AWS_ACCESS_KEY_ID= your id -#AWS_SECRET_ACCESS_KEY= yourkey -#BUCKET_NAME= your bucket name +#FILE_UPLOAD_METHOD=disk # options are s3,disk +#AWS_ACCESS_KEY_ID= your id +#AWS_SECRET_ACCESS_KEY= yourkey +#BUCKET_NAME= your bucket name #[TM] #host= #user= #password= #port= + +#[CELERY] +#CELERY_BROKER_URL=redis://localhost:6379 +#CELERY_RESULT_BACKEND=redis://localhost:6379