From 6b770f87a07f7e97d4d7a9239c570a018bbcf04c Mon Sep 17 00:00:00 2001 From: Jeroen van der Heijden Date: Tue, 3 Nov 2020 18:06:35 +0100 Subject: [PATCH] prepare for kube --- Kubernetes/statefulset.yaml | 49 +++++++++++++++++++------------------ docker/Dockerfile | 21 ++++++++++++---- siridb.conf | 14 +++++------ src/siri/net/tcp.c | 6 ++--- 4 files changed, 51 insertions(+), 39 deletions(-) diff --git a/Kubernetes/statefulset.yaml b/Kubernetes/statefulset.yaml index 6d56ca70..9e1adccf 100644 --- a/Kubernetes/statefulset.yaml +++ b/Kubernetes/statefulset.yaml @@ -1,43 +1,44 @@ apiVersion: apps/v1 kind: StatefulSet metadata: - name: thingsdb + name: siridb labels: - app: thingsdb + app: siridb spec: selector: matchLabels: - app: thingsdb - serviceName: thingsdb - replicas: 2 + app: siridb + serviceName: siridb + replicas: 12 updateStrategy: type: RollingUpdate podManagementPolicy: Parallel template: metadata: labels: - app: thingsdb + app: siridb spec: - terminationGracePeriodSeconds: 90 + terminationGracePeriodSeconds: 120 dnsConfig: searches: - - thingsdb.default.svc.cluster.local + - siridb.default.svc.cluster.local containers: - - name: thingsdb - image: thingsdb/node:gcloud-v0.9.19 + - name: siridb + image: siridb/siridb/siridb-server:2.0.40 imagePullPolicy: Always - args: ["--deploy"] env: - name: SIRIDB_HTTP_STATUS_PORT value: "8080" - name: SIRIDB_HTTP_API_PORT - value: "80" + value: "9080" - name: SIRIDB_ENABLE_SHARD_COMPRESSION value: "1" + - name: SIRIDB_ENABLE_SHARD_AUTO_DURATION + value: "1" - name: SIRIDB_BUFFER_SYNC_INTERVAL value: "500" - name: SIRIDB_DEFAULT_DB_PATH - value: /mnt/thingsdb/ + value: /mnt/siridb/ - name: SIRIDB_BIND_SERVER_ADDRESS value: "0.0.0.0" - name: SIRIDB_BIND_CLIENT_ADDRESS @@ -50,30 +51,30 @@ spec: - name: status containerPort: 8080 - name: client - containerPort: 9200 + containerPort: 9000 - name: http - containerPort: 9210 - - name: node - containerPort: 9220 + containerPort: 9080 + - name: server + containerPort: 9010 volumeMounts: - name: data mountPath: /mnt/siridb/ resources: requests: - memory: 100M + memory: 100M # For example, 3Gi for large data sets livenessProbe: httpGet: path: /healthy port: 8080 - periodSeconds: 10 - timeoutSeconds: 5 + periodSeconds: 20 + timeoutSeconds: 10 readinessProbe: httpGet: path: /ready port: 8080 - initialDelaySeconds: 5 - periodSeconds: 10 - timeoutSeconds: 2 + initialDelaySeconds: 15 + periodSeconds: 20 + timeoutSeconds: 10 volumeClaimTemplates: - metadata: name: data @@ -81,4 +82,4 @@ spec: accessModes: ["ReadWriteOnce"] resources: requests: - storage: 20Gi + storage: 200Mi # For example, 300Gi for large data sets diff --git a/docker/Dockerfile b/docker/Dockerfile index bf96afc2..86c3680f 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -16,16 +16,27 @@ RUN apk update && \ apk add pcre2 libuv libuuid yajl && \ mkdir -p /etc/siridb && \ mkdir -p /var/lib/siridb -COPY --from=0 /tmp/siridb-server/siridb.conf /etc/siridb/siridb.conf COPY --from=0 /tmp/siridb-server/Release/siridb-server /usr/local/bin/ COPY --from=0 /usr/lib/libcleri* /usr/lib/ -# Configuration -VOLUME ["/etc/siridb"] # config # Data VOLUME ["/var/lib/siridb/"] -# Client connections +# Client (Socket) connections EXPOSE 9000 -# back-end connections +# Server (Socket) connections EXPOSE 9010 +# Client (HTTP) connections +EXPOSE 9080 +# Status connection +EXPOSE 8080 + +# Overwrite default configuration parameters +ENV SIRIDB_BIND_SERVER_ADDRESS 0.0.0.0 +ENV SIRIDB_BIND_CLIENT_ADDRESS 0.0.0.0 +ENV SIRIDB_HTTP_API_PORT 9080 +ENV SIRIDB_HTTP_STATUS_PORT 8080 +ENV SIRIDB_ENABLE_SHARD_COMPRESSION 1 +ENV SIRIDB_ENABLE_SHARD_AUTO_DURATION 1 +ENV SIRIDB_BUFFER_SYNC_INTERVAL 500 + ENTRYPOINT ["/usr/local/bin/siridb-server"] diff --git a/siridb.conf b/siridb.conf index a8ef21c5..731c6374 100644 --- a/siridb.conf +++ b/siridb.conf @@ -75,9 +75,9 @@ max_open_files = 32768 enable_shard_compression = 1 # -# Let SiriDB control shard duration when possible. When enabled, the configured -# shard duration fot both number and log values are still used when SiriDB is -# not able to detect a sensible duration. +# Let SiriDB control shard duration when possible. When enabled, the configured +# shard duration for both number and log values will still be used when SiriDB +# is not able to detect a sensible duration. # enable_shard_auto_duration = 1 @@ -92,19 +92,19 @@ enable_pipe_support = 0 pipe_client_name = siridb_client.sock # -# When the HTTP status port is not set (or 0), the service will not start. +# When the HTTP status port is not set (or 0), the service will not start. # Otherwise the HTTP requests `/status`, `/ready` and `/healthy` are available # which can be used for readiness and liveness requests. -# +# # Example usage using wget: -# +# # wget -q -O - http://siridb-server.local:8080/status # #http_status_port = 8080 http_status_port = 0 # -# When the HTTP API port is not set (or 0), the API service will not start. +# When the HTTP API port is not set (or 0), the API service will not start. # Otherwise the HTTP POST requests can be user to insert or query data points. # #http_api_port = 9020 diff --git a/src/siri/net/tcp.c b/src/siri/net/tcp.c index 06a7cb83..9567ac9f 100644 --- a/src/siri/net/tcp.c +++ b/src/siri/net/tcp.c @@ -134,7 +134,7 @@ int sirinet_extract_addr_port( if (!strlen(address) || strlen(address) >= SIRI_CFG_MAX_LEN_ADDRESS) { - log_critical("error: got an unexpected address value '%s'.", s); + log_error("error: got an unexpected address value '%s'.", s); return -1; } @@ -144,7 +144,7 @@ int sirinet_extract_addr_port( hostname, SIRI_CFG_MAX_LEN_ADDRESS)) { - log_critical("error: memory allocation while copying address"); + log_critical("memory allocation while copying address"); return -1; } @@ -153,7 +153,7 @@ int sirinet_extract_addr_port( test_port = atoi(strport); if (test_port < 1 || test_port > 65535) { - log_critical( + log_error( "error: port should be between 1 and 65535, got '%d'.", test_port); return -1; -- 2.30.2