|
|
@@ -32,9 +32,9 @@ pipeline {
|
|
|
IMAGE_GATEWAY = 'alien_gateway:local'
|
|
|
IMAGE_CONTRACT = 'alien_contract:local'
|
|
|
|
|
|
- CONTAINER_NAME_STORE = 'alien_store_produ'
|
|
|
- CONTAINER_NAME_GATEWAY = 'alien_gateway_produ'
|
|
|
- CONTAINER_NAME_CONTRACT = 'alien_contract_produ'
|
|
|
+ CONTAINER_NAME_STORE = 'py_esign_produ'
|
|
|
+ CONTAINER_NAME_GATEWAY = 'py_gateway_produ'
|
|
|
+ CONTAINER_NAME_CONTRACT = 'py_contract_produ'
|
|
|
|
|
|
PORT_STORE_INTERNAL = '48001'
|
|
|
PORT_GATEWAY_INTERNAL = '43333'
|
|
|
@@ -117,12 +117,37 @@ sudo docker network create ${DOCKER_NET} 2>/dev/null || true
|
|
|
mkdir -p ${LOG_ROOT_REMOTE}/store ${LOG_ROOT_REMOTE}/gateway ${LOG_ROOT_REMOTE}/contract
|
|
|
|
|
|
sudo docker rm -f ${CONTAINER_NAME_STORE} ${CONTAINER_NAME_GATEWAY} ${CONTAINER_NAME_CONTRACT} 2>/dev/null || true
|
|
|
+# legacy / previous container names (same host ports)
|
|
|
+sudo docker rm -f esign alien_gateway_py alien_contract_py \\
|
|
|
+ alien_store_produ alien_gateway_produ alien_contract_produ 2>/dev/null || true
|
|
|
+
|
|
|
+wait_http() {
|
|
|
+ url="\$1"
|
|
|
+ label="\$2"
|
|
|
+ cname="\$3"
|
|
|
+ for i in \$(seq 1 30); do
|
|
|
+ if curl -sf "\$url" >/dev/null 2>&1; then
|
|
|
+ echo ">>> \$label OK: \$url"
|
|
|
+ return 0
|
|
|
+ fi
|
|
|
+ sleep 2
|
|
|
+ done
|
|
|
+ echo ">>> \$label FAILED: \$url"
|
|
|
+ if [ -n "\$cname" ]; then
|
|
|
+ echo ">>> docker ps -a:"
|
|
|
+ sudo docker ps -a --filter name="\$cname" || true
|
|
|
+ echo ">>> docker logs --tail 100 \$cname:"
|
|
|
+ sudo docker logs --tail 100 "\$cname" 2>&1 || true
|
|
|
+ fi
|
|
|
+ return 1
|
|
|
+}
|
|
|
|
|
|
sudo docker run -d --name ${CONTAINER_NAME_STORE} \\
|
|
|
--network ${DOCKER_NET} \\
|
|
|
--env-file ${ENV_FILE_REMOTE} \\
|
|
|
-v ${ENV_FILE_REMOTE}:/app/.env.produ:ro \\
|
|
|
-v ${LOG_ROOT_REMOTE}/store:/app/common/logs/alien_store \\
|
|
|
+ -e SNOWFLAKE_WORKER_IP=127.0.0.1 \\
|
|
|
--restart unless-stopped \\
|
|
|
${IMAGE_STORE}
|
|
|
|
|
|
@@ -132,6 +157,7 @@ sudo docker run -d --name ${CONTAINER_NAME_CONTRACT} \\
|
|
|
--env-file ${ENV_FILE_REMOTE} \\
|
|
|
-v ${ENV_FILE_REMOTE}:/app/.env.produ:ro \\
|
|
|
-v ${LOG_ROOT_REMOTE}/contract:/app/common/logs/alien_contract \\
|
|
|
+ -e SNOWFLAKE_WORKER_IP=127.0.0.1 \\
|
|
|
--restart unless-stopped \\
|
|
|
${IMAGE_CONTRACT}
|
|
|
|
|
|
@@ -142,12 +168,12 @@ sudo docker run -d --name ${CONTAINER_NAME_GATEWAY} \\
|
|
|
-v ${ENV_FILE_REMOTE}:/app/.env.produ:ro \\
|
|
|
-v ${LOG_ROOT_REMOTE}/gateway:/app/common/logs/alien_gateway \\
|
|
|
-e STORE_BASE_URL=http://${CONTAINER_NAME_STORE}:${PORT_STORE_INTERNAL} \\
|
|
|
+ -e SNOWFLAKE_WORKER_IP=127.0.0.1 \\
|
|
|
--restart unless-stopped \\
|
|
|
${IMAGE_GATEWAY}
|
|
|
|
|
|
-sleep 3
|
|
|
-curl -sf http://127.0.0.1:${PORT_GATEWAY_HOST}/health || (echo 'gateway /health failed' && exit 1)
|
|
|
-curl -sf http://127.0.0.1:${PORT_CONTRACT_HOST}/health || (echo 'contract /health failed' && exit 1)
|
|
|
+wait_http "http://127.0.0.1:${PORT_CONTRACT_HOST}/health" "contract" "${CONTAINER_NAME_CONTRACT}"
|
|
|
+wait_http "http://127.0.0.1:${PORT_GATEWAY_HOST}/health" "gateway" "${CONTAINER_NAME_GATEWAY}"
|
|
|
sudo docker ps --filter name=${CONTAINER_NAME_STORE} --filter name=${CONTAINER_NAME_GATEWAY} --filter name=${CONTAINER_NAME_CONTRACT}
|
|
|
REMOTE_EOF
|
|
|
"""
|