@wazir-dev/cli 1.0.0
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.
- package/AGENTS.md +111 -0
- package/CHANGELOG.md +14 -0
- package/CONTRIBUTING.md +101 -0
- package/LICENSE +21 -0
- package/README.md +314 -0
- package/assets/composition-engine.mmd +34 -0
- package/assets/demo-script.sh +17 -0
- package/assets/logo-dark.svg +14 -0
- package/assets/logo.svg +14 -0
- package/assets/pipeline.mmd +39 -0
- package/assets/record-demo.sh +51 -0
- package/docs/README.md +51 -0
- package/docs/adapters/context-mode.md +60 -0
- package/docs/concepts/architecture.md +87 -0
- package/docs/concepts/artifact-model.md +60 -0
- package/docs/concepts/composition-engine.md +36 -0
- package/docs/concepts/indexing-and-recall.md +160 -0
- package/docs/concepts/observability.md +41 -0
- package/docs/concepts/roles-and-workflows.md +59 -0
- package/docs/concepts/terminology-policy.md +27 -0
- package/docs/getting-started/01-installation.md +78 -0
- package/docs/getting-started/02-first-run.md +102 -0
- package/docs/getting-started/03-adding-to-project.md +15 -0
- package/docs/getting-started/04-host-setup.md +15 -0
- package/docs/guides/ci-integration.md +15 -0
- package/docs/guides/creating-skills.md +15 -0
- package/docs/guides/expertise-module-authoring.md +15 -0
- package/docs/guides/hook-development.md +15 -0
- package/docs/guides/memory-and-learnings.md +34 -0
- package/docs/guides/multi-host-export.md +15 -0
- package/docs/guides/troubleshooting.md +101 -0
- package/docs/guides/writing-custom-roles.md +15 -0
- package/docs/plans/2026-03-15-cli-pipeline-integration-design.md +592 -0
- package/docs/plans/2026-03-15-cli-pipeline-integration-plan.md +598 -0
- package/docs/plans/2026-03-15-docs-enforcement-plan.md +238 -0
- package/docs/readmes/INDEX.md +99 -0
- package/docs/readmes/features/expertise/README.md +171 -0
- package/docs/readmes/features/exports/README.md +222 -0
- package/docs/readmes/features/hooks/README.md +103 -0
- package/docs/readmes/features/hooks/loop-cap-guard.md +133 -0
- package/docs/readmes/features/hooks/post-tool-capture.md +121 -0
- package/docs/readmes/features/hooks/post-tool-lint.md +130 -0
- package/docs/readmes/features/hooks/pre-compact-summary.md +122 -0
- package/docs/readmes/features/hooks/pre-tool-capture-route.md +100 -0
- package/docs/readmes/features/hooks/protected-path-write-guard.md +128 -0
- package/docs/readmes/features/hooks/session-start.md +119 -0
- package/docs/readmes/features/hooks/stop-handoff-harvest.md +125 -0
- package/docs/readmes/features/roles/README.md +157 -0
- package/docs/readmes/features/roles/clarifier.md +152 -0
- package/docs/readmes/features/roles/content-author.md +190 -0
- package/docs/readmes/features/roles/designer.md +193 -0
- package/docs/readmes/features/roles/executor.md +184 -0
- package/docs/readmes/features/roles/learner.md +210 -0
- package/docs/readmes/features/roles/planner.md +182 -0
- package/docs/readmes/features/roles/researcher.md +164 -0
- package/docs/readmes/features/roles/reviewer.md +184 -0
- package/docs/readmes/features/roles/specifier.md +162 -0
- package/docs/readmes/features/roles/verifier.md +215 -0
- package/docs/readmes/features/schemas/README.md +178 -0
- package/docs/readmes/features/skills/README.md +63 -0
- package/docs/readmes/features/skills/brainstorming.md +96 -0
- package/docs/readmes/features/skills/debugging.md +148 -0
- package/docs/readmes/features/skills/design.md +120 -0
- package/docs/readmes/features/skills/prepare-next.md +109 -0
- package/docs/readmes/features/skills/run-audit.md +159 -0
- package/docs/readmes/features/skills/scan-project.md +109 -0
- package/docs/readmes/features/skills/self-audit.md +176 -0
- package/docs/readmes/features/skills/tdd.md +137 -0
- package/docs/readmes/features/skills/using-skills.md +92 -0
- package/docs/readmes/features/skills/verification.md +120 -0
- package/docs/readmes/features/skills/writing-plans.md +104 -0
- package/docs/readmes/features/tooling/README.md +320 -0
- package/docs/readmes/features/workflows/README.md +186 -0
- package/docs/readmes/features/workflows/author.md +181 -0
- package/docs/readmes/features/workflows/clarify.md +154 -0
- package/docs/readmes/features/workflows/design-review.md +171 -0
- package/docs/readmes/features/workflows/design.md +169 -0
- package/docs/readmes/features/workflows/discover.md +162 -0
- package/docs/readmes/features/workflows/execute.md +173 -0
- package/docs/readmes/features/workflows/learn.md +167 -0
- package/docs/readmes/features/workflows/plan-review.md +165 -0
- package/docs/readmes/features/workflows/plan.md +170 -0
- package/docs/readmes/features/workflows/prepare-next.md +167 -0
- package/docs/readmes/features/workflows/review.md +169 -0
- package/docs/readmes/features/workflows/run-audit.md +191 -0
- package/docs/readmes/features/workflows/spec-challenge.md +159 -0
- package/docs/readmes/features/workflows/specify.md +160 -0
- package/docs/readmes/features/workflows/verify.md +177 -0
- package/docs/readmes/packages/README.md +50 -0
- package/docs/readmes/packages/ajv.md +117 -0
- package/docs/readmes/packages/context-mode.md +118 -0
- package/docs/readmes/packages/gray-matter.md +116 -0
- package/docs/readmes/packages/node-test.md +137 -0
- package/docs/readmes/packages/yaml.md +112 -0
- package/docs/reference/configuration-reference.md +159 -0
- package/docs/reference/expertise-index.md +52 -0
- package/docs/reference/git-flow.md +43 -0
- package/docs/reference/hooks.md +87 -0
- package/docs/reference/host-exports.md +50 -0
- package/docs/reference/launch-checklist.md +172 -0
- package/docs/reference/marketplace-listings.md +76 -0
- package/docs/reference/release-process.md +34 -0
- package/docs/reference/roles-reference.md +77 -0
- package/docs/reference/skills.md +33 -0
- package/docs/reference/templates.md +29 -0
- package/docs/reference/tooling-cli.md +94 -0
- package/docs/truth-claims.yaml +222 -0
- package/expertise/PROGRESS.md +63 -0
- package/expertise/README.md +18 -0
- package/expertise/antipatterns/PROGRESS.md +56 -0
- package/expertise/antipatterns/backend/api-design-antipatterns.md +1271 -0
- package/expertise/antipatterns/backend/auth-antipatterns.md +1195 -0
- package/expertise/antipatterns/backend/caching-antipatterns.md +622 -0
- package/expertise/antipatterns/backend/database-antipatterns.md +1038 -0
- package/expertise/antipatterns/backend/index.md +24 -0
- package/expertise/antipatterns/backend/microservices-antipatterns.md +850 -0
- package/expertise/antipatterns/code/architecture-antipatterns.md +919 -0
- package/expertise/antipatterns/code/async-antipatterns.md +622 -0
- package/expertise/antipatterns/code/code-smells.md +1186 -0
- package/expertise/antipatterns/code/dependency-antipatterns.md +1209 -0
- package/expertise/antipatterns/code/error-handling-antipatterns.md +1360 -0
- package/expertise/antipatterns/code/index.md +27 -0
- package/expertise/antipatterns/code/naming-and-abstraction.md +1118 -0
- package/expertise/antipatterns/code/state-management-antipatterns.md +1076 -0
- package/expertise/antipatterns/code/testing-antipatterns.md +1053 -0
- package/expertise/antipatterns/design/accessibility-antipatterns.md +1136 -0
- package/expertise/antipatterns/design/dark-patterns.md +1121 -0
- package/expertise/antipatterns/design/index.md +22 -0
- package/expertise/antipatterns/design/ui-antipatterns.md +1202 -0
- package/expertise/antipatterns/design/ux-antipatterns.md +680 -0
- package/expertise/antipatterns/frontend/css-layout-antipatterns.md +691 -0
- package/expertise/antipatterns/frontend/flutter-antipatterns.md +1827 -0
- package/expertise/antipatterns/frontend/index.md +23 -0
- package/expertise/antipatterns/frontend/mobile-antipatterns.md +573 -0
- package/expertise/antipatterns/frontend/react-antipatterns.md +1128 -0
- package/expertise/antipatterns/frontend/spa-antipatterns.md +1235 -0
- package/expertise/antipatterns/index.md +31 -0
- package/expertise/antipatterns/performance/index.md +20 -0
- package/expertise/antipatterns/performance/performance-antipatterns.md +1013 -0
- package/expertise/antipatterns/performance/premature-optimization.md +623 -0
- package/expertise/antipatterns/performance/scaling-antipatterns.md +785 -0
- package/expertise/antipatterns/process/ai-coding-antipatterns.md +853 -0
- package/expertise/antipatterns/process/code-review-antipatterns.md +656 -0
- package/expertise/antipatterns/process/deployment-antipatterns.md +920 -0
- package/expertise/antipatterns/process/index.md +23 -0
- package/expertise/antipatterns/process/technical-debt-antipatterns.md +647 -0
- package/expertise/antipatterns/security/index.md +20 -0
- package/expertise/antipatterns/security/secrets-antipatterns.md +849 -0
- package/expertise/antipatterns/security/security-theater.md +843 -0
- package/expertise/antipatterns/security/vulnerability-patterns.md +801 -0
- package/expertise/architecture/PROGRESS.md +70 -0
- package/expertise/architecture/data/caching-architecture.md +671 -0
- package/expertise/architecture/data/data-consistency.md +574 -0
- package/expertise/architecture/data/data-modeling.md +536 -0
- package/expertise/architecture/data/event-streams-and-queues.md +634 -0
- package/expertise/architecture/data/index.md +25 -0
- package/expertise/architecture/data/search-architecture.md +663 -0
- package/expertise/architecture/data/sql-vs-nosql.md +708 -0
- package/expertise/architecture/decisions/architecture-decision-records.md +640 -0
- package/expertise/architecture/decisions/build-vs-buy.md +616 -0
- package/expertise/architecture/decisions/index.md +23 -0
- package/expertise/architecture/decisions/monolith-to-microservices.md +790 -0
- package/expertise/architecture/decisions/technology-selection.md +616 -0
- package/expertise/architecture/distributed/cap-theorem-and-tradeoffs.md +800 -0
- package/expertise/architecture/distributed/circuit-breaker-bulkhead.md +741 -0
- package/expertise/architecture/distributed/consensus-and-coordination.md +796 -0
- package/expertise/architecture/distributed/distributed-systems-fundamentals.md +564 -0
- package/expertise/architecture/distributed/idempotency-and-retry.md +796 -0
- package/expertise/architecture/distributed/index.md +25 -0
- package/expertise/architecture/distributed/saga-pattern.md +797 -0
- package/expertise/architecture/foundations/architectural-thinking.md +460 -0
- package/expertise/architecture/foundations/coupling-and-cohesion.md +770 -0
- package/expertise/architecture/foundations/design-principles-solid.md +649 -0
- package/expertise/architecture/foundations/domain-driven-design.md +719 -0
- package/expertise/architecture/foundations/index.md +25 -0
- package/expertise/architecture/foundations/separation-of-concerns.md +472 -0
- package/expertise/architecture/foundations/twelve-factor-app.md +797 -0
- package/expertise/architecture/index.md +34 -0
- package/expertise/architecture/integration/api-design-graphql.md +638 -0
- package/expertise/architecture/integration/api-design-grpc.md +804 -0
- package/expertise/architecture/integration/api-design-rest.md +892 -0
- package/expertise/architecture/integration/index.md +25 -0
- package/expertise/architecture/integration/third-party-integration.md +795 -0
- package/expertise/architecture/integration/webhooks-and-callbacks.md +1152 -0
- package/expertise/architecture/integration/websockets-realtime.md +791 -0
- package/expertise/architecture/mobile-architecture/index.md +22 -0
- package/expertise/architecture/mobile-architecture/mobile-app-architecture.md +780 -0
- package/expertise/architecture/mobile-architecture/mobile-backend-for-frontend.md +670 -0
- package/expertise/architecture/mobile-architecture/offline-first.md +719 -0
- package/expertise/architecture/mobile-architecture/push-and-sync.md +782 -0
- package/expertise/architecture/patterns/cqrs-event-sourcing.md +717 -0
- package/expertise/architecture/patterns/event-driven.md +797 -0
- package/expertise/architecture/patterns/hexagonal-clean-architecture.md +870 -0
- package/expertise/architecture/patterns/index.md +27 -0
- package/expertise/architecture/patterns/layered-architecture.md +736 -0
- package/expertise/architecture/patterns/microservices.md +753 -0
- package/expertise/architecture/patterns/modular-monolith.md +692 -0
- package/expertise/architecture/patterns/monolith.md +626 -0
- package/expertise/architecture/patterns/plugin-architecture.md +735 -0
- package/expertise/architecture/patterns/serverless.md +780 -0
- package/expertise/architecture/scaling/database-scaling.md +615 -0
- package/expertise/architecture/scaling/feature-flags-and-rollouts.md +757 -0
- package/expertise/architecture/scaling/horizontal-vs-vertical.md +606 -0
- package/expertise/architecture/scaling/index.md +24 -0
- package/expertise/architecture/scaling/multi-tenancy.md +800 -0
- package/expertise/architecture/scaling/stateless-design.md +787 -0
- package/expertise/backend/embedded-firmware.md +625 -0
- package/expertise/backend/go.md +853 -0
- package/expertise/backend/index.md +24 -0
- package/expertise/backend/java-spring.md +448 -0
- package/expertise/backend/node-typescript.md +625 -0
- package/expertise/backend/python-fastapi.md +724 -0
- package/expertise/backend/rust.md +458 -0
- package/expertise/backend/solidity.md +711 -0
- package/expertise/composition-map.yaml +443 -0
- package/expertise/content/foundations/content-modeling.md +395 -0
- package/expertise/content/foundations/editorial-standards.md +449 -0
- package/expertise/content/foundations/index.md +24 -0
- package/expertise/content/foundations/microcopy.md +455 -0
- package/expertise/content/foundations/terminology-governance.md +509 -0
- package/expertise/content/index.md +34 -0
- package/expertise/content/patterns/accessibility-copy.md +518 -0
- package/expertise/content/patterns/index.md +24 -0
- package/expertise/content/patterns/notification-content.md +433 -0
- package/expertise/content/patterns/sample-content.md +486 -0
- package/expertise/content/patterns/state-copy.md +439 -0
- package/expertise/design/PROGRESS.md +58 -0
- package/expertise/design/disciplines/dark-mode-theming.md +577 -0
- package/expertise/design/disciplines/design-systems.md +595 -0
- package/expertise/design/disciplines/index.md +25 -0
- package/expertise/design/disciplines/information-architecture.md +800 -0
- package/expertise/design/disciplines/interaction-design.md +788 -0
- package/expertise/design/disciplines/responsive-design.md +552 -0
- package/expertise/design/disciplines/usability-testing.md +516 -0
- package/expertise/design/disciplines/user-research.md +792 -0
- package/expertise/design/foundations/accessibility-design.md +796 -0
- package/expertise/design/foundations/color-theory.md +797 -0
- package/expertise/design/foundations/iconography.md +795 -0
- package/expertise/design/foundations/index.md +26 -0
- package/expertise/design/foundations/motion-and-animation.md +653 -0
- package/expertise/design/foundations/rtl-design.md +585 -0
- package/expertise/design/foundations/spacing-and-layout.md +607 -0
- package/expertise/design/foundations/typography.md +800 -0
- package/expertise/design/foundations/visual-hierarchy.md +761 -0
- package/expertise/design/index.md +32 -0
- package/expertise/design/patterns/authentication-flows.md +474 -0
- package/expertise/design/patterns/content-consumption.md +789 -0
- package/expertise/design/patterns/data-display.md +618 -0
- package/expertise/design/patterns/e-commerce.md +1494 -0
- package/expertise/design/patterns/feedback-and-states.md +642 -0
- package/expertise/design/patterns/forms-and-input.md +819 -0
- package/expertise/design/patterns/gamification.md +801 -0
- package/expertise/design/patterns/index.md +31 -0
- package/expertise/design/patterns/microinteractions.md +449 -0
- package/expertise/design/patterns/navigation.md +800 -0
- package/expertise/design/patterns/notifications.md +705 -0
- package/expertise/design/patterns/onboarding.md +700 -0
- package/expertise/design/patterns/search-and-filter.md +601 -0
- package/expertise/design/patterns/settings-and-preferences.md +768 -0
- package/expertise/design/patterns/social-and-community.md +748 -0
- package/expertise/design/platforms/desktop-native.md +612 -0
- package/expertise/design/platforms/index.md +25 -0
- package/expertise/design/platforms/mobile-android.md +825 -0
- package/expertise/design/platforms/mobile-cross-platform.md +983 -0
- package/expertise/design/platforms/mobile-ios.md +699 -0
- package/expertise/design/platforms/tablet.md +794 -0
- package/expertise/design/platforms/web-dashboard.md +790 -0
- package/expertise/design/platforms/web-responsive.md +550 -0
- package/expertise/design/psychology/behavioral-nudges.md +449 -0
- package/expertise/design/psychology/cognitive-load.md +1191 -0
- package/expertise/design/psychology/error-psychology.md +778 -0
- package/expertise/design/psychology/index.md +22 -0
- package/expertise/design/psychology/persuasive-design.md +736 -0
- package/expertise/design/psychology/user-mental-models.md +623 -0
- package/expertise/design/tooling/open-pencil.md +266 -0
- package/expertise/frontend/angular.md +1073 -0
- package/expertise/frontend/desktop-electron.md +546 -0
- package/expertise/frontend/flutter.md +782 -0
- package/expertise/frontend/index.md +27 -0
- package/expertise/frontend/native-android.md +409 -0
- package/expertise/frontend/native-ios.md +490 -0
- package/expertise/frontend/react-native.md +1160 -0
- package/expertise/frontend/react.md +808 -0
- package/expertise/frontend/vue.md +1089 -0
- package/expertise/humanize/domain-rules-code.md +79 -0
- package/expertise/humanize/domain-rules-content.md +67 -0
- package/expertise/humanize/domain-rules-technical-docs.md +56 -0
- package/expertise/humanize/index.md +35 -0
- package/expertise/humanize/self-audit-checklist.md +87 -0
- package/expertise/humanize/sentence-patterns.md +218 -0
- package/expertise/humanize/vocabulary-blacklist.md +105 -0
- package/expertise/i18n/PROGRESS.md +65 -0
- package/expertise/i18n/advanced/accessibility-and-i18n.md +28 -0
- package/expertise/i18n/advanced/bidirectional-text-algorithm.md +38 -0
- package/expertise/i18n/advanced/complex-scripts.md +30 -0
- package/expertise/i18n/advanced/performance-and-i18n.md +27 -0
- package/expertise/i18n/advanced/testing-i18n.md +28 -0
- package/expertise/i18n/content/content-adaptation.md +23 -0
- package/expertise/i18n/content/locale-specific-formatting.md +23 -0
- package/expertise/i18n/content/machine-translation-integration.md +28 -0
- package/expertise/i18n/content/translation-management.md +29 -0
- package/expertise/i18n/foundations/date-time-calendars.md +67 -0
- package/expertise/i18n/foundations/i18n-architecture.md +272 -0
- package/expertise/i18n/foundations/locale-and-language-tags.md +79 -0
- package/expertise/i18n/foundations/numbers-currency-units.md +61 -0
- package/expertise/i18n/foundations/pluralization-and-gender.md +109 -0
- package/expertise/i18n/foundations/string-externalization.md +236 -0
- package/expertise/i18n/foundations/text-direction-bidi.md +241 -0
- package/expertise/i18n/foundations/unicode-and-encoding.md +86 -0
- package/expertise/i18n/index.md +38 -0
- package/expertise/i18n/platform/backend-i18n.md +31 -0
- package/expertise/i18n/platform/flutter-i18n.md +148 -0
- package/expertise/i18n/platform/native-android-i18n.md +36 -0
- package/expertise/i18n/platform/native-ios-i18n.md +36 -0
- package/expertise/i18n/platform/react-i18n.md +103 -0
- package/expertise/i18n/platform/web-css-i18n.md +81 -0
- package/expertise/i18n/rtl/arabic-specific.md +175 -0
- package/expertise/i18n/rtl/hebrew-specific.md +149 -0
- package/expertise/i18n/rtl/rtl-animations-and-transitions.md +111 -0
- package/expertise/i18n/rtl/rtl-forms-and-input.md +161 -0
- package/expertise/i18n/rtl/rtl-fundamentals.md +211 -0
- package/expertise/i18n/rtl/rtl-icons-and-images.md +181 -0
- package/expertise/i18n/rtl/rtl-layout-mirroring.md +252 -0
- package/expertise/i18n/rtl/rtl-navigation-and-gestures.md +107 -0
- package/expertise/i18n/rtl/rtl-testing-and-qa.md +147 -0
- package/expertise/i18n/rtl/rtl-typography.md +160 -0
- package/expertise/index.md +113 -0
- package/expertise/index.yaml +216 -0
- package/expertise/infrastructure/cloud-aws.md +597 -0
- package/expertise/infrastructure/cloud-gcp.md +599 -0
- package/expertise/infrastructure/cybersecurity.md +816 -0
- package/expertise/infrastructure/database-mongodb.md +447 -0
- package/expertise/infrastructure/database-postgres.md +400 -0
- package/expertise/infrastructure/devops-cicd.md +787 -0
- package/expertise/infrastructure/index.md +27 -0
- package/expertise/performance/PROGRESS.md +50 -0
- package/expertise/performance/backend/api-latency.md +1204 -0
- package/expertise/performance/backend/background-jobs.md +506 -0
- package/expertise/performance/backend/connection-pooling.md +1209 -0
- package/expertise/performance/backend/database-query-optimization.md +515 -0
- package/expertise/performance/backend/index.md +23 -0
- package/expertise/performance/backend/rate-limiting-and-throttling.md +971 -0
- package/expertise/performance/foundations/algorithmic-complexity.md +954 -0
- package/expertise/performance/foundations/caching-strategies.md +489 -0
- package/expertise/performance/foundations/concurrency-and-parallelism.md +847 -0
- package/expertise/performance/foundations/index.md +24 -0
- package/expertise/performance/foundations/measuring-and-profiling.md +440 -0
- package/expertise/performance/foundations/memory-management.md +964 -0
- package/expertise/performance/foundations/performance-budgets.md +1314 -0
- package/expertise/performance/index.md +31 -0
- package/expertise/performance/infrastructure/auto-scaling.md +1059 -0
- package/expertise/performance/infrastructure/cdn-and-edge.md +1081 -0
- package/expertise/performance/infrastructure/index.md +22 -0
- package/expertise/performance/infrastructure/load-balancing.md +1081 -0
- package/expertise/performance/infrastructure/observability.md +1079 -0
- package/expertise/performance/mobile/index.md +23 -0
- package/expertise/performance/mobile/mobile-animations.md +544 -0
- package/expertise/performance/mobile/mobile-memory-battery.md +416 -0
- package/expertise/performance/mobile/mobile-network.md +452 -0
- package/expertise/performance/mobile/mobile-rendering.md +599 -0
- package/expertise/performance/mobile/mobile-startup-time.md +505 -0
- package/expertise/performance/platform-specific/flutter-performance.md +647 -0
- package/expertise/performance/platform-specific/index.md +22 -0
- package/expertise/performance/platform-specific/node-performance.md +1307 -0
- package/expertise/performance/platform-specific/postgres-performance.md +1366 -0
- package/expertise/performance/platform-specific/react-performance.md +1403 -0
- package/expertise/performance/web/bundle-optimization.md +1239 -0
- package/expertise/performance/web/image-and-media.md +636 -0
- package/expertise/performance/web/index.md +24 -0
- package/expertise/performance/web/network-optimization.md +1133 -0
- package/expertise/performance/web/rendering-performance.md +1098 -0
- package/expertise/performance/web/ssr-and-hydration.md +918 -0
- package/expertise/performance/web/web-vitals.md +1374 -0
- package/expertise/quality/accessibility.md +985 -0
- package/expertise/quality/evidence-based-verification.md +499 -0
- package/expertise/quality/index.md +24 -0
- package/expertise/quality/ml-model-audit.md +614 -0
- package/expertise/quality/performance.md +600 -0
- package/expertise/quality/testing-api.md +891 -0
- package/expertise/quality/testing-mobile.md +496 -0
- package/expertise/quality/testing-web.md +849 -0
- package/expertise/security/PROGRESS.md +54 -0
- package/expertise/security/agentic-identity.md +540 -0
- package/expertise/security/compliance-frameworks.md +601 -0
- package/expertise/security/data/data-encryption.md +364 -0
- package/expertise/security/data/data-privacy-gdpr.md +692 -0
- package/expertise/security/data/database-security.md +1171 -0
- package/expertise/security/data/index.md +22 -0
- package/expertise/security/data/pii-handling.md +531 -0
- package/expertise/security/foundations/authentication.md +1041 -0
- package/expertise/security/foundations/authorization.md +603 -0
- package/expertise/security/foundations/cryptography.md +1001 -0
- package/expertise/security/foundations/index.md +25 -0
- package/expertise/security/foundations/owasp-top-10.md +1354 -0
- package/expertise/security/foundations/secrets-management.md +1217 -0
- package/expertise/security/foundations/secure-sdlc.md +700 -0
- package/expertise/security/foundations/supply-chain-security.md +698 -0
- package/expertise/security/index.md +31 -0
- package/expertise/security/infrastructure/cloud-security-aws.md +1296 -0
- package/expertise/security/infrastructure/cloud-security-gcp.md +1376 -0
- package/expertise/security/infrastructure/container-security.md +721 -0
- package/expertise/security/infrastructure/incident-response.md +1295 -0
- package/expertise/security/infrastructure/index.md +24 -0
- package/expertise/security/infrastructure/logging-and-monitoring.md +1618 -0
- package/expertise/security/infrastructure/network-security.md +1337 -0
- package/expertise/security/mobile/index.md +23 -0
- package/expertise/security/mobile/mobile-android-security.md +1218 -0
- package/expertise/security/mobile/mobile-binary-protection.md +1229 -0
- package/expertise/security/mobile/mobile-data-storage.md +1265 -0
- package/expertise/security/mobile/mobile-ios-security.md +1401 -0
- package/expertise/security/mobile/mobile-network-security.md +1520 -0
- package/expertise/security/smart-contract-security.md +594 -0
- package/expertise/security/testing/index.md +22 -0
- package/expertise/security/testing/penetration-testing.md +1258 -0
- package/expertise/security/testing/security-code-review.md +1765 -0
- package/expertise/security/testing/threat-modeling.md +1074 -0
- package/expertise/security/testing/vulnerability-scanning.md +1062 -0
- package/expertise/security/web/api-security.md +586 -0
- package/expertise/security/web/cors-and-headers.md +433 -0
- package/expertise/security/web/csrf.md +562 -0
- package/expertise/security/web/file-upload.md +1477 -0
- package/expertise/security/web/index.md +25 -0
- package/expertise/security/web/injection.md +1375 -0
- package/expertise/security/web/session-management.md +1101 -0
- package/expertise/security/web/xss.md +1158 -0
- package/exports/README.md +17 -0
- package/exports/hosts/claude/.claude/agents/clarifier.md +42 -0
- package/exports/hosts/claude/.claude/agents/content-author.md +63 -0
- package/exports/hosts/claude/.claude/agents/designer.md +55 -0
- package/exports/hosts/claude/.claude/agents/executor.md +55 -0
- package/exports/hosts/claude/.claude/agents/learner.md +51 -0
- package/exports/hosts/claude/.claude/agents/planner.md +53 -0
- package/exports/hosts/claude/.claude/agents/researcher.md +43 -0
- package/exports/hosts/claude/.claude/agents/reviewer.md +54 -0
- package/exports/hosts/claude/.claude/agents/specifier.md +47 -0
- package/exports/hosts/claude/.claude/agents/verifier.md +71 -0
- package/exports/hosts/claude/.claude/commands/author.md +42 -0
- package/exports/hosts/claude/.claude/commands/clarify.md +38 -0
- package/exports/hosts/claude/.claude/commands/design-review.md +46 -0
- package/exports/hosts/claude/.claude/commands/design.md +44 -0
- package/exports/hosts/claude/.claude/commands/discover.md +37 -0
- package/exports/hosts/claude/.claude/commands/execute.md +48 -0
- package/exports/hosts/claude/.claude/commands/learn.md +38 -0
- package/exports/hosts/claude/.claude/commands/plan-review.md +42 -0
- package/exports/hosts/claude/.claude/commands/plan.md +39 -0
- package/exports/hosts/claude/.claude/commands/prepare-next.md +37 -0
- package/exports/hosts/claude/.claude/commands/review.md +40 -0
- package/exports/hosts/claude/.claude/commands/run-audit.md +41 -0
- package/exports/hosts/claude/.claude/commands/spec-challenge.md +41 -0
- package/exports/hosts/claude/.claude/commands/specify.md +38 -0
- package/exports/hosts/claude/.claude/commands/verify.md +37 -0
- package/exports/hosts/claude/.claude/settings.json +34 -0
- package/exports/hosts/claude/CLAUDE.md +19 -0
- package/exports/hosts/claude/export.manifest.json +38 -0
- package/exports/hosts/claude/host-package.json +67 -0
- package/exports/hosts/codex/AGENTS.md +19 -0
- package/exports/hosts/codex/export.manifest.json +38 -0
- package/exports/hosts/codex/host-package.json +41 -0
- package/exports/hosts/cursor/.cursor/hooks.json +16 -0
- package/exports/hosts/cursor/.cursor/rules/wazir-core.mdc +19 -0
- package/exports/hosts/cursor/export.manifest.json +38 -0
- package/exports/hosts/cursor/host-package.json +42 -0
- package/exports/hosts/gemini/GEMINI.md +19 -0
- package/exports/hosts/gemini/export.manifest.json +38 -0
- package/exports/hosts/gemini/host-package.json +41 -0
- package/hooks/README.md +18 -0
- package/hooks/definitions/loop_cap_guard.yaml +21 -0
- package/hooks/definitions/post_tool_capture.yaml +24 -0
- package/hooks/definitions/pre_compact_summary.yaml +19 -0
- package/hooks/definitions/pre_tool_capture_route.yaml +19 -0
- package/hooks/definitions/protected_path_write_guard.yaml +19 -0
- package/hooks/definitions/session_start.yaml +19 -0
- package/hooks/definitions/stop_handoff_harvest.yaml +20 -0
- package/hooks/loop-cap-guard +17 -0
- package/hooks/post-tool-lint +36 -0
- package/hooks/protected-path-write-guard +17 -0
- package/hooks/session-start +41 -0
- package/llms-full.txt +2355 -0
- package/llms.txt +43 -0
- package/package.json +79 -0
- package/roles/README.md +20 -0
- package/roles/clarifier.md +42 -0
- package/roles/content-author.md +63 -0
- package/roles/designer.md +55 -0
- package/roles/executor.md +55 -0
- package/roles/learner.md +51 -0
- package/roles/planner.md +53 -0
- package/roles/researcher.md +43 -0
- package/roles/reviewer.md +54 -0
- package/roles/specifier.md +47 -0
- package/roles/verifier.md +71 -0
- package/schemas/README.md +24 -0
- package/schemas/accepted-learning.schema.json +20 -0
- package/schemas/author-artifact.schema.json +156 -0
- package/schemas/clarification.schema.json +19 -0
- package/schemas/design-artifact.schema.json +80 -0
- package/schemas/docs-claim.schema.json +18 -0
- package/schemas/export-manifest.schema.json +20 -0
- package/schemas/hook.schema.json +67 -0
- package/schemas/host-export-package.schema.json +18 -0
- package/schemas/implementation-plan.schema.json +19 -0
- package/schemas/proposed-learning.schema.json +19 -0
- package/schemas/research.schema.json +18 -0
- package/schemas/review.schema.json +29 -0
- package/schemas/run-manifest.schema.json +18 -0
- package/schemas/spec-challenge.schema.json +18 -0
- package/schemas/spec.schema.json +20 -0
- package/schemas/usage.schema.json +102 -0
- package/schemas/verification-proof.schema.json +29 -0
- package/schemas/wazir-manifest.schema.json +173 -0
- package/skills/README.md +40 -0
- package/skills/brainstorming/SKILL.md +77 -0
- package/skills/debugging/SKILL.md +50 -0
- package/skills/design/SKILL.md +61 -0
- package/skills/dispatching-parallel-agents/SKILL.md +128 -0
- package/skills/executing-plans/SKILL.md +70 -0
- package/skills/finishing-a-development-branch/SKILL.md +169 -0
- package/skills/humanize/SKILL.md +123 -0
- package/skills/init-pipeline/SKILL.md +124 -0
- package/skills/prepare-next/SKILL.md +20 -0
- package/skills/receiving-code-review/SKILL.md +123 -0
- package/skills/requesting-code-review/SKILL.md +105 -0
- package/skills/requesting-code-review/code-reviewer.md +108 -0
- package/skills/run-audit/SKILL.md +197 -0
- package/skills/scan-project/SKILL.md +41 -0
- package/skills/self-audit/SKILL.md +153 -0
- package/skills/subagent-driven-development/SKILL.md +154 -0
- package/skills/subagent-driven-development/code-quality-reviewer-prompt.md +26 -0
- package/skills/subagent-driven-development/implementer-prompt.md +102 -0
- package/skills/subagent-driven-development/spec-reviewer-prompt.md +61 -0
- package/skills/tdd/SKILL.md +23 -0
- package/skills/using-git-worktrees/SKILL.md +163 -0
- package/skills/using-skills/SKILL.md +95 -0
- package/skills/verification/SKILL.md +22 -0
- package/skills/wazir/SKILL.md +463 -0
- package/skills/writing-plans/SKILL.md +30 -0
- package/skills/writing-skills/SKILL.md +157 -0
- package/skills/writing-skills/anthropic-best-practices.md +122 -0
- package/skills/writing-skills/persuasion-principles.md +50 -0
- package/templates/README.md +20 -0
- package/templates/artifacts/README.md +10 -0
- package/templates/artifacts/accepted-learning.md +19 -0
- package/templates/artifacts/accepted-learning.template.json +12 -0
- package/templates/artifacts/author.md +74 -0
- package/templates/artifacts/author.template.json +19 -0
- package/templates/artifacts/clarification.md +21 -0
- package/templates/artifacts/clarification.template.json +12 -0
- package/templates/artifacts/execute-notes.md +19 -0
- package/templates/artifacts/implementation-plan.md +21 -0
- package/templates/artifacts/implementation-plan.template.json +11 -0
- package/templates/artifacts/learning-proposal.md +19 -0
- package/templates/artifacts/next-run-handoff.md +21 -0
- package/templates/artifacts/plan-review.md +19 -0
- package/templates/artifacts/proposed-learning.template.json +12 -0
- package/templates/artifacts/research.md +21 -0
- package/templates/artifacts/research.template.json +12 -0
- package/templates/artifacts/review-findings.md +19 -0
- package/templates/artifacts/review.template.json +11 -0
- package/templates/artifacts/run-manifest.template.json +8 -0
- package/templates/artifacts/spec-challenge.md +19 -0
- package/templates/artifacts/spec-challenge.template.json +11 -0
- package/templates/artifacts/spec.md +21 -0
- package/templates/artifacts/spec.template.json +12 -0
- package/templates/artifacts/verification-proof.md +19 -0
- package/templates/artifacts/verification-proof.template.json +11 -0
- package/templates/examples/accepted-learning.example.json +14 -0
- package/templates/examples/author.example.json +152 -0
- package/templates/examples/clarification.example.json +15 -0
- package/templates/examples/docs-claim.example.json +8 -0
- package/templates/examples/export-manifest.example.json +7 -0
- package/templates/examples/host-export-package.example.json +11 -0
- package/templates/examples/implementation-plan.example.json +17 -0
- package/templates/examples/proposed-learning.example.json +13 -0
- package/templates/examples/research.example.json +15 -0
- package/templates/examples/research.example.md +6 -0
- package/templates/examples/review.example.json +17 -0
- package/templates/examples/run-manifest.example.json +9 -0
- package/templates/examples/spec-challenge.example.json +14 -0
- package/templates/examples/spec.example.json +21 -0
- package/templates/examples/verification-proof.example.json +21 -0
- package/templates/examples/wazir-manifest.example.yaml +65 -0
- package/templates/task-definition-schema.md +99 -0
- package/tooling/README.md +20 -0
- package/tooling/src/adapters/context-mode.js +50 -0
- package/tooling/src/capture/command.js +376 -0
- package/tooling/src/capture/store.js +99 -0
- package/tooling/src/capture/usage.js +270 -0
- package/tooling/src/checks/branches.js +50 -0
- package/tooling/src/checks/brand-truth.js +110 -0
- package/tooling/src/checks/changelog.js +231 -0
- package/tooling/src/checks/command-registry.js +36 -0
- package/tooling/src/checks/commits.js +102 -0
- package/tooling/src/checks/docs-drift.js +103 -0
- package/tooling/src/checks/docs-truth.js +201 -0
- package/tooling/src/checks/runtime-surface.js +156 -0
- package/tooling/src/cli.js +116 -0
- package/tooling/src/command-options.js +56 -0
- package/tooling/src/commands/validate.js +320 -0
- package/tooling/src/doctor/command.js +91 -0
- package/tooling/src/export/command.js +77 -0
- package/tooling/src/export/compiler.js +498 -0
- package/tooling/src/guards/loop-cap-guard.js +52 -0
- package/tooling/src/guards/protected-path-write-guard.js +67 -0
- package/tooling/src/index/command.js +152 -0
- package/tooling/src/index/storage.js +1061 -0
- package/tooling/src/index/summarizers.js +261 -0
- package/tooling/src/loaders.js +18 -0
- package/tooling/src/project-root.js +22 -0
- package/tooling/src/recall/command.js +225 -0
- package/tooling/src/schema-validator.js +30 -0
- package/tooling/src/state-root.js +40 -0
- package/tooling/src/status/command.js +71 -0
- package/wazir.manifest.yaml +135 -0
- package/workflows/README.md +19 -0
- package/workflows/author.md +42 -0
- package/workflows/clarify.md +38 -0
- package/workflows/design-review.md +46 -0
- package/workflows/design.md +44 -0
- package/workflows/discover.md +37 -0
- package/workflows/execute.md +48 -0
- package/workflows/learn.md +38 -0
- package/workflows/plan-review.md +42 -0
- package/workflows/plan.md +39 -0
- package/workflows/prepare-next.md +37 -0
- package/workflows/review.md +40 -0
- package/workflows/run-audit.md +41 -0
- package/workflows/spec-challenge.md +41 -0
- package/workflows/specify.md +38 -0
- package/workflows/verify.md +37 -0
|
@@ -0,0 +1,599 @@
|
|
|
1
|
+
# Cloud GCP -- Expertise Module
|
|
2
|
+
|
|
3
|
+
> A GCP cloud specialist designs, provisions, secures, and operates workloads on Google Cloud Platform.
|
|
4
|
+
> Scope spans resource hierarchy, networking, compute, storage, databases, messaging, IAM, CI/CD,
|
|
5
|
+
> observability, cost management, and security -- from single-project startups to multi-folder enterprises.
|
|
6
|
+
|
|
7
|
+
## Core Patterns & Conventions
|
|
8
|
+
|
|
9
|
+
### Project & Organization Hierarchy
|
|
10
|
+
|
|
11
|
+
- **Organization node** is the root, tied to a Google Workspace or Cloud Identity domain. All resources inherit policies downward.
|
|
12
|
+
- **Folders** group projects by business unit, environment (prod/staging/dev), or regulatory boundary. Nest up to 10 levels deep.
|
|
13
|
+
- **Projects** are the fundamental unit for APIs, billing, IAM, and quotas. Every resource lives inside exactly one project.
|
|
14
|
+
- **Billing accounts** are separate from the hierarchy. Link each project to a billing account; use labels and cost-center tags for chargeback.
|
|
15
|
+
- **Organization policies** (constraints) apply at org, folder, or project level and are inherited. Examples: `constraints/compute.disableSerialPortAccess`, `constraints/iam.disableServiceAccountKeyCreation`.
|
|
16
|
+
|
|
17
|
+
Best practice layout:
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
org: example.com
|
|
21
|
+
folder: Production
|
|
22
|
+
folder: Platform (shared VPC host, logging, monitoring)
|
|
23
|
+
folder: Workloads (one project per service)
|
|
24
|
+
folder: Non-Production
|
|
25
|
+
folder: Staging
|
|
26
|
+
folder: Development
|
|
27
|
+
folder: Sandbox (experimentation, auto-delete after 30 days)
|
|
28
|
+
folder: Security (Security Command Center, org-level logs)
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Networking
|
|
32
|
+
|
|
33
|
+
- **VPC** is global; subnets are regional. Use custom-mode VPCs (not auto-mode) for production.
|
|
34
|
+
- **Shared VPC** lets a host project own the network while service projects attach workloads. Centralizes firewall rules, routes, and IP management.
|
|
35
|
+
- **Private Google Access** allows VMs without external IPs to reach Google APIs (BigQuery, Cloud Storage, etc.) over internal routes.
|
|
36
|
+
- **Cloud NAT** provides outbound internet for private instances without exposing inbound. One Cloud NAT gateway per region per VPC.
|
|
37
|
+
- **Private Service Connect** creates private endpoints for Google APIs and third-party services within your VPC, replacing the older Private Google Access for some use cases.
|
|
38
|
+
- **Cloud Interconnect** (Dedicated or Partner) for hybrid connectivity at 10/100 Gbps. Cloud VPN as lower-cost alternative.
|
|
39
|
+
- **Hierarchical firewall policies** at org/folder level override project-level rules. Use for mandatory deny/allow.
|
|
40
|
+
- Enable **VPC Flow Logs** on all production subnets for network forensics and troubleshooting.
|
|
41
|
+
|
|
42
|
+
### Compute Patterns
|
|
43
|
+
|
|
44
|
+
| Service | Best For | Scaling Model |
|
|
45
|
+
|---------|----------|---------------|
|
|
46
|
+
| **Cloud Run** | Stateless HTTP containers, APIs, microservices | Per-request, scale to zero |
|
|
47
|
+
| **Cloud Run functions** | Event-driven glue code, webhooks, Pub/Sub triggers | Per-invocation, scale to zero |
|
|
48
|
+
| **GKE (Autopilot)** | Complex multi-service platforms, stateful workloads, GPU/TPU | Pod-level (HPA/VPA) + node-level (cluster autoscaler) |
|
|
49
|
+
| **GKE (Standard)** | Full node control, DaemonSets, custom kernels | Same as Autopilot but you manage nodes |
|
|
50
|
+
| **Compute Engine** | Lift-and-shift VMs, HPC, Windows workloads, licensing | Managed Instance Groups (MIG) with autoscaler |
|
|
51
|
+
| **App Engine** | Legacy; new projects should prefer Cloud Run | Automatic instance scaling |
|
|
52
|
+
|
|
53
|
+
- Cloud Run functions (formerly Cloud Functions 2nd gen) now run on Cloud Run infrastructure. The two are converging; prefer Cloud Run for new services unless you need the simpler function-deployment model.
|
|
54
|
+
- GKE Autopilot is recommended for most Kubernetes workloads -- Google manages nodes, you pay per pod resource request.
|
|
55
|
+
|
|
56
|
+
### Storage
|
|
57
|
+
|
|
58
|
+
- **Cloud Storage**: Object store with Standard, Nearline (30-day), Coldline (90-day), Archive (365-day) classes. Use lifecycle rules to transition objects automatically.
|
|
59
|
+
- **Persistent Disks**: Block storage for Compute Engine / GKE. Choose pd-ssd for latency-sensitive, pd-balanced for general, pd-standard for throughput. Regional PDs for HA.
|
|
60
|
+
- **Filestore**: Managed NFS. Use for shared file systems on GKE or Compute Engine. Tiers: Basic HDD, Basic SSD, Enterprise (regional HA).
|
|
61
|
+
### Database Services
|
|
62
|
+
|
|
63
|
+
| Service | Type | Use When |
|
|
64
|
+
|---------|------|----------|
|
|
65
|
+
| **Cloud SQL** | Managed MySQL/PostgreSQL/SQL Server | General OLTP, <10 TB, single-region |
|
|
66
|
+
| **AlloyDB** | Managed PostgreSQL-compatible | High-performance OLTP+OLAP hybrid; 4x faster than standard PostgreSQL for transactions, 100x for analytics |
|
|
67
|
+
| **Cloud Spanner** | Distributed relational | Global scale, 99.999% SLA, unlimited horizontal scale with strong consistency |
|
|
68
|
+
| **Firestore** | Document (NoSQL) | Mobile/web apps, real-time sync, serverless, <1 TB typical |
|
|
69
|
+
| **Bigtable** | Wide-column (NoSQL) | Time-series, IoT, analytics, >1 TB, <10 ms latency at any scale |
|
|
70
|
+
| **Memorystore** | Managed Redis / Memcached / Valkey | Caching, session store, pub/sub |
|
|
71
|
+
| **BigQuery** | Serverless data warehouse | Analytics, BI, ML feature store (not OLTP) |
|
|
72
|
+
|
|
73
|
+
### Messaging & Orchestration
|
|
74
|
+
|
|
75
|
+
- **Pub/Sub**: Global, at-least-once message delivery. Supports push and pull subscriptions, ordering keys, dead-letter topics, exactly-once delivery (opt-in). Use for decoupled microservice communication.
|
|
76
|
+
- **Eventarc**: Event routing from 130+ Google Cloud sources (audit logs, Cloud Storage, Firestore, custom) to Cloud Run, GKE, Workflows. Uses CloudEvents standard. Use for "plumbing" Google Cloud events.
|
|
77
|
+
- **Cloud Tasks**: HTTP task queues with rate limiting, retry, scheduling. Use when you need to control dispatch rate to a target.
|
|
78
|
+
- **Workflows**: Serverless orchestration of Google Cloud APIs and HTTP services. YAML/JSON-based, supports conditionals, loops, error handling. Use for multi-step processes that coordinate services.
|
|
79
|
+
### IAM & Identity
|
|
80
|
+
|
|
81
|
+
- **Principle of least privilege**: Grant predefined roles (e.g., `roles/cloudsql.viewer`) not primitive roles (`roles/editor`).
|
|
82
|
+
- **Service accounts**: Use one per workload. Never share service accounts across unrelated services.
|
|
83
|
+
- **Workload Identity Federation**: Preferred over service account keys. Lets external workloads (AWS, Azure, GitHub Actions, GitLab CI) authenticate without downloading JSON keys.
|
|
84
|
+
- **Workload Identity (GKE)**: Maps Kubernetes service accounts to Google service accounts. Eliminates node-level service account sharing.
|
|
85
|
+
- **Organization policies**: Enforce `iam.disableServiceAccountKeyCreation` to ban key downloads org-wide.
|
|
86
|
+
- **IAM Conditions**: Time-based or attribute-based access (e.g., grant access only during business hours).
|
|
87
|
+
- **Groups-based access**: Assign IAM roles to Google Groups, not individual users.
|
|
88
|
+
|
|
89
|
+
### Infrastructure as Code
|
|
90
|
+
|
|
91
|
+
**Terraform (recommended)**:
|
|
92
|
+
- Use the [Google Cloud Terraform modules](https://github.com/terraform-google-modules) maintained by Google.
|
|
93
|
+
- Store state in a GCS backend with versioning and state locking enabled.
|
|
94
|
+
- Structure: `modules/` for reusable components, `environments/{prod,staging,dev}/` for instances.
|
|
95
|
+
- Use separate service accounts per environment with minimal permissions.
|
|
96
|
+
- Run `terraform plan` in CI, require human approval before `terraform apply`.
|
|
97
|
+
- Never store secrets in Terraform state; reference Secret Manager instead.
|
|
98
|
+
|
|
99
|
+
**Pulumi**: Alternative IaC using general-purpose languages (TypeScript, Python, Go). **Deployment Manager**: Legacy -- use Terraform for new projects.
|
|
100
|
+
|
|
101
|
+
## Anti-Patterns & Pitfalls
|
|
102
|
+
|
|
103
|
+
### 1. Using Primitive Roles (Owner/Editor/Viewer)
|
|
104
|
+
**Why it hurts**: `roles/editor` grants write access to almost every service. A compromised service account with Editor can delete databases, exfiltrate data, and create new resources. Use predefined or custom roles scoped to exactly the needed permissions.
|
|
105
|
+
|
|
106
|
+
### 2. Downloading Service Account Keys
|
|
107
|
+
**Why it hurts**: JSON key files are long-lived credentials that can be committed to git, stolen from laptops, or leaked in logs. Use Workload Identity Federation (external workloads) or attached service accounts (GCP workloads) instead. Enforce `iam.disableServiceAccountKeyCreation` org policy.
|
|
108
|
+
|
|
109
|
+
### 3. Single Project for Everything
|
|
110
|
+
**Why it hurts**: Mixing prod and dev in one project means a dev mistake can delete prod resources. IAM permissions cannot be scoped below the project level for many services. Quotas are per-project, so a runaway dev workload can exhaust prod quotas.
|
|
111
|
+
|
|
112
|
+
### 4. Using Default VPC / Auto-Mode Networks
|
|
113
|
+
**Why it hurts**: Auto-mode VPCs create a subnet in every region with predetermined CIDR ranges, leading to IP conflicts when peering. Custom-mode VPCs give you explicit control over IP ranges and are required for Shared VPC.
|
|
114
|
+
|
|
115
|
+
### 5. Ignoring Resource Quotas and Limits
|
|
116
|
+
**Why it hurts**: GCP enforces quotas per project per region (e.g., max CPUs, max IP addresses, API rate limits). Running into quotas during a traffic spike causes outages. Proactively request quota increases and set alerts on quota utilization.
|
|
117
|
+
|
|
118
|
+
### 6. Not Enabling Audit Logs
|
|
119
|
+
**Why it hurts**: Admin Activity audit logs are on by default, but Data Access logs are off. Without Data Access logs, you cannot detect who read sensitive data in BigQuery, Cloud Storage, or Spanner. Enable Data Access logs for sensitive projects (be aware of log volume costs).
|
|
120
|
+
|
|
121
|
+
### 7. Over-Engineering with Microservices
|
|
122
|
+
**Why it hurts**: Splitting a simple app into 20 Cloud Run services introduces network latency, distributed tracing complexity, and deployment coordination overhead. Start with a modular monolith; extract services when a clear scaling or team-boundary need arises.
|
|
123
|
+
|
|
124
|
+
### 8. Neglecting Cloud Storage Lifecycle Rules
|
|
125
|
+
**Why it hurts**: Without lifecycle policies, temporary uploads, old backups, and intermediate data accumulate indefinitely. A single bucket with millions of abandoned objects can cost thousands per month. Set lifecycle rules to transition to Coldline/Archive or delete after N days.
|
|
126
|
+
|
|
127
|
+
### 9. Hard-Coding Regions and Zones
|
|
128
|
+
**Why it hurts**: Makes disaster recovery and multi-region expansion painful. Use variables/configs for all region references. Design for regional failover from day one.
|
|
129
|
+
|
|
130
|
+
### 10. Skipping VPC Service Controls in Regulated Environments
|
|
131
|
+
**Why it hurts**: Without VPC-SC, a compromised identity can exfiltrate data from BigQuery or Cloud Storage to an external project. VPC-SC creates a security perimeter that blocks data movement outside trusted boundaries, even with valid credentials.
|
|
132
|
+
|
|
133
|
+
### 11. Synchronous Chains of Cloud Functions
|
|
134
|
+
**Why it hurts**: Function A calls Function B calls Function C synchronously. Each hop adds latency, compounds cold-start delays, and creates cascading timeout failures. Use Pub/Sub or Workflows for multi-step processes.
|
|
135
|
+
|
|
136
|
+
### 12. Running Cloud SQL Without High Availability
|
|
137
|
+
**Why it hurts**: A single-zone Cloud SQL instance goes down during zone maintenance or failure. Enabling HA (regional instance with automatic failover) costs approximately 2x but provides <60-second failover. For production, HA is non-negotiable.
|
|
138
|
+
|
|
139
|
+
### 13. Not Setting Budget Alerts
|
|
140
|
+
**Why it hurts**: A misconfigured autoscaler, a runaway BigQuery query, or a Pub/Sub consumer lag can generate thousands in unexpected charges within hours. Set budget alerts at 50%, 80%, 100% of expected spend per billing account and per project.
|
|
141
|
+
|
|
142
|
+
### 14. Treating GKE Like a VM Cluster
|
|
143
|
+
**Why it hurts**: Running one pod per node, not setting resource requests/limits, using SSH to "fix" nodes, or not using namespaces. This wastes the orchestration benefits of Kubernetes and leads to poor resource utilization and operational fragility.
|
|
144
|
+
|
|
145
|
+
### 15. Ignoring Pub/Sub Dead-Letter Topics
|
|
146
|
+
**Why it hurts**: Without a dead-letter topic (DLT), messages that repeatedly fail processing get retried forever, consuming subscriber resources and potentially causing out-of-order processing. Configure DLT with max delivery attempts (typically 5-10) to capture poison messages for later analysis.
|
|
147
|
+
|
|
148
|
+
## Testing Strategy
|
|
149
|
+
|
|
150
|
+
### Infrastructure Testing
|
|
151
|
+
|
|
152
|
+
- **Terraform validate + plan**: Run `terraform validate` and `terraform plan` in CI on every PR. Review plan diffs for unintended resource destruction.
|
|
153
|
+
- **Terratest / Kitchen-Terraform**: Write Go or Ruby tests that deploy ephemeral infrastructure and verify behavior (e.g., can a VM reach Cloud SQL? Does the firewall block port 22?).
|
|
154
|
+
- **Policy-as-Code**: Use Open Policy Agent (OPA) with `conftest` or Google's Policy Controller to validate Terraform plans against organization rules before apply.
|
|
155
|
+
- **Checkov / tfsec**: Static analysis scanners that flag insecure Terraform configurations (public buckets, open firewall rules, unencrypted disks).
|
|
156
|
+
|
|
157
|
+
### Load Testing
|
|
158
|
+
|
|
159
|
+
- **Cloud Load Testing**: Managed service (built on Locust) for distributed load tests. Define test scenarios in Python, deploy across multiple regions.
|
|
160
|
+
- **Locust / k6 on GKE**: For custom load testing, deploy Locust or Grafana k6 on GKE with cluster autoscaler to generate high-volume traffic.
|
|
161
|
+
- Test Cloud Run with concurrency limits to find the optimal `--concurrency` setting per service.
|
|
162
|
+
- Test GKE HPA thresholds by ramping traffic and verifying scaling speed matches SLO requirements.
|
|
163
|
+
|
|
164
|
+
### Chaos Engineering
|
|
165
|
+
|
|
166
|
+
- **Fault injection with Istio/Envoy**: Inject delays and errors at the service mesh level on GKE.
|
|
167
|
+
- **gcloud compute instances stop**: Randomly stop instances in a MIG to test auto-healing.
|
|
168
|
+
- **Zone / region failover drills**: Simulate zone outages by cordoning GKE nodes in one zone. Verify Cloud SQL HA failover by triggering manual failover.
|
|
169
|
+
- **Pub/Sub backpressure**: Pause consumers to test dead-letter topic behavior and alerting.
|
|
170
|
+
|
|
171
|
+
### Cost Estimation & Budgets
|
|
172
|
+
|
|
173
|
+
- **Google Cloud Pricing Calculator**: Estimate costs before provisioning. Required for architecture reviews.
|
|
174
|
+
- **Billing budgets + alerts**: Set per-project and per-billing-account budgets. Use Pub/Sub notifications to trigger automated responses (e.g., disable billing, scale down).
|
|
175
|
+
- **BigQuery billing export**: Export detailed billing to BigQuery for custom cost dashboards and anomaly detection.
|
|
176
|
+
## Performance Considerations
|
|
177
|
+
|
|
178
|
+
### Cloud Run Scaling & Cold Starts
|
|
179
|
+
|
|
180
|
+
- **Startup CPU Boost**: Enable to temporarily double CPU during container startup; significantly reduces cold start for JVM-based apps.
|
|
181
|
+
- **Minimum instances**: Set `--min-instances=1` (or more) on latency-sensitive services to keep warm instances. Increases cost but eliminates cold starts.
|
|
182
|
+
- **Container optimization**: Use distroless or alpine base images. Lazy-initialize heavy dependencies. Move initialization to global scope (outside request handler) so it persists across requests.
|
|
183
|
+
- **Concurrency tuning**: Default is 80 concurrent requests per instance. Increase for I/O-bound workloads, decrease for CPU-bound. Higher concurrency = fewer instances = fewer cold starts.
|
|
184
|
+
- **Cloud Run scales to 1000 instances** by default (quota-adjustable). Each instance handles up to 250 concurrent requests.
|
|
185
|
+
|
|
186
|
+
### Spanner vs. Cloud SQL Performance Tradeoffs
|
|
187
|
+
|
|
188
|
+
| Dimension | Cloud SQL | Cloud Spanner |
|
|
189
|
+
|-----------|-----------|---------------|
|
|
190
|
+
| Max storage | ~64 TB | Unlimited (horizontal) |
|
|
191
|
+
| Read latency | <5 ms (same zone) | ~5-10 ms (single region), higher cross-region |
|
|
192
|
+
| Write latency | <5 ms | ~6-15 ms (due to distributed consensus) |
|
|
193
|
+
| Scale-out | Vertical (bigger VM) + read replicas | Horizontal (add nodes, linear throughput) |
|
|
194
|
+
| Cost at small scale | Low (~$50/mo for small) | High (minimum ~$200/mo for 1 node) |
|
|
195
|
+
| Global strong consistency | No | Yes |
|
|
196
|
+
|
|
197
|
+
Choose Cloud SQL when: single-region, <10 TB, cost-sensitive, standard PostgreSQL/MySQL compatibility needed.
|
|
198
|
+
Choose Spanner when: multi-region, >10 TB, need 99.999% SLA, or need unlimited horizontal write scaling.
|
|
199
|
+
|
|
200
|
+
### Cloud CDN Caching Strategies
|
|
201
|
+
|
|
202
|
+
- Enable Cloud CDN on external Application Load Balancers for static and semi-dynamic content.
|
|
203
|
+
- Use `Cache-Control` headers: `public, max-age=3600` for static assets, `private, no-store` for user-specific data.
|
|
204
|
+
- **Signed URLs / signed cookies** for access-controlled cached content.
|
|
205
|
+
- **Cache invalidation**: Use URL-based invalidation (`gcloud compute url-maps invalidate-cdn-cache`). Design cache keys carefully; include query parameters only when they affect response.
|
|
206
|
+
- Backend buckets (Cloud Storage) + Cloud CDN for static site hosting with global edge caching.
|
|
207
|
+
|
|
208
|
+
### GKE Autoscaling
|
|
209
|
+
|
|
210
|
+
**Horizontal Pod Autoscaler (HPA)**:
|
|
211
|
+
- Scale on CPU, memory, or custom metrics (Pub/Sub queue depth, request latency via Cloud Monitoring).
|
|
212
|
+
- Set `minReplicas` high enough to absorb traffic while new pods start (typically 60-90 seconds).
|
|
213
|
+
- Avoid scaling on both CPU and memory simultaneously with VPA active.
|
|
214
|
+
|
|
215
|
+
**Vertical Pod Autoscaler (VPA)**:
|
|
216
|
+
- Recommends or auto-sets resource requests based on historical usage (needs 24+ hours of data).
|
|
217
|
+
- Use in "Off" mode (recommendation-only) initially, then switch to "Auto" after validating.
|
|
218
|
+
- Do not combine VPA on CPU/memory with HPA on the same metrics -- they will conflict.
|
|
219
|
+
|
|
220
|
+
**Cluster Autoscaler + Node Auto-Provisioning (NAP)**:
|
|
221
|
+
- Cluster autoscaler adds/removes nodes when pods are pending (unschedulable).
|
|
222
|
+
- NAP creates new node pools with optimal machine types based on pending pod requirements.
|
|
223
|
+
- Set `--max-nodes` per pool to prevent runaway scaling. Use Pod Disruption Budgets (PDBs) to control disruption during scale-down.
|
|
224
|
+
|
|
225
|
+
### Cost Optimization
|
|
226
|
+
|
|
227
|
+
- **Committed Use Discounts (CUDs)**: 1-year = ~37% off, 3-year = ~55-70% off for Compute Engine. Resource-based CUDs for specific vCPU/memory. Spend-based CUDs for Cloud SQL, AlloyDB, and others.
|
|
228
|
+
- **Spot VMs**: Up to 91% discount. Can be preempted with 30-second notice. Use for batch processing, CI/CD runners, GKE non-critical node pools. Cannot combine with CUDs.
|
|
229
|
+
- **GKE Autopilot**: Pay per pod resource request, not per node. Often cheaper than Standard mode for bursty workloads since you don't pay for idle node capacity.
|
|
230
|
+
- **BigQuery**: Use on-demand pricing for exploratory work; switch to capacity pricing (editions) for predictable workloads. Partition and cluster tables to minimize bytes scanned.
|
|
231
|
+
- **Cloud Storage**: Use Autoclass to automatically move objects between storage classes based on access patterns.
|
|
232
|
+
- **Recommender**: Regularly review idle resource recommendations in the console or via API.
|
|
233
|
+
- **Right-sizing**: Use Cloud Monitoring metrics to identify over-provisioned instances. GKE VPA recommendations help right-size pods.
|
|
234
|
+
|
|
235
|
+
## Security Considerations
|
|
236
|
+
|
|
237
|
+
### Google Cloud Security Foundations
|
|
238
|
+
|
|
239
|
+
Follow the [Google Cloud Security Foundations Blueprint](https://cloud.google.com/architecture/security-foundations):
|
|
240
|
+
- Separate organization into folders by environment (prod, non-prod, bootstrap, common).
|
|
241
|
+
- Centralize logging in a dedicated project with locked-down IAM.
|
|
242
|
+
- Enable organization policies: disable default service accounts, disable key creation, restrict resource locations.
|
|
243
|
+
- Use Security Command Center (SCC) Premium for vulnerability scanning, threat detection, and compliance monitoring.
|
|
244
|
+
|
|
245
|
+
### Security Command Center (SCC)
|
|
246
|
+
|
|
247
|
+
- **SCC Premium** provides: vulnerability findings (misconfigured firewalls, public buckets), threat detection (crypto-mining, exfiltration), compliance reports (CIS, NIST, PCI-DSS).
|
|
248
|
+
- **SCC Enterprise** (Chronicle-backed) adds SIEM/SOAR capabilities with case management and playbook automation.
|
|
249
|
+
- Integrate SCC findings into Pub/Sub for automated remediation workflows.
|
|
250
|
+
|
|
251
|
+
### VPC Service Controls
|
|
252
|
+
|
|
253
|
+
- Define a **service perimeter** around projects containing sensitive data (BigQuery, Cloud Storage, Spanner, etc.).
|
|
254
|
+
- Even with valid IAM credentials, data cannot be copied outside the perimeter.
|
|
255
|
+
- **Always run in dry-run mode first** for 2-4 weeks to identify legitimate cross-perimeter traffic before enforcing.
|
|
256
|
+
- Use **access levels** (based on IP range, device policy, identity) to allow controlled ingress/egress.
|
|
257
|
+
- Use **perimeter bridges** to allow controlled data sharing between perimeters.
|
|
258
|
+
|
|
259
|
+
### Secret Manager
|
|
260
|
+
|
|
261
|
+
- Store all secrets (API keys, DB passwords, TLS certs) in Secret Manager, not in environment variables, code, or Terraform state.
|
|
262
|
+
- Use **IAM per secret**: grant `roles/secretmanager.secretAccessor` only to the specific service account that needs each secret.
|
|
263
|
+
- Enable **automatic rotation** with Cloud Functions or Workflows for database passwords and API keys.
|
|
264
|
+
- **Versioning**: Secret Manager versions secrets automatically. Reference specific versions or "latest" in application code.
|
|
265
|
+
- Use **regional secrets** for data residency compliance when secrets must not leave specific jurisdictions.
|
|
266
|
+
|
|
267
|
+
### Cloud Armor (WAF & DDoS)
|
|
268
|
+
|
|
269
|
+
- Attach Cloud Armor security policies to external Application Load Balancers.
|
|
270
|
+
- **Preconfigured WAF rules**: OWASP Top 10 protections (SQLi, XSS, RCE). Enable ModSecurity Core Rule Set.
|
|
271
|
+
- **Adaptive Protection**: ML-based anomaly detection that auto-generates rules during DDoS attacks.
|
|
272
|
+
- **Rate limiting**: Per-client rate limits to prevent abuse without blocking legitimate traffic.
|
|
273
|
+
- **Bot management**: reCAPTCHA Enterprise integration for advanced bot detection.
|
|
274
|
+
- Edge-level blocking -- traffic stopped before reaching backends, minimizing resource consumption.
|
|
275
|
+
|
|
276
|
+
### Binary Authorization
|
|
277
|
+
|
|
278
|
+
- Enforces deploy-time policy: only container images signed by trusted authorities can deploy to GKE.
|
|
279
|
+
- Integrate with Cloud Build to automatically sign images after successful CI pipeline.
|
|
280
|
+
- Use **attestors** for different stages (build, vulnerability scan, QA approval).
|
|
281
|
+
- Enforce in GKE cluster admission control: unsigned or unsigned-by-wrong-key images are rejected.
|
|
282
|
+
|
|
283
|
+
## Integration Patterns
|
|
284
|
+
|
|
285
|
+
### Event-Driven Architecture
|
|
286
|
+
|
|
287
|
+
- **Eventarc** for routing Google Cloud events (Cloud Storage uploads, Firestore writes, Audit Log entries) to Cloud Run or Workflows. No topic management needed.
|
|
288
|
+
- **Pub/Sub** for custom application events, high-throughput streaming, and when you need ordering, filtering, or exactly-once delivery.
|
|
289
|
+
- **Cloud Tasks** when you need rate-limited, scheduled task dispatch to a single target (e.g., throttled API calls).
|
|
290
|
+
- **Workflows** for orchestrating multi-step processes: call API A, wait for result, conditionally call API B, retry on failure.
|
|
291
|
+
- Ensure all consumers are **idempotent** -- Pub/Sub guarantees at-least-once delivery, meaning duplicates will occur.
|
|
292
|
+
|
|
293
|
+
### API Management
|
|
294
|
+
|
|
295
|
+
- **API Gateway**: Managed API proxy for Cloud Run, Cloud Functions, App Engine. Supports OpenAPI spec, API keys, rate limiting. Good for simple REST APIs.
|
|
296
|
+
- **Apigee**: Full API management platform for enterprises. API versioning, monetization, developer portal, advanced analytics. Use when you are exposing APIs to external partners or developers.
|
|
297
|
+
- **Cloud Endpoints**: Lightweight API management with OpenAPI and gRPC support. Less feature-rich than Apigee.
|
|
298
|
+
|
|
299
|
+
### BigQuery Analytics Integration
|
|
300
|
+
|
|
301
|
+
- **Cloud Storage -> BigQuery**: Data Transfer Service or load jobs for batch; external tables for federated queries.
|
|
302
|
+
- **Pub/Sub -> BigQuery**: Direct BigQuery subscriptions (no consumer code needed).
|
|
303
|
+
- **Cloud SQL / Spanner -> BigQuery**: Datastream for real-time change data capture (CDC).
|
|
304
|
+
- **Vertex AI + BigQuery**: BigQuery ML for in-warehouse training, or export to Vertex AI for custom models.
|
|
305
|
+
|
|
306
|
+
### Vertex AI Integration
|
|
307
|
+
|
|
308
|
+
- **Model training**: Vertex AI Training with data in Cloud Storage or BigQuery. Pre-built containers (TensorFlow, PyTorch, XGBoost) or custom.
|
|
309
|
+
- **Model serving**: Vertex AI Endpoints with autoscaling, A/B testing, and traffic splitting.
|
|
310
|
+
- **Feature Store**: Centralized feature management for online (low-latency) and offline (batch) serving.
|
|
311
|
+
|
|
312
|
+
### Hybrid with Anthos
|
|
313
|
+
|
|
314
|
+
- **Anthos** extends GKE to on-premises and other clouds (AWS, Azure).
|
|
315
|
+
- **Anthos Service Mesh** (Istio-based): consistent networking, security, observability across clusters.
|
|
316
|
+
- **Anthos Config Management**: GitOps-based policy and configuration across all clusters.
|
|
317
|
+
- **Connect Gateway**: centralized kubectl access to registered clusters regardless of location.
|
|
318
|
+
|
|
319
|
+
## DevOps & Deployment
|
|
320
|
+
|
|
321
|
+
### Cloud Build CI/CD
|
|
322
|
+
|
|
323
|
+
- Cloud Build executes build steps as containers. Define pipeline in `cloudbuild.yaml`.
|
|
324
|
+
- Use **build triggers** on Cloud Source Repositories, GitHub, or GitLab pushes / PR events.
|
|
325
|
+
- **Private pools**: Run builds in your VPC for access to private resources (internal registries, databases).
|
|
326
|
+
- Cache dependencies using Cloud Storage buckets to speed up builds.
|
|
327
|
+
- Integrate vulnerability scanning: Artifact Registry scans images on push; fail the build if critical CVEs are found.
|
|
328
|
+
|
|
329
|
+
### Cloud Deploy (Continuous Delivery)
|
|
330
|
+
|
|
331
|
+
- Managed progressive delivery for GKE and Cloud Run.
|
|
332
|
+
- Define a **delivery pipeline** with ordered targets (dev -> staging -> production).
|
|
333
|
+
- Supports **canary deployments**, **blue-green**, and custom verification steps.
|
|
334
|
+
- Integrates with Cloud Build (CI) and Artifact Registry for end-to-end supply chain.
|
|
335
|
+
- **Rollback**: One-click rollback to any previous release.
|
|
336
|
+
|
|
337
|
+
### Artifact Registry
|
|
338
|
+
|
|
339
|
+
- Successor to Container Registry. Supports Docker, Maven, npm, Python, Go, Apt, Yum, Helm.
|
|
340
|
+
- **Vulnerability scanning**: Automatic scanning on push (OS and language package vulnerabilities).
|
|
341
|
+
- **Cleanup policies**: Automatically delete old image versions to control storage costs.
|
|
342
|
+
- **Remote repositories**: Proxy and cache external registries (Docker Hub, Maven Central) to avoid rate limits and improve reliability.
|
|
343
|
+
|
|
344
|
+
### Observability Stack
|
|
345
|
+
|
|
346
|
+
| Service | Purpose |
|
|
347
|
+
|---------|---------|
|
|
348
|
+
| **Cloud Monitoring** | Metrics, dashboards, alerting (SLOs, uptime checks) |
|
|
349
|
+
| **Cloud Logging** | Centralized log ingestion, search, log-based metrics |
|
|
350
|
+
| **Cloud Trace** | Distributed tracing for latency analysis |
|
|
351
|
+
| **Cloud Profiler** | Continuous CPU and heap profiling in production |
|
|
352
|
+
| **Error Reporting** | Groups and tracks application errors with stack traces |
|
|
353
|
+
|
|
354
|
+
- Use **log sinks** to route logs to Cloud Storage (long-term), BigQuery (analysis), or Pub/Sub (alerting).
|
|
355
|
+
- Define **SLOs** in Cloud Monitoring with burn-rate alerting on error budget consumption.
|
|
356
|
+
- Enable **W3C Trace Context** propagation for end-to-end tracing across services.
|
|
357
|
+
- Set **log exclusion filters** to drop high-volume, low-value logs (health checks) and reduce costs.
|
|
358
|
+
|
|
359
|
+
## Decision Trees
|
|
360
|
+
|
|
361
|
+
### Which Compute Service?
|
|
362
|
+
|
|
363
|
+
```
|
|
364
|
+
Need to run containers?
|
|
365
|
+
|
|
|
366
|
+
+-- YES
|
|
367
|
+
| |
|
|
368
|
+
| +-- Stateless HTTP / event-driven?
|
|
369
|
+
| | |
|
|
370
|
+
| | +-- YES --> Cloud Run (default choice for most workloads)
|
|
371
|
+
| | +-- NO (stateful, GPU, complex scheduling, multi-service platform)
|
|
372
|
+
| | |
|
|
373
|
+
| | +-- Need full Kubernetes control / DaemonSets / custom CNI?
|
|
374
|
+
| | |
|
|
375
|
+
| | +-- YES --> GKE Standard
|
|
376
|
+
| | +-- NO --> GKE Autopilot
|
|
377
|
+
| |
|
|
378
|
+
| +-- Tiny event-driven glue code (<10 sec)?
|
|
379
|
+
| +-- YES --> Cloud Run functions
|
|
380
|
+
| +-- NO --> Cloud Run
|
|
381
|
+
|
|
|
382
|
+
+-- NO (VMs needed -- Windows, licensing, legacy)
|
|
383
|
+
|
|
|
384
|
+
+-- Need autoscaling group?
|
|
385
|
+
+-- YES --> Compute Engine with Managed Instance Group (MIG)
|
|
386
|
+
+-- NO --> Compute Engine (standalone or instance template)
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
**Rule of thumb**: Cloud Run first. GKE Autopilot when you outgrow it. GKE Standard only when Autopilot cannot meet a requirement. Compute Engine only for VM-specific needs.
|
|
390
|
+
|
|
391
|
+
### Which Database?
|
|
392
|
+
|
|
393
|
+
```
|
|
394
|
+
What data model?
|
|
395
|
+
|
|
|
396
|
+
+-- Relational (SQL, ACID transactions)
|
|
397
|
+
| |
|
|
398
|
+
| +-- Need global distribution / 99.999% SLA / unlimited scale?
|
|
399
|
+
| | +-- YES --> Cloud Spanner
|
|
400
|
+
| | +-- NO
|
|
401
|
+
| | |
|
|
402
|
+
| | +-- Need PostgreSQL and high performance (HTAP)?
|
|
403
|
+
| | | +-- YES --> AlloyDB
|
|
404
|
+
| | | +-- NO --> Cloud SQL (PostgreSQL, MySQL, or SQL Server)
|
|
405
|
+
| |
|
|
406
|
+
+-- Document / flexible schema (NoSQL)
|
|
407
|
+
| |
|
|
408
|
+
| +-- Mobile / web real-time sync needed?
|
|
409
|
+
| | +-- YES --> Firestore
|
|
410
|
+
| | +-- NO
|
|
411
|
+
| | +-- Wide-column, high-throughput, time-series?
|
|
412
|
+
| | +-- YES --> Bigtable
|
|
413
|
+
| | +-- NO --> Firestore
|
|
414
|
+
| |
|
|
415
|
+
+-- Key-value cache / session store
|
|
416
|
+
| +-- Memorystore (Redis or Valkey)
|
|
417
|
+
|
|
|
418
|
+
+-- Analytics / data warehouse
|
|
419
|
+
+-- BigQuery
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
**Rule of thumb**: Cloud SQL is the safe default. AlloyDB when Cloud SQL performance is insufficient. Spanner only for genuine global scale needs.
|
|
423
|
+
|
|
424
|
+
### Serverless vs. Managed Kubernetes?
|
|
425
|
+
|
|
426
|
+
| Team Profile | Recommendation | Why |
|
|
427
|
+
|---|---|---|
|
|
428
|
+
| Small (1-5 devs), no K8s expertise | Cloud Run | Zero infra, pay-per-request, auto-TLS |
|
|
429
|
+
| Medium (5-20 devs), >10 services needing mesh | GKE Autopilot | Shared platform, Google manages nodes |
|
|
430
|
+
| Medium, fewer services | Cloud Run | Simpler operations, lower overhead |
|
|
431
|
+
| Large platform team, needs DaemonSets/GPUs/custom kernels | GKE Standard | Full node control |
|
|
432
|
+
|
|
433
|
+
## Code Examples
|
|
434
|
+
|
|
435
|
+
### 1. Terraform: Cloud Run Service with VPC Connector
|
|
436
|
+
|
|
437
|
+
```hcl
|
|
438
|
+
resource "google_cloud_run_v2_service" "api" {
|
|
439
|
+
name = "my-api"
|
|
440
|
+
location = var.region
|
|
441
|
+
ingress = "INGRESS_TRAFFIC_ALL"
|
|
442
|
+
|
|
443
|
+
template {
|
|
444
|
+
scaling {
|
|
445
|
+
min_instance_count = 1 # Eliminate cold starts for latency-sensitive APIs
|
|
446
|
+
max_instance_count = 100
|
|
447
|
+
}
|
|
448
|
+
containers {
|
|
449
|
+
image = "${var.region}-docker.pkg.dev/${var.project_id}/my-repo/my-api:latest"
|
|
450
|
+
resources {
|
|
451
|
+
limits = { cpu = "2", memory = "1Gi" }
|
|
452
|
+
cpu_idle = true # Throttle CPU between requests (cost saving)
|
|
453
|
+
startup_cpu_boost = true # 2x CPU during startup (faster cold starts)
|
|
454
|
+
}
|
|
455
|
+
env {
|
|
456
|
+
name = "DB_PASSWORD"
|
|
457
|
+
value_source {
|
|
458
|
+
secret_key_ref {
|
|
459
|
+
secret = google_secret_manager_secret.db_password.secret_id
|
|
460
|
+
version = "latest"
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
vpc_access {
|
|
466
|
+
connector = google_vpc_access_connector.connector.id
|
|
467
|
+
egress = "PRIVATE_RANGES_ONLY"
|
|
468
|
+
}
|
|
469
|
+
service_account = google_service_account.api_sa.email
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
### 2. Terraform: GKE Autopilot Cluster
|
|
475
|
+
|
|
476
|
+
```hcl
|
|
477
|
+
resource "google_container_cluster" "primary" {
|
|
478
|
+
name = "platform-cluster"
|
|
479
|
+
location = var.region
|
|
480
|
+
enable_autopilot = true
|
|
481
|
+
network = google_compute_network.vpc.id
|
|
482
|
+
subnetwork = google_compute_subnetwork.gke_subnet.id
|
|
483
|
+
|
|
484
|
+
ip_allocation_policy {
|
|
485
|
+
cluster_secondary_range_name = "pods"
|
|
486
|
+
services_secondary_range_name = "services"
|
|
487
|
+
}
|
|
488
|
+
private_cluster_config {
|
|
489
|
+
enable_private_nodes = true
|
|
490
|
+
enable_private_endpoint = false
|
|
491
|
+
master_ipv4_cidr_block = "172.16.0.0/28"
|
|
492
|
+
}
|
|
493
|
+
release_channel { channel = "REGULAR" }
|
|
494
|
+
binary_authorization { evaluation_mode = "PROJECT_SINGLETON_POLICY_ENFORCE" }
|
|
495
|
+
workload_identity_config { workload_pool = "${var.project_id}.svc.id.goog" }
|
|
496
|
+
}
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
### 3. gcloud: Set Up Cloud Build + Cloud Deploy Pipeline
|
|
500
|
+
|
|
501
|
+
```bash
|
|
502
|
+
# Create Artifact Registry repository
|
|
503
|
+
gcloud artifacts repositories create my-repo \
|
|
504
|
+
--repository-format=docker \
|
|
505
|
+
--location=us-central1 \
|
|
506
|
+
--description="Production container images"
|
|
507
|
+
|
|
508
|
+
# Submit a build
|
|
509
|
+
gcloud builds submit \
|
|
510
|
+
--config=cloudbuild.yaml \
|
|
511
|
+
--substitutions=_IMAGE_TAG=$(git rev-parse --short HEAD)
|
|
512
|
+
|
|
513
|
+
# Create a Cloud Deploy delivery pipeline (define stages in clouddeploy.yaml)
|
|
514
|
+
gcloud deploy apply --file=clouddeploy.yaml --region=us-central1
|
|
515
|
+
|
|
516
|
+
# Create a release targeting the first stage (staging)
|
|
517
|
+
gcloud deploy releases create release-001 \
|
|
518
|
+
--delivery-pipeline=my-app-pipeline \
|
|
519
|
+
--region=us-central1 \
|
|
520
|
+
--images=my-api=${_IMAGE}
|
|
521
|
+
```
|
|
522
|
+
|
|
523
|
+
### 4. Terraform: VPC Service Controls Perimeter
|
|
524
|
+
|
|
525
|
+
```hcl
|
|
526
|
+
resource "google_access_context_manager_service_perimeter" "data_perimeter" {
|
|
527
|
+
parent = "accessPolicies/${var.access_policy_id}"
|
|
528
|
+
name = "accessPolicies/${var.access_policy_id}/servicePerimeters/data_perimeter"
|
|
529
|
+
title = "Data Protection Perimeter"
|
|
530
|
+
|
|
531
|
+
status {
|
|
532
|
+
resources = [
|
|
533
|
+
"projects/${var.data_project_number}",
|
|
534
|
+
"projects/${var.analytics_project_number}",
|
|
535
|
+
]
|
|
536
|
+
restricted_services = [
|
|
537
|
+
"bigquery.googleapis.com",
|
|
538
|
+
"storage.googleapis.com",
|
|
539
|
+
"spanner.googleapis.com",
|
|
540
|
+
]
|
|
541
|
+
vpc_accessible_services {
|
|
542
|
+
enable_restriction = true
|
|
543
|
+
allowed_services = ["RESTRICTED-SERVICES"]
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
### 5. Terraform: Pub/Sub with Dead-Letter Topic and BigQuery Subscription
|
|
550
|
+
|
|
551
|
+
```hcl
|
|
552
|
+
resource "google_pubsub_topic" "events" { name = "order-events" }
|
|
553
|
+
resource "google_pubsub_topic" "events_dlq" { name = "order-events-dlq" }
|
|
554
|
+
|
|
555
|
+
resource "google_pubsub_subscription" "processor" {
|
|
556
|
+
name = "order-processor"
|
|
557
|
+
topic = google_pubsub_topic.events.id
|
|
558
|
+
ack_deadline_seconds = 60
|
|
559
|
+
enable_exactly_once_delivery = true
|
|
560
|
+
|
|
561
|
+
retry_policy {
|
|
562
|
+
minimum_backoff = "10s"
|
|
563
|
+
maximum_backoff = "600s"
|
|
564
|
+
}
|
|
565
|
+
dead_letter_policy {
|
|
566
|
+
dead_letter_topic = google_pubsub_topic.events_dlq.id
|
|
567
|
+
max_delivery_attempts = 10
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
# BigQuery subscription -- writes Pub/Sub messages directly to BQ, no consumer needed
|
|
572
|
+
resource "google_pubsub_subscription" "analytics" {
|
|
573
|
+
name = "order-analytics"
|
|
574
|
+
topic = google_pubsub_topic.events.id
|
|
575
|
+
bigquery_config {
|
|
576
|
+
table = "${var.project_id}.analytics.order_events"
|
|
577
|
+
write_metadata = true
|
|
578
|
+
drop_unknown_fields = true
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
```
|
|
582
|
+
|
|
583
|
+
---
|
|
584
|
+
|
|
585
|
+
*Researched: 2026-03-07 | Sources:*
|
|
586
|
+
- *[Google Cloud Architecture Center](https://docs.cloud.google.com/architecture)*
|
|
587
|
+
- *[Security Foundations Blueprint](https://docs.cloud.google.com/architecture/blueprints/security-foundations/organization-structure)*
|
|
588
|
+
- *[Terraform Best Practices on Google Cloud](https://docs.cloud.google.com/docs/terraform/best-practices/operations)*
|
|
589
|
+
- *[Choosing a Compute Option](https://cloud.google.com/blog/topics/developers-practitioners/where-should-i-run-my-stuff-choosing-google-cloud-compute-option)*
|
|
590
|
+
- *[Cloud SQL vs Spanner vs AlloyDB](https://oneuptime.com/blog/post/2026-02-17-how-to-choose-between-cloud-sql-cloud-spanner-and-alloydb-for-your-database-workload/view)*
|
|
591
|
+
- *[Cloud Run Development Tips](https://docs.cloud.google.com/run/docs/tips/general)*
|
|
592
|
+
- *[Workload Identity Federation](https://docs.cloud.google.com/iam/docs/best-practices-for-using-workload-identity-federation)*
|
|
593
|
+
- *[VPC Service Controls](https://cloud.google.com/security/vpc-service-controls)*
|
|
594
|
+
- *[Cloud Armor Overview](https://docs.cloud.google.com/armor/docs/security-policy-overview)*
|
|
595
|
+
- *[CUD & Spot VM Pricing](https://docs.cloud.google.com/compute/docs/instances/committed-use-discounts-overview)*
|
|
596
|
+
- *[Event-Driven Architectures on GCP](https://www.thecloudguru.in/2025/11/16/gcp-event-driven-architectures-pub-sub-eventarc-or-cloud-tasks/)*
|
|
597
|
+
- *[GCP Security Checklist 2026](https://www.sentinelone.com/cybersecurity-101/cloud-security/gcp-security-checklist/)*
|
|
598
|
+
- *[DevSecOps and CI/CD on Google Cloud](https://cloud.google.com/blog/products/devops-sre/devsecops-and-cicd-using-google-cloud-built-in-services)*
|
|
599
|
+
- *[GKE Cluster Optimization](https://cast.ai/blog/gke-cluster-optimization-13-tactics-for-a-smoother-k8s-deployment/)*
|