Storage Filesystem

Receiver

This service implements a distributed filesystem storage. Templates, configurations or any type of files stored on a filesystem can be retrieved from the hive by other services.

docker pull registry.goingrid.io/services/storage-filesystem:v0.1.0:v0.1.0

Table of contents

Service properties

The storage filesystem does not implement the ingrid protocol message. It is only used by other services to retrieve files via the hive.

Service capabilities

Retrieve file

apiVersion: apps/v1
kind: Deployment
metadata:
  name: storage-filesystem-service
spec:
  selector:
    matchLabels:
      app: storage-filesystem-service
  template:
    metadata:
      labels:
        app: storage-filesystem-service
    spec:
      containers:
      - name: storage-filesystem-service
        env:
        - name: name
          value: storage-filesystem-service
        - name: SERVERHOST
          value: ingrid-hive
        - name: LOGLEVEL
          value: debug
        - name: LOGFORMAT
          value: text/default
        - name: LOGSENSITIVE
          value: "false"
        - name: INPUTCHANNEL
          value: storage_slap
        - name: STORAGEDIR
          value: /storage
        - name: SERVERAUTH
          valueFrom:
            secretKeyRef:
              key: serverkey
              name: ingrid-serverkey
        image: registry-dev.goingrid.io/services/storage-filesystem:latest
        imagePullPolicy: Always
        resources:
          limits:
            cpu: 200m
            memory: 32Mi
          requests:
            cpu: 50m
            memory: 16Mi
        volumeMounts:
        - mountPath: /storage
          name: storage-filesystem
      serviceAccount: ingrid
      serviceAccountName: ingrid
      volumes:
      - name: storage-filesystem
        persistentVolumeClaim:
          claimName: storage-filesystem-claim

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: storage-filesystem-flow
spec:
  selector:
    matchLabels:
      app: storage-filesystem-flow
  template:
    metadata:
      labels:
        app: storage-filesystem-flow
    spec:
      containers:
      - name: storage-filesystem-flow
        env:
          - name: name
            value: log-append-flow
          - name: SERVERHOST
            value: ingrid-hive
          - name: LOGLEVEL
            value: debug
          - name: LOGFORMAT
            value: text/default
          - name: LOGSENSITIVE
            value: "false"
          - name: INPUTCHANNEL
            value: storage_filesystem
          - name: TEMPLATE
            value: "hive://echo.tmpl"
          - name: SERVERAUTH
            valueFrom:
              secretKeyRef:
                key: serverkey
                name: ingrid-serverkey
        image: registry-dev.goingrid.io/services/gotmplengine:latest
        imagePullPolicy: Always
        resources:
          limits:
            cpu: 200m
            memory: 32Mi
          requests:
            cpu: 50m
            memory: 16Mi
      serviceAccount: ingrid
      serviceAccountName: ingrid
      volumes:
      - name: storage-filesystem
        persistentVolumeClaim:
          claimName: storage-filesystem-claim
storage-filesystem:
  image: registry.goingrid.io/services/storage-filesystem:v0.1.0
  deploy:
    restart_policy:
      condition: on-failure
    placement:
      constraints:
        - node.role == manager
  environment:
    NAME: "storage-filesystem"
    SERVERHOST: "hive"
    SERVERAUTH: "file:///run/secrets/ing-hive-key"
  depends_on:
    - hive
  secrets:
    - ing-hive-key
  volumes:
    - /srv/ingrid/storage:/storage
  networks:
    - ing-entry
    - ing-middle

echo:
  image: registry.goingrid.io/services/tmplengine:v0.1.0
  deploy:
    restart_policy:
      condition: on-failure
    placement:
      constraints:
        - node.role == manager
  environment:
    NAME: "echo"
    SERVERHOST: "hive"
    SERVERAUTH: "file:///run/secrets/ing-hive-key"
    TEMPLATE: "hive://echo.tmpl"
  depends_on:
    - hive
  secrets:
    - ing-hive-key
  networks:
    - ing-entry
    - ing-middle
ingrid@ingrid:/srv/ingrid/storage$ ls -l
-rw-rw-r-- 1 ingrid ingrid     572 Mar  2 11:03 echo.tmpl

echo.tmpl

[[ $req := getRequest ]]
[[ $reqData := getRequestData $req ]]
[[ $res := newResult ]]
[[ $res = setResultCode $res 200 ]]
[[ $res = setResultMsg $res "Echo back" ]]
[[ $res = setResultData $res $reqData ]]
[[ $_ := setCurrentResult $res ]]

Service configuration

Parameter Default Description
InputChannel* "storage_slap" Channel to be used as input
StorageDir "./storage" Directory containing all the storage files

* inherited from service configuration, mentioned here because it has a different default value

Additionally the storage filesystem service includes all properties of the service configuration and the input configuration.