From fe1f2297443e4bb622390a313d454f7c1803c8e4 Mon Sep 17 00:00:00 2001 From: Oleg Sheynin Date: Fri, 28 Mar 2025 18:07:14 -0400 Subject: [PATCH] DEV-85 DEV-90 DEV-86 --- microservices/ac_gateway/.dockerignore | 3 ++ microservices/ac_gateway/Dockerfile | 19 +++++++++++ microservices/ac_gateway/build.sh | 41 +++++++++++++++++++++++ microservices/ac_gateway/entrypoint.sh | 15 +++++++++ microservices/ac_gateway/requirements.txt | 10 ++++++ microservices/docker-compose.yml | 18 ++++++++-- microservices/md_gateway/requirements.txt | 2 ++ microservices/oe_gateway/requirements.txt | 4 +++ 8 files changed, 109 insertions(+), 3 deletions(-) create mode 100644 microservices/ac_gateway/.dockerignore create mode 100644 microservices/ac_gateway/Dockerfile create mode 100755 microservices/ac_gateway/build.sh create mode 100755 microservices/ac_gateway/entrypoint.sh create mode 100644 microservices/ac_gateway/requirements.txt diff --git a/microservices/ac_gateway/.dockerignore b/microservices/ac_gateway/.dockerignore new file mode 100644 index 0000000..a4f7c14 --- /dev/null +++ b/microservices/ac_gateway/.dockerignore @@ -0,0 +1,3 @@ +.git +**/__pycache__ +.pipenv \ No newline at end of file diff --git a/microservices/ac_gateway/Dockerfile b/microservices/ac_gateway/Dockerfile new file mode 100644 index 0000000..33e3bc2 --- /dev/null +++ b/microservices/ac_gateway/Dockerfile @@ -0,0 +1,19 @@ +FROM python:3.12-slim + +COPY requirements.txt / + +RUN pip install --upgrade pip --root-user-action=ignore +RUN pip install -r /requirements.txt --root-user-action=ignore + +COPY cvttpy /cvttpy + +RUN mkdir -p /logs /config + +SHELL ["/bin/bash", "-c"] + +ENV PYTHONPATH=/ + +COPY entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh + +ENTRYPOINT ["/entrypoint.sh"] diff --git a/microservices/ac_gateway/build.sh b/microservices/ac_gateway/build.sh new file mode 100755 index 0000000..17e519b --- /dev/null +++ b/microservices/ac_gateway/build.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +function usage { + echo "Usage: ${0} " + exit +} + +CvttpyVersion=${1} + +if [ "${CvttpyVersion}" == "" ] +then + usage +fi + +# --- Settings +ImageName=ac_gateway +RegistryService=cloud21.cvtt.vpn:5500 +# --- Settings + + +DockerDir=$(realpath $(dirname ${0})) +Version=${CvttpyVersion} + +cd ${DockerDir} + +source ../mu_svc_functions.sh +get_project_version cvttpy ${Version} + +function cleanup { + cd ${DockerDir} + rm -rf cvttpy +} +trap cleanup EXIT + +build_docker_image ${ImageName} ${RegistryService} ${Version} + + +# echo "**** D E B U G E X I T" && exit +echo "***** ${0} D O N E" + + diff --git a/microservices/ac_gateway/entrypoint.sh b/microservices/ac_gateway/entrypoint.sh new file mode 100755 index 0000000..fc42a99 --- /dev/null +++ b/microservices/ac_gateway/entrypoint.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +ConfigDir=/config +Config="${ConfigDir}/cvtt_musvc.cfg" +Creds="${ConfigDir}/.creds" + +Cmd="python3.12" +Cmd+=" cvttpy/apps/microservices/market_gateways/accounting_gateway.py" +Cmd+=" --config=${Config}" +Cmd+=" --credentials_file=${Creds}" +Cmd+=" --log_file=/logs/%T.ac_gateway.log" +Cmd+=" ${ACGW_ADD_ARGS}" +echo ${Cmd} +exec ${Cmd} + diff --git a/microservices/ac_gateway/requirements.txt b/microservices/ac_gateway/requirements.txt new file mode 100644 index 0000000..433ffc3 --- /dev/null +++ b/microservices/ac_gateway/requirements.txt @@ -0,0 +1,10 @@ +aiohttp>=3.7.4.post0 +nest-asyncio>=1.5.5 +hjson>=3.1.0 +sortedcontainers>=2.4.0 +redis>=5.0.8 +python-dateutil>=2.8.2 +types-python-dateutil>=2.8.19.6 +cryptography>=43.0.0 +jwt>=1.3.1 + diff --git a/microservices/docker-compose.yml b/microservices/docker-compose.yml index 003cd34..37c0635 100644 --- a/microservices/docker-compose.yml +++ b/microservices/docker-compose.yml @@ -1,7 +1,7 @@ # CVTT Microservices services: md_gateway: - image: cloud21.cvtt.vpn:5500/md_gateway:latest + image: cloud21.cvtt.vpn:5500/md_gateway:${CVTT_VERSION} container_name: md_gateway environment: CONFIG_SERVICE: ${CONFIG_SERVICE:-cloud16.cvtt.vpn:6789} @@ -13,7 +13,7 @@ services: - redis oe_gateway: - image: cloud21.cvtt.vpn:5500/oe_gateway:latest + image: cloud21.cvtt.vpn:5500/oe_gateway:${CVTT_VERSION} container_name: oe_gateway environment: CONFIG_SERVICE: ${CONFIG_SERVICE:-cloud16.cvtt.vpn:6789} @@ -24,9 +24,21 @@ services: depends_on: - redis + ac_gateway: + image: cloud21.cvtt.vpn:5500/ac_gateway:${CVTT_VERSION} + container_name: ac_gateway + environment: + CONFIG_SERVICE: ${CONFIG_SERVICE:-cloud16.cvtt.vpn:6789} + ACGW_ADD_ARGS: ${ACGW_ADD_ARGS:-} + volumes: + - ./config:/config + - ./logs:/logs + depends_on: + - redis + redis: image: redis:latest - container_name: redis + container_name: redis-cvtt ports: - "16379:6379" volumes: diff --git a/microservices/md_gateway/requirements.txt b/microservices/md_gateway/requirements.txt index 852e647..d837c8c 100644 --- a/microservices/md_gateway/requirements.txt +++ b/microservices/md_gateway/requirements.txt @@ -5,3 +5,5 @@ sortedcontainers>=2.4.0 redis>=5.0.8 python-dateutil>=2.8.2 types-python-dateutil>=2.8.19.6 +cryptography>=43.0.0 +jwt>=1.3.1 diff --git a/microservices/oe_gateway/requirements.txt b/microservices/oe_gateway/requirements.txt index 852e647..3b39e97 100644 --- a/microservices/oe_gateway/requirements.txt +++ b/microservices/oe_gateway/requirements.txt @@ -5,3 +5,7 @@ sortedcontainers>=2.4.0 redis>=5.0.8 python-dateutil>=2.8.2 types-python-dateutil>=2.8.19.6 +cryptography>=43.0.0 +jwt>=1.3.1 + +