This commit is contained in:
Oleg Sheynin 2024-01-19 15:07:12 -05:00
parent 85b0dcec5f
commit 8ec343416c
7 changed files with 76 additions and 11 deletions

View File

@ -1,10 +1,18 @@
#!/bin/bash
function usage {
echo "Usage: ${0} <target_host_name>"
echo "Usage: ${0} <app_name> <target_host>"
exit
}
AppName=${1}
if [ "${AppName}" == "" ]
then
usage
fi
shift
TgtHostname=${1}
if [ "${TgtHostname}" == "" ]
@ -14,19 +22,20 @@ fi
# --- Settings
DockerDir=$(dirname ${0})
RootDir=${DockerDir}/../..
DockerDir=$(realpath $(dirname ${0})/${AppName})
RootDir=$(realpath ${DockerDir}/../..)
cd ${RootDir}
ImageName=cvtt_executor
ImageName=${AppName}
ImageDir=${HOME}/docker_images
mkdir -p ${ImageDir}
TgtImageDir=/home/cvtt/docker_images
Version=$(cat ${RootDir}/cvttpy/release_version.txt)
cd ${RootDir}
Cmd="docker build -t ${ImageName} -t ${ImageName}:${Version} -f ${DockerDir}/Dockerfile ."
echo ${Cmd}
eval ${Cmd}

View File

@ -2,7 +2,7 @@
# ===== MUST RUN ON TARGET HOST
ImageName=cvtt_executor
ImageName=${1}
ImageDir=/home/cvtt/docker_images
AdminPort=7220
@ -10,7 +10,7 @@ LogDir=/home/cvtt/prod/logs
mkdir -p ${LogDir}
docker image rm -f ${ImageName}
docker image rm -f ${ImageName}:*
docker rm -f ${ImageName}
docker load -i ${ImageDir}/${ImageName}.img.tar
docker run -d --network="host" --name=${ImageName} -p ${AdminPort}:${AdminPort} -v ${LogDir}:/logs ${ImageName}

View File

@ -11,5 +11,4 @@
, "account_uuid": "???"
, "book_id": "CVTT_BK01"
}
}

View File

@ -13,13 +13,17 @@ COPY docker_dev/executor/.creds /.creds
RUN mkdir /logs
ENV PYTHONPATH=/
# default config
ENV CONFIG=http://cloud16.cvtt.vpn:6789/apps/cvtt
CMD [ \
"python3.10", \
"cvttpy/apps/executor_app.py", \
"--config=http://cloud16.cvtt.vpn:6789/apps/cvtt", \
"--config=${CONFIG}", \
"--admin_port=7220", \
"--active_exchanges=COINBASE_AT", \
"--credentials_file=/.creds", \
"--credentials_file=/.creds", \
"--log_file=/logs/%T.EXECUTOR_APP.log" \
]

14
quant/.creds Normal file
View File

@ -0,0 +1,14 @@
{
"COINBASE_ADV_TRD": {
"api_key": "nKIyZxS95J4MsY4N"
, "secret_key": "sih7Txx3htlTWJrQ3EiuRS3qRfv7qZ4P"
, "account_uuid": "???"
, "book_id": "CVTT_BK01"
}
, "COINBASE_ADV_RO": {
"api_key": "Ip4QpRtRHBmWNpc3"
, "secret_key": "N6ZEMdIdUYUldkJRTUcCRKUFot4Fp2j0"
, "account_uuid": "???"
, "book_id": "CVTT_BK01"
}
}

33
quant/Dockerfile Normal file
View File

@ -0,0 +1,33 @@
FROM python:3.10-slim
WORKDIR /
COPY docker_dev/quant/requirements.txt /
RUN pip install --upgrade pip
RUN pip install -r /requirements.txt
COPY cvttpy /cvttpy
COPY docker_dev/quant/.creds /.creds
RUN mkdir /logs
ENV PYTHONPATH=/
# default config
ENV CONFIG=http://cloud16.cvtt.vpn:6789/apps/cvtt
ENV BOOK_ID=CVTT_CLD17_BK01
# ENV INSTRUMENTS="COINBASE:PAIR-BTC-USD"
CMD [ \
"python3.10", \
"cvttpy/apps/quant_app.py", \
"--config=${CONFIG}", \
"--credentials_file=/.creds", \
"--active_exchanges=COINBASE_AT", \
# "--instruments=${INSTRUMENTS}", \
"--instruments=COINBASE:PAIR-BTC-USD", \
"--book=${BOOK_ID}" \
"--admin_port=7221", \
"--log_file=/logs/%T.QUANT.log" \
]

6
quant/requirements.txt Normal file
View File

@ -0,0 +1,6 @@
aiohttp>=3.7.4.post0
aioredis>=2.0.1
nest-asyncio>=1.5.5
hjson>=3.1.0
# sortedcontainers>=2.4.0
pandas>=1.5.3