Add Flower to track a state of celery tasks and terminate tasks to.

Updated celery to 5.3.6 version
Enable an autoscaling feature for celery workers (from 4 to 12) in dependency of requested tasks to be done

PRODX-37490

Change-Id: I9d410de5fadd2fe254ee2a18a67f56f5a28305a2
diff --git a/testrail_bot/.env b/testrail_bot/.env
index 31adfbb..b90eb6d 100644
--- a/testrail_bot/.env
+++ b/testrail_bot/.env
@@ -9,3 +9,4 @@
 DATABASE=postgres
 TESTRAIL_EMAIL=mosqa-eng@mirantis.com
 TESTRAIL_PASSWORD=mosqa-eng496F
+FLOWER_UNAUTHENTICATED_API=true
diff --git a/testrail_bot/docker-compose.yml b/testrail_bot/docker-compose.yml
index 9f5d128..27a12a8 100644
--- a/testrail_bot/docker-compose.yml
+++ b/testrail_bot/docker-compose.yml
@@ -18,12 +18,11 @@
       - tr_bot
   worker:
     build: .
-    command: celery -A testrail_bot worker -l info --concurrency=4
+    command: celery -A testrail_bot worker --concurrency=4 --autoscale=4,12 --loglevel=INFO
     volumes:
-    - .:/testrail_bot
-    - media_volume:/mediafiles
-    - static_volume:/staticfiles
-
+      - .:/testrail_bot
+      - media_volume:/mediafiles
+      - static_volume:/staticfiles
     networks:
       - tr_bot
     depends_on:
@@ -31,6 +30,22 @@
       - db
     env_file:
       - .env
+  celery_monitor:
+    build: .
+    command: celery  -A testrail_bot flower --loglevel=INFO
+    volumes:
+      - .:/testrail_bot
+      - media_volume:/mediafiles
+      - static_volume:/staticfiles
+    networks:
+      - tr_bot
+    ports:
+      - "5555:5555"
+    depends_on:
+      - redis
+      - db
+    env_file:
+      - .env
   web:
     build: .
     command: ./start_webapp.sh
@@ -55,10 +70,9 @@
     - "80:80"
     depends_on:
       - web
+      - celery_monitor
     networks:
       - tr_bot
-
-
 networks:
   tr_bot:
     driver: bridge
@@ -70,4 +84,4 @@
 volumes:
   postgres_data:
   static_volume:
-  media_volume:
\ No newline at end of file
+  media_volume:
diff --git a/testrail_bot/nginx/nginx.conf b/testrail_bot/nginx/nginx.conf
index 5201782..c9d7e5e 100644
--- a/testrail_bot/nginx/nginx.conf
+++ b/testrail_bot/nginx/nginx.conf
@@ -18,4 +18,16 @@
         alias /staticfiles/;
     }
 
-}
\ No newline at end of file
+}
+
+server {
+
+    listen 5555;
+
+    location / {
+        proxy_pass http://worker:5555;
+        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+        proxy_set_header Host $host;
+        proxy_redirect off;
+    }
+}
diff --git a/testrail_bot/requirements.txt b/testrail_bot/requirements.txt
index d0c566a..727ea37 100644
--- a/testrail_bot/requirements.txt
+++ b/testrail_bot/requirements.txt
@@ -1,13 +1,14 @@
-celery==4.4.6
+celery==5.3.6
 Django==4.2.7
 django-bootstrap-v5==1.0.11
 psycopg2-binary==2.8.5
 redis==3.5.3
 testrail-api==1.8.0
 uWSGI==2.0.19.1
-python-jenkins==1.7.0
-matplotlib==3.3.2
 retry==0.9.2
-psycopg2==2.9.9
 parse==1.19.1
 rpdb==0.1.6
+flower==2.0.1
+click==8.1.7
+python-jenkins==1.7.0
+matplotlib==3.3.2