From: Jeroen van der Heijden Date: Tue, 3 Nov 2020 14:00:10 +0000 (+0100) Subject: changes for kube X-Git-Tag: archive/raspbian/2.0.44-1+rpi1~1^2~3^2~1^2~3^2~2^2~3 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=1b151664991ae43b9d2dc5acd0ba1a8a65e499b7;p=siridb-server.git changes for kube --- diff --git a/Kubernetes/statefulset.yaml b/Kubernetes/statefulset.yaml new file mode 100644 index 00000000..6d56ca70 --- /dev/null +++ b/Kubernetes/statefulset.yaml @@ -0,0 +1,84 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: thingsdb + labels: + app: thingsdb +spec: + selector: + matchLabels: + app: thingsdb + serviceName: thingsdb + replicas: 2 + updateStrategy: + type: RollingUpdate + podManagementPolicy: Parallel + template: + metadata: + labels: + app: thingsdb + spec: + terminationGracePeriodSeconds: 90 + dnsConfig: + searches: + - thingsdb.default.svc.cluster.local + containers: + - name: thingsdb + image: thingsdb/node:gcloud-v0.9.19 + imagePullPolicy: Always + args: ["--deploy"] + env: + - name: SIRIDB_HTTP_STATUS_PORT + value: "8080" + - name: SIRIDB_HTTP_API_PORT + value: "80" + - name: SIRIDB_ENABLE_SHARD_COMPRESSION + value: "1" + - name: SIRIDB_BUFFER_SYNC_INTERVAL + value: "500" + - name: SIRIDB_DEFAULT_DB_PATH + value: /mnt/thingsdb/ + - name: SIRIDB_BIND_SERVER_ADDRESS + value: "0.0.0.0" + - name: SIRIDB_BIND_CLIENT_ADDRESS + value: "0.0.0.0" + - name: SIRIDB_SERVER_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + ports: + - name: status + containerPort: 8080 + - name: client + containerPort: 9200 + - name: http + containerPort: 9210 + - name: node + containerPort: 9220 + volumeMounts: + - name: data + mountPath: /mnt/siridb/ + resources: + requests: + memory: 100M + livenessProbe: + httpGet: + path: /healthy + port: 8080 + periodSeconds: 10 + timeoutSeconds: 5 + readinessProbe: + httpGet: + path: /ready + port: 8080 + initialDelaySeconds: 5 + periodSeconds: 10 + timeoutSeconds: 2 + volumeClaimTemplates: + - metadata: + name: data + spec: + accessModes: ["ReadWriteOnce"] + resources: + requests: + storage: 20Gi diff --git a/src/siri/net/tcp.c b/src/siri/net/tcp.c index 76ce0bee..06a7cb83 100644 --- a/src/siri/net/tcp.c +++ b/src/siri/net/tcp.c @@ -132,34 +132,35 @@ int sirinet_extract_addr_port( } } - if ( !strlen(address) || - strlen(address) >= SIRI_CFG_MAX_LEN_ADDRESS || - !xstr_is_int(strport) || - strcpy(addr, address) == NULL || - xstr_replace_str( - addr, - "%HOSTNAME", - hostname, - SIRI_CFG_MAX_LEN_ADDRESS)) + if (!strlen(address) || strlen(address) >= SIRI_CFG_MAX_LEN_ADDRESS) { - log_critical( - "error: got an unexpected value '%s:%s'.", - address, - strport); + log_critical("error: got an unexpected address value '%s'.", s); return -1; } - test_port = atoi(strport); - - if (test_port < 1 || test_port > 65535) + if (strcpy(addr, address) == NULL || xstr_replace_str( + addr, + "%HOSTNAME", + hostname, + SIRI_CFG_MAX_LEN_ADDRESS)) { - log_critical( - "error: port should be between 1 and 65535, got '%d'.", - test_port); + log_critical("error: memory allocation while copying address"); return -1; } - *addrport = (uint16_t) test_port; + if (xstr_is_int(strport)) + { + test_port = atoi(strport); + if (test_port < 1 || test_port > 65535) + { + log_critical( + "error: port should be between 1 and 65535, got '%d'.", + test_port); + return -1; + } + + *addrport = (uint16_t) test_port; + } log_debug("Read '%s': %s:%d", s,