oe_gateway docker image build
This commit is contained in:
parent
d0079d6f56
commit
6dd31615c5
@ -12,6 +12,18 @@ services:
|
|||||||
depends_on:
|
depends_on:
|
||||||
- redis
|
- redis
|
||||||
|
|
||||||
|
oe_gateway:
|
||||||
|
image: cloud21.cvtt.vpn:5500/oe_gateway:latest
|
||||||
|
container_name: oe_gateway
|
||||||
|
environment:
|
||||||
|
CONFIG_SERVICE: ${CONFIG_SERVICE:-cloud16.cvtt.vpn:6789}
|
||||||
|
OEGW_ADD_ARGS: ${OEGW_ADD_ARGS:-}
|
||||||
|
volumes:
|
||||||
|
- ./config:/config
|
||||||
|
- ./logs:/logs
|
||||||
|
depends_on:
|
||||||
|
- redis
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
image: redis:latest
|
image: redis:latest
|
||||||
container_name: redis
|
container_name: redis
|
||||||
|
|||||||
@ -2,8 +2,8 @@ FROM python:3.12-slim
|
|||||||
|
|
||||||
COPY requirements.txt /
|
COPY requirements.txt /
|
||||||
|
|
||||||
RUN pip install --upgrade pip --root-user-action=ignore \
|
RUN pip install --upgrade pip --root-user-action=ignore
|
||||||
pip install -r /requirements.txt --root-user-action=ignore
|
RUN pip install -r /requirements.txt --root-user-action=ignore
|
||||||
|
|
||||||
COPY cvttpy /cvttpy
|
COPY cvttpy /cvttpy
|
||||||
|
|
||||||
|
|||||||
@ -1,25 +1,19 @@
|
|||||||
FROM python:3.12-slim
|
FROM python:3.12-slim
|
||||||
|
|
||||||
ARG ROOT_MCRSVC_DIR=docker_dev/microservices
|
COPY requirements.txt /
|
||||||
ARG FROM_DIR=${ROOT_MCRSVC_DIR}/oe_gateway
|
|
||||||
|
|
||||||
COPY ${ROOT_MCRSVC_DIR}/requirements.txt /
|
|
||||||
RUN pip install --upgrade pip --root-user-action=ignore
|
RUN pip install --upgrade pip --root-user-action=ignore
|
||||||
RUN pip install -r /requirements.txt --root-user-action=ignore
|
RUN pip install -r /requirements.txt --root-user-action=ignore
|
||||||
|
|
||||||
COPY cvttpy /cvttpy
|
COPY cvttpy /cvttpy
|
||||||
COPY ${ROOT_MCRSVC_DIR}/.creds /.creds
|
|
||||||
|
|
||||||
|
RUN mkdir -p /logs /config
|
||||||
|
|
||||||
COPY ${FROM_DIR}/run_oegw.sh /run_oegw.sh
|
|
||||||
RUN chmod +x /run_oegw.sh
|
|
||||||
|
|
||||||
RUN mkdir /logs
|
|
||||||
RUN mkdir -p /config
|
|
||||||
|
|
||||||
|
|
||||||
WORKDIR /
|
|
||||||
SHELL ["/bin/bash", "-c"]
|
SHELL ["/bin/bash", "-c"]
|
||||||
ENV PYTHONPATH=/
|
|
||||||
ENTRYPOINT [ "/run_oegw.sh" ]
|
|
||||||
|
|
||||||
|
ENV PYTHONPATH=/
|
||||||
|
|
||||||
|
COPY entrypoint.sh /entrypoint.sh
|
||||||
|
RUN chmod +x /entrypoint.sh
|
||||||
|
|
||||||
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
|||||||
41
microservices/oe_gateway/build.sh
Executable file
41
microservices/oe_gateway/build.sh
Executable file
@ -0,0 +1,41 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
function usage {
|
||||||
|
echo "Usage: ${0} <version>"
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
|
CvttpyVersion=${1}
|
||||||
|
|
||||||
|
if [ "${CvttpyVersion}" == "" ]
|
||||||
|
then
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
|
||||||
|
# --- Settings
|
||||||
|
ImageName=oe_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"
|
||||||
|
|
||||||
|
|
||||||
15
microservices/oe_gateway/entrypoint.sh
Executable file
15
microservices/oe_gateway/entrypoint.sh
Executable file
@ -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/order_entry_gateway.py"
|
||||||
|
Cmd+=" --config=${Config}"
|
||||||
|
Cmd+=" --credentials_file=${Creds}"
|
||||||
|
Cmd+=" --log_file=/logs/%T.oe_gateway.log"
|
||||||
|
Cmd+=" ${OEGW_ADD_ARGS}"
|
||||||
|
echo ${Cmd}
|
||||||
|
exec ${Cmd}
|
||||||
|
|
||||||
7
microservices/oe_gateway/requirements.txt
Normal file
7
microservices/oe_gateway/requirements.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
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
|
||||||
@ -1,48 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# runs in container
|
|
||||||
|
|
||||||
# runs on host to start container
|
|
||||||
usage() {
|
|
||||||
echo -n "Usage: ${0}"
|
|
||||||
echo -n " [-c <config (/config/cvtt.cfg)>]"
|
|
||||||
echo -n " [-a <admin_port (7220)>]"
|
|
||||||
echo -n " [-z (compress log)"]
|
|
||||||
echo
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
Config=/config/cvtt.cfg
|
|
||||||
AdminPort=7220
|
|
||||||
COMPRESS_LOG=false
|
|
||||||
|
|
||||||
|
|
||||||
while getopts "c:a:z" opt; do
|
|
||||||
case ${opt} in
|
|
||||||
c ) Config=$OPTARG ;;
|
|
||||||
a ) AdminPort=$OPTARG ;;
|
|
||||||
z ) COMPRESS_LOG=true ;;
|
|
||||||
\? )
|
|
||||||
echo "Invalid option: -$OPTARG" >&2
|
|
||||||
usage
|
|
||||||
;;
|
|
||||||
: )
|
|
||||||
echo "Option -$OPTARG requires an argument." >&2
|
|
||||||
usage
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
Cmd="python3.12"
|
|
||||||
Cmd="${Cmd} cvttpy/apps/microservices/market_gateways/order_entry_gateway.py"
|
|
||||||
Cmd="${Cmd} --config=${Config}"
|
|
||||||
Cmd="${Cmd} --credentials_file=/.creds"
|
|
||||||
Cmd="${Cmd} --admin_port=${AdminPort}"
|
|
||||||
Cmd="${Cmd} --log_file=/logs/%T.md_gateway.log"
|
|
||||||
if ${COMPRESS_LOG} ; then
|
|
||||||
Cmd="${Cmd} --compress_log"
|
|
||||||
fi
|
|
||||||
echo ${Cmd}
|
|
||||||
eval ${Cmd}
|
|
||||||
|
|
||||||
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
.git
|
|
||||||
**/__pycache__
|
|
||||||
.pipenv
|
|
||||||
@ -1,26 +0,0 @@
|
|||||||
FROM python:3.12-slim
|
|
||||||
|
|
||||||
ARG ROOT_MUSVC_DIR=docker_dev/microservices
|
|
||||||
ARG FROM_DIR=${ROOT_MUSVC_DIR}/tester
|
|
||||||
|
|
||||||
COPY ${ROOT_MUSVC_DIR}/requirements.txt /
|
|
||||||
RUN pip install --upgrade pip --root-user-action=ignore
|
|
||||||
RUN pip install -r /requirements.txt --root-user-action=ignore
|
|
||||||
|
|
||||||
COPY cvttpy /cvttpy
|
|
||||||
# COPY ${ROOT_MUSVC_DIR}/.creds /.creds
|
|
||||||
|
|
||||||
|
|
||||||
COPY ${FROM_DIR}/run_tester.sh /run_tester.sh
|
|
||||||
RUN chmod +x /run_tester.sh
|
|
||||||
|
|
||||||
RUN mkdir /logs
|
|
||||||
RUN mkdir -p /config
|
|
||||||
RUN mkdir -p /data
|
|
||||||
|
|
||||||
|
|
||||||
WORKDIR /
|
|
||||||
SHELL ["/bin/bash", "-c"]
|
|
||||||
ENV PYTHONPATH=/
|
|
||||||
ENTRYPOINT [ "/run_tester.sh" ]
|
|
||||||
|
|
||||||
@ -1,55 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# runs in container
|
|
||||||
|
|
||||||
# runs on host to start container
|
|
||||||
usage() {
|
|
||||||
echo -n "Usage: ${0}"
|
|
||||||
echo -n " [-c <config (/config/cvtt.cfg) >]"
|
|
||||||
echo -n " [-i <instruments (COINBASE:PAIR-BTC-USD,BNBFUT:PERP-BTC-USDT) >]"
|
|
||||||
echo -n " [-d <data types (TRADES) >]"
|
|
||||||
echo -n " [-a <admin_port (7221) >]"
|
|
||||||
echo -n " [-z (compress log (false))"]
|
|
||||||
echo
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
Config=/config/cvtt.cfg
|
|
||||||
AdminPort=7221
|
|
||||||
COMPRESS_LOG=false
|
|
||||||
Instruments="COINBASE:PAIR-BTC-USD,BNBFUT:PERP-BTC-USDT"
|
|
||||||
DataTypes="TRADES"
|
|
||||||
|
|
||||||
while getopts "a:c:d:i:z" opt; do
|
|
||||||
case ${opt} in
|
|
||||||
c ) Config=$OPTARG ;;
|
|
||||||
a ) AdminPort=$OPTARG ;;
|
|
||||||
i ) Instruments=$OPTARG ;;
|
|
||||||
d ) DataTypes=$OPTARG ;;
|
|
||||||
z ) COMPRESS_LOG=true ;;
|
|
||||||
\? )
|
|
||||||
echo "Invalid option: -$OPTARG" >&2
|
|
||||||
usage
|
|
||||||
;;
|
|
||||||
: )
|
|
||||||
echo "Option -$OPTARG requires an argument." >&2
|
|
||||||
usage
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
Cmd="python3.12"
|
|
||||||
Cmd="${Cmd} cvttpy/apps/microservices/tester/musvc_tester.py"
|
|
||||||
Cmd="${Cmd} --config=${Config}"
|
|
||||||
Cmd="${Cmd} --credentials_file=/.creds"
|
|
||||||
Cmd="${Cmd} --admin_port=${AdminPort}"
|
|
||||||
Cmd="${Cmd} --data_types=${DataTypes}"
|
|
||||||
Cmd="${Cmd} --instruments=${Instruments}"
|
|
||||||
Cmd="${Cmd} --log_file=/logs/%T.tester.log"
|
|
||||||
if ${COMPRESS_LOG} ; then
|
|
||||||
Cmd="${Cmd} --compress_log"
|
|
||||||
fi
|
|
||||||
echo ${Cmd}
|
|
||||||
eval ${Cmd}
|
|
||||||
|
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user