FlowRunner supports multiple storage backends for persisting flows, executions, and other data. This guide provides detailed instructions for configuring and using each supported storage backend.
FlowRunner supports the following storage backends:
- In-Memory: Volatile storage for development and testing
- PostgreSQL: Relational database storage for production use
- DynamoDB: NoSQL database storage for AWS environments
The storage backend is configured using environment variables or a configuration file.
In-memory storage is the simplest option and is suitable for development and testing. Data is stored in memory and is lost when the server restarts.
# .env file
FLOWRUNNER_STORAGE_TYPE=memory
- No external dependencies
- Fast performance
- Simple setup
- Data is lost when the server restarts
- Not suitable for production use
- Limited scalability
- Development and testing
- Demos and presentations
- Single-user environments
PostgreSQL storage provides persistent storage using a PostgreSQL database. This is suitable for production use and supports multi-user environments.
- PostgreSQL server (version 10 or higher)
- Database user with CREATE, ALTER, and SELECT privileges
# .env file
FLOWRUNNER_STORAGE_TYPE=postgres
FLOWRUNNER_POSTGRES_HOST=localhost
FLOWRUNNER_POSTGRES_PORT=5432
FLOWRUNNER_POSTGRES_DATABASE=flowrunner
FLOWRUNNER_POSTGRES_USER=postgres
FLOWRUNNER_POSTGRES_PASSWORD=postgres
FLOWRUNNER_POSTGRES_SSL_MODE=disable
- Create a new database:
CREATE DATABASE flowrunner;- Create a user (optional):
CREATE USER flowrunner WITH PASSWORD 'your-password';
GRANT ALL PRIVILEGES ON DATABASE flowrunner TO flowrunner;- FlowRunner will automatically create the necessary tables on startup.
FlowRunner creates the following tables in the PostgreSQL database:
accounts: User accountsflows: Flow definitionsexecutions: Flow executionsexecution_logs: Execution logssecrets: Encrypted secretsstructured_secrets: Structured encrypted secrets
FlowRunner uses connection pooling to manage database connections. You can configure the pool size using the following environment variables:
FLOWRUNNER_POSTGRES_MAX_CONNECTIONS=10
FLOWRUNNER_POSTGRES_IDLE_CONNECTIONS=5
FLOWRUNNER_POSTGRES_CONNECTION_LIFETIME=1h
To enable SSL for PostgreSQL connections:
FLOWRUNNER_POSTGRES_SSL_MODE=require
FLOWRUNNER_POSTGRES_SSL_CERT=/path/to/cert.pem
FLOWRUNNER_POSTGRES_SSL_KEY=/path/to/key.pem
FLOWRUNNER_POSTGRES_SSL_ROOT_CERT=/path/to/root.pem
SSL modes:
disable: No SSLrequire: Always use SSL (skip verification)verify-ca: Always use SSL (verify server certificate)verify-full: Always use SSL (verify server certificate and hostname)
Use the provided script to test your PostgreSQL configuration:
./scripts/test_postgres_integration.shThis script will:
- Connect to your PostgreSQL database
- Create test tables
- Insert and retrieve test data
- Clean up test tables
DynamoDB storage provides persistent storage using AWS DynamoDB. This is suitable for AWS environments and supports high scalability.
- AWS account with DynamoDB access
- AWS credentials with appropriate permissions
# .env file
FLOWRUNNER_STORAGE_TYPE=dynamodb
FLOWRUNNER_DYNAMODB_REGION=us-west-2
FLOWRUNNER_DYNAMODB_ENDPOINT=http://localhost:8000
FLOWRUNNER_DYNAMODB_TABLE_PREFIX=flowrunner_
For local development, you can use DynamoDB Local:
FLOWRUNNER_DYNAMODB_ENDPOINT=http://localhost:8000
For production, use the AWS DynamoDB endpoint:
FLOWRUNNER_DYNAMODB_ENDPOINT=https://dynamodb.us-west-2.amazonaws.com
FlowRunner uses the AWS SDK for Go to connect to DynamoDB. You can provide AWS credentials using:
- Environment variables:
AWS_ACCESS_KEY_ID=your-access-key
AWS_SECRET_ACCESS_KEY=your-secret-key
AWS_SESSION_TOKEN=your-session-token
- AWS credentials file (
~/.aws/credentials):
[default]
aws_access_key_id = your-access-key
aws_secret_access_key = your-secret-key
- IAM roles for EC2 instances or ECS tasks
FlowRunner creates the following tables in DynamoDB:
{prefix}_accounts: User accounts{prefix}_flows: Flow definitions{prefix}_executions: Flow executions{prefix}_execution_logs: Execution logs{prefix}_secrets: Encrypted secrets{prefix}_structured_secrets: Structured encrypted secrets
By default, FlowRunner creates DynamoDB tables with on-demand capacity mode. You can configure provisioned throughput using the following environment variables:
FLOWRUNNER_DYNAMODB_READ_CAPACITY=5
FLOWRUNNER_DYNAMODB_WRITE_CAPACITY=5
For local development, you can use DynamoDB Local:
- Download DynamoDB Local:
wget https://s3.us-west-2.amazonaws.com/dynamodb-local/dynamodb_local_latest.tar.gz
tar -xzf dynamodb_local_latest.tar.gz- Start DynamoDB Local:
java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb- Configure FlowRunner to use the local endpoint:
FLOWRUNNER_DYNAMODB_ENDPOINT=http://localhost:8000
Use the provided script to test your DynamoDB configuration:
./scripts/test_dynamodb_integration.shThis script will:
- Connect to your DynamoDB instance
- Create test tables
- Insert and retrieve test data
- Clean up test tables
FlowRunner does not currently provide built-in tools for migrating data between storage backends. However, you can use the following approach to migrate data:
- Export data from the source storage:
flowrunner export --all --output data.json-
Configure FlowRunner to use the target storage backend.
-
Import data into the target storage:
flowrunner import --input data.jsonFor production environments, we recommend:
-
PostgreSQL Storage:
- Use a managed PostgreSQL service (AWS RDS, Google Cloud SQL, Azure Database for PostgreSQL)
- Configure appropriate backup and replication
- Use SSL for secure connections
- Monitor database performance
-
DynamoDB Storage:
- Use on-demand capacity mode for unpredictable workloads
- Use provisioned capacity with auto-scaling for predictable workloads
- Enable point-in-time recovery
- Monitor throughput and adjust capacity as needed
For development environments, we recommend:
-
In-Memory Storage:
- Simplest option for local development
- No external dependencies
-
Local PostgreSQL:
- Use Docker for easy setup:
docker run -d --name postgres -p 5432:5432 -e POSTGRES_PASSWORD=postgres postgres
- Use Docker for easy setup:
-
DynamoDB Local:
- Use for testing AWS-specific features
- No AWS account required
-
Database Credentials:
- Use environment variables or a secure configuration manager
- Never hardcode credentials in source code
- Use least-privilege database users
-
Encryption:
- Enable encryption at rest for PostgreSQL and DynamoDB
- Use SSL/TLS for PostgreSQL connections
- Use HTTPS for DynamoDB connections
-
Secrets:
- FlowRunner encrypts secrets before storing them
- Use a strong encryption key (
FLOWRUNNER_ENCRYPTION_KEY) - Rotate the encryption key periodically
-
PostgreSQL:
- Optimize connection pooling settings
- Create appropriate indexes
- Monitor query performance
-
DynamoDB:
- Choose appropriate partition keys
- Use sparse indexes for efficient queries
- Monitor throughput and adjust capacity