mirror of
https://github.com/floci-io/floci.git
synced 2026-12-05 19:18:01 -05:00
de2fbf8deeb4fa29ebdf6e9c32528dfa6093f2dd
7
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
f2125d8908 |
fix(neptune): start clusters' containers again when Floci restarts (#9522)
Floci's shutdown stopped every Neptune cluster's proxy and graph database container and nothing started them again, so after a restart with persistent storage a cluster reported available with nothing behind its port. At startup each cluster now reports maintenance, and its instances starting, with its proxy port held for it at once, so a cluster created meanwhile is never handed it. Its container comes back in the background on the volume its graph is kept in, in the engine the graph was kept in, which the cluster's record now names, and its proxy listens on its port again; the cluster and its instances then report available. With no Docker daemon reachable they come back available with no container, as a cluster created then does. A cluster whose container or proxy does not start is left with none and its instances failed, and is tried again at the next start. The restore runs in each cluster's own account and Region, and marking the clusters calls no Docker. Floci now records which cluster holds each proxy port, so a cluster whose stored port another cluster holds moves to a free one, its instances with it, and one restored in the same process keeps its own. One recorded before its engine was kept is taken to be in the configured one, and one recorded before its graph was kept in a volume gets a volume, both kept before any Docker call. A DeleteDBCluster while the restore is starting the cluster's container leaves it deleting until the container has started, a second one too, and the restore removes it then. A delete defers only while a restore owns the cluster, which it does only once its marking is done, so one a failed write left deleting is retried at once; one still deleting at the next start is removed in the background. The delete, the restore and CreateDBInstance decide under a per-cluster lock, and instance creation, deletion and the restore's status writes under a per-instance one, taken first, so the restore never puts back an instance deleted meanwhile. CreateDBInstance is refused with InvalidDBClusterStateFault for a cluster that is not available. Shutdown now marks the container manager first, after which no container starts. A container left under a cluster's name, by a Floci that exited without stopping it, is now stopped with the same 30 seconds as at shutdown before its replacement starts, rather than removed outright, so Gremlin Server saves its graph to the volume first. The message refusing to delete a cluster with instances uses a colon in place of its dash. Closes #5664. |
||
|
|
6a3874a3e2 |
fix(neptune): keep each cluster's graph in a Docker volume of its own (#9505)
A Neptune cluster's graph lived only in its container: Gremlin Server's TinkerGraph kept it in memory, and Neo4j in the unnamed volume its image declares for /data. Removing the container, as Floci's shutdown does, lost it, so a cluster could never be started again with its graph. When Neptune's records are kept (its own storage mode, or the global one, is persistent, hybrid or wal), a new cluster now gets a volume ID, kept in its record, and its container mounts floci-aws-neptune-<id>, or binds <host-path>/neptune/<id> when the host persistent path is an absolute path. Neo4j keeps its data directory there. Gremlin Server's image has its data directory there, and Floci writes the image's TinkerGraph properties before the container starts so the graph is saved to it when the server stops and loaded from it when it starts. Under the host path Gremlin Server runs as root, since the directory belongs to whoever created it rather than to the image's gremlin user. An image laid out otherwise keeps its graph in memory, with a warning. A container now has 30 seconds to stop before Docker kills it, as Gremlin Server saves its graph a few seconds after the stop signal. DeleteDBCluster removes the volume as the storage policy says, under the storage mode Neptune's records are kept in, its own or the global one; a create that fails removes it whatever the policy. A cluster created again under a deleted one's identifier starts on a new, empty volume. Starting the clusters' containers again on these volumes when Floci restarts comes next. Part of #5664. |
||
|
|
a7be2dd299 |
feat(neptune): support the Terraform aws_neptune_cluster read-back contract (#3017)
* feat(neptune): support the Terraform aws_neptune_cluster read-back contract The Terraform AWS provider's aws_neptune_cluster resource reads back every DBCluster field after create and update, and treats a mismatch on a ForceNew attribute as a replacement. Against Floci the resource could not converge: StorageEncrypted was hardcoded to true against the provider's default of false, AvailabilityZones was emitted as a singular element that SDK parsers drop, BackupRetentionPeriod and the other settings were never stored, and tag calls on a Neptune ARN never reached the Neptune store. CreateDBCluster and ModifyDBCluster now store the settings a request carries (NeptuneClusterSettings, modelled on DocDbClusterSettings) and DescribeDBClusters reads them back with the AWS defaults otherwise: AvailabilityZones, BackupRetentionPeriod, PreferredBackupWindow, PreferredMaintenanceWindow, DBSubnetGroup, DBClusterParameterGroup, VpcSecurityGroups, StorageEncrypted, KmsKeyId, StorageType, DeletionProtection, CopyTagsToSnapshot, EnabledCloudwatchLogsExports, ReplicationSourceIdentifier, ServerlessV2ScalingConfiguration, AssociatedRoles and ClusterCreateTime. StorageEncrypted defaults to false as on AWS. Also: - A requested Port is honoured when it is free inside the proxy range, so Terraform's default port of 8182 matches the first cluster. - DeleteDBCluster refuses a cluster with DeletionProtection enabled with InvalidParameterCombination, as on AWS. - DBClusterMembers uses the DBClusterMember element the Neptune API model declares; the previous member element was dropped by SDK parsers. - New actions: AddRoleToDBCluster, RemoveRoleFromDBCluster, DescribeGlobalClusters (empty list), ListTagsForResource, AddTagsToResource and RemoveTagsFromResource. Tags are accepted on CreateDBCluster and CreateDBInstance, and the rds credential scope routes a Neptune ARN ResourceName to the Neptune handler. Verified against hashicorp/aws 6.62.0 with terraform apply, a clean re-plan, an update covering retention, protection, log exports, security groups, iam_roles and tags, a destroy blocked by deletion protection, and a destroy after disabling it. * test(compat): cover aws_neptune_cluster in the Terraform and Java SDK suites Adds a dedicated Terraform fixture and bats test that applies an aws_neptune_cluster, checks the read-back through terraform output and the AWS CLI, checks tags through ListTagsForResource, and asserts a clean re-plan. Extends the Java SDK NeptuneTest with tags, IAM roles, modify settings, deletion protection and cluster members, so a real SDK parser covers the new DBCluster fields. * fix(neptune): infer the rds service for the DBCluster role actions Unsigned Query requests resolve their service from the action name, and AddRoleToDBCluster and RemoveRoleFromDBCluster were missing from the RDS action set, so they fell through to the SQS default instead of reaching the Neptune handler. * feat(neptune): read back the settings Terraform's aws_neptune_cluster_instance manages DescribeDBInstances omitted AutoMinorVersionUpgrade, PromotionTier, PubliclyAccessible, the parameter and subnet groups and the windows, ModifyDBInstance ignored them, StorageEncrypted was hardcoded to true, and every cluster member was reported as the writer, so the provider issued a ModifyDBInstance on every apply. NeptuneInstanceSettings, modelled on NeptuneClusterSettings, stores what a request carries and DescribeDBInstances reads it back with the AWS defaults otherwise; StorageEncrypted, KmsKeyId and StorageType are the cluster's. The first member of a cluster is its writer and deleting it promotes the next. Covered by unit, integration and Java SDK tests and a Terraform compat fixture with a writer and a reader instance. --------- Co-authored-by: kurtmc <2661907+kurtmc@users.noreply.github.com> |
||
|
|
3b0e31b888 |
fix(rds,docdb): list DocumentDB clusters and instances in the RDS-family list form (#2623)
* fix(rds,docdb): list DocumentDB clusters and instances in the RDS-family list form The list form of DescribeDBClusters and DescribeDBInstances answered from one store: on the rds scope from RDS, on the docdb scope from DocumentDB, so a DocumentDB cluster was invisible to every list while its identifier form worked. A live account lists the whole family from either endpoint. RdsQueryHandler now assembles the list from both stores, honouring the db-cluster-id / db-instance-id filters in each and an engine filter across them (case-insensitive, OR over values, refused for a name outside the family's engine list as on AWS), and the controller sends the docdb-scope list form there too. The identifier form keeps routing to the store that owns the identifier. Both halves list the region the request is signed for. Closes #2613 * fix(rds): report and filter an Aurora member instance by its Aurora engine name DbInstance collapsed aurora-postgresql and aurora-mysql onto the community engine enum, so a cluster member reported Engine postgres and the engine filter matched it as postgres, where a live account says and matches aurora-postgresql. Keep the engine name the request gave (or the cluster's, for a member created without one) on the instance, and read it for both the Engine element and the filter; a record persisted before the field existed falls back to the enum. * fix(rds): give a persisted instance its engine name on restore An instance written before engineIdentifier existed deserializes with it null, and a runtime fallback to the enum would keep reporting an Aurora member as postgres. Backfill it in restorePersistedRuntime from the state that knows: the member's cluster for a member, the enum for a standalone instance. * fix(rds): never persist a guessed engine name for a member of a nameless cluster A cluster persisted before its own engineIdentifier existed (#1829) has none to hand down, and writing the member's enum in that case would store postgres for what may be an Aurora member — a guess that outlives the code able to tell. The backfill writes only what is certain: the cluster's stored name for a member, the enum for a standalone instance; a member of a nameless cluster is left unset. * fix(rds,neptune): list Neptune clusters and instances in the RDS-family list form too A live account lists a Neptune cluster from the rds, docdb and neptune endpoints alike and selects it with engine=neptune. The list form now merges Neptune rows the way it merges DocumentDB ones, and the neptune scope's list form goes to the same assembly. The Neptune store is not keyed by region, so its rows are scoped to the request's region by ARN. * fix(rds): close the subnet-group tags test in rds.bats --------- Co-authored-by: Priamo Germosen <6233424+pgermosen@users.noreply.github.com> |
||
|
|
7d70f64162 |
feat(docs): generate Supported Actions tables from handler source (#1641)
* feat(docs): generate Supported Actions tables from handler source The "Supported Actions" tables in docs/services/*.md were hand-maintained and drifted from the handlers. For example secrets-manager.md omitted RestoreSecret, which SecretsManagerJsonHandler dispatches, and acm.md listed RenewCertificate, which is not implemented anywhere in src/. Derive the action list from handler source so it cannot drift, while keeping the hand-written Description column: - tools/docs/regen_action_docs.py extracts actions from `case "X" ->` switch arms (including multi-label arms) and JAX-RS REST controllers, and rewrites only the rows between the <!-- floci:actions --> markers. Descriptions are preserved by action name; new actions get a "-" placeholder. PascalCase-only matching avoids picking up SCREAMING_CASE labels from non-action switches. - tools/docs/services.yaml registers 18 single-table switch services and lists the remaining switch handlers under deferred_handlers, so the new-service sentinel fires only on a genuinely unregistered handler. - make docs-sync / docs-check / docs-test, plus a Python-only CI workflow that gates on handler, doc, and tooling changes. - Migrate 18 service docs into marker blocks, reconciling real drift (adds RestoreSecret, ImportCertificate, and others; drops the unimplemented RenewCertificate). Revives the parser and CI gate from #738 by @ericbsantana and completes the description-preservation its spec described. REST-mode, mixed-mode, multi-table, non-tabular, S3, and ecr docs are deferred and tracked in deferred_handlers. * docs: drop standalone design spec from action-docs tooling Remove ideas/auto-generated-action-tables.spec.md and the four references to it (CONTRIBUTING.md, Makefile, regen_action_docs.py docstring, services.yaml). It was a planning artifact; the operational docs live in CONTRIBUTING.md and the tooling is self-documenting. The #738 / @ericbsantana credit is preserved in the PR description. * chore: address review on action-docs tooling - pin actions/checkout to v7.0.0 in docs-actions workflow to match the repo-wide bump (#1690), so dependabot does not immediately flag the new file - document in the generator docstring that a switch case label counts as supported purely by existing, so a per-action UnsupportedOperation stub would be a false positive (handlers here reject from the default arm) * docs: regenerate action tables against current handler source Resync the generated Supported Actions tables to handler source after rebasing onto the latest main: - cloudformation: add DescribeStackInstance and DescribeStackSetOperation now emitted by the handler, and keep the implemented StackSet descriptions - cloudtrail: add LookupEvents - firehose: add UpdateDestination - step-functions: add PublishStateMachineVersion, ListStateMachineVersions, DeleteStateMachineVersion - register the cloudcontrol handler in deferred_handlers so the strict unregistered-handler gate passes (no standalone action table yet) * fix(docs): prevent action-table generator from silently dropping actions Address the latest review pass on the action-docs tooling: - switch extraction now captures case arms whose labels wrap across lines (valid Java 14+ syntax). The capture group excludes only `{ } ;` boundaries, so it spans newlines between labels but stops at the arm's `->`. A wrapped arm was previously missed, and docs-check would stay green because the doc and the generated output agreed on the omission, defeating the whole drift-prevention guarantee. - REST extraction skips Javadoc / inline comments between a verb annotation and the method signature; such a line otherwise reset the lookahead and dropped the action. - parse_marker_block raises a descriptive error when a marker is not on its own line, instead of a bare "substring not found". - doc, source, and registry reads/writes are pinned to UTF-8 so generation is locale-independent (the docs contain non-ASCII text). - the docs-actions push trigger watches Makefile and the workflow file, matching its pull_request trigger. Adds regression tests for the multi-line arm and comment-skip paths (20 total). |
||
|
|
760d48b91a |
feat(neptune): support neo4j backend for openCypher via NEPTUNE_DB_TYPE (#1449)
* feat(neptune): support neo4j backend for openCypher via NEPTUNE_DB_TYPE Neptune emulation always started a TinkerPop Gremlin Server, which only speaks Gremlin. Add a global db-type selector (FLOCI_SERVICES_NEPTUNE_DB_TYPE, mirroring LocalStack's NEPTUNE_DB_TYPE) so clusters can be backed by Neo4j and served over the Bolt protocol for openCypher. - Add NeptuneDbType enum (gremlin -> 8182, neo4j -> 7687) with alias parsing - Add db-type and default-neo4j-image config (default neo4j:5-community) - Resolve image/port per engine in NeptuneService and NeptuneContainerManager - Run Neo4j with NEO4J_AUTH=none and probe readiness via the Bolt handshake - Add openCypher/Bolt integration test and NeptuneDbType unit test - Document the new option in README and docs/services/neptune.md * test(neptune): assert DeleteDBCluster cleanup and clarify docs Assert the openCypher integration test's DeleteDBCluster cleanup returns 200 so a failed delete surfaces instead of silently leaking a backend container and proxy port into later tests. Also drop the misleading backend ports from the db-type table (users connect via the proxy port range, not the container-native port) and correct the SigV4 auth-header comment to reference the management request routing. * fix(neptune): treat all-zero Bolt handshake reply as not-ready The Neo4j readiness probe accepted any non-empty response, but Neo4j answers the Bolt handshake with 0x00000000 when it rejects every proposed version (Bolt disabled, wrong port, or an unsupported server version). That made the probe report ready for a backend whose sessions would then fail. Require a non-zero agreed version for the neo4j db-type so such a backend times out with a clear error instead. * fix(neptune): fall back to default db-type on unknown config value A server-side typo in FLOCI_SERVICES_NEPTUNE_DB_TYPE shouldn't fail the client's CreateDBCluster. Make NeptuneDbType.fromConfig return an Optional and have NeptuneService fall back to GREMLIN with a WARN for an unrecognised value, instead of throwing InvalidParameterValue. The cluster still comes up on the default engine. |
||
|
|
a0a30a26f8 |
docs: add Neptune service page and fix missing index entries (#950, #951) (#1056)
- Create docs/services/neptune.md: 8 supported actions, configuration table (proxy ports, Docker image, network), Docker Compose snippet, AWS CLI + gremlin-python + boto3 examples, and Out of Scope section - Add Neptune to mkdocs.yml nav (after Glue) - Add Neptune row to docs/services/index.md service matrix - Add missing EventBridge Pipes row to docs/services/index.md |