solokit 0.1.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- solokit/__init__.py +10 -0
- solokit/__version__.py +3 -0
- solokit/cli.py +374 -0
- solokit/core/__init__.py +1 -0
- solokit/core/cache.py +102 -0
- solokit/core/command_runner.py +278 -0
- solokit/core/config.py +453 -0
- solokit/core/config_validator.py +204 -0
- solokit/core/constants.py +291 -0
- solokit/core/error_formatter.py +279 -0
- solokit/core/error_handlers.py +346 -0
- solokit/core/exceptions.py +1567 -0
- solokit/core/file_ops.py +309 -0
- solokit/core/logging_config.py +166 -0
- solokit/core/output.py +99 -0
- solokit/core/performance.py +57 -0
- solokit/core/protocols.py +141 -0
- solokit/core/types.py +312 -0
- solokit/deployment/__init__.py +1 -0
- solokit/deployment/executor.py +411 -0
- solokit/git/__init__.py +1 -0
- solokit/git/integration.py +619 -0
- solokit/init/__init__.py +41 -0
- solokit/init/claude_commands_installer.py +87 -0
- solokit/init/dependency_installer.py +313 -0
- solokit/init/docs_structure.py +90 -0
- solokit/init/env_generator.py +160 -0
- solokit/init/environment_validator.py +334 -0
- solokit/init/git_hooks_installer.py +71 -0
- solokit/init/git_setup.py +188 -0
- solokit/init/gitignore_updater.py +195 -0
- solokit/init/initial_commit.py +145 -0
- solokit/init/initial_scans.py +109 -0
- solokit/init/orchestrator.py +246 -0
- solokit/init/readme_generator.py +207 -0
- solokit/init/session_structure.py +239 -0
- solokit/init/template_installer.py +424 -0
- solokit/learning/__init__.py +1 -0
- solokit/learning/archiver.py +115 -0
- solokit/learning/categorizer.py +126 -0
- solokit/learning/curator.py +428 -0
- solokit/learning/extractor.py +352 -0
- solokit/learning/reporter.py +351 -0
- solokit/learning/repository.py +254 -0
- solokit/learning/similarity.py +342 -0
- solokit/learning/validator.py +144 -0
- solokit/project/__init__.py +1 -0
- solokit/project/init.py +1162 -0
- solokit/project/stack.py +436 -0
- solokit/project/sync_plugin.py +438 -0
- solokit/project/tree.py +375 -0
- solokit/quality/__init__.py +1 -0
- solokit/quality/api_validator.py +424 -0
- solokit/quality/checkers/__init__.py +25 -0
- solokit/quality/checkers/base.py +114 -0
- solokit/quality/checkers/context7.py +221 -0
- solokit/quality/checkers/custom.py +162 -0
- solokit/quality/checkers/deployment.py +323 -0
- solokit/quality/checkers/documentation.py +179 -0
- solokit/quality/checkers/formatting.py +161 -0
- solokit/quality/checkers/integration.py +394 -0
- solokit/quality/checkers/linting.py +159 -0
- solokit/quality/checkers/security.py +261 -0
- solokit/quality/checkers/spec_completeness.py +127 -0
- solokit/quality/checkers/tests.py +184 -0
- solokit/quality/env_validator.py +306 -0
- solokit/quality/gates.py +655 -0
- solokit/quality/reporters/__init__.py +10 -0
- solokit/quality/reporters/base.py +25 -0
- solokit/quality/reporters/console.py +98 -0
- solokit/quality/reporters/json_reporter.py +34 -0
- solokit/quality/results.py +98 -0
- solokit/session/__init__.py +1 -0
- solokit/session/briefing/__init__.py +245 -0
- solokit/session/briefing/documentation_loader.py +53 -0
- solokit/session/briefing/formatter.py +476 -0
- solokit/session/briefing/git_context.py +282 -0
- solokit/session/briefing/learning_loader.py +212 -0
- solokit/session/briefing/milestone_builder.py +78 -0
- solokit/session/briefing/orchestrator.py +137 -0
- solokit/session/briefing/stack_detector.py +51 -0
- solokit/session/briefing/tree_generator.py +52 -0
- solokit/session/briefing/work_item_loader.py +209 -0
- solokit/session/briefing.py +353 -0
- solokit/session/complete.py +1188 -0
- solokit/session/status.py +246 -0
- solokit/session/validate.py +452 -0
- solokit/templates/.claude/commands/end.md +109 -0
- solokit/templates/.claude/commands/init.md +159 -0
- solokit/templates/.claude/commands/learn-curate.md +88 -0
- solokit/templates/.claude/commands/learn-search.md +62 -0
- solokit/templates/.claude/commands/learn-show.md +69 -0
- solokit/templates/.claude/commands/learn.md +136 -0
- solokit/templates/.claude/commands/start.md +114 -0
- solokit/templates/.claude/commands/status.md +22 -0
- solokit/templates/.claude/commands/validate.md +27 -0
- solokit/templates/.claude/commands/work-delete.md +119 -0
- solokit/templates/.claude/commands/work-graph.md +139 -0
- solokit/templates/.claude/commands/work-list.md +26 -0
- solokit/templates/.claude/commands/work-new.md +114 -0
- solokit/templates/.claude/commands/work-next.md +25 -0
- solokit/templates/.claude/commands/work-show.md +24 -0
- solokit/templates/.claude/commands/work-update.md +141 -0
- solokit/templates/CHANGELOG.md +17 -0
- solokit/templates/WORK_ITEM_TYPES.md +141 -0
- solokit/templates/__init__.py +1 -0
- solokit/templates/bug_spec.md +217 -0
- solokit/templates/config.schema.json +150 -0
- solokit/templates/dashboard_refine/base/.gitignore +36 -0
- solokit/templates/dashboard_refine/base/app/(dashboard)/layout.tsx +22 -0
- solokit/templates/dashboard_refine/base/app/(dashboard)/page.tsx +68 -0
- solokit/templates/dashboard_refine/base/app/(dashboard)/users/page.tsx +77 -0
- solokit/templates/dashboard_refine/base/app/globals.css +60 -0
- solokit/templates/dashboard_refine/base/app/layout.tsx +23 -0
- solokit/templates/dashboard_refine/base/app/page.tsx +9 -0
- solokit/templates/dashboard_refine/base/components/client-refine-wrapper.tsx +21 -0
- solokit/templates/dashboard_refine/base/components/layout/header.tsx +44 -0
- solokit/templates/dashboard_refine/base/components/layout/sidebar.tsx +82 -0
- solokit/templates/dashboard_refine/base/components/ui/button.tsx +53 -0
- solokit/templates/dashboard_refine/base/components/ui/card.tsx +78 -0
- solokit/templates/dashboard_refine/base/components/ui/table.tsx +116 -0
- solokit/templates/dashboard_refine/base/components.json +16 -0
- solokit/templates/dashboard_refine/base/lib/refine.tsx +65 -0
- solokit/templates/dashboard_refine/base/lib/utils.ts +13 -0
- solokit/templates/dashboard_refine/base/next.config.ts +10 -0
- solokit/templates/dashboard_refine/base/package.json.template +40 -0
- solokit/templates/dashboard_refine/base/postcss.config.mjs +8 -0
- solokit/templates/dashboard_refine/base/providers/refine-provider.tsx +26 -0
- solokit/templates/dashboard_refine/base/tailwind.config.ts +57 -0
- solokit/templates/dashboard_refine/base/tsconfig.json +27 -0
- solokit/templates/dashboard_refine/docker/Dockerfile +57 -0
- solokit/templates/dashboard_refine/docker/docker-compose.prod.yml +31 -0
- solokit/templates/dashboard_refine/docker/docker-compose.yml +21 -0
- solokit/templates/dashboard_refine/tier-1-essential/.eslintrc.json +7 -0
- solokit/templates/dashboard_refine/tier-1-essential/jest.config.ts +17 -0
- solokit/templates/dashboard_refine/tier-1-essential/jest.setup.ts +1 -0
- solokit/templates/dashboard_refine/tier-1-essential/package.json.tier1.template +57 -0
- solokit/templates/dashboard_refine/tier-1-essential/tests/setup.ts +26 -0
- solokit/templates/dashboard_refine/tier-1-essential/tests/unit/example.test.tsx +73 -0
- solokit/templates/dashboard_refine/tier-2-standard/package.json.tier2.template +62 -0
- solokit/templates/dashboard_refine/tier-3-comprehensive/eslint.config.mjs +22 -0
- solokit/templates/dashboard_refine/tier-3-comprehensive/package.json.tier3.template +79 -0
- solokit/templates/dashboard_refine/tier-3-comprehensive/playwright.config.ts +66 -0
- solokit/templates/dashboard_refine/tier-3-comprehensive/stryker.conf.json +38 -0
- solokit/templates/dashboard_refine/tier-3-comprehensive/tests/e2e/dashboard.spec.ts +88 -0
- solokit/templates/dashboard_refine/tier-3-comprehensive/tests/e2e/user-management.spec.ts +102 -0
- solokit/templates/dashboard_refine/tier-3-comprehensive/tests/integration/dashboard.test.tsx +90 -0
- solokit/templates/dashboard_refine/tier-3-comprehensive/type-coverage.json +16 -0
- solokit/templates/dashboard_refine/tier-4-production/instrumentation.ts +9 -0
- solokit/templates/dashboard_refine/tier-4-production/k6/dashboard-load-test.js +70 -0
- solokit/templates/dashboard_refine/tier-4-production/next.config.ts +46 -0
- solokit/templates/dashboard_refine/tier-4-production/package.json.tier4.template +89 -0
- solokit/templates/dashboard_refine/tier-4-production/sentry.client.config.ts +26 -0
- solokit/templates/dashboard_refine/tier-4-production/sentry.edge.config.ts +11 -0
- solokit/templates/dashboard_refine/tier-4-production/sentry.server.config.ts +11 -0
- solokit/templates/deployment_spec.md +500 -0
- solokit/templates/feature_spec.md +248 -0
- solokit/templates/fullstack_nextjs/base/.gitignore +36 -0
- solokit/templates/fullstack_nextjs/base/app/api/example/route.ts +65 -0
- solokit/templates/fullstack_nextjs/base/app/globals.css +27 -0
- solokit/templates/fullstack_nextjs/base/app/layout.tsx +20 -0
- solokit/templates/fullstack_nextjs/base/app/page.tsx +32 -0
- solokit/templates/fullstack_nextjs/base/components/example-component.tsx +20 -0
- solokit/templates/fullstack_nextjs/base/lib/prisma.ts +17 -0
- solokit/templates/fullstack_nextjs/base/lib/utils.ts +13 -0
- solokit/templates/fullstack_nextjs/base/lib/validations.ts +20 -0
- solokit/templates/fullstack_nextjs/base/next.config.ts +7 -0
- solokit/templates/fullstack_nextjs/base/package.json.template +32 -0
- solokit/templates/fullstack_nextjs/base/postcss.config.mjs +8 -0
- solokit/templates/fullstack_nextjs/base/prisma/schema.prisma +21 -0
- solokit/templates/fullstack_nextjs/base/tailwind.config.ts +19 -0
- solokit/templates/fullstack_nextjs/base/tsconfig.json +27 -0
- solokit/templates/fullstack_nextjs/docker/Dockerfile +60 -0
- solokit/templates/fullstack_nextjs/docker/docker-compose.prod.yml +57 -0
- solokit/templates/fullstack_nextjs/docker/docker-compose.yml +47 -0
- solokit/templates/fullstack_nextjs/tier-1-essential/.eslintrc.json +7 -0
- solokit/templates/fullstack_nextjs/tier-1-essential/jest.config.ts +17 -0
- solokit/templates/fullstack_nextjs/tier-1-essential/jest.setup.ts +1 -0
- solokit/templates/fullstack_nextjs/tier-1-essential/package.json.tier1.template +48 -0
- solokit/templates/fullstack_nextjs/tier-1-essential/tests/api/example.test.ts +88 -0
- solokit/templates/fullstack_nextjs/tier-1-essential/tests/setup.ts +22 -0
- solokit/templates/fullstack_nextjs/tier-1-essential/tests/unit/example.test.tsx +22 -0
- solokit/templates/fullstack_nextjs/tier-2-standard/package.json.tier2.template +52 -0
- solokit/templates/fullstack_nextjs/tier-3-comprehensive/eslint.config.mjs +39 -0
- solokit/templates/fullstack_nextjs/tier-3-comprehensive/package.json.tier3.template +68 -0
- solokit/templates/fullstack_nextjs/tier-3-comprehensive/playwright.config.ts +66 -0
- solokit/templates/fullstack_nextjs/tier-3-comprehensive/stryker.conf.json +33 -0
- solokit/templates/fullstack_nextjs/tier-3-comprehensive/tests/e2e/flow.spec.ts +59 -0
- solokit/templates/fullstack_nextjs/tier-3-comprehensive/tests/integration/api.test.ts +165 -0
- solokit/templates/fullstack_nextjs/tier-3-comprehensive/type-coverage.json +12 -0
- solokit/templates/fullstack_nextjs/tier-4-production/instrumentation.ts +9 -0
- solokit/templates/fullstack_nextjs/tier-4-production/k6/load-test.js +45 -0
- solokit/templates/fullstack_nextjs/tier-4-production/next.config.ts +46 -0
- solokit/templates/fullstack_nextjs/tier-4-production/package.json.tier4.template +77 -0
- solokit/templates/fullstack_nextjs/tier-4-production/sentry.client.config.ts +26 -0
- solokit/templates/fullstack_nextjs/tier-4-production/sentry.edge.config.ts +11 -0
- solokit/templates/fullstack_nextjs/tier-4-production/sentry.server.config.ts +11 -0
- solokit/templates/git-hooks/prepare-commit-msg +24 -0
- solokit/templates/integration_test_spec.md +363 -0
- solokit/templates/learnings.json +15 -0
- solokit/templates/ml_ai_fastapi/base/.gitignore +104 -0
- solokit/templates/ml_ai_fastapi/base/alembic/env.py +96 -0
- solokit/templates/ml_ai_fastapi/base/alembic.ini +114 -0
- solokit/templates/ml_ai_fastapi/base/pyproject.toml.template +91 -0
- solokit/templates/ml_ai_fastapi/base/requirements.txt.template +28 -0
- solokit/templates/ml_ai_fastapi/base/src/__init__.py +5 -0
- solokit/templates/ml_ai_fastapi/base/src/api/__init__.py +3 -0
- solokit/templates/ml_ai_fastapi/base/src/api/dependencies.py +20 -0
- solokit/templates/ml_ai_fastapi/base/src/api/routes/__init__.py +3 -0
- solokit/templates/ml_ai_fastapi/base/src/api/routes/example.py +134 -0
- solokit/templates/ml_ai_fastapi/base/src/api/routes/health.py +66 -0
- solokit/templates/ml_ai_fastapi/base/src/core/__init__.py +3 -0
- solokit/templates/ml_ai_fastapi/base/src/core/config.py +64 -0
- solokit/templates/ml_ai_fastapi/base/src/core/database.py +50 -0
- solokit/templates/ml_ai_fastapi/base/src/main.py +64 -0
- solokit/templates/ml_ai_fastapi/base/src/models/__init__.py +7 -0
- solokit/templates/ml_ai_fastapi/base/src/models/example.py +61 -0
- solokit/templates/ml_ai_fastapi/base/src/services/__init__.py +3 -0
- solokit/templates/ml_ai_fastapi/base/src/services/example.py +115 -0
- solokit/templates/ml_ai_fastapi/docker/Dockerfile +59 -0
- solokit/templates/ml_ai_fastapi/docker/docker-compose.prod.yml +112 -0
- solokit/templates/ml_ai_fastapi/docker/docker-compose.yml +77 -0
- solokit/templates/ml_ai_fastapi/tier-1-essential/pyproject.toml.tier1.template +112 -0
- solokit/templates/ml_ai_fastapi/tier-1-essential/pyrightconfig.json +41 -0
- solokit/templates/ml_ai_fastapi/tier-1-essential/pytest.ini +69 -0
- solokit/templates/ml_ai_fastapi/tier-1-essential/requirements-dev.txt +17 -0
- solokit/templates/ml_ai_fastapi/tier-1-essential/ruff.toml +81 -0
- solokit/templates/ml_ai_fastapi/tier-1-essential/tests/__init__.py +3 -0
- solokit/templates/ml_ai_fastapi/tier-1-essential/tests/conftest.py +72 -0
- solokit/templates/ml_ai_fastapi/tier-1-essential/tests/test_main.py +49 -0
- solokit/templates/ml_ai_fastapi/tier-1-essential/tests/unit/__init__.py +3 -0
- solokit/templates/ml_ai_fastapi/tier-1-essential/tests/unit/test_example.py +113 -0
- solokit/templates/ml_ai_fastapi/tier-2-standard/pyproject.toml.tier2.template +130 -0
- solokit/templates/ml_ai_fastapi/tier-3-comprehensive/locustfile.py +99 -0
- solokit/templates/ml_ai_fastapi/tier-3-comprehensive/mutmut_config.py +53 -0
- solokit/templates/ml_ai_fastapi/tier-3-comprehensive/pyproject.toml.tier3.template +150 -0
- solokit/templates/ml_ai_fastapi/tier-3-comprehensive/tests/integration/__init__.py +3 -0
- solokit/templates/ml_ai_fastapi/tier-3-comprehensive/tests/integration/conftest.py +74 -0
- solokit/templates/ml_ai_fastapi/tier-3-comprehensive/tests/integration/test_api.py +131 -0
- solokit/templates/ml_ai_fastapi/tier-4-production/pyproject.toml.tier4.template +162 -0
- solokit/templates/ml_ai_fastapi/tier-4-production/requirements-prod.txt +25 -0
- solokit/templates/ml_ai_fastapi/tier-4-production/src/api/routes/metrics.py +19 -0
- solokit/templates/ml_ai_fastapi/tier-4-production/src/core/logging.py +74 -0
- solokit/templates/ml_ai_fastapi/tier-4-production/src/core/monitoring.py +68 -0
- solokit/templates/ml_ai_fastapi/tier-4-production/src/core/sentry.py +66 -0
- solokit/templates/ml_ai_fastapi/tier-4-production/src/middleware/__init__.py +3 -0
- solokit/templates/ml_ai_fastapi/tier-4-production/src/middleware/logging.py +79 -0
- solokit/templates/ml_ai_fastapi/tier-4-production/src/middleware/tracing.py +60 -0
- solokit/templates/refactor_spec.md +287 -0
- solokit/templates/saas_t3/base/.gitignore +36 -0
- solokit/templates/saas_t3/base/app/api/trpc/[trpc]/route.ts +33 -0
- solokit/templates/saas_t3/base/app/globals.css +27 -0
- solokit/templates/saas_t3/base/app/layout.tsx +23 -0
- solokit/templates/saas_t3/base/app/page.tsx +31 -0
- solokit/templates/saas_t3/base/lib/api.tsx +77 -0
- solokit/templates/saas_t3/base/lib/utils.ts +13 -0
- solokit/templates/saas_t3/base/next.config.ts +7 -0
- solokit/templates/saas_t3/base/package.json.template +38 -0
- solokit/templates/saas_t3/base/postcss.config.mjs +8 -0
- solokit/templates/saas_t3/base/prisma/schema.prisma +20 -0
- solokit/templates/saas_t3/base/server/api/root.ts +19 -0
- solokit/templates/saas_t3/base/server/api/routers/example.ts +28 -0
- solokit/templates/saas_t3/base/server/api/trpc.ts +52 -0
- solokit/templates/saas_t3/base/server/db.ts +17 -0
- solokit/templates/saas_t3/base/tailwind.config.ts +19 -0
- solokit/templates/saas_t3/base/tsconfig.json +27 -0
- solokit/templates/saas_t3/docker/Dockerfile +60 -0
- solokit/templates/saas_t3/docker/docker-compose.prod.yml +59 -0
- solokit/templates/saas_t3/docker/docker-compose.yml +49 -0
- solokit/templates/saas_t3/tier-1-essential/.eslintrc.json +7 -0
- solokit/templates/saas_t3/tier-1-essential/jest.config.ts +17 -0
- solokit/templates/saas_t3/tier-1-essential/jest.setup.ts +1 -0
- solokit/templates/saas_t3/tier-1-essential/package.json.tier1.template +54 -0
- solokit/templates/saas_t3/tier-1-essential/tests/setup.ts +22 -0
- solokit/templates/saas_t3/tier-1-essential/tests/unit/example.test.tsx +24 -0
- solokit/templates/saas_t3/tier-2-standard/package.json.tier2.template +58 -0
- solokit/templates/saas_t3/tier-3-comprehensive/eslint.config.mjs +39 -0
- solokit/templates/saas_t3/tier-3-comprehensive/package.json.tier3.template +74 -0
- solokit/templates/saas_t3/tier-3-comprehensive/playwright.config.ts +66 -0
- solokit/templates/saas_t3/tier-3-comprehensive/stryker.conf.json +34 -0
- solokit/templates/saas_t3/tier-3-comprehensive/tests/e2e/home.spec.ts +41 -0
- solokit/templates/saas_t3/tier-3-comprehensive/tests/integration/api.test.ts +44 -0
- solokit/templates/saas_t3/tier-3-comprehensive/type-coverage.json +12 -0
- solokit/templates/saas_t3/tier-4-production/instrumentation.ts +9 -0
- solokit/templates/saas_t3/tier-4-production/k6/load-test.js +51 -0
- solokit/templates/saas_t3/tier-4-production/next.config.ts +46 -0
- solokit/templates/saas_t3/tier-4-production/package.json.tier4.template +83 -0
- solokit/templates/saas_t3/tier-4-production/sentry.client.config.ts +26 -0
- solokit/templates/saas_t3/tier-4-production/sentry.edge.config.ts +11 -0
- solokit/templates/saas_t3/tier-4-production/sentry.server.config.ts +11 -0
- solokit/templates/saas_t3/tier-4-production/vercel.json +37 -0
- solokit/templates/security_spec.md +287 -0
- solokit/templates/stack-versions.yaml +617 -0
- solokit/templates/status_update.json +6 -0
- solokit/templates/template-registry.json +257 -0
- solokit/templates/work_items.json +11 -0
- solokit/testing/__init__.py +1 -0
- solokit/testing/integration_runner.py +550 -0
- solokit/testing/performance.py +637 -0
- solokit/visualization/__init__.py +1 -0
- solokit/visualization/dependency_graph.py +788 -0
- solokit/work_items/__init__.py +1 -0
- solokit/work_items/creator.py +217 -0
- solokit/work_items/delete.py +264 -0
- solokit/work_items/get_dependencies.py +185 -0
- solokit/work_items/get_dependents.py +113 -0
- solokit/work_items/get_metadata.py +121 -0
- solokit/work_items/get_next_recommendations.py +133 -0
- solokit/work_items/manager.py +235 -0
- solokit/work_items/milestones.py +137 -0
- solokit/work_items/query.py +376 -0
- solokit/work_items/repository.py +267 -0
- solokit/work_items/scheduler.py +184 -0
- solokit/work_items/spec_parser.py +838 -0
- solokit/work_items/spec_validator.py +493 -0
- solokit/work_items/updater.py +157 -0
- solokit/work_items/validator.py +205 -0
- solokit-0.1.1.dist-info/METADATA +640 -0
- solokit-0.1.1.dist-info/RECORD +323 -0
- solokit-0.1.1.dist-info/WHEEL +5 -0
- solokit-0.1.1.dist-info/entry_points.txt +2 -0
- solokit-0.1.1.dist-info/licenses/LICENSE +21 -0
- solokit-0.1.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{project_name}",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "{project_description}",
|
|
5
|
+
"private": true,
|
|
6
|
+
"type": "module",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"dev": "next dev",
|
|
9
|
+
"build": "next build",
|
|
10
|
+
"start": "next start",
|
|
11
|
+
"lint": "next lint",
|
|
12
|
+
"lint:fix": "next lint --fix",
|
|
13
|
+
"format": "prettier --write \"**/*.{ts,tsx,js,jsx,json,css,md}\"",
|
|
14
|
+
"format:check": "prettier --check \"**/*.{ts,tsx,js,jsx,json,css,md}\"",
|
|
15
|
+
"type-check": "tsc --noEmit",
|
|
16
|
+
"test": "jest",
|
|
17
|
+
"test:coverage": "jest --coverage",
|
|
18
|
+
"test:watch": "jest --watch",
|
|
19
|
+
"test:e2e": "playwright test",
|
|
20
|
+
"test:e2e:ui": "playwright test --ui",
|
|
21
|
+
"test:e2e:debug": "playwright test --debug",
|
|
22
|
+
"test:a11y": "playwright test --grep @a11y",
|
|
23
|
+
"test:mutation": "stryker run",
|
|
24
|
+
"check:duplication": "jscpd .",
|
|
25
|
+
"check:types": "type-coverage",
|
|
26
|
+
"check:unused": "ts-prune",
|
|
27
|
+
"prepare": "husky install",
|
|
28
|
+
"audit": "npm audit --audit-level=moderate",
|
|
29
|
+
"analyze": "ANALYZE=true npm run build",
|
|
30
|
+
"lighthouse": "lhci autorun",
|
|
31
|
+
"load:test": "k6 run k6/dashboard-load-test.js",
|
|
32
|
+
"postinstall": "patch-package"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"next": "16.0.1",
|
|
36
|
+
"react": "19.2.0",
|
|
37
|
+
"react-dom": "19.2.0",
|
|
38
|
+
"@refinedev/cli": "2.16.50",
|
|
39
|
+
"@refinedev/core": "5.0.5",
|
|
40
|
+
"@refinedev/nextjs-router": "7.0.4",
|
|
41
|
+
"@refinedev/react-table": "6.0.1",
|
|
42
|
+
"@refinedev/react-hook-form": "5.0.2",
|
|
43
|
+
"recharts": "3.3.0",
|
|
44
|
+
"react-hook-form": "7.66.0",
|
|
45
|
+
"zod": "4.1.12",
|
|
46
|
+
"@hookform/resolvers": "5.2.2",
|
|
47
|
+
"lucide-react": "0.553.0",
|
|
48
|
+
"class-variance-authority": "0.7.1",
|
|
49
|
+
"clsx": "2.1.1",
|
|
50
|
+
"tailwind-merge": "3.3.1",
|
|
51
|
+
"tailwindcss": "4.1.17",
|
|
52
|
+
"@tailwindcss/postcss": "4.1.17",
|
|
53
|
+
"@sentry/nextjs": "10.23.0",
|
|
54
|
+
"@vercel/analytics": "1.5.0"
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"typescript": "5.9.3",
|
|
58
|
+
"@types/node": "20.19.24",
|
|
59
|
+
"@types/react": "19.2.2",
|
|
60
|
+
"@types/react-dom": "19.2.2",
|
|
61
|
+
"eslint": "9.39.1",
|
|
62
|
+
"eslint-config-next": "16.0.1",
|
|
63
|
+
"@typescript-eslint/parser": "8.46.3",
|
|
64
|
+
"@typescript-eslint/eslint-plugin": "8.46.3",
|
|
65
|
+
"prettier": "3.6.2",
|
|
66
|
+
"jest": "30.2.0",
|
|
67
|
+
"@types/jest": "30.0.0",
|
|
68
|
+
"ts-jest": "29.4.5",
|
|
69
|
+
"jest-environment-jsdom": "30.2.0",
|
|
70
|
+
"@testing-library/react": "16.3.0",
|
|
71
|
+
"@testing-library/jest-dom": "6.9.1",
|
|
72
|
+
"husky": "9.1.7",
|
|
73
|
+
"lint-staged": "16.2.6",
|
|
74
|
+
"jscpd": "4.0.5",
|
|
75
|
+
"ts-prune": "0.10.3",
|
|
76
|
+
"type-coverage": "2.29.7",
|
|
77
|
+
"@stryker-mutator/core": "9.3.0",
|
|
78
|
+
"@stryker-mutator/jest-runner": "9.3.0",
|
|
79
|
+
"@playwright/test": "1.56.1",
|
|
80
|
+
"playwright": "1.56.1",
|
|
81
|
+
"@axe-core/playwright": "4.11.0",
|
|
82
|
+
"eslint-plugin-jest-dom": "5.5.0",
|
|
83
|
+
"eslint-plugin-testing-library": "7.13.3",
|
|
84
|
+
"patch-package": "8.0.1",
|
|
85
|
+
"@next/bundle-analyzer": "16.0.1",
|
|
86
|
+
"@lhci/cli": "0.15.1",
|
|
87
|
+
"dotenv-cli": "11.0.0"
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as Sentry from "@sentry/nextjs";
|
|
2
|
+
|
|
3
|
+
Sentry.init({
|
|
4
|
+
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
|
|
5
|
+
|
|
6
|
+
// Adjust this value in production, or use tracesSampler for greater control
|
|
7
|
+
tracesSampleRate: 1,
|
|
8
|
+
|
|
9
|
+
// Setting this option to true will print useful information to the console while you're setting up Sentry.
|
|
10
|
+
debug: false,
|
|
11
|
+
|
|
12
|
+
replaysOnErrorSampleRate: 1.0,
|
|
13
|
+
|
|
14
|
+
// This sets the sample rate to be 10%. You may want this to be 100% while
|
|
15
|
+
// in development and sample at a lower rate in production
|
|
16
|
+
replaysSessionSampleRate: 0.1,
|
|
17
|
+
|
|
18
|
+
// You can remove this option if you're not planning to use the Sentry Session Replay feature:
|
|
19
|
+
integrations: [
|
|
20
|
+
Sentry.replayIntegration({
|
|
21
|
+
// Additional Replay configuration goes in here, for example:
|
|
22
|
+
maskAllText: true,
|
|
23
|
+
blockAllMedia: true,
|
|
24
|
+
}),
|
|
25
|
+
],
|
|
26
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as Sentry from "@sentry/nextjs";
|
|
2
|
+
|
|
3
|
+
Sentry.init({
|
|
4
|
+
dsn: process.env.SENTRY_DSN,
|
|
5
|
+
|
|
6
|
+
// Adjust this value in production, or use tracesSampler for greater control
|
|
7
|
+
tracesSampleRate: 1,
|
|
8
|
+
|
|
9
|
+
// Setting this option to true will print useful information to the console while you're setting up Sentry.
|
|
10
|
+
debug: false,
|
|
11
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as Sentry from "@sentry/nextjs";
|
|
2
|
+
|
|
3
|
+
Sentry.init({
|
|
4
|
+
dsn: process.env.SENTRY_DSN,
|
|
5
|
+
|
|
6
|
+
// Adjust this value in production, or use tracesSampler for greater control
|
|
7
|
+
tracesSampleRate: 1,
|
|
8
|
+
|
|
9
|
+
// Setting this option to true will print useful information to the console while you're setting up Sentry.
|
|
10
|
+
debug: false,
|
|
11
|
+
});
|
|
@@ -0,0 +1,500 @@
|
|
|
1
|
+
# Deployment: [Name]
|
|
2
|
+
|
|
3
|
+
<!--
|
|
4
|
+
TEMPLATE INSTRUCTIONS:
|
|
5
|
+
- Replace [Name] with a descriptive name for this deployment
|
|
6
|
+
- Fill out all deployment procedures with specific commands
|
|
7
|
+
- Include rollback procedures and smoke tests
|
|
8
|
+
- Document all environment configuration
|
|
9
|
+
- Test the deployment in staging before production
|
|
10
|
+
- Remove these instructions before finalizing the spec
|
|
11
|
+
-->
|
|
12
|
+
|
|
13
|
+
## Deployment Scope
|
|
14
|
+
|
|
15
|
+
<!-- Define what is being deployed and to which environment -->
|
|
16
|
+
|
|
17
|
+
Define what is being deployed and to which environment.
|
|
18
|
+
|
|
19
|
+
**Example:**
|
|
20
|
+
> Deploy the Order Processing API v2.5.0 to production. This release includes performance improvements, bug fixes for payment processing, and new inventory integration features. Zero-downtime deployment using blue-green strategy.
|
|
21
|
+
|
|
22
|
+
**Application/Service:**
|
|
23
|
+
- Name: order-processing-api
|
|
24
|
+
- Version: 2.5.0
|
|
25
|
+
- Repository: https://github.com/company/order-api
|
|
26
|
+
- Branch/Tag: `v2.5.0` (tagged release)
|
|
27
|
+
- Build: `#1234` (CI/CD build number)
|
|
28
|
+
- Docker Image: `order-api:2.5.0-abc123`
|
|
29
|
+
|
|
30
|
+
**Target Environment:**
|
|
31
|
+
- Environment: Production
|
|
32
|
+
- Cloud Provider: AWS
|
|
33
|
+
- Region/Zone: us-east-1 (primary), us-west-2 (replica)
|
|
34
|
+
- Cluster/Namespace: `production/order-api`
|
|
35
|
+
- Load Balancer: ALB `order-api-prod`
|
|
36
|
+
- Deployment Strategy: Blue-Green (zero downtime)
|
|
37
|
+
|
|
38
|
+
**Scope of Changes:**
|
|
39
|
+
- Backend API code changes (15 files modified)
|
|
40
|
+
- Database migration: Add `order_metadata` column
|
|
41
|
+
- Configuration updates: New Stripe API key
|
|
42
|
+
- Infrastructure: No changes (existing resources)
|
|
43
|
+
|
|
44
|
+
## Deployment Procedure
|
|
45
|
+
|
|
46
|
+
<!-- Detailed step-by-step deployment instructions with specific commands -->
|
|
47
|
+
|
|
48
|
+
### Pre-Deployment Checklist
|
|
49
|
+
|
|
50
|
+
<!-- All items must be checked before deployment can proceed -->
|
|
51
|
+
|
|
52
|
+
- [ ] All integration tests passed in CI/CD (Build #1234: ✓ PASSED)
|
|
53
|
+
- [ ] Security scans passed (0 critical, 0 high vulnerabilities)
|
|
54
|
+
- [ ] Code review approved by 2+ engineers
|
|
55
|
+
- [ ] Product owner approved release notes
|
|
56
|
+
- [ ] Database migration tested in staging
|
|
57
|
+
- [ ] Rollback procedure documented and tested
|
|
58
|
+
- [ ] Deployment window scheduled (maintenance window if needed)
|
|
59
|
+
- [ ] Team notified via Slack #deployments channel
|
|
60
|
+
- [ ] On-call engineer identified and available
|
|
61
|
+
- [ ] Monitoring dashboards ready (DataDog, Grafana)
|
|
62
|
+
- [ ] Feature flags configured (if applicable)
|
|
63
|
+
- [ ] Backup of current production state completed
|
|
64
|
+
|
|
65
|
+
**Pre-Deployment Commands:**
|
|
66
|
+
```bash
|
|
67
|
+
# 1. Verify staging deployment successful
|
|
68
|
+
curl https://staging-api.example.com/health
|
|
69
|
+
# Expected: {"status": "healthy", "version": "2.5.0"}
|
|
70
|
+
|
|
71
|
+
# 2. Backup production database
|
|
72
|
+
pg_dump -h prod-db.example.com -U admin -d orders > backup_$(date +%Y%m%d_%H%M%S).sql
|
|
73
|
+
|
|
74
|
+
# 3. Verify backup integrity
|
|
75
|
+
pg_restore --list backup_*.sql | wc -l
|
|
76
|
+
# Expected: > 100 (tables and data)
|
|
77
|
+
|
|
78
|
+
# 4. Tag deployment in monitoring
|
|
79
|
+
curl -X POST https://api.datadoghq.com/api/v1/events \
|
|
80
|
+
-H "DD-API-KEY: ${DD_API_KEY}" \
|
|
81
|
+
-d '{"title":"Deployment Start","text":"v2.5.0 deployment to production starting"}'
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Deployment Steps
|
|
85
|
+
|
|
86
|
+
<!-- Execute these steps in order during the deployment window -->
|
|
87
|
+
|
|
88
|
+
**Step 1: Prepare New Version (Blue Environment)**
|
|
89
|
+
```bash
|
|
90
|
+
# Pull latest Docker image
|
|
91
|
+
docker pull order-api:2.5.0-abc123
|
|
92
|
+
|
|
93
|
+
# Verify image integrity
|
|
94
|
+
docker inspect order-api:2.5.0-abc123 | grep Created
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**Step 2: Run Database Migrations**
|
|
98
|
+
```bash
|
|
99
|
+
# Connect to production database (read-write connection)
|
|
100
|
+
psql postgresql://admin:${DB_PASSWORD}@prod-db.example.com:5432/orders
|
|
101
|
+
|
|
102
|
+
# Run migration (idempotent, safe to re-run)
|
|
103
|
+
\i migrations/025_add_order_metadata.sql
|
|
104
|
+
|
|
105
|
+
# Verify migration
|
|
106
|
+
SELECT column_name FROM information_schema.columns
|
|
107
|
+
WHERE table_name = 'orders' AND column_name = 'order_metadata';
|
|
108
|
+
# Expected: order_metadata
|
|
109
|
+
|
|
110
|
+
# Check row count (should not change)
|
|
111
|
+
SELECT COUNT(*) FROM orders;
|
|
112
|
+
# Expected: same as before migration
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
**Step 3: Deploy to Blue Environment**
|
|
116
|
+
```bash
|
|
117
|
+
# Update ECS task definition with new image
|
|
118
|
+
aws ecs register-task-definition \
|
|
119
|
+
--cli-input-json file://task-definition-v2.5.0.json
|
|
120
|
+
|
|
121
|
+
# Update service to use new task definition (Blue environment)
|
|
122
|
+
aws ecs update-service \
|
|
123
|
+
--cluster production \
|
|
124
|
+
--service order-api-blue \
|
|
125
|
+
--task-definition order-api:42 \
|
|
126
|
+
--desired-count 3
|
|
127
|
+
|
|
128
|
+
# Wait for deployment to complete (5-10 minutes)
|
|
129
|
+
aws ecs wait services-stable \
|
|
130
|
+
--cluster production \
|
|
131
|
+
--services order-api-blue
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
**Step 4: Run Smoke Tests on Blue**
|
|
135
|
+
```bash
|
|
136
|
+
# Execute smoke test suite against blue environment
|
|
137
|
+
npm run smoke-test -- --url https://blue.order-api.internal
|
|
138
|
+
|
|
139
|
+
# Expected output:
|
|
140
|
+
# ✓ Health check passed
|
|
141
|
+
# ✓ Create order endpoint working
|
|
142
|
+
# ✓ Payment processing functional
|
|
143
|
+
# ✓ Database connectivity verified
|
|
144
|
+
# All smoke tests passed (4/4)
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
**Step 5: Switch Traffic (Blue-Green Cutover)**
|
|
148
|
+
```bash
|
|
149
|
+
# Update load balancer to route traffic to Blue
|
|
150
|
+
aws elbv2 modify-rule \
|
|
151
|
+
--rule-arn arn:aws:elasticloadbalancing:us-east-1:123456:rule/abc123 \
|
|
152
|
+
--actions Type=forward,TargetGroupArn=arn:aws:elasticloadbalancing:us-east-1:123456:targetgroup/order-api-blue
|
|
153
|
+
|
|
154
|
+
# Monitor traffic switch (gradual if using weighted routing)
|
|
155
|
+
watch -n 5 'aws elbv2 describe-target-health \
|
|
156
|
+
--target-group-arn arn:aws:elasticloadbalancing:us-east-1:123456:targetgroup/order-api-blue'
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
**Step 6: Monitor New Version**
|
|
160
|
+
```bash
|
|
161
|
+
# Watch error rate in real-time (should stay < 1%)
|
|
162
|
+
watch -n 10 'curl -s "https://api.datadoghq.com/api/v1/query?query=sum:api.errors{service:order-api}.as_rate()" -H "DD-API-KEY: ${DD_API_KEY}"'
|
|
163
|
+
|
|
164
|
+
# Watch response time (p95 should be < 500ms)
|
|
165
|
+
watch -n 10 'curl -s "https://api.datadoghq.com/api/v1/query?query=p95:api.response_time{service:order-api}" -H "DD-API-KEY: ${DD_API_KEY}"'
|
|
166
|
+
|
|
167
|
+
# Check application logs
|
|
168
|
+
kubectl logs -n production -l app=order-api --tail=100 -f
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### Post-Deployment Steps
|
|
172
|
+
|
|
173
|
+
<!-- Verify deployment success and complete deployment tasks -->
|
|
174
|
+
|
|
175
|
+
- [ ] Smoke tests passed on production (all 4 tests green)
|
|
176
|
+
- [ ] Error rate < 1% for 15 minutes post-deployment
|
|
177
|
+
- [ ] Response time p95 < 500ms (no regression)
|
|
178
|
+
- [ ] Database queries performing well (no slow query alerts)
|
|
179
|
+
- [ ] Critical user flows verified:
|
|
180
|
+
- [ ] Place order and complete payment
|
|
181
|
+
- [ ] View order history
|
|
182
|
+
- [ ] Cancel order
|
|
183
|
+
- [ ] Monitoring dashboards show healthy metrics
|
|
184
|
+
- [ ] No alerts fired in past 15 minutes
|
|
185
|
+
- [ ] Application logs show no errors
|
|
186
|
+
- [ ] Team notified of successful deployment
|
|
187
|
+
- [ ] Deployment documented in changelog
|
|
188
|
+
- [ ] Old version (Green) scaled down after 1 hour soak time
|
|
189
|
+
|
|
190
|
+
**Post-Deployment Commands:**
|
|
191
|
+
```bash
|
|
192
|
+
# Tag successful deployment in monitoring
|
|
193
|
+
curl -X POST https://api.datadoghq.com/api/v1/events \
|
|
194
|
+
-H "DD-API-KEY: ${DD_API_KEY}" \
|
|
195
|
+
-d '{"title":"Deployment Complete","text":"v2.5.0 deployed successfully to production","tags":["deployment:success","version:2.5.0"]}'
|
|
196
|
+
|
|
197
|
+
# Scale down old version (Green) after soak period
|
|
198
|
+
aws ecs update-service \
|
|
199
|
+
--cluster production \
|
|
200
|
+
--service order-api-green \
|
|
201
|
+
--desired-count 0
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
## Environment Configuration
|
|
205
|
+
|
|
206
|
+
<!-- Document all environment variables, secrets, and infrastructure dependencies -->
|
|
207
|
+
|
|
208
|
+
**Required Environment Variables:**
|
|
209
|
+
```bash
|
|
210
|
+
# Database
|
|
211
|
+
DATABASE_URL=postgresql://app_user:${DB_PASSWORD}@prod-db.example.com:5432/orders
|
|
212
|
+
DATABASE_POOL_SIZE=20
|
|
213
|
+
DATABASE_TIMEOUT=30000
|
|
214
|
+
|
|
215
|
+
# Cache
|
|
216
|
+
REDIS_URL=redis://:${REDIS_PASSWORD}@prod-redis.example.com:6379/0
|
|
217
|
+
REDIS_POOL_SIZE=10
|
|
218
|
+
|
|
219
|
+
# External APIs
|
|
220
|
+
STRIPE_API_KEY=${STRIPE_PROD_API_KEY}
|
|
221
|
+
STRIPE_WEBHOOK_SECRET=${STRIPE_WEBHOOK_SECRET}
|
|
222
|
+
|
|
223
|
+
# Application
|
|
224
|
+
NODE_ENV=production
|
|
225
|
+
PORT=8080
|
|
226
|
+
LOG_LEVEL=info
|
|
227
|
+
LOG_FORMAT=json
|
|
228
|
+
|
|
229
|
+
# Feature Flags
|
|
230
|
+
FEATURE_NEW_INVENTORY=true
|
|
231
|
+
FEATURE_PAYMENT_V2=true
|
|
232
|
+
|
|
233
|
+
# Monitoring
|
|
234
|
+
DATADOG_API_KEY=${DD_API_KEY}
|
|
235
|
+
DATADOG_SERVICE_NAME=order-api
|
|
236
|
+
DATADOG_ENV=production
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
**Required Secrets (stored in AWS Secrets Manager):**
|
|
240
|
+
- `prod/order-api/db-password` - Database password
|
|
241
|
+
- `prod/order-api/redis-password` - Redis password
|
|
242
|
+
- `prod/order-api/stripe-api-key` - Stripe production API key
|
|
243
|
+
- `prod/order-api/stripe-webhook-secret` - Stripe webhook signing secret
|
|
244
|
+
- `prod/order-api/datadog-api-key` - DataDog API key
|
|
245
|
+
|
|
246
|
+
**Secrets Rotation Policy:**
|
|
247
|
+
- Database password: Rotate every 90 days
|
|
248
|
+
- API keys: Rotate every 180 days
|
|
249
|
+
- Webhook secrets: Rotate on compromise only
|
|
250
|
+
|
|
251
|
+
**Infrastructure Dependencies:**
|
|
252
|
+
- Database: PostgreSQL 14.2 (RDS instance: `prod-orders-db.cqx7.us-east-1.rds.amazonaws.com`)
|
|
253
|
+
- Cache: Redis 7.0 (ElastiCache cluster: `prod-orders-cache`)
|
|
254
|
+
- Load Balancer: ALB `order-api-prod` (arn:aws:elasticloadbalancing:...)
|
|
255
|
+
- CDN: CloudFront distribution `E1234ABCD` (for static assets)
|
|
256
|
+
- DNS: Route53 hosted zone `example.com`
|
|
257
|
+
- Monitoring: DataDog agent v7.40+
|
|
258
|
+
- Logging: CloudWatch Logs group `/aws/ecs/order-api`
|
|
259
|
+
|
|
260
|
+
**Resource Limits:**
|
|
261
|
+
- CPU: 2 vCPU per task
|
|
262
|
+
- Memory: 4 GB per task
|
|
263
|
+
- Disk: 20 GB ephemeral storage
|
|
264
|
+
- Network: 1 Gbps
|
|
265
|
+
|
|
266
|
+
## Rollback Procedure
|
|
267
|
+
|
|
268
|
+
<!-- Detailed procedure for rolling back if deployment fails -->
|
|
269
|
+
|
|
270
|
+
### Rollback Triggers
|
|
271
|
+
|
|
272
|
+
**Automatic Rollback (if enabled):**
|
|
273
|
+
- Smoke tests fail (any test fails)
|
|
274
|
+
- Error rate exceeds 5% for 5 consecutive minutes
|
|
275
|
+
- Response time p95 > 1000ms for 5 minutes
|
|
276
|
+
- Health check failures > 50% of instances
|
|
277
|
+
|
|
278
|
+
**Manual Rollback Decision:**
|
|
279
|
+
- Critical bug discovered in production
|
|
280
|
+
- Data corruption detected
|
|
281
|
+
- Performance degradation > 50%
|
|
282
|
+
- Security vulnerability discovered
|
|
283
|
+
- Customer-facing feature broken
|
|
284
|
+
|
|
285
|
+
### Rollback Steps
|
|
286
|
+
|
|
287
|
+
**IMPORTANT: Rollback must be executed within 30 minutes of deployment**
|
|
288
|
+
|
|
289
|
+
**Step 1: Stop New Deployments**
|
|
290
|
+
```bash
|
|
291
|
+
# Pause auto-scaling to prevent new tasks
|
|
292
|
+
aws application-autoscaling register-scalable-target \
|
|
293
|
+
--service-namespace ecs \
|
|
294
|
+
--resource-id service/production/order-api-blue \
|
|
295
|
+
--scalable-dimension ecs:service:DesiredCount \
|
|
296
|
+
--suspended-state DynamicScalingInSuspended=true,DynamicScalingOutSuspended=true
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
**Step 2: Switch Traffic Back to Green (Previous Version)**
|
|
300
|
+
```bash
|
|
301
|
+
# Immediate cutover back to old version
|
|
302
|
+
aws elbv2 modify-rule \
|
|
303
|
+
--rule-arn arn:aws:elasticloadbalancing:us-east-1:123456:rule/abc123 \
|
|
304
|
+
--actions Type=forward,TargetGroupArn=arn:aws:elasticloadbalancing:us-east-1:123456:targetgroup/order-api-green
|
|
305
|
+
|
|
306
|
+
# Verify traffic switched
|
|
307
|
+
curl https://api.example.com/health
|
|
308
|
+
# Expected: {"status": "healthy", "version": "2.4.0"} (old version)
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
**Step 3: Rollback Database Migration (if needed)**
|
|
312
|
+
```bash
|
|
313
|
+
# ONLY if migration caused issues
|
|
314
|
+
psql postgresql://admin:${DB_PASSWORD}@prod-db.example.com:5432/orders
|
|
315
|
+
|
|
316
|
+
# Run rollback migration
|
|
317
|
+
\i migrations/025_add_order_metadata_rollback.sql
|
|
318
|
+
|
|
319
|
+
# Verify rollback
|
|
320
|
+
SELECT column_name FROM information_schema.columns
|
|
321
|
+
WHERE table_name = 'orders' AND column_name = 'order_metadata';
|
|
322
|
+
# Expected: (empty) - column removed
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
**Step 4: Scale Down Failed Version**
|
|
326
|
+
```bash
|
|
327
|
+
# Stop Blue environment (failed version)
|
|
328
|
+
aws ecs update-service \
|
|
329
|
+
--cluster production \
|
|
330
|
+
--service order-api-blue \
|
|
331
|
+
--desired-count 0
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
**Step 5: Verify Rollback Success**
|
|
335
|
+
```bash
|
|
336
|
+
# Run smoke tests against rolled-back version
|
|
337
|
+
npm run smoke-test -- --url https://api.example.com
|
|
338
|
+
|
|
339
|
+
# Check error rate (should drop to normal < 1%)
|
|
340
|
+
# Check response times (should return to baseline)
|
|
341
|
+
# Verify critical user flows working
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
**Step 6: Post-Rollback Actions**
|
|
345
|
+
- [ ] Notify team of rollback via Slack
|
|
346
|
+
- [ ] Create incident post-mortem
|
|
347
|
+
- [ ] Document root cause
|
|
348
|
+
- [ ] Create bug fix work item
|
|
349
|
+
- [ ] Schedule fix deployment
|
|
350
|
+
|
|
351
|
+
### Rollback Time Estimate
|
|
352
|
+
- Traffic switch: < 1 minute
|
|
353
|
+
- Full rollback (with DB): < 5 minutes
|
|
354
|
+
- Verification: < 10 minutes
|
|
355
|
+
- **Total rollback time: < 15 minutes**
|
|
356
|
+
|
|
357
|
+
## Smoke Tests
|
|
358
|
+
|
|
359
|
+
<!-- Critical tests that must pass for deployment to be considered successful -->
|
|
360
|
+
|
|
361
|
+
### Test 1: Health Check
|
|
362
|
+
```bash
|
|
363
|
+
curl https://api.example.com/health
|
|
364
|
+
# Expected: {"status": "healthy", "version": "2.5.0", "database": "connected"}
|
|
365
|
+
# Pass criteria: HTTP 200, status = healthy
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
### Test 2: Create Order (End-to-End)
|
|
369
|
+
```bash
|
|
370
|
+
curl -X POST https://api.example.com/api/orders \
|
|
371
|
+
-H "Authorization: Bearer ${TEST_TOKEN}" \
|
|
372
|
+
-H "Content-Type: application/json" \
|
|
373
|
+
-d '{
|
|
374
|
+
"customer_id": "test_customer_123",
|
|
375
|
+
"items": [{"product_id": "prod_456", "quantity": 1}],
|
|
376
|
+
"payment_method": "card",
|
|
377
|
+
"card_token": "tok_visa_test"
|
|
378
|
+
}'
|
|
379
|
+
# Expected: HTTP 201, order_id returned, status = completed
|
|
380
|
+
# Pass criteria: Order created, payment processed, inventory reserved
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
### Test 3: Retrieve Order
|
|
384
|
+
```bash
|
|
385
|
+
curl https://api.example.com/api/orders/test_order_123 \
|
|
386
|
+
-H "Authorization: Bearer ${TEST_TOKEN}"
|
|
387
|
+
# Expected: HTTP 200, order details returned
|
|
388
|
+
# Pass criteria: Order data matches expected structure
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
### Test 4: Database Connectivity
|
|
392
|
+
```bash
|
|
393
|
+
curl https://api.example.com/api/internal/db-check \
|
|
394
|
+
-H "X-Internal-Token: ${INTERNAL_TOKEN}"
|
|
395
|
+
# Expected: {"database": "connected", "latency_ms": < 50}
|
|
396
|
+
# Pass criteria: Database reachable, latency < 100ms
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
### Smoke Test Execution
|
|
400
|
+
```bash
|
|
401
|
+
# Automated smoke test suite
|
|
402
|
+
npm run smoke-test -- \
|
|
403
|
+
--url https://api.example.com \
|
|
404
|
+
--token ${TEST_TOKEN} \
|
|
405
|
+
--timeout 30000 \
|
|
406
|
+
--retries 3
|
|
407
|
+
|
|
408
|
+
# Expected output:
|
|
409
|
+
# ✓ Health check passed (45ms)
|
|
410
|
+
# ✓ Create order passed (234ms)
|
|
411
|
+
# ✓ Retrieve order passed (12ms)
|
|
412
|
+
# ✓ Database connectivity passed (8ms)
|
|
413
|
+
#
|
|
414
|
+
# All smoke tests passed (4/4)
|
|
415
|
+
# Total time: 299ms
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
## Monitoring & Alerting
|
|
419
|
+
|
|
420
|
+
<!-- Key metrics to monitor during and after deployment -->
|
|
421
|
+
|
|
422
|
+
**Dashboard:** https://app.datadoghq.com/dashboard/order-api-production
|
|
423
|
+
|
|
424
|
+
**Key Metrics:**
|
|
425
|
+
- Error rate (target: < 1%, alert: > 5%)
|
|
426
|
+
- Response time p95 (target: < 500ms, alert: > 1000ms)
|
|
427
|
+
- Throughput (baseline: 100 req/min, alert: < 50 req/min)
|
|
428
|
+
- Database connection pool (target: < 80%, alert: > 90%)
|
|
429
|
+
- Memory usage (target: < 80%, alert: > 90%)
|
|
430
|
+
- CPU usage (target: < 70%, alert: > 85%)
|
|
431
|
+
|
|
432
|
+
**Alerts:**
|
|
433
|
+
- High error rate: > 5% for 5 minutes → Page on-call
|
|
434
|
+
- Slow responses: p95 > 1000ms for 5 minutes → Slack alert
|
|
435
|
+
- Health check failures: > 50% instances → Page on-call
|
|
436
|
+
- Database connection exhaustion: > 90% → Page on-call
|
|
437
|
+
|
|
438
|
+
**Log Queries:**
|
|
439
|
+
```bash
|
|
440
|
+
# View recent errors
|
|
441
|
+
aws logs tail /aws/ecs/order-api --follow --filter-pattern "ERROR"
|
|
442
|
+
|
|
443
|
+
# View deployment-related logs
|
|
444
|
+
aws logs tail /aws/ecs/order-api --follow --filter-pattern "deployment" --since 30m
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
## Acceptance Criteria
|
|
448
|
+
|
|
449
|
+
<!-- Deployment is considered successful when these criteria are met -->
|
|
450
|
+
|
|
451
|
+
- [ ] All pre-deployment checks passed
|
|
452
|
+
- [ ] Database migration completed successfully (column added)
|
|
453
|
+
- [ ] Blue environment deployed and stable (3 tasks running)
|
|
454
|
+
- [ ] All smoke tests passed (4/4 tests green)
|
|
455
|
+
- [ ] Traffic switched to new version (Blue)
|
|
456
|
+
- [ ] Error rate < 1% for 30 minutes post-deployment
|
|
457
|
+
- [ ] Response time p95 < 500ms (no regression)
|
|
458
|
+
- [ ] No critical alerts fired
|
|
459
|
+
- [ ] Critical user flows verified manually
|
|
460
|
+
- [ ] Old version (Green) scaled down after 1 hour soak period
|
|
461
|
+
- [ ] Deployment documented and team notified
|
|
462
|
+
- [ ] Rollback procedure tested and ready if needed
|
|
463
|
+
|
|
464
|
+
## Post-Deployment Monitoring Period
|
|
465
|
+
|
|
466
|
+
**Soak Time:** 1 hour (monitor new version before scaling down old)
|
|
467
|
+
|
|
468
|
+
**Monitoring checklist (during soak time):**
|
|
469
|
+
- [ ] 0-15 min: Watch error rate and response time closely
|
|
470
|
+
- [ ] 15-30 min: Verify no alerts, check logs for warnings
|
|
471
|
+
- [ ] 30-45 min: Verify database performance, check slow queries
|
|
472
|
+
- [ ] 45-60 min: Final check of all metrics, prepare to scale down old version
|
|
473
|
+
|
|
474
|
+
**If issues detected during soak time:**
|
|
475
|
+
1. Evaluate severity (critical vs minor)
|
|
476
|
+
2. Decide: rollback vs hotfix vs acceptable
|
|
477
|
+
3. If rollback: execute rollback procedure
|
|
478
|
+
4. If hotfix: create urgent fix and deploy
|
|
479
|
+
5. If acceptable: document issue and create follow-up work item
|
|
480
|
+
|
|
481
|
+
## Dependencies
|
|
482
|
+
|
|
483
|
+
<!-- Other work items or infrastructure that must be in place -->
|
|
484
|
+
|
|
485
|
+
- `feature_payment_v2` (must be completed - provides new Stripe integration)
|
|
486
|
+
- `integration_test_order_flow` (must pass - validates end-to-end flow)
|
|
487
|
+
- Infrastructure: ALB target groups for blue-green deployment (must exist)
|
|
488
|
+
- Database migration 024 (must be applied - adds required indexes)
|
|
489
|
+
|
|
490
|
+
## Estimated Effort
|
|
491
|
+
|
|
492
|
+
1 session (includes deployment, monitoring, and verification)
|
|
493
|
+
|
|
494
|
+
<!--
|
|
495
|
+
Breakdown:
|
|
496
|
+
- Pre-deployment prep: 0.25 sessions
|
|
497
|
+
- Deployment execution: 0.25 sessions
|
|
498
|
+
- Smoke testing: 0.25 sessions
|
|
499
|
+
- Post-deployment monitoring (1 hour soak): 0.25 sessions
|
|
500
|
+
-->
|