diff --git a/cope2n-ai-fi/Dockerfile b/cope2n-ai-fi/Dockerfile index 1bb583f..13ba941 100755 --- a/cope2n-ai-fi/Dockerfile +++ b/cope2n-ai-fi/Dockerfile @@ -48,12 +48,12 @@ RUN cd /workspace/cope2n-ai-fi/modules/ocr_engine/externals/sdsvtr && pip3 insta RUN cd /workspace/cope2n-ai-fi/modules/sdsvkvu && pip3 install -v -e . --no-cache-dir RUN cd /workspace/cope2n-ai-fi && pip3 install -r requirements.txt --no-cache-dir -RUN rm -f /usr/local/lib/python3.10/dist-packages/nvidia/cublas/lib/libcublasLt.so.11 && \ - rm -f /usr/local/lib/python3.10/dist-packages/nvidia/cublas/lib/libcublas.so.11 && \ - rm -f /usr/local/lib/python3.10/dist-packages/nvidia/cublas/lib/libnvblas.so.11 && \ - ln -s /opt/conda/lib/libcublasLt.so /usr/local/lib/python3.10/dist-packages/nvidia/cublas/lib/libcublasLt.so.11 && \ - ln -s /opt/conda/lib/libcublas.so /usr/local/lib/python3.10/dist-packages/nvidia/cublas/lib/libcublas.so.11 && \ - ln -s /opt/conda/lib/libnvblas.so /usr/local/lib/python3.10/dist-packages/nvidia/cublas/lib/libnvblas.so.11 +# RUN rm -f /usr/local/lib/python3.10/dist-packages/nvidia/cublas/lib/libcublasLt.so.11 && \ +# rm -f /usr/local/lib/python3.10/dist-packages/nvidia/cublas/lib/libcublas.so.11 && \ +# rm -f /usr/local/lib/python3.10/dist-packages/nvidia/cublas/lib/libnvblas.so.11 && \ +# ln -s /opt/conda/lib/libcublasLt.so /usr/local/lib/python3.10/dist-packages/nvidia/cublas/lib/libcublasLt.so.11 && \ +# ln -s /opt/conda/lib/libcublas.so /usr/local/lib/python3.10/dist-packages/nvidia/cublas/lib/libcublas.so.11 && \ +# ln -s /opt/conda/lib/libnvblas.so /usr/local/lib/python3.10/dist-packages/nvidia/cublas/lib/libnvblas.so.11 WORKDIR /workspace diff --git a/cope2n-ai-fi/requirements.txt b/cope2n-ai-fi/requirements.txt index 7c388a4..faf39a9 100755 --- a/cope2n-ai-fi/requirements.txt +++ b/cope2n-ai-fi/requirements.txt @@ -10,4 +10,5 @@ easydict imagesize==1.4.1 pdf2image==1.16.3 -redis==5.0.1 \ No newline at end of file +redis==5.0.1 +celery==5.3.6 \ No newline at end of file diff --git a/deploy_images.py b/deploy_images.py index 5f1804f..2de1774 100644 --- a/deploy_images.py +++ b/deploy_images.py @@ -8,8 +8,8 @@ from datetime import datetime BASH_FILE = './deploy_images.sh' S3_ENDPOINT = "" -S3_ACCESS_KEY = "AKIA3AFPFVWZD77UACHE" -S3_SECRET_KEY = "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" +S3_ACCESS_KEY = "secret" +S3_SECRET_KEY = "secret" S3_BUCKET = "ocr-deployment-config" class MinioS3Client: @@ -77,7 +77,8 @@ def deploy(): # Define the variable tag = str(random_hash()[:8]) now = datetime.now() - tag = tag + "_" + str(now.strftime("%d%m%y%H%M%S")) + # tag = tag + "_" + str(now.strftime("%d%m%y%H%M%S")) + tag = "4cae5134_261223123256" print(tag) # Execute the Bash script with the variable as a command-line argument diff --git a/deploy_images.sh b/deploy_images.sh index 8048a3b..b0b8195 100755 --- a/deploy_images.sh +++ b/deploy_images.sh @@ -1,23 +1,24 @@ #!/bin/bash +set -e tag=$1 echo "[INFO] Tag received from Python: $tag" -echo "[INFO] Pushing AI image with tag: $tag..." -docker compose -f docker-compose-dev.yml build cope2n-fi-sbt -docker tag sidp/cope2n-ai-fi-sbt:latest public.ecr.aws/v4n9y6r8/sidp/cope2n-ai-fi-sbt:${tag} -docker push public.ecr.aws/v4n9y6r8/sidp/cope2n-ai-fi-sbt:${tag} +# echo "[INFO] Pushing AI image with tag: $tag..." +# docker compose -f docker-compose-dev.yml build cope2n-fi-sbt +# docker tag sidp/cope2n-ai-fi-sbt:latest public.ecr.aws/v4n9y6r8/sidp/cope2n-ai-fi-sbt:${tag} +# docker push public.ecr.aws/v4n9y6r8/sidp/cope2n-ai-fi-sbt:${tag} -echo "[INFO] Pushing BE image with tag: $tag..." -docker compose -f docker-compose-dev.yml build be-ctel-sbt -docker tag sidp/cope2n-be-fi-sbt:latest public.ecr.aws/v4n9y6r8/sidp/cope2n-be-fi-sbt:${tag} -docker push public.ecr.aws/v4n9y6r8/sidp/cope2n-be-fi-sbt:${tag} +# echo "[INFO] Pushing BE image with tag: $tag..." +# docker compose -f docker-compose-dev.yml build be-ctel-sbt +# docker tag sidp/cope2n-be-fi-sbt:latest public.ecr.aws/v4n9y6r8/sidp/cope2n-be-fi-sbt:${tag} +# docker push public.ecr.aws/v4n9y6r8/sidp/cope2n-be-fi-sbt:${tag} -echo "[INFO] Pushing FE image with tag: $tag..." -docker compose -f docker-compose-dev.yml build fe-sbt -docker tag sidp/cope2n-fe-fi-sbt:latest public.ecr.aws/v4n9y6r8/sidp/cope2n-fe-fi-sbt:${tag} -docker push public.ecr.aws/v4n9y6r8/sidp/cope2n-fe-fi-sbt:${tag} +# echo "[INFO] Pushing FE image with tag: $tag..." +# docker compose -f docker-compose-dev.yml build fe-sbt +# docker tag sidp/cope2n-fe-fi-sbt:latest public.ecr.aws/v4n9y6r8/sidp/cope2n-fe-fi-sbt:${tag} +# docker push public.ecr.aws/v4n9y6r8/sidp/cope2n-fe-fi-sbt:${tag} cp ./docker-compose-prod.yml ./docker-compose_${tag}.yml sed -i "s/{{tag}}/$tag/g" ./docker-compose_${tag}.yml diff --git a/docker-compose-dev.yml b/docker-compose-dev.yml index 45edf08..45b7e4f 100755 --- a/docker-compose-dev.yml +++ b/docker-compose-dev.yml @@ -173,7 +173,7 @@ services: db-sbt: restart: always mem_reservation: 500m - image: postgres:14.7-alpine + image: postgres:15.4-alpine volumes: - ./data/postgres_data:/var/lib/postgresql/data networks: diff --git a/docker-compose-prod.yml b/docker-compose-prod.yml index 280499a..35106c7 100644 --- a/docker-compose-prod.yml +++ b/docker-compose-prod.yml @@ -51,15 +51,16 @@ services: - S3_SECRET_KEY=${S3_SECRET_KEY} - S3_BUCKET_NAME=${S3_BUCKET_NAME} restart: always + privileged: true # for chmod mem_limit: 10gb image: public.ecr.aws/v4n9y6r8/sidp/cope2n-be-fi-sbt:{{tag}} networks: - ctel-sbt volumes: - - ${HOST_MEDIA_FOLDER}:${MEDIA_ROOT} + - BE_media:${MEDIA_ROOT} - BE_static:/app/static working_dir: /app - command: sh -c "chmod -R 777 /app/static; sleep 5; python manage.py collectstatic --no-input && + command: sh -c "chmod -R 777 /app; sleep 5; python manage.py collectstatic --no-input && python manage.py migrate && python manage.py compilemessages && gunicorn fwd.asgi:application -k uvicorn.workers.UvicornWorker --timeout 300 -b 0.0.0.0:9000" # pre-makemigrations on prod @@ -135,7 +136,7 @@ services: rabbitmq-sbt: condition: service_started volumes: - - ${HOST_MEDIA_FOLDER}:${MEDIA_ROOT} + - BE_media:${MEDIA_ROOT} working_dir: /app command: sh -c "celery -A fwd_api.celery_worker.worker worker -l INFO -c 5" @@ -191,3 +192,4 @@ services: volumes: db_data: BE_static: + BE_media: