LPX-263: ElastiCache (Valkey) cache + manifest-driven session store#65
Open
stevethomas wants to merge 1 commit into
Open
Conversation
… for Fargate Adds a manifest-gated ElastiCache (Valkey) shared cache and a manifest-driven session backend for Fargate apps: - aws.cache provisions a shared, env-scoped single-node Valkey replication group (cache.t4g.micro, allkeys-lru, at-rest encryption), a cache subnet group, and a security group allowing 6379 only from the task SG. Bootstrapped from sync:app like the RDS SG. Injects CACHE_STORE=redis + REDIS_HOST/PORT/PREFIX. - session.driver picks the session backend; YOLO provisions only what's needed: dynamodb gets a per-app DynamoDB table (on-demand, TTL) + task-role grant + DYNAMODB_CACHE_TABLE; redis reuses the cache (requires aws.cache); database/ cookie/file are app-managed. Validated at manifest-integrity time. - Extracts the shared 'authorise <port> from task SG' logic into an AuthorisesTaskIngress trait (RDS SG + cache SG) and collapses the ElastiCache describe-and-match lookups into a single helper. 456 Pest tests green, phpstan + pint clean, docs updated and VitePress build clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hey, I made a thing! 🥳
LPX-263
What problems are you solving?
Fargate apps had no shared cache or session store — they fell back to Laravel's default drivers on the ephemeral, per-task filesystem, which breaks the moment an app runs more than one task or needs state to survive a restart (disconnected caches, sessions lost across rolling deploys, unshared rate-limiters/locks). This ships the full "cache + session store":
aws.cache→ a shared, env-scoped Valkey (ElastiCache) cache: a single-node replication group (cache.t4g.micro,allkeys-lru, at-rest encryption), a cache subnet group across the VPC subnets, and a security group allowing6379only from the Fargate task SG. Bootstrapped fromsync:applike the RDS SG. InjectsCACHE_STORE=redis+REDIS_HOST/REDIS_PORT/REDIS_PREFIX(only if your.envdoesn't set them).session.driver→ a manifest-driven session backend. YOLO injectsSESSION_DRIVERand provisions only what each driver needs:dynamodbgets a per-app DynamoDB table (on-demand, TTL onexpires_at) + a task-role grant +DYNAMODB_CACHE_TABLE;redisreuses the cache (requiresaws.cache);database/cookie/fileare app-managed.<port>from the task SG" logic is extracted into anAuthorisesTaskIngresstrait (now used by both the RDS SG and cache SG steps), and the ElastiCache describe-and-match lookups collapse into one helper.Is there anything the reviewer needs to know to deploy this?
aws.cache/session.driverare unchanged. The new steps returnSKIPPED; no new resources, no env-var changes for existing apps.sync:appwithaws.cacheblocks ~5 min while the replication group reachesavailable(a one-timewaitUntilincreate()); subsequent syncs are no-ops.EcsTaskPolicygains a DynamoDB statement (scoped toyolo-{env}-*tables). It reconciles onto existing task roles via the existingsynchroniseDocument()(new default policy version), so the nextsync:environmentwill show a task-policy change even for apps not using DynamoDB — a harmless capability grant.dynamodbsessions require the app to haveaws/aws-sdk-phpinstalled.session.drivervalues — andrediswithoutaws.cache— hard-fail at manifest-integrity time. Cache loss repopulates from source; session durability is thedynamodbdriver's job. In-transit TLS + AUTH hardening is tracked as a follow-up.🤖 Generated with Claude Code