mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-02-22 10:20:52 +00:00
get connected to temporal
This commit is contained in:
parent
69c590ff81
commit
d865c42ef8
@ -280,15 +280,21 @@ PostgreSQL::~PostgreSQL()
|
|||||||
void PostgreSQL::configureSmee()
|
void PostgreSQL::configureSmee()
|
||||||
{
|
{
|
||||||
const char *TEMPORAL_HOST = "ZT_TEMPORAL_HOST";
|
const char *TEMPORAL_HOST = "ZT_TEMPORAL_HOST";
|
||||||
|
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 *host = getenv(TEMPORAL_HOST);
|
const char *host = getenv(TEMPORAL_HOST);
|
||||||
|
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 && ns != NULL && task_queue != NULL) {
|
if (host != NULL && port != NULL && ns != NULL && task_queue != NULL) {
|
||||||
this->_smee = smeeclient::smee_client_new(host, ns, task_queue);
|
fprintf(stderr, "creating smee client\n");
|
||||||
|
std::string hostPort = 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");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1426,6 +1432,13 @@ void PostgreSQL::commitThread()
|
|||||||
|
|
||||||
if (_smee != NULL && isNewMember) {
|
if (_smee != NULL && isNewMember) {
|
||||||
notifyNewMember(networkId, memberId);
|
notifyNewMember(networkId, memberId);
|
||||||
|
} else {
|
||||||
|
if (_smee == NULL) {
|
||||||
|
fprintf(stderr, "smee is NULL\n");
|
||||||
|
}
|
||||||
|
if (!isNewMember) {
|
||||||
|
fprintf(stderr, "nt a new member\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint64_t nwidInt = OSUtils::jsonIntHex(config["nwid"], 0ULL);
|
const uint64_t nwidInt = OSUtils::jsonIntHex(config["nwid"], 0ULL);
|
||||||
|
@ -11,4 +11,5 @@ RUN apt -y install \
|
|||||||
binutils \
|
binutils \
|
||||||
linux-tools-gke \
|
linux-tools-gke \
|
||||||
perf-tools-unstable \
|
perf-tools-unstable \
|
||||||
google-perftools
|
google-perftools \
|
||||||
|
netcat
|
||||||
|
@ -100,6 +100,13 @@ else
|
|||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "Waiting for temporal"
|
||||||
|
while ! nc -z ${ZT_TEMPORAL_HOST} ${ZTC_TEMPORAL_PORT}; do
|
||||||
|
echo "waiting...";
|
||||||
|
sleep 1;
|
||||||
|
done
|
||||||
|
echo "Temporal is up"
|
||||||
|
|
||||||
export GLIBCXX_FORCE_NEW=1
|
export GLIBCXX_FORCE_NEW=1
|
||||||
export GLIBCPP_FORCE_NEW=1
|
export GLIBCPP_FORCE_NEW=1
|
||||||
export LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libjemalloc.so.2"
|
export LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libjemalloc.so.2"
|
||||||
|
@ -99,6 +99,9 @@ pub extern "C" fn smee_client_notify_network_joined(
|
|||||||
|
|
||||||
match smee.notify_network_joined(params) {
|
match smee.notify_network_joined(params) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(_) => false,
|
Err(e) => {
|
||||||
|
println!("error notifying network joined: {0}", e.to_string());
|
||||||
|
false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -80,6 +80,7 @@ impl SmeeClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn notify_network_joined(&self, params: NetworkJoinedParams) -> Result<(), Box<dyn std::error::Error>> {
|
pub fn notify_network_joined(&self, params: NetworkJoinedParams) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
|
println!("notifying network joined");
|
||||||
let options = WorkflowOptions {
|
let options = WorkflowOptions {
|
||||||
id_reuse_policy: WorkflowIdReusePolicy::RejectDuplicate,
|
id_reuse_policy: WorkflowIdReusePolicy::RejectDuplicate,
|
||||||
execution_timeout: None,
|
execution_timeout: None,
|
||||||
@ -94,6 +95,7 @@ impl SmeeClient {
|
|||||||
let workflow_id = Uuid::new_v4();
|
let workflow_id = Uuid::new_v4();
|
||||||
|
|
||||||
self.tokio_rt.block_on(async {
|
self.tokio_rt.block_on(async {
|
||||||
|
println!("calilng start_workflow");
|
||||||
self.client
|
self.client
|
||||||
.start_workflow(
|
.start_workflow(
|
||||||
payload,
|
payload,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user