new microservices images
This commit is contained in:
parent
b78304b620
commit
930981b260
@ -1,52 +1,22 @@
|
||||
version: "3.9"
|
||||
|
||||
# CVTT Microservices
|
||||
services:
|
||||
md_gateway:
|
||||
image: cloud21.cvtt.vpn:5500/md_gateway:latest
|
||||
container_name: md_gateway
|
||||
environment:
|
||||
- REDIS_HOST=redis
|
||||
volumes:
|
||||
- ./.creds:/.creds
|
||||
- ./config:/config
|
||||
- ./logs:/logs
|
||||
- ./data:/data
|
||||
depends_on:
|
||||
- redis
|
||||
|
||||
tester:
|
||||
image: cloud21.cvtt.vpn:5500/tester:latest
|
||||
container_name: tester
|
||||
environment:
|
||||
- REDIS_HOST=redis
|
||||
CONFIG_SERVICE: ${CONFIG_SERVICE:-cloud16.cvtt.vpn:6789}
|
||||
MDGW_ADD_ARGS: ${MDGW_ADD_ARGS:-}
|
||||
volumes:
|
||||
- ./config:/config
|
||||
- ./logs:/logs
|
||||
- ./data:/data
|
||||
depends_on:
|
||||
- redis
|
||||
- md_gateway
|
||||
|
||||
redis:
|
||||
image: redis:latest
|
||||
container_name: redis
|
||||
ports:
|
||||
- "6379:6379"
|
||||
- "16379:6379"
|
||||
volumes:
|
||||
- ./data/redis:/data
|
||||
|
||||
|
||||
# test_program:
|
||||
# image: your_test_program_image:latest
|
||||
# container_name: test_program
|
||||
# environment:
|
||||
# - REDIS_HOST=redis
|
||||
# volumes:
|
||||
# - ./config:/shared/config
|
||||
# - ./logs:/shared/logs
|
||||
# depends_on:
|
||||
# - market_data_gateway
|
||||
# - redis
|
||||
|
||||
# volumes:
|
||||
# redis_data:
|
||||
|
||||
@ -1,25 +1,19 @@
|
||||
FROM python:3.12-slim
|
||||
|
||||
ARG ROOT_MCRSVC_DIR=docker_dev/microservices
|
||||
ARG FROM_DIR=${ROOT_MCRSVC_DIR}/md_gateway
|
||||
COPY requirements.txt /
|
||||
|
||||
COPY ${ROOT_MCRSVC_DIR}/requirements.txt /
|
||||
RUN pip install --upgrade pip --root-user-action=ignore
|
||||
RUN pip install -r /requirements.txt --root-user-action=ignore
|
||||
RUN pip install --upgrade pip --root-user-action=ignore \
|
||||
pip install -r /requirements.txt --root-user-action=ignore
|
||||
|
||||
COPY cvttpy /cvttpy
|
||||
# COPY ${ROOT_MCRSVC_DIR}/.creds /.creds
|
||||
|
||||
RUN mkdir -p /logs /config
|
||||
|
||||
COPY ${FROM_DIR}/run_mdgw.sh /run_mdgw.sh
|
||||
RUN chmod +x /run_mdgw.sh
|
||||
|
||||
RUN mkdir /logs
|
||||
RUN mkdir -p /config
|
||||
|
||||
|
||||
WORKDIR /
|
||||
SHELL ["/bin/bash", "-c"]
|
||||
ENV PYTHONPATH=/
|
||||
ENTRYPOINT [ "/run_mdgw.sh" ]
|
||||
|
||||
ENV PYTHONPATH=/
|
||||
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
||||
91
microservices/md_gateway/build.sh
Executable file
91
microservices/md_gateway/build.sh
Executable file
@ -0,0 +1,91 @@
|
||||
#!/bin/bash
|
||||
|
||||
function usage {
|
||||
echo "Usage: ${0} <version>"
|
||||
exit
|
||||
}
|
||||
|
||||
CvttpyVersion=${1}
|
||||
|
||||
if [ "${CvttpyVersion}" == "" ]
|
||||
then
|
||||
usage
|
||||
fi
|
||||
|
||||
# --- Settings
|
||||
ImageName=md_gateway
|
||||
RegistryService=cloud21.cvtt.vpn:5500
|
||||
# --- Settings
|
||||
|
||||
get_cvttpy() {
|
||||
Version=${1}
|
||||
Project=cvttpy
|
||||
|
||||
host="cloud21.cvtt.vpn"
|
||||
port="22"
|
||||
user="cvttdist"
|
||||
rel_dir="/home/cvttdist/software/cvtt2"
|
||||
if [ "${Version}" == "latest" ]; then
|
||||
echo "Checking for latest version of ${Project} on ${user}@${host}:${rel_dir}"
|
||||
Version=$(ssh -q -p ${port} ${user}@${host} "ls -tr ${rel_dir}/${Project} | tail -1" )
|
||||
echo "Latest version is ${Version}"
|
||||
fi
|
||||
echo "Checking ${user}@${host} for ${rel_dir}/${Project}/${Version} ..."
|
||||
if ssh -q -p ${port} ${user}@${host} "test -d ${rel_dir}/${Project}/${Version}"
|
||||
then
|
||||
echo "Version ${Version} found..."
|
||||
rsync_cmd="rsync -ahv -e \"ssh -p ${port}\""
|
||||
rsync_cmd="${rsync_cmd} ${user}@${host}:${rel_dir}/${Project}/${Version}/"
|
||||
rsync_cmd="${rsync_cmd} ./"
|
||||
echo ${rsync_cmd}
|
||||
eval ${rsync_cmd}
|
||||
status=$?
|
||||
if [ ${status} -eq 0 ]
|
||||
then
|
||||
echo "Loading successful..."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "Not Found ${rel_dir}/${Project}/${Version} on ${user}@${host}"
|
||||
fi
|
||||
}
|
||||
|
||||
DockerDir=$(realpath $(dirname ${0}))
|
||||
Version=${CvttpyVersion}
|
||||
|
||||
cd ${DockerDir}
|
||||
|
||||
get_cvttpy ${Version}
|
||||
|
||||
function cleanup {
|
||||
cd ${DockerDir}
|
||||
rm -rf cvttpy
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
Cmd="docker build"
|
||||
Cmd+=" -t ${ImageName}"
|
||||
Cmd+=" -t ${ImageName}:latest"
|
||||
Cmd+=" -t ${ImageName}:${Version}"
|
||||
Cmd+=" -f Dockerfile"
|
||||
Cmd+=" ."
|
||||
echo ${Cmd}
|
||||
eval ${Cmd} || exit
|
||||
|
||||
Cmd="docker tag ${ImageName}:latest ${RegistryService}/${ImageName}:latest"
|
||||
echo ${Cmd}
|
||||
eval ${Cmd} || exit
|
||||
|
||||
Cmd="docker tag ${ImageName}:${Version} ${RegistryService}/${ImageName}:${Version}"
|
||||
echo ${Cmd}
|
||||
eval ${Cmd} || exit
|
||||
|
||||
Cmd="docker push ${RegistryService}/${ImageName}:latest"
|
||||
echo ${Cmd}
|
||||
eval ${Cmd} || exit
|
||||
|
||||
Cmd="docker push ${RegistryService}/${ImageName}:${Version}"
|
||||
echo ${Cmd}
|
||||
eval ${Cmd} || exit
|
||||
|
||||
|
||||
15
microservices/md_gateway/entrypoint.sh
Executable file
15
microservices/md_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/md_gateway.py"
|
||||
Cmd+=" --config=${Config}"
|
||||
Cmd+=" --credentials_file=${Creds}"
|
||||
Cmd+=" --log_file=/logs/%T.md_gateway.log"
|
||||
Cmd+=" ${MDGW_ADD_ARGS}"
|
||||
echo ${Cmd}
|
||||
exec ${Cmd}
|
||||
|
||||
7
microservices/md_gateway/requirements.txt
Normal file
7
microservices/md_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/md_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}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user