From 60fb8c941af3a01b074dc769d6d1a331421b5f36 Mon Sep 17 00:00:00 2001 From: Grant Limberg Date: Tue, 29 Aug 2023 16:43:05 -0700 Subject: [PATCH] fully wire up temporal. add startup script test to ensure temporal is running --- controller/PostgreSQL.cpp | 9 +++++++-- ext/central-controller-docker/Dockerfile.builder | 2 +- ext/central-controller-docker/Dockerfile.run_base | 4 ++-- ext/central-controller-docker/main.sh | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/controller/PostgreSQL.cpp b/controller/PostgreSQL.cpp index 5aa6d2c20..beee5e06d 100644 --- a/controller/PostgreSQL.cpp +++ b/controller/PostgreSQL.cpp @@ -279,19 +279,24 @@ PostgreSQL::~PostgreSQL() void PostgreSQL::configureSmee() { + const char *TEMPORAL_SCHEME = "ZT_TEMPORAL_SCHEME"; const char *TEMPORAL_HOST = "ZT_TEMPORAL_HOST"; const char *TEMPORAL_PORT = "ZT_TEMPORAL_PORT"; const char *TEMPORAL_NAMESPACE = "ZT_TEMPORAL_NAMESPACE"; const char *SMEE_TASK_QUEUE = "ZT_SMEE_TASK_QUEUE"; + const char *scheme = getenv(TEMPORAL_SCHEME); + if (scheme == NULL) { + scheme = "http"; + } const char *host = getenv(TEMPORAL_HOST); const char *port = getenv(TEMPORAL_PORT); const char *ns = getenv(TEMPORAL_NAMESPACE); const char *task_queue = getenv(SMEE_TASK_QUEUE); - if (host != NULL && port != NULL && ns != NULL && task_queue != NULL) { + if (scheme != NULL && host != NULL && port != NULL && ns != NULL && task_queue != NULL) { fprintf(stderr, "creating smee client\n"); - std::string hostPort = std::string(host) + std::string(":") + std::string(port); + std::string hostPort = std::string(scheme) + std::string("://") + std::string(host) + std::string(":") + std::string(port); this->_smee = smeeclient::smee_client_new(hostPort.c_str(), ns, task_queue); } else { fprintf(stderr, "Smee client not configured\n"); diff --git a/ext/central-controller-docker/Dockerfile.builder b/ext/central-controller-docker/Dockerfile.builder index e5b7810ff..29356b8e4 100644 --- a/ext/central-controller-docker/Dockerfile.builder +++ b/ext/central-controller-docker/Dockerfile.builder @@ -21,6 +21,6 @@ RUN apt -y install \ curl \ google-perftools \ libgoogle-perftools-dev \ - protobuf-compiler + protobuf-compiler RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y diff --git a/ext/central-controller-docker/Dockerfile.run_base b/ext/central-controller-docker/Dockerfile.run_base index c724bc251..a581d015f 100644 --- a/ext/central-controller-docker/Dockerfile.run_base +++ b/ext/central-controller-docker/Dockerfile.run_base @@ -3,6 +3,7 @@ FROM ubuntu:jammy RUN apt update && apt upgrade -y RUN apt -y install \ + netcat \ postgresql-client \ postgresql-client-common \ libjemalloc2 \ @@ -11,5 +12,4 @@ RUN apt -y install \ binutils \ linux-tools-gke \ perf-tools-unstable \ - google-perftools \ - netcat + google-perftools diff --git a/ext/central-controller-docker/main.sh b/ext/central-controller-docker/main.sh index 838c97316..04778a277 100755 --- a/ext/central-controller-docker/main.sh +++ b/ext/central-controller-docker/main.sh @@ -101,7 +101,7 @@ else fi echo "Waiting for temporal" -while ! nc -z ${ZT_TEMPORAL_HOST} ${ZTC_TEMPORAL_PORT}; do +while ! nc -z ${ZT_TEMPORAL_HOST} ${ZT_TEMPORAL_PORT}; do echo "waiting..."; sleep 1; done