From f453727d403d33c50d490770fdef0a3e7a10c022 Mon Sep 17 00:00:00 2001 From: ucpr Date: Sun, 17 Dec 2023 16:28:19 +0900 Subject: [PATCH] chore: fix pubsub emulator initialize --- docker-compose.yaml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index fcc6f6a..ede5b66 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -39,14 +39,19 @@ services: - "8085:8085" entrypoint: /bin/bash - pubsub-init: + setup-pubsub-emulator: image: gcr.io/google.com/cloudsdktool/cloud-sdk:455.0.0-emulators depends_on: - pubsub-emulator environment: PUBSUB_EMULATOR_HOST: "pubsub-emulator:8085" command: | - gcloud config configurations create emulator && gcloud config set project dummy-project && gcloud config set auth/disable_credentials true && gcloud pubsub topics create dummy-topic && echo "finish setup pubsub" + bash -c " + until curl -X GET \"http://pubsub-emulator:8085\"; do + sleep 1 + done + curl -X PUT "http://pubsub-emulator:8085/v1/projects/dummy-project/topics/dummy-topic" + " mongo-streamer: build: . @@ -55,6 +60,7 @@ services: - mongo-primary - mongo-secondary - mongo-arbiter + - setup-pubsub-emulator ports: - "8080:8080" develop: @@ -71,7 +77,7 @@ services: METRICS_ADDR: :8080 PUBSUB_PROJECT_ID: "dummy-project" PUBSUB_TOPIC_ID: "dummy-topic" - PUBSUB_EMULATOR_HOST: "localhost:8085" + PUBSUB_EMULATOR_HOST: "pubsub-emulator:8085" prometheus: image: prom/prometheus