fully wire up temporal. add startup script test to ensure temporal is running

This commit is contained in:
Grant Limberg 2023-08-29 16:43:05 -07:00
parent d865c42ef8
commit 60fb8c941a
No known key found for this signature in database
GPG Key ID: 8F2F97D3BE8D7735
4 changed files with 11 additions and 6 deletions

View File

@ -279,19 +279,24 @@ PostgreSQL::~PostgreSQL()
void PostgreSQL::configureSmee() void PostgreSQL::configureSmee()
{ {
const char *TEMPORAL_SCHEME = "ZT_TEMPORAL_SCHEME";
const char *TEMPORAL_HOST = "ZT_TEMPORAL_HOST"; const char *TEMPORAL_HOST = "ZT_TEMPORAL_HOST";
const char *TEMPORAL_PORT = "ZT_TEMPORAL_PORT"; const char *TEMPORAL_PORT = "ZT_TEMPORAL_PORT";
const char *TEMPORAL_NAMESPACE = "ZT_TEMPORAL_NAMESPACE"; const char *TEMPORAL_NAMESPACE = "ZT_TEMPORAL_NAMESPACE";
const char *SMEE_TASK_QUEUE = "ZT_SMEE_TASK_QUEUE"; 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 *host = getenv(TEMPORAL_HOST);
const char *port = getenv(TEMPORAL_PORT); const char *port = getenv(TEMPORAL_PORT);
const char *ns = getenv(TEMPORAL_NAMESPACE); const char *ns = getenv(TEMPORAL_NAMESPACE);
const char *task_queue = getenv(SMEE_TASK_QUEUE); 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"); 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); this->_smee = smeeclient::smee_client_new(hostPort.c_str(), ns, task_queue);
} else { } else {
fprintf(stderr, "Smee client not configured\n"); fprintf(stderr, "Smee client not configured\n");

View File

@ -3,6 +3,7 @@ FROM ubuntu:jammy
RUN apt update && apt upgrade -y RUN apt update && apt upgrade -y
RUN apt -y install \ RUN apt -y install \
netcat \
postgresql-client \ postgresql-client \
postgresql-client-common \ postgresql-client-common \
libjemalloc2 \ libjemalloc2 \
@ -11,5 +12,4 @@ RUN apt -y install \
binutils \ binutils \
linux-tools-gke \ linux-tools-gke \
perf-tools-unstable \ perf-tools-unstable \
google-perftools \ google-perftools
netcat

View File

@ -101,7 +101,7 @@ else
fi fi
echo "Waiting for temporal" 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..."; echo "waiting...";
sleep 1; sleep 1;
done done