Files
floci/docs/configuration/storage.md
T
AgustinBertagna 4446404288 feat(appsync): Phase 2 — Schema Registry, Model Fixes, CRUDL completion & AWS Scalars (#1185)
* build: add graphql-java dependency

* feat(appsync): add and extend data models for Phase 2

- Add AdditionalAuthenticationProvider, DomainName, ChannelNamespace, ApiAssociation models
- Add 14 fields to GraphqlApi (apiType, visibility, owner, etc.)
- Change additionalAuthenticationProviders from raw maps to typed list
- Add 6 fields to Resolver (resolverArn, cachingConfig, maxBatchSize, etc.)
- Add dataSourceArn to DataSource
- Rename FunctionConfiguration.arn to functionArn

* feat(appsync): add service and controller changes for Phase 2

* feat(appsync): add service and controller changes for Phase 2

* test(appsync): add Phase 2 integration tests

Add ~60 new tests for:
- Model completeness (new fields, ARNs, functionArn rename)
- Domain names CRUDL + associate/disassociate
- Channel namespaces CRUDL + update
- Merged API associations CRUDL
- Enhanced metrics
- Schema registry parsing with AWS scalars and extensions
- Directive registration (aws_api_key, aws_subscribe, deprecated, unknown)
- Edge cases (null auth providers, maxBatchSize 0, cleanup on delete)

* test(appsync): add AWS scalar unit tests

Test all 17 AWS scalars:
- All registered in AppSyncScalarRegistry
- AWSDateTime, AWSJSON, AWSEmail parse valid/invalid values
- AWSTimestamp and AWSShort range validation
- AWSURL and AWSPhone format validation

* test(appsync): add SDK compatibility tests for Phase 2

Validate that the AWS SDK Java v2 can read:
- dataSourceArn() on CreateDataSource response
- resolverArn() on CreateResolver response
- functionArn() on CreateFunction response
- BadRequestException on invalid schema creation

* docs(appsync): add Phase 2 operations, schema registry, and AWS scalars documentation

- Add Domain Names, Channel Namespaces, Merged API Associations, Enhanced Metrics
- Document AWS scalar types (17 scalars with validation rules)
- Document AppSync directives (8 directives with locations)
- Update Not Implemented section with future phase references
- Add CLI examples for domain names and channel namespaces
- Update cascade delete to include channel namespaces and domain associations

* docs: add AppSync to service tables, env vars, storage config, and SDK README

- README.md: add AppSync to category table, detailed notes, and architecture diagram
- docs/index.md: add AppSync to supported services table, fix count to 52
- docs/configuration/environment-variables.md: add FLOCI_SERVICES_APPSYNC_ENABLED
- docs/configuration/advanced/application-yml.md: add appsync config block
- docs/configuration/storage.md: add AppSync per-service storage override
- compatibility-tests/sdk-test-java/README.md: add AppSyncTest to services table

* fix(appsync): reuse ObjectMapper and fix AWSJSON serialize for non-string values

AWSJSON scalar was creating a new ObjectMapper on every parseValue() call. serialize() used toString() which produces invalid JSON for Map/JsonNode results.

* fix(appsync): strip string literals and comments before unknown directive validation

The regex @(\w+) incorrectly flagged @ mentions inside GraphQL string literals and comments as unknown directives.

* fix(appsync): prevent silent overwrite on creates, validate required fields and input values

- Add existence checks on createDataSource, createResolver, createType,
  createChannelNamespace, createMergedApiAssociation (→ ConflictException 409)
- Validate authenticationType is required on createGraphqlApi
- Validate typeName is required on createResolver
- Validate dataSourceName exists on createResolver and createFunction
- Prevent associateApi from silently overwriting existing association
- Enforce API key limit (max 2 per API)
- Fix expires parsing to accept ISO 8601 strings, throw on invalid values
- Fix castInt overflow detection
- Fix updateApiKey expires validation (was silently swallowing errors)
- Change InvalidNextTokenException to BadRequestException (AWS standard)
- Fix maxResults=0 to return empty page
- Fix getIntrospectionSchema to throw 404 instead of returning null
- Fix tags with null values (was producing literal string "null")

* test(appsync): fix cascade delete test to create data source before function, align with new validation

* refactor(appsync): remove dead code and unused hasSchema()

- Delete AppSyncDirectiveRegistry.java (100 lines, never used)
- Delete DirectiveValidator.java (45 lines, never called)
- Remove hasSchema() from SchemaRegistry (never called)

* fix(appsync): scalar null-safety, type validation, and DNS resolution

- Add null checks to 5 serialize() methods (AWS_TIMESTAMP, AWS_LONG,
  AWS_INTEGER, AWS_BOOLEAN, AWS_FLOAT) to prevent NPE
- Fix AWS_TIMESTAMP parseValue() ClassCastException on String input
- Replace InetAddress.getByName() with regex in AWS IPAddress to
  prevent DNS resolution (SSRF concern)
- AWSBoolean now rejects non-boolean values (matches AppSync behavior)

* refactor(appsync): centralize directive definitions in AppSyncDirective enum

- Add AppSyncDirective enum as single source of truth for directive
  names and SDL definitions
- Update AppSyncSchemaParser to use enum instead of duplicated strings
- Eliminates 3 sources of truth (validateNoUnknownDirectives Set,
  injectDirectiveDefinitions SDL, and formerly AppSyncDirectiveRegistry)

* perf(appsync): cache scalarMap in AppSyncScalarRegistry

- Initialize scalarMap once in constructor as unmodifiableMap
- Avoids recreating HashMap on every call (was called twice per
  schema parse)

* test(appsync): add tests for scalar fixes and behavior changes

- Add tests for null-safety in serialize() (5 scalars)
- Add test for AWSTimestamp parseValue with String input
- Add tests for AWSIPAddress regex validation (IPv4, IPv6, invalid)
- Add tests for AWSBoolean rejecting non-boolean values
- Add test for scalarMap caching

* test(sdk): add AWS scalars schema creation test

Verifies that schemas with AWS scalar types (AWSDateTime, AWSJSON,
AWSIPAddress, AWSBoolean) parse correctly via the SDK.

* fix(appsync): correct API paths to match AWS documentation

- Channel namespaces: /v1/ → /v2/, channelnamespaces → channelNamespaces
- Domain association: /apis → /apiassociation
- Remove ListApiAssociations (not a real AppSync operation)
- Remove GetEnhancedMetricsConfig (not a real AppSync operation)
- Rename Merged API Association to Source API Association with correct paths:
  - AssociateSourceGraphqlApi: POST /v1/mergedApis/{id}/sourceApiAssociations
  - GetSourceApiAssociation: GET /v1/mergedApis/{id}/sourceApiAssociations/{id}
  - ListSourceApiAssociations: GET /v1/apis/{apiId}/sourceApiAssociations
  - DisassociateSourceGraphqlApi: DELETE /v1/mergedApis/{id}/sourceApiAssociations/{id}

* feat(appsync): add SourceApiAssociation models

Add SourceApiAssociation, SourceApiAssociationConfig, and
SourceApiAssociationSummary models to support merged/source API
association operations per AWS AppSync API Reference.

* feat(appsync): add ChannelNamespace support models

Add AuthMode, HandlerConfig, HandlerConfigs, Integration, and
LambdaConfig models for ChannelNamespace handler configuration
per AWS AppSync API Reference.

* fix(appsync): fix ApiAssociation and ChannelNamespace models

ApiAssociation: remove source/merged API fields, keep only domain
association fields (apiId, associationStatus, deploymentDetail,
domainName) per AWS AppSync API Reference.

ChannelNamespace: add missing fields (channelNamespaceArn,
codeHandlers, created, handlerConfigs, lastModified,
publishAuthModes, subscribeAuthModes, tags) per AWS docs.

* feat(appsync): add missing service methods and fix response models

- associateApi now returns full ApiAssociation object
- createMergedApiAssociation returns SourceApiAssociation
- createSourceApiAssociation returns SourceApiAssociation
- getSourceApiAssociation validates mergedApiId
- listSourceApiAssociations returns SourceApiAssociationSummary
- Add updateSourceApiAssociation method
- Add deleteMergedApiAssociation method
- ChannelNamespace: populate arn, timestamps on create/update

* feat(appsync): fix response formats and add missing endpoints

- associateMergedGraphqlApi: response key apiAssociation → sourceApiAssociation
- disassociateSourceGraphqlApi: returns 200 + body (not 204)
- associateApi: returns full ApiAssociation from service
- Add POST /v1/mergedApis/{id}/sourceApiAssociations/{assocId} (UpdateSourceApiAssociation)
- Add DELETE /v1/sourceApis/{id}/mergedApiAssociations/{assocId} (DisassociateMergedGraphqlApi)

* test(appsync): fix and add integration tests for new endpoints

- Fix associateSourceGraphqlApi: use mergedApiId and sourceApiAssociationStatus
- Fix deleteSourceApiAssociation: expect 200 with body (not 204)
- Add updateDomainName test
- Add associateMergedGraphqlApi test
- Add updateSourceApiAssociation test
- Add disassociateMergedGraphqlApi test

* test(appsync): add SDK tests for missing operations

- Add updateDomainName test
- Add associateMergedGraphqlApi test
- Add updateSourceApiAssociation test
- Add disassociateMergedGraphqlApi test
- Fix test ordering for new domain tests
2026-06-07 00:05:51 -05:00

6.9 KiB

Storage Modes

Floci supports four storage backends. You can set a global default and override it per service.

Modes

Mode Data survives restart Write performance Use case
memory No Fastest Unit tests, CI pipelines
persistent Yes Synchronous disk write on every change Development with durable state
hybrid Yes In-memory reads, async flush to disk General local development
wal Yes Append-only write-ahead log with compaction High-write workloads

Global Configuration

Variable Default Description
FLOCI_STORAGE_MODE memory Storage backend (memory, persistent, hybrid, wal)
FLOCI_STORAGE_PERSISTENT_PATH ./data Base directory for all persistent data
FLOCI_STORAGE_WAL_COMPACTION_INTERVAL_MS 30000 WAL compaction interval (milliseconds)

!!! note "Code default vs shipped default" The Java @WithDefault for storage.mode is hybrid, but the published Docker image ships with memory set in application.yml. Running the stock image gives you memory unless you set FLOCI_STORAGE_MODE.

Per-Service Override

When not set for a service, it inherits FLOCI_STORAGE_MODE. Only override when you need different behavior for a specific service.

Variable Default Description
FLOCI_STORAGE_SERVICES_SSM_MODE global default SSM storage mode
FLOCI_STORAGE_SERVICES_SSM_FLUSH_INTERVAL_MS 5000 SSM flush interval (ms)
FLOCI_STORAGE_SERVICES_SQS_MODE global default SQS storage mode
FLOCI_STORAGE_SERVICES_S3_MODE global default S3 storage mode
FLOCI_STORAGE_SERVICES_DYNAMODB_MODE global default DynamoDB storage mode
FLOCI_STORAGE_SERVICES_DYNAMODB_FLUSH_INTERVAL_MS 5000 DynamoDB flush interval (ms)
FLOCI_STORAGE_SERVICES_SNS_MODE global default SNS storage mode
FLOCI_STORAGE_SERVICES_SNS_FLUSH_INTERVAL_MS 5000 SNS flush interval (ms)
FLOCI_STORAGE_SERVICES_LAMBDA_MODE global default Lambda storage mode
FLOCI_STORAGE_SERVICES_LAMBDA_FLUSH_INTERVAL_MS 5000 Lambda flush interval (ms)
FLOCI_STORAGE_SERVICES_CLOUDWATCHLOGS_MODE global default CloudWatch Logs storage mode
FLOCI_STORAGE_SERVICES_CLOUDWATCHLOGS_FLUSH_INTERVAL_MS 5000 CloudWatch Logs flush interval (ms)
FLOCI_STORAGE_SERVICES_CLOUDWATCHMETRICS_MODE global default CloudWatch Metrics storage mode
FLOCI_STORAGE_SERVICES_CLOUDWATCHMETRICS_FLUSH_INTERVAL_MS 5000 CloudWatch Metrics flush interval (ms)
FLOCI_STORAGE_SERVICES_SECRETSMANAGER_MODE global default Secrets Manager storage mode
FLOCI_STORAGE_SERVICES_SECRETSMANAGER_FLUSH_INTERVAL_MS 5000 Secrets Manager flush interval (ms)
FLOCI_STORAGE_SERVICES_ACM_MODE global default ACM storage mode
FLOCI_STORAGE_SERVICES_ACM_FLUSH_INTERVAL_MS 5000 ACM flush interval (ms)
FLOCI_STORAGE_SERVICES_APPSYNC_MODE global default AppSync storage mode
FLOCI_STORAGE_SERVICES_APPSYNC_FLUSH_INTERVAL_MS 5000 AppSync flush interval (ms)
FLOCI_STORAGE_SERVICES_OPENSEARCH_MODE global default OpenSearch storage mode
FLOCI_STORAGE_SERVICES_OPENSEARCH_FLUSH_INTERVAL_MS 5000 OpenSearch flush interval (ms)
FLOCI_STORAGE_SERVICES_RDS_MODE global default RDS metadata storage mode (see note below)

!!! note "RDS storage mode" FLOCI_STORAGE_SERVICES_RDS_MODE controls Floci's own metadata persistence for RDS, not the DB container volumes. In all modes, each DB instance or cluster gets a named Docker volume (floci-rds-{volumeId}). In memory mode the volume is automatically removed when the instance is deleted. In other modes the volume is retained unless FLOCI_STORAGE_PRUNE_VOLUMES_ON_DELETE=true.

=== "Fast CI"

All in memory — fastest possible startup and test execution:

```bash
FLOCI_STORAGE_MODE=memory
```

=== "Local development"

Hybrid — survive restarts without slowing down writes:

```bash
FLOCI_STORAGE_MODE=hybrid
FLOCI_STORAGE_PERSISTENT_PATH=/app/data
```

Docker Compose:

```yaml
volumes:
  - floci-data:/app/data
environment:
  FLOCI_STORAGE_MODE: hybrid
  FLOCI_STORAGE_PERSISTENT_PATH: /app/data
```

=== "Durable development"

Persistent — every write is immediately on disk:

```bash
FLOCI_STORAGE_MODE=persistent
FLOCI_STORAGE_PERSISTENT_PATH=/app/data
```

Docker Compose:

```yaml
volumes:
  - floci-data:/app/data
environment:
  FLOCI_STORAGE_MODE: persistent
  FLOCI_STORAGE_PERSISTENT_PATH: /app/data
```

=== "Mixed"

Keep most services in memory, persist only DynamoDB and S3:

```bash
FLOCI_STORAGE_MODE=memory
FLOCI_STORAGE_SERVICES_DYNAMODB_MODE=persistent
FLOCI_STORAGE_SERVICES_S3_MODE=hybrid
FLOCI_STORAGE_PERSISTENT_PATH=/app/data
```

Container Storage (RDS, OpenSearch, MSK, ECR)

Services that spawn Docker containers (RDS, OpenSearch, MSK, ECR registry) need a volume for their data. Floci manages this automatically using named Docker volumes — no extra configuration required.

How it works

Each resource gets a volumeId (a 6-character hex string, e.g. a1b2c3) generated at creation time and stored in the resource model. The container name and volume name both use this suffix:

floci-rds-a1b2c3         # RDS instance container and volume
floci-opensearch-b4c5d6  # OpenSearch domain container and volume
floci-msk-e7f8a9         # MSK cluster container and volume
floci-ecr-registry-data  # ECR shared registry volume (singleton)

Volumes are labelled floci=true so you can manage them with standard Docker commands:

# List all Floci-managed volumes
docker volume ls --filter label=floci=true

# Remove all Floci-managed volumes (destructive)
docker volume prune --filter label=floci=true

Volume lifecycle

By default volumes survive resource deletion, matching real AWS behavior.

FLOCI_STORAGE_MODE Volume on resource delete
memory Always removed — memory mode implies no persistence across restarts
persistent / hybrid / wal Retained (default) — remove with FLOCI_STORAGE_PRUNE_VOLUMES_ON_DELETE=true
# Remove named volumes immediately when a resource is deleted (useful in CI with persistent mode)
FLOCI_STORAGE_PRUNE_VOLUMES_ON_DELETE=true

Host-path mode (advanced)

Set FLOCI_STORAGE_HOST_PERSISTENT_PATH to an absolute host path to use bind mounts instead of named volumes. This is only needed when you must access the container data directly from the host filesystem.

FLOCI_STORAGE_HOST_PERSISTENT_PATH=/absolute/host/path/data

!!! warning FLOCI_STORAGE_HOST_PERSISTENT_PATH must be an absolute path (starting with /). Volume names and relative paths are not supported and will be silently ignored, falling back to named-volume mode.