From 07f6d5a0c9cc096c8e2ebdb99addf8804915cff3 Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Thu, 24 Oct 2024 18:46:35 +0530 Subject: [PATCH] Run auction handler script from main script --- docker-compose.yml | 3 ++- scripts/handle-auctions.sh | 7 +++++-- scripts/run.sh | 4 ++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 6269b35..5876c43 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,10 +11,11 @@ services: cerc-webapp-auction-handler: image: cerc/webapp-deployer-backend:local restart: always + environment: + RUN_AUCTIONS_HANDLER: "true" volumes: - srv:/srv - config:/etc/config:ro - command: "./scripts/handle-auctions.sh" volumes: config: diff --git a/scripts/handle-auctions.sh b/scripts/handle-auctions.sh index 6a583ce..915d80e 100755 --- a/scripts/handle-auctions.sh +++ b/scripts/handle-auctions.sh @@ -11,8 +11,11 @@ if [ "$HANDLE_AUCTION_REQUESTS" = "true" ]; then exit 2 fi else - echo "Not handling auction requests, exiting..." - exit 0 + echo "Not handling auction requests" + + # k8s integration only supports "always" restart policy, so wait indefinitely + # TODO: Exit container once restart policy is supported + tail -f /dev/null fi STORAGE_ROOT="${STORAGE_ROOT:-/srv}" diff --git a/scripts/run.sh b/scripts/run.sh index ba063e5..b95241f 100755 --- a/scripts/run.sh +++ b/scripts/run.sh @@ -1,5 +1,9 @@ #!/bin/bash +if [ "$RUN_AUCTIONS_HANDLER" = "true" ]; then + exec "./scripts/handle-auctions.sh" +fi + function is_privileged { ip link add dummy0 type dummy >/dev/null if [[ $? -eq 0 ]]; then