@percepta/create 3.6.1 → 3.6.3

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.
Files changed (83) hide show
  1. package/README.md +37 -6
  2. package/dist/{git-ops-C2CIjuce.js → git-ops-BD7JNnal.js} +1 -1
  3. package/dist/{git-ops-C2CIjuce.js.map → git-ops-BD7JNnal.js.map} +1 -1
  4. package/dist/github-RCIMUq70.js +131 -0
  5. package/dist/github-RCIMUq70.js.map +1 -0
  6. package/dist/index.js +63 -122
  7. package/dist/index.js.map +1 -1
  8. package/dist/{init-sI9aIrkU.js → init-COp0nGdk.js} +4 -2
  9. package/dist/{init-sI9aIrkU.js.map → init-COp0nGdk.js.map} +1 -1
  10. package/dist/manifest-CqIDnbgs.js +58 -0
  11. package/dist/manifest-CqIDnbgs.js.map +1 -0
  12. package/dist/register-app-C7ZBpAaZ.js +103 -0
  13. package/dist/register-app-C7ZBpAaZ.js.map +1 -0
  14. package/dist/register-os-blueprint-DGjBUZYa.js +90 -0
  15. package/dist/register-os-blueprint-DGjBUZYa.js.map +1 -0
  16. package/dist/{status-CKe4aKso.js → status-BXYaQ4a2.js} +3 -3
  17. package/dist/{status-CKe4aKso.js.map → status-BXYaQ4a2.js.map} +1 -1
  18. package/dist/{sync-D1vkoofl.js → sync-BayU4w1j.js} +3 -3
  19. package/dist/{sync-D1vkoofl.js.map → sync-BayU4w1j.js.map} +1 -1
  20. package/dist/template-versions-CEIP9vhl.js +35 -0
  21. package/dist/template-versions-CEIP9vhl.js.map +1 -0
  22. package/dist/{upstream-gUHLWSR1.js → upstream-CZEzLrS4.js} +3 -3
  23. package/dist/{upstream-gUHLWSR1.js.map → upstream-CZEzLrS4.js.map} +1 -1
  24. package/dist/validate-dssldJAj.js +14 -0
  25. package/dist/validate-dssldJAj.js.map +1 -0
  26. package/package.json +1 -1
  27. package/template-versions.json +2 -2
  28. package/templates/infra/os.blueprint.yaml.template +138 -0
  29. package/templates/monorepo/README.md +41 -3
  30. package/templates/monorepo/auth/README.md +6 -3
  31. package/templates/monorepo/auth/package.json +2 -4
  32. package/templates/monorepo/auth/src/config/database.ts +1 -1
  33. package/templates/{webapp → monorepo}/docker-compose.yml +2 -2
  34. package/templates/monorepo/package.json.template +5 -2
  35. package/templates/monorepo/pnpm-workspace.yaml +4 -0
  36. package/templates/monorepo/scripts/setup-local-databases.mjs +183 -0
  37. package/templates/webapp/AGENTS.md +13 -20
  38. package/templates/webapp/README.md +32 -36
  39. package/templates/webapp/agent-skills/database.md +21 -21
  40. package/templates/webapp/agent-skills/langfuse.md +7 -7
  41. package/templates/webapp/agent-skills/llm.md +4 -2
  42. package/templates/webapp/agent-skills/oneshot.md +7 -6
  43. package/templates/webapp/agent-skills/ryvn.md +12 -16
  44. package/templates/webapp/deploy/README.md +10 -51
  45. package/templates/webapp/drizzle.config.ts +2 -23
  46. package/templates/webapp/env.example.template +8 -14
  47. package/templates/webapp/package.json.template +8 -15
  48. package/templates/webapp/scripts/start.sh +12 -16
  49. package/templates/webapp/src/config/getEnvConfig.ts +4 -10
  50. package/templates/webapp/src/drizzle/db.ts +6 -21
  51. package/templates/webapp/src/startup-checks.ts +28 -7
  52. package/templates/monorepo/auth/scripts/setup-database.ts +0 -11
  53. package/templates/webapp/.github/workflows/__APP_NAME__-terraform-ryvn-release.yaml +0 -92
  54. package/templates/webapp/agent-skills/deploy.md +0 -92
  55. package/templates/webapp/deploy/ryvn/__APP_NAME__-terraform.service.yaml +0 -10
  56. package/templates/webapp/deploy/ryvn/environments/percepta-test/installations/__APP_NAME__-terraform.env.percepta-test.serviceinstallation.yaml +0 -11
  57. package/templates/webapp/deploy/ryvn/environments/percepta-test/installations/__APP_NAME__.env.percepta-test.serviceinstallation.yaml +0 -154
  58. package/templates/webapp/terraform/README.md +0 -147
  59. package/templates/webapp/terraform/deploy.sh +0 -97
  60. package/templates/webapp/terraform/main.tf +0 -101
  61. package/templates/webapp/terraform/modules/cloudtrail/main.tf +0 -27
  62. package/templates/webapp/terraform/modules/cloudtrail/outputs.tf +0 -10
  63. package/templates/webapp/terraform/modules/cloudtrail/variables.tf +0 -15
  64. package/templates/webapp/terraform/modules/networking/main.tf +0 -118
  65. package/templates/webapp/terraform/modules/networking/outputs.tf +0 -38
  66. package/templates/webapp/terraform/modules/networking/variables.tf +0 -24
  67. package/templates/webapp/terraform/modules/rds/main.tf +0 -227
  68. package/templates/webapp/terraform/modules/rds/outputs.tf +0 -73
  69. package/templates/webapp/terraform/modules/rds/variables.tf +0 -61
  70. package/templates/webapp/terraform/modules/s3-logging/main.tf +0 -148
  71. package/templates/webapp/terraform/modules/s3-logging/outputs.tf +0 -10
  72. package/templates/webapp/terraform/modules/s3-logging/variables.tf +0 -16
  73. package/templates/webapp/terraform/modules/secrets/main.tf +0 -39
  74. package/templates/webapp/terraform/modules/secrets/outputs.tf +0 -9
  75. package/templates/webapp/terraform/modules/secrets/variables.tf +0 -51
  76. package/templates/webapp/terraform/outputs.tf +0 -102
  77. package/templates/webapp/terraform/providers.tf +0 -32
  78. package/templates/webapp/terraform/schema/main.tf +0 -4
  79. package/templates/webapp/terraform/schema/outputs.tf +0 -9
  80. package/templates/webapp/terraform/schema/variables.tf +0 -19
  81. package/templates/webapp/terraform/schema/versions.tf +0 -38
  82. package/templates/webapp/terraform/terraform.tfvars.example +0 -65
  83. package/templates/webapp/terraform/variables.tf +0 -129
@@ -1,92 +0,0 @@
1
- name: Build & Release __APP_NAME__-terraform
2
-
3
- on:
4
- push:
5
- branches:
6
- - "main"
7
- paths:
8
- - "packages/__APP_NAME__/terraform/schema/**"
9
- - ".github/workflows/__APP_NAME__-terraform-ryvn-release.yaml"
10
- workflow_dispatch:
11
-
12
- env:
13
- SERVICE_NAME: __APP_NAME__-terraform
14
-
15
- jobs:
16
- build-and-release:
17
- name: Build and Release
18
- runs-on: ubuntu-latest
19
- permissions:
20
- contents: write
21
- id-token: write
22
-
23
- steps:
24
- - name: Checkout code
25
- uses: actions/checkout@v4
26
- with:
27
- fetch-depth: 0
28
-
29
- - name: Install Ryvn CLI
30
- uses: ryvn-technologies/install-ryvn-cli@v1.0.0
31
-
32
- - name: Generate Release Tag
33
- id: generate-tag
34
- env:
35
- RYVN_CLIENT_ID: ${{ secrets.RYVN_CLIENT_ID }}
36
- RYVN_CLIENT_SECRET: ${{ secrets.RYVN_CLIENT_SECRET }}
37
- run: |
38
- tag_info=$(ryvn generate-release-tag "$SERVICE_NAME" --prefix="${SERVICE_NAME}@" -o json --default-bump-minor)
39
-
40
- version=$(echo "$tag_info" | jq -r '.version')
41
- new_tag=$(echo "$tag_info" | jq -r '.tag')
42
- channel=$(echo "$tag_info" | jq -r '.channel')
43
- isPreview=$(echo "$tag_info" | jq -r '.isPreview')
44
-
45
- echo "version=$version" >> $GITHUB_OUTPUT
46
- echo "new_tag=$new_tag" >> $GITHUB_OUTPUT
47
- echo "channel=$channel" >> $GITHUB_OUTPUT
48
- echo "isPreview=$isPreview" >> $GITHUB_OUTPUT
49
-
50
- - name: Create Ryvn Release
51
- if: |
52
- !contains(github.event.head_commit.message, '[skip-release]') &&
53
- !contains(github.event.pull_request.title, '[skip-release]') &&
54
- (steps.generate-tag.outputs.isPreview == 'true' || github.ref == format('refs/heads/{0}', github.event.repository.default_branch))
55
- env:
56
- RYVN_CLIENT_ID: ${{ secrets.RYVN_CLIENT_ID }}
57
- RYVN_CLIENT_SECRET: ${{ secrets.RYVN_CLIENT_SECRET }}
58
- run: |
59
- version="${{ steps.generate-tag.outputs.new_tag }}"
60
- version="${version#"${SERVICE_NAME}@"}"
61
- version="${version#@}"
62
- channel="${{ steps.generate-tag.outputs.channel }}"
63
-
64
- if [ -n "$channel" ] && [ "$channel" != "null" ]; then
65
- ryvn create release "$SERVICE_NAME" "$version" --channel "$channel"
66
- else
67
- ryvn create release "$SERVICE_NAME" "$version"
68
- fi
69
-
70
- - name: Create GitHub Tag
71
- if: |
72
- github.ref == format('refs/heads/{0}', github.event.repository.default_branch) &&
73
- !contains(github.event.head_commit.message, '[skip-release]') &&
74
- !contains(github.event.pull_request.title, '[skip-release]')
75
- run: |
76
- git config --global user.email "github-actions[bot]@users.noreply.github.com"
77
- git config --global user.name "github-actions[bot]"
78
- git tag "${{ steps.generate-tag.outputs.new_tag }}"
79
- git push origin "${{ steps.generate-tag.outputs.new_tag }}"
80
-
81
- - name: Create GitHub Release
82
- if: |
83
- github.ref == format('refs/heads/{0}', github.event.repository.default_branch) &&
84
- !contains(github.event.head_commit.message, '[skip-release]') &&
85
- !contains(github.event.pull_request.title, '[skip-release]')
86
- uses: softprops/action-gh-release@v1
87
- with:
88
- tag_name: ${{ steps.generate-tag.outputs.new_tag }}
89
- name: ${{ steps.generate-tag.outputs.new_tag }}
90
- generate_release_notes: true
91
- draft: false
92
- prerelease: false
@@ -1,92 +0,0 @@
1
- # Deploying to Percepta Test
2
-
3
- This guide deploys __APP_TITLE__ to `https://__APP_NAME__.percepta-test.aitco.dev` using Ryvn. Tell Claude "deploy this app to percepta-test" and it should run the direct deploy helper below.
4
-
5
- This is the existing-environment deploy motion: `percepta-test` already owns the shared platform services, and this app is wired into them. Fresh-environment platform bootstrap is separate and should use a Ryvn blueprint or environment-specific platform rollout before app deploys run. The `pnpm deploy:percepta-test` script delegates to the versioned `@percepta/deploy` CLI; this app owns only its Ryvn YAML and generated secrets env file.
6
-
7
- ## What's Already Scaffolded
8
-
9
- - `deploy/ryvn/__APP_NAME__.service.yaml` — Ryvn server service for the web app.
10
- - `deploy/ryvn/__APP_NAME__-terraform.service.yaml` — Ryvn Terraform service that creates the app's Postgres schema.
11
- - `deploy/ryvn/environments/percepta-test/installations/__APP_NAME__.env.percepta-test.serviceinstallation.yaml` — web installation.
12
- - `deploy/ryvn/environments/percepta-test/installations/__APP_NAME__-terraform.env.percepta-test.serviceinstallation.yaml` — schema installation.
13
- - `.github/workflows/__APP_NAME__-ryvn-release.yaml` — builds the Docker image and creates the web Ryvn release.
14
- - `.github/workflows/__APP_NAME__-terraform-ryvn-release.yaml` — creates the schema Terraform Ryvn release.
15
- - `deploy/ryvn/percepta-test.secrets.env` — generated locally and ignored by git; injected into the app installation as Ryvn secrets by the deploy helper.
16
-
17
- See [`deploy/README.md`](../deploy/README.md) for the file-by-file breakdown.
18
-
19
- ## Prerequisites
20
-
21
- - `git`, `gh`, and `ryvn` are installed and authenticated.
22
- - The worktree is clean and committed. The helper pushes the current branch to `main` because GitHub Actions builds from GitHub.
23
- - The Percepta-Core org has `RYVN_CLIENT_ID`, `RYVN_CLIENT_SECRET`, and `NPM_TOKEN` available as org-level GitHub secrets.
24
- - These shared platform installations are already deployed and healthy in `percepta-test`: `percepta-internal-terraform`, `inngest-test`, `otel-collector`, `lgtm-stack-helm`, and `langfuse`.
25
- - The `demos-commons` Ryvn variable group exists in `percepta-test` and provides `LANGFUSE_PUBLIC_KEY` plus sensitive `ANTHROPIC_API_KEY` and `LANGFUSE_SECRET_KEY` for shared demo LLM calls and Langfuse tracing.
26
-
27
- ## Deploy
28
-
29
- From this package directory:
30
-
31
- ```bash
32
- pnpm deploy:percepta-test -- --yes
33
- ```
34
-
35
- The helper:
36
-
37
- 1. Checks the existing platform installations and shared demo variable group in `percepta-test`.
38
- 2. Creates `Percepta-Core/__REPO_NAME__` if needed.
39
- 3. Pushes the current branch to `main`.
40
- 4. Creates or replaces the Ryvn web and schema services.
41
- 5. Runs the schema Terraform release workflow.
42
- 6. Creates or replaces the schema installation and approves the Terraform plan.
43
- 7. Runs the web release workflow.
44
- 8. Creates or replaces the web installation.
45
- 9. Creates or updates app-scoped Ryvn installation secrets for `BETTER_AUTH_SECRET` and `ENCRYPTION_SECRET_KEY` from `deploy/ryvn/percepta-test.secrets.env`. On first install, the helper injects them into the create manifest so the first pod starts with auth configured.
46
- 10. Waits for Ryvn health and checks `/api/healthz`, `/api/readyz`, and the protected app route.
47
-
48
- The app will be available at **https://__APP_NAME__.percepta-test.aitco.dev**.
49
-
50
- ## Useful Variants
51
-
52
- ```bash
53
- pnpm deploy:percepta-test -- --skip-workflows --yes
54
- pnpm deploy:percepta-test -- --skip-push --yes
55
- pnpm deploy:percepta-test -- --timeout-minutes 30 --yes
56
- ```
57
-
58
- Use `--skip-workflows` when the required Ryvn releases already exist. Use `--skip-push` only when the target ref is already pushed.
59
-
60
- The legacy infra-PR path is still available:
61
-
62
- ```bash
63
- pnpm deploy:percepta-test:pr -- --phase service --yes
64
- pnpm deploy:percepta-test:pr -- --phase installation --yes
65
- ```
66
-
67
- ## Verify
68
-
69
- ```bash
70
- ryvn get installation __APP_NAME__ -e percepta-test
71
- ryvn logs __APP_NAME__ -e percepta-test
72
- curl -s https://__APP_NAME__.percepta-test.aitco.dev/api/healthz
73
- curl -s https://__APP_NAME__.percepta-test.aitco.dev/api/readyz
74
- curl -I https://__APP_NAME__.percepta-test.aitco.dev/
75
- ```
76
-
77
- For apps with tRPC routes, also verify at least one endpoint that initializes Better Auth or app services. `healthz` can be green even when app-specific secrets or workflow wiring are wrong.
78
-
79
- ## Troubleshooting
80
-
81
- - **Image build fails fetching @percepta packages** → check the Percepta-Core org-level `NPM_TOKEN` secret. Do not add a repo-level token unless the org secret is unavailable.
82
- - **Ryvn release already exists** → commit a new change or re-run with `--skip-workflows` if the current releases are already present.
83
- - **Terraform plan needs approval** → the helper approves it when run with `--yes`; without `--yes`, approve the prompt.
84
- - **Auth/sign-in or tRPC routes fail after install** → verify the `__APP_NAME__` installation has `BETTER_AUTH_SECRET` and `ENCRYPTION_SECRET_KEY` secrets from `deploy/ryvn/percepta-test.secrets.env`, then redeploy `__APP_NAME__` so the pod reloads them.
85
- - **Pod crash-looping** → check `ryvn logs`; migration or database connectivity failures are the most common fresh-deploy causes.
86
- - **Database schema missing** → check `ryvn get installation __APP_NAME__-terraform -e percepta-test`.
87
- - **Inngest can't reach the app** → `INNGEST_APP_URL` must use the k8s service name `__APP_NAME__-web-server`.
88
- - **Platform preflight fails** → deploy or repair the missing shared installation first. This helper only wires apps into an existing environment.
89
- - **No Langfuse traces** → verify the target environment has Langfuse deployed and that the `demos-commons` variable group has `LANGFUSE_PUBLIC_KEY` and sensitive `LANGFUSE_SECRET_KEY`.
90
- - **LLM calls fail after deploy** → verify `demos-commons` has sensitive `ANTHROPIC_API_KEY` and the installation has `LLM_PROVIDER=anthropic`.
91
-
92
- For Ryvn CLI operations, use the `/use-ryvn` skill.
@@ -1,10 +0,0 @@
1
- kind: Service
2
- metadata:
3
- name: __APP_NAME__-terraform
4
- spec:
5
- type: terraform
6
- repo: Percepta-Core/__REPO_NAME__
7
- autoApprove: false
8
- build:
9
- path: packages/__APP_NAME__/terraform/schema
10
- tagPrefix: __APP_NAME__-terraform@
@@ -1,11 +0,0 @@
1
- kind: ServiceInstallation
2
- metadata:
3
- name: __APP_NAME__-terraform
4
- spec:
5
- service: __APP_NAME__-terraform
6
- environment: percepta-test
7
- config: |
8
- aws_region: {{ .ryvn.env.state.cluster_region }}
9
- database_secret_name: {{ .ryvn.installations.percepta_internal_terraform.outputs.percepta_internal_secrets_manager_secret_name }}
10
- database_name: demos
11
- schema_name: __APP_NAME_SNAKE__
@@ -1,154 +0,0 @@
1
- kind: ServiceInstallation
2
- metadata:
3
- name: __APP_NAME__
4
- spec:
5
- service: __APP_NAME__
6
- environment: percepta-test
7
- config: |
8
- replicaCount: 1
9
-
10
- service:
11
- port: 3000
12
-
13
- startupEnabled: true
14
- startupProbe:
15
- httpGet:
16
- path: /api/healthz
17
- port: 3000
18
- failureThreshold: 30
19
- periodSeconds: 10
20
- livenessEnabled: true
21
- livenessProbe:
22
- httpGet:
23
- path: /api/healthz
24
- port: 3000
25
- readinessEnabled: true
26
- readinessProbe:
27
- httpGet:
28
- path: /api/readyz
29
- port: 3000
30
-
31
- resources:
32
- requests:
33
- cpu: "100m"
34
- memory: "256Mi"
35
- limits:
36
- cpu: "500m"
37
- memory: "512Mi"
38
-
39
- ingress:
40
- enabled: true
41
- className: external-nginx
42
- annotations:
43
- cert-manager.io/cluster-issuer: external-issuer
44
- nginx.ingress.kubernetes.io/ssl-redirect: "true"
45
- hosts:
46
- - host: __APP_NAME__.percepta-test.aitco.dev
47
- paths:
48
- - path: /
49
- pathType: Prefix
50
- tls:
51
- - secretName: __APP_NAME__-tls
52
- hosts:
53
- - __APP_NAME__.percepta-test.aitco.dev
54
-
55
- env:
56
- # Database — shared `demos` DB on the percepta-internal Postgres instance.
57
- # Tables live under a per-app schema created by the __APP_NAME__-terraform
58
- # Ryvn service. DATABASE_SCHEMA pins the connection search_path so Drizzle
59
- # migrations + queries land there.
60
- - name: DATABASE_HOST
61
- valueFrom:
62
- secretKeyRef:
63
- name: "{{ .ryvn.installations.percepta_internal_terraform.outputs.percepta_internal_postgresql_secret_name }}"
64
- key: host
65
- - name: DATABASE_PORT
66
- valueFrom:
67
- secretKeyRef:
68
- name: "{{ .ryvn.installations.percepta_internal_terraform.outputs.percepta_internal_postgresql_secret_name }}"
69
- key: port
70
- - name: DATABASE_USERNAME
71
- valueFrom:
72
- secretKeyRef:
73
- name: "{{ .ryvn.installations.percepta_internal_terraform.outputs.percepta_internal_postgresql_secret_name }}"
74
- key: username
75
- - name: DATABASE_PASSWORD
76
- valueFrom:
77
- secretKeyRef:
78
- name: "{{ .ryvn.installations.percepta_internal_terraform.outputs.percepta_internal_postgresql_secret_name }}"
79
- key: password
80
- - name: DATABASE_NAME
81
- value: "demos"
82
- - name: DATABASE_SCHEMA
83
- value: "__APP_NAME_SNAKE__"
84
- - name: DATABASE_USE_SSL
85
- value: "true"
86
-
87
- - name: NODE_ENV
88
- value: "production"
89
- - name: PORT
90
- value: "3000"
91
- env:
92
- # App identity
93
- - key: APP_BASE_URL
94
- value: https://__APP_NAME__.percepta-test.aitco.dev
95
- - key: BETTER_AUTH_URL
96
- value: https://__APP_NAME__.percepta-test.aitco.dev
97
- # deploy:percepta-test injects BETTER_AUTH_SECRET and ENCRYPTION_SECRET_KEY
98
- # from deploy/ryvn/percepta-test.secrets.env into the create request.
99
- # Secret values are intentionally not declared here.
100
-
101
- # Inngest (shared percepta-test platform service)
102
- - key: INNGEST_BASE_URL
103
- value: http://inngest.percepta-test.svc.cluster.local:8288
104
- - key: INNGEST_EVENT_KEY
105
- value: c0766e61c95af6afd18911698080b4fea4d311f60b02033d673234ded333ff39
106
- - key: INNGEST_SIGNING_KEY
107
- value: signkey-dev-7782b39265d2ca61d083fe1b230b468b10f01434d49486051fd108363da736f2
108
- - key: INNGEST_APP_URL
109
- value: http://__APP_NAME__-web-server.percepta-test.svc.cluster.local:3000/api/inngest
110
- - key: INNGEST_SERVE_HOST
111
- value: http://__APP_NAME__-web-server.percepta-test.svc.cluster.local:3000/api/inngest
112
-
113
- # Observability (shared percepta-test OTEL collector + LGTM stack)
114
- # Application logs are emitted to stdout and collected by the shared OTEL
115
- # collector. Traces and metrics are exported over OTLP HTTP.
116
- - key: OTEL_SERVICE_NAME
117
- value: __APP_NAME__
118
- - key: OTEL_RESOURCE_ATTRIBUTES
119
- value: service.namespace=__REPO_NAME__,deployment.environment=percepta-test
120
- - key: OTEL_TRACES_EXPORTER
121
- value: otlp
122
- - key: OTEL_METRICS_EXPORTER
123
- value: otlp
124
- - key: OTEL_LOGS_EXPORTER
125
- value: none
126
- - key: OTEL_EXPORTER_OTLP_PROTOCOL
127
- value: http/protobuf
128
- - key: OTEL_EXPORTER_OTLP_ENDPOINT
129
- value: http://otel-collector-opentelemetry-collector.percepta-test.svc.cluster.local:4318
130
- - key: OTEL_EXPORTER_OTLP_TRACES_ENDPOINT
131
- value: http://otel-collector-opentelemetry-collector.percepta-test.svc.cluster.local:4318/v1/traces
132
- - key: OTEL_EXPORTER_OTLP_METRICS_ENDPOINT
133
- value: http://otel-collector-opentelemetry-collector.percepta-test.svc.cluster.local:4318/v1/metrics
134
- - key: OTEL_METRIC_EXPORT_INTERVAL
135
- value: "60000"
136
- - key: NEXT_PUBLIC_FARO_APP_NAME
137
- value: __APP_NAME__
138
- - key: NEXT_PUBLIC_FARO_APP_VERSION
139
- value: "0.1.0"
140
- - key: NEXT_PUBLIC_FARO_APP_ENVIRONMENT
141
- value: percepta-test
142
- - key: LOG_LEVEL
143
- value: debug
144
-
145
- # Langfuse (shared percepta-test platform service). Project keys come from
146
- # the demos-commons Ryvn variable group below.
147
- - key: LANGFUSE_BASE_URL
148
- value: https://langfuse.percepta-test.aitco.dev
149
-
150
- # LLM provider (shared demo Anthropic key comes from demos-commons).
151
- - key: LLM_PROVIDER
152
- value: anthropic
153
- variableGroups:
154
- - name: demos-commons
@@ -1,147 +0,0 @@
1
- # __APP_NAME_UPPER__ Terraform Service
2
-
3
- This Terraform service creates AWS infrastructure for the __APP_NAME_UPPER__ system.
4
-
5
- ## Architecture Overview
6
-
7
- The service creates the following components:
8
-
9
- ### 1. RDS Module
10
- - **Flexible RDS**: Can use existing cluster or create new Aurora PostgreSQL cluster
11
- - **Database**: `__DB_NAME__` database
12
- - **User**: `__APP_NAME__-db-user` with access to the database
13
- - **Security**: Proper VPC security groups and SSL certificates
14
-
15
- ### 3. Secrets Module
16
- - **EKS Secrets**: All credentials stored as Kubernetes secrets:
17
- - `__APP_NAME__-database-credentials`
18
-
19
- ### 4. Networking Module
20
- - **VPC Integration**: Works with existing VPC and subnets
21
- - **Security Groups**: Proper network access controls
22
-
23
- ## Usage
24
-
25
- ### Required Variables
26
-
27
- ```hcl
28
- # Basic configuration
29
- environment = "prod"
30
- name = "__APP_NAME__"
31
- region = "us-west-2"
32
-
33
- # EKS configuration
34
- cluster_name = "my-eks-cluster"
35
- vpc_id = "vpc-12345678"
36
-
37
- # Optional: Use existing RDS cluster
38
- existing_rds_cluster_name = "existing-cluster-name"
39
- ```
40
-
41
- ### Optional Variables
42
-
43
- ```hcl
44
- # Kubernetes namespace (default: "__APP_NAME__")
45
- namespace = "__APP_NAME__"
46
-
47
- # Subnet configuration (auto-discovered if not provided)
48
- subnet_ids = ["subnet-12345", "subnet-67890"]
49
-
50
- # RDS configuration
51
- create_new_rds = true
52
- rds_engine_version = "16.8"
53
- rds_port = 5432
54
-
55
- # S3 lifecycle
56
- s3_bucket_expiration_days = 90
57
-
58
- # Readonly database access (optional - for external data warehouse access)
59
- edw_allowed_principals = ["arn:aws:iam::123456789012:role/ExampleRole"]
60
- edw_vpc_cidr_blocks = ["10.20.0.0/16"]
61
- ```
62
-
63
- ## Readonly Database Access
64
-
65
- The infrastructure optionally creates a readonly database user for external data access (e.g., data warehouses, analytics platforms). When `edw_allowed_principals` is configured:
66
-
67
- - A readonly database user is created with `SELECT`-only access
68
- - Credentials are stored in AWS Secrets Manager
69
- - An IAM role is created that specified principals can assume to read the credentials
70
- - Security group rules allow traffic from specified VPC CIDR blocks
71
-
72
- Configure `edw_allowed_principals` and `edw_vpc_cidr_blocks` in your `terraform.tfvars` to enable this feature. See the Terraform outputs for the secret ARN and reader role ARN needed to connect.
73
-
74
- ## Deployment
75
-
76
- 1. **Initialize Terraform**:
77
- ```bash
78
- terraform init
79
- ```
80
-
81
- 2. **Plan deployment**:
82
- ```bash
83
- terraform plan -var-file="terraform.tfvars"
84
- ```
85
-
86
- 3. **Apply configuration**:
87
- ```bash
88
- terraform apply -var-file="terraform.tfvars"
89
- ```
90
-
91
- ## Outputs
92
-
93
- The service provides comprehensive outputs for integration:
94
-
95
- ### Database Outputs
96
- - `rds_cluster_endpoint`: Database endpoint
97
- - `rds_database_name`: Database name
98
- - `database_secret_name`: Kubernetes secret name
99
-
100
- ## Security Features
101
-
102
- - **Encryption**: All S3 buckets enforce encryption in transit
103
- - **IAM**: Least-privilege access policies
104
- - **Network**: VPC-based security groups
105
- - **Secrets**: Sensitive data stored in AWS Secrets Manager and Kubernetes secrets
106
- - **SSL**: Database connections use SSL certificates
107
-
108
- ## Prerequisites
109
-
110
- - AWS CLI configured with appropriate permissions
111
- - kubectl configured for target EKS cluster
112
- - Terraform >= 1.9.8
113
- - Existing VPC and EKS cluster
114
-
115
- ## Permissions Required
116
-
117
- The deploying user/role needs permissions for:
118
- - IAM user and policy management
119
- - S3 bucket creation and management
120
- - RDS cluster management (if creating new)
121
- - Kubernetes secret management
122
- - VPC and networking resources
123
-
124
- ## Notes
125
-
126
- - **Database User Creation**: The RDS module creates the password and stores it securely, but actual database user creation may need to be handled through initialization scripts or database providers.
127
- - **Cost Optimization**: S3 lifecycle policies are configured to expire objects after the specified number of days.
128
-
129
- ## Troubleshooting
130
-
131
- ### Common Issues
132
-
133
- 1. **VPC Subnets**: Verify subnets have the correct tags for auto-discovery
134
- 2. **EKS Permissions**: Ensure Terraform has permissions to create Kubernetes resources
135
- 3. **RDS Existing Cluster**: Verify the existing cluster name is correct and accessible
136
-
137
- ### Validation
138
-
139
- Run `terraform validate` to check configuration syntax:
140
- ```bash
141
- terraform validate
142
- ```
143
-
144
- Run `terraform plan` to preview changes before applying:
145
- ```bash
146
- terraform plan
147
- ```
@@ -1,97 +0,0 @@
1
- #!/bin/bash
2
-
3
- # __APP_NAME_UPPER__ Terraform Deployment Script
4
- # This script helps deploy the __APP_NAME_UPPER__ infrastructure
5
-
6
- set -e
7
-
8
- # Colors for output
9
- RED='\033[0;31m'
10
- GREEN='\033[0;32m'
11
- YELLOW='\033[1;33m'
12
- NC='\033[0m' # No Color
13
-
14
- # Function to print colored output
15
- print_status() {
16
- echo -e "${GREEN}[INFO]${NC} $1"
17
- }
18
-
19
- print_warning() {
20
- echo -e "${YELLOW}[WARNING]${NC} $1"
21
- }
22
-
23
- print_error() {
24
- echo -e "${RED}[ERROR]${NC} $1"
25
- }
26
-
27
- # Check if terraform.tfvars exists
28
- if [ ! -f "terraform.tfvars" ]; then
29
- print_error "terraform.tfvars not found!"
30
- print_status "Please copy terraform.tfvars.example to terraform.tfvars and customize it for your environment."
31
- exit 1
32
- fi
33
-
34
- # Check if required tools are installed
35
- command -v terraform >/dev/null 2>&1 || { print_error "terraform is required but not installed. Aborting."; exit 1; }
36
- command -v kubectl >/dev/null 2>&1 || { print_error "kubectl is required but not installed. Aborting."; exit 1; }
37
- command -v aws >/dev/null 2>&1 || { print_error "aws CLI is required but not installed. Aborting."; exit 1; }
38
-
39
- # Parse command line arguments
40
- ACTION=${1:-plan}
41
-
42
- case $ACTION in
43
- init)
44
- print_status "Initializing Terraform..."
45
- terraform init
46
- ;;
47
- plan)
48
- print_status "Planning Terraform deployment..."
49
- terraform plan -var-file="terraform.tfvars"
50
- ;;
51
- apply)
52
- print_status "Applying Terraform configuration..."
53
- print_warning "This will create/modify AWS resources. Continue? (y/N)"
54
- read -r response
55
- if [[ "$response" =~ ^([yY][eE][sS]|[yY])$ ]]; then
56
- terraform apply -var-file="terraform.tfvars"
57
- print_status "Deployment completed successfully!"
58
- print_status "Check the outputs above for important resource information."
59
- else
60
- print_status "Deployment cancelled."
61
- fi
62
- ;;
63
- destroy)
64
- print_warning "This will DESTROY all __APP_NAME_UPPER__ infrastructure!"
65
- print_warning "Are you absolutely sure? Type 'yes' to continue:"
66
- read -r response
67
- if [[ "$response" == "yes" ]]; then
68
- terraform destroy -var-file="terraform.tfvars"
69
- print_status "Infrastructure destroyed."
70
- else
71
- print_status "Destruction cancelled."
72
- fi
73
- ;;
74
- validate)
75
- print_status "Validating Terraform configuration..."
76
- terraform validate
77
- print_status "Configuration is valid!"
78
- ;;
79
- output)
80
- print_status "Showing Terraform outputs..."
81
- terraform output
82
- ;;
83
- *)
84
- echo "Usage: $0 {init|plan|apply|destroy|validate|output}"
85
- echo ""
86
- echo "Commands:"
87
- echo " init - Initialize Terraform (run this first)"
88
- echo " plan - Show what changes will be made"
89
- echo " apply - Apply the Terraform configuration"
90
- echo " destroy - Destroy all infrastructure (DANGEROUS)"
91
- echo " validate - Validate the Terraform configuration"
92
- echo " output - Show current outputs"
93
- echo ""
94
- echo "Example: $0 plan"
95
- exit 1
96
- ;;
97
- esac