{"id":35405145,"url":"https://github.com/capralifecycle/webapp-deploy-lambda","last_synced_at":"2026-05-26T05:06:38.731Z","repository":{"id":37306799,"uuid":"198500457","full_name":"capralifecycle/webapp-deploy-lambda","owner":"capralifecycle","description":"CDK Construct for deploying a webapp release","archived":false,"fork":false,"pushed_at":"2026-04-18T03:14:17.000Z","size":7482,"stargazers_count":1,"open_issues_count":4,"forks_count":4,"subscribers_count":21,"default_branch":"master","last_synced_at":"2026-04-18T05:27:29.926Z","etag":null,"topics":["cdk","deployment","webapp"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@capraconsulting/webapp-deploy-lambda","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/capralifecycle.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-07-23T20:05:02.000Z","updated_at":"2026-04-18T03:13:44.000Z","dependencies_parsed_at":"2025-12-18T19:07:20.335Z","dependency_job_id":"00516305-1db3-4e30-86f8-7e520e6f9627","html_url":"https://github.com/capralifecycle/webapp-deploy-lambda","commit_stats":null,"previous_names":["capraconsulting/webapp-deploy-lambda"],"tags_count":121,"template":false,"template_full_name":null,"purl":"pkg:github/capralifecycle/webapp-deploy-lambda","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capralifecycle%2Fwebapp-deploy-lambda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capralifecycle%2Fwebapp-deploy-lambda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capralifecycle%2Fwebapp-deploy-lambda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capralifecycle%2Fwebapp-deploy-lambda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/capralifecycle","download_url":"https://codeload.github.com/capralifecycle/webapp-deploy-lambda/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capralifecycle%2Fwebapp-deploy-lambda/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32285283,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-25T18:29:39.964Z","status":"online","status_checked_at":"2026-04-26T02:00:05.962Z","response_time":129,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cdk","deployment","webapp"],"created_at":"2026-01-02T12:42:37.251Z","updated_at":"2026-04-26T04:03:21.208Z","avatar_url":"https://github.com/capralifecycle.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CDK Construct for deploying a webapp release\n\nThis project contains a CDK Construct for an AWS Lambda Function to handle\ndeployment of a bundled static web application to a S3 bucket\nwhile preserving files from previous deployments within a time\nthreshold.\n\nWhat it does:\n\n1. Fetch deployment log from S3\n2. Fetch bundled artifact and extract locally with optional filtering\n3. Upload all non-html files to S3\n4. Upload html files to S3\n5. Add uploaded items to deployment log\n6. Delete old items from S3\n7. Prune old deployments from deployment log\n8. Store deployment log to S3 for next run\n9. Optionally invalidate CloudFront distribution\n\n## Preserving old files\n\nA single-page application using code splitting will cause the client to\ndefer loading lots of files. To avoid a deployment disrupting the user, we\ncannot delete the previous files (e.g. using `aws s3 sync --delete`), as\nthat would cause the client to get 404 errors when navigating through the app.\nCloudFront will in many cases hide this issue for most of the users due to\nits edge caches, but it will still be an issue for users that haven't\nupdated the application since the day before.\n\nOne way of handling this would be to never delete any files from the\nS3 bucket. That means the bucket will fill up with a lot of old files.\nThis project approaches it differently by deleting old files.\n\nA user that still uses an application deployed five days ago should not\nbe disrupted. To keep this promise we keep the newest deployment that\nhappened more than five days ago, and delete files from older ones that no\nlonger have any reference to them.\n\n## Triggering a deployment\n\n```bash\naws lambda invoke \\\n  --function-name my-deploy-lambda \\\n  --payload '{\n    \"ResourceProperties\": {\n      \"artifactS3Url\": \"s3://my-bucket/my-release.tgz\"\n    },\n    \"RequestType\": \"Update\"\n  }' \\\n  /tmp/out.log\n```\n\n## Development\n\nTesting locally:\n\n```bash\n$ uv sync\n\n# Adjust to your project. See config.py for full list.\n$ export TARGET_BUCKET_URL=s3://my-website/web\n$ export EXPIRE_SECONDS=86400\n$ export DEPLOY_LOG_BUCKET_URL=s3://my-website/deployments.log\n$ export CF_DISTRIBUTION_ID=EKJ2IPY1KTEAR1\n\n# Adjust artifact path.\n$ uv run python -m webapp_deploy.main s3://my-bucket/my-release.tgz\n```\n\n## Notes\n\n- To avoid a race condition in using and updating the deployment log, no\n  concurrent execution of the lambda should be allowed.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcapralifecycle%2Fwebapp-deploy-lambda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcapralifecycle%2Fwebapp-deploy-lambda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcapralifecycle%2Fwebapp-deploy-lambda/lists"}