diff --git a/deploy/check/Dockerfile b/deploy/check/Dockerfile deleted file mode 100644 index 7f3226ce..00000000 --- a/deploy/check/Dockerfile +++ /dev/null @@ -1,5 +0,0 @@ -FROM python:3.12-slim -COPY check.py . -RUN --mount=type=bind,source=requirements.txt,target=/tmp/requirements.txt \ - python -m pip install --no-cache-dir -r /tmp/requirements.txt -CMD python check.py \ No newline at end of file diff --git a/deploy/check/check.py b/deploy/check/check.py deleted file mode 100644 index b370c30f..00000000 --- a/deploy/check/check.py +++ /dev/null @@ -1,57 +0,0 @@ -import json -import os -import asyncio -import logging -from aiomcache import Client - -debug_level = os.environ.get("LOGGING") -memcached_host = os.environ.get("MEMCACHED_HOST") or "localhost" -alert_loop_time = os.environ.get("ALERT_PERIOD") or 3 - -logging.basicConfig(level=debug_level, format="%(asctime)s %(levelname)s : %(message)s") -logger = logging.getLogger(__name__) - - -async def alarm_data(mc, alerts_cached_data): - try: - task1_result = await mc.get(b"alerts") - logger.debug("Task 1...") - - if task1_result: - logger.debug("result") - encoded_result = json.loads(task1_result.decode("utf-8")) - logger.debug(task1_result.decode("utf-8")) - - await asyncio.sleep(alert_loop_time) - - except Exception as e: - logger.error(f"Error fetching data: {str(e)}") - raise - - -async def main(): - mc = Client(memcached_host, 11211) # Connect to your Memcache server - alerts_cached_data = {} - while True: - try: - logger.debug("task start") - await alarm_data(mc, alerts_cached_data) - - except asyncio.CancelledError: - logger.error("Task canceled. Shutting down...") - await mc.close() - break - - except Exception as e: - logger.error(f"Caught an exception: {e}") - - finally: - asyncio.sleep(1) - - -if __name__ == "__main__": - try: - logger.debug("Task 1: Doing some cool async stuff...") - asyncio.run(main()) - except KeyboardInterrupt: - pass diff --git a/deploy/check/requirements.txt b/deploy/check/requirements.txt deleted file mode 100644 index 93ca9071..00000000 --- a/deploy/check/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -aiohttp==3.10.2 -aiomcache==0.8.1 \ No newline at end of file diff --git a/deploy/redeploy_check.sh b/deploy/redeploy_check.sh deleted file mode 100644 index 915b8209..00000000 --- a/deploy/redeploy_check.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/bash - -# Default values -ALERT_TOKEN="" -MEMCACHED_HOST="" -LOGGING="INFO" - -# Check for arguments -while [[ $# -gt 0 ]]; do - case "$1" in - -a|--alert-token) - ALERT_TOKEN="$2" - shift 2 - ;; - -m|--memcached-host) - MEMCACHED_HOST="$2" - shift 2 - ;; - -l|--logging) - LOGGING="$2" - shift 2 - ;; - *) - echo "Unknown argument: $1" - exit 1 - ;; - esac -done - -echo "CHECK" - -echo "ALERT_TOKEN: $ALERT_TOKEN" -echo "MEMCACHED_HOST: $MEMCACHED_HOST" -echo "LOGGING: $LOGGING" - - -# Updating the Git repo -echo "Updating Git repo..." -#cd /path/to/your/git/repo -git pull - -# Moving to the deployment directory -echo "Moving to deployment directory..." -cd check - -# Building Docker image -echo "Building Docker image..." -docker build -t map_check -f DockerfileCheck . - -# Stopping and removing the old container (if exists) -echo "Stopping and removing old container..." -docker stop map_check || true -docker rm map_check || true - -# Deploying the new container -echo "Deploying new container..." -docker run --name map_check --restart unless-stopped -d --env MEMCACHED_HOST="$MEMCACHED_HOST" --env LOGGING="$LOGGING" map_check - -echo "Container deployed successfully!" -