prepare for kube
authorJeroen van der Heijden <jeroen@transceptor.technology>
Tue, 3 Nov 2020 17:06:35 +0000 (18:06 +0100)
committerJeroen van der Heijden <jeroen@transceptor.technology>
Tue, 3 Nov 2020 17:06:35 +0000 (18:06 +0100)
Kubernetes/statefulset.yaml
docker/Dockerfile
siridb.conf
src/siri/net/tcp.c

index 6d56ca70a274b7c8c3049df45141054cfb24f287..9e1adccfc4d1efb35297aacccf360086c336e3ac 100644 (file)
@@ -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
index bf96afc24a9a9839498c5675040ffd7ecbd2abce..86c3680f95acd19164aeb4240cffd0a9f297ba3f 100644 (file)
@@ -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"]
index a8ef21c5cf6421c5cd037dc8781ef700dba5a6d0..731c63742b66d905b7527ab0c1ea4db9507e0a5c 100644 (file)
@@ -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
index 06a7cb8333c0c98827ecb60404a17696ce4a5849..9567ac9fe7855b50c7d31fb7f235095371b350ed 100644 (file)
@@ -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;