FlowForge File Storage

FlowForge File Storage

When running in container-based environments, such as Docker or Kubernetes, the Node-RED instances do not have access to a persistent filesystem.

This means any files written to the container will be lost if the instance is restarted.

The FlowForge platform includes a File Storage service that can be used to provide persistent storage to Node-RED in two different ways:

  • A set of custom File nodes that behave the same way as the standard Node-RED File nodes
  • An optional Persistent Context store for storing context data within flows. This feature is only available for platforms running with a premium license.

Note: the File Storage service is only required in Docker or Kubernetes environments. If you are running using the LocalFS platform driver, Node-RED will have direct access to the local filesystem already.

Configuring

The File Storage server has its own configuration file: etc/flowforge-storage.yml.

  • Docker Compose - edit the file directly before starting the service
  • Kubernetes/Helm - include the options in your customization.yml, using forge.fileStore.* as the property name prefix. You must also set forge.fileStore.enabled to true to tell Helm to deploy the service.

There are three parts to the configuration:

Platform Configuration

OptionDescription
hostWhere to listen for incoming connections. Default: 0.0.0.0.
portThe port to listen on. Default: 3001
base_urlThe url to access the FlowForge platform on. This defaults to http://localhost:3000

File Storage configuration

The File Storage configuration determines where the files used by Node-RED File nodes are stored.

This can be configured to either store the files on the local filesystem of the File Storage server, or using an AWS S3 compatible service.

LocalFS

Stores the files locally, for example using a volume mounted into the File Storage server container.

OptionDescription
driver.typelocalfs
driver.quotaA per-instance quota for how much data will be stored - in bytes. If this is not set, no limit will be applied
driver.options.rootThe root path under which Node-RED instance data should be stored.

The following shows an example configuration using the localfs file driver.

driver:
  type: localfs
  quota: 104857600
  options:
    root: var/root

S3 Compatible Storage

Stores the files in an external service using the AWS S3 API.

OptionDescription
driver.types3
driver.quotaA per-instance quota for how much data will be stored - in bytes. If this is not set, no limit will be applied
driver.options.bucketName of the S3 bucket to use (required)
driver.options.regionName of AWS region of the bucket (required)
driver.options.endpointS3 ObjectStore Endpoint, if not using AWS S3
driver.options.forcePathStyletrue
driver.options.credential.accessKeyIdAccount ID / Username
driver.options.credential.secretAccessKeySecret Key / Password

The full list of valid options under driver.options is available in the AWS S3Client documentation.

For example:

driver:
  type: s3
  quota: 104857600
  options:
    bucket: flowforge-files
    credentials:
      accessKeyId: XXXXXXXXXXXXXXXXXXX
      secretAccessKey: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    forcePathStyle: true
    region: us-east-1

Enabling the FlowForge File Nodes

The FlowForge File nodes have been written to be direct replacements for the Node-RED core file-in and file-out nodes. This means that only one version of these nodes can be active in Node-RED at a time.

The FlowForge File nodes will automatically disable themselves if the core nodes are present. This means to enable the nodes you need to exclude the code nodes.

This can be done in the FlowForge Template.

Adding 10-file.js to the list of "Excluded nodes by filename" section will ensure that the core file nodes are not loaded by Node-RED.

Persistent Context configuration

The Context Storage configuration determines where Node-RED Context data is stored.

This feature is only available when running with a FlowForge Premium license.

Due to the different access patterns for context data, this requires a separate storage configuration to the File store. It can use either an SQLite or PostgreSQL database.

SQLite

OptionDescription
context.typesequelize
context.quoteA per-instance quota for how much data will be stored - in bytes. If this is not set, no limit will be applied
context.options.typesqlite
context.options.storagePath to the sqlite database file to use

For example:

context:
  type: sequelize
  quota: 1048576
  options:
    type: sqlite
    storage: ff-context.db

PostgreSQL

OptionDescription
context.typesequelize
context.quoteA per-instance quota for how much data will be stored - in bytes. If this is not set, no limit will be applied
context.options.typepostgres
context.options.hostThe hostname of the database server
context.options.portThe port of the database server
context.options.databaseThe name of the database to store context data in
context.options.usernameThe username to access to the database with
context.options.passwordThe password to access to the database with

For example:

context:
  type: sequelize
  quota: 1048576
  options:
    type: postgres
    host: flowforge-postgresql
    port: 5432
    database: ff-context
    username: postgres
    password: password

Working with FlowForge Devices

The FlowForge Device Agent does not use the File Storage service. Any flows using the file nodes or persistent context that are deployed to a Device will use the local filesystem directly.

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值