Skip to content

Commit

Permalink
fix: update job cronicle
Browse files Browse the repository at this point in the history
  • Loading branch information
aeppling committed Oct 25, 2024
1 parent 72ca9a4 commit e86de16
Showing 1 changed file with 26 additions and 11 deletions.
37 changes: 26 additions & 11 deletions cronicle/jobCronicleScriptDocker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

# docker pull innovtech/kexa:latest

echo "Testing API connectivity..."
echo "KEXA_API_URL: ${KEXA_API_URL}"
echo "NAMESPACE: ${KUBE_APP_NAME}"
curl -v "http://${KUBE_APP_NAME}-api-svc:4012" || echo "Service name only failed"
curl -v "http://${KUBE_APP_NAME}-api-svc.kexa:4012" || echo "Service with namespace failed"

TMP_KEXA_IMG="temp_image"
HOST_CONFIG_FOLDER="tmpconfig"
KUBERNETES_CONFIG_FOLDER="kubernetesconfigurations"
Expand All @@ -12,10 +18,16 @@ SHARED_DIR="/app/shared/$HOST_CONFIG_FOLDER/rules"

mkdir /tmp/$KUBERNETES_CONFIG_FOLDER

for file in /app/$KUBERNETES_CONFIG_FOLDER/*; do
filename=$(basename "$file")
cat "$file" > "/tmp/$KUBERNETES_CONFIG_FOLDER/$filename"
done
if [ -d "/app/$KUBERNETES_CONFIG_FOLDER" ] && [ "$(ls -A /app/$KUBERNETES_CONFIG_FOLDER 2>/dev/null)" ]; then
for file in /app/$KUBERNETES_CONFIG_FOLDER/*; do
if [ -f "$file" ]; then
filename=$(basename "$file")
cat "$file" > "/tmp/$KUBERNETES_CONFIG_FOLDER/$filename"
fi
done
else
echo "No Kubernetes configuration files found or directory is empty"
fi

if [ "$(docker ps -aq -f name=temp_container)" ]; then
docker stop temp_container
Expand All @@ -41,9 +53,10 @@ docker cp "$SHARED_DIR" temp_container:/app/
docker cp /app/config temp_container:/app/
echo "INTERFACE_CONFIGURATION_ENABLED='true'" >> /app/.env
docker cp /app/.env temp_container:/app/.env
docker cp /tmp/$KUBERNETES_CONFIG_FOLDER/* temp_container:/app/

docker exec temp_container sh -c 'ls /app/'
if [ "$(ls -A /tmp/$KUBERNETES_CONFIG_FOLDER 2>/dev/null)" ]; then
docker cp /tmp/$KUBERNETES_CONFIG_FOLDER/. temp_container:/app/
fi

docker commit temp_container $TMP_KEXA_IMG

Expand All @@ -52,14 +65,16 @@ printenv | grep -E '^[A-Z_][A-Z0-9_]*=.*$' | grep -v ' ' > tmp_env_file
echo "Running kexa..."

docker run --rm \
-e NODE_OPTIONS="--max-old-space-size=8192" \
--env-file tmp_env_file \
$TMP_KEXA_IMG sh -c "pnpm run start:nobuild"
--network=host \
-e NODE_OPTIONS="--max-old-space-size=8192" \
--env-file tmp_env_file \
$TMP_KEXA_IMG sh -c "pnpm run start:nobuild"

rm -rf tmp_env_file

rm -rf /tmp/$KUBERNETES_CONFIG_FOLDER/*
rmdir -rf /tmp/$KUBERNETES_CONFIG_FOLDER
rm -rf /tmp/$KUBERNETES_CONFIG_FOLDER
rmdir /tmp/$KUBERNETES_CONFIG_FOLDER 2>/dev/null || true


if [ "$(docker ps -aq -f name=temp_container)" ]; then
docker stop temp_container
Expand Down

0 comments on commit e86de16

Please sign in to comment.