agent-starter-pack 0.18.2__py3-none-any.whl → 0.21.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- agent_starter_pack/agents/{langgraph_base_react → adk_a2a_base}/.template/templateconfig.yaml +5 -12
- agent_starter_pack/agents/adk_a2a_base/README.md +37 -0
- agent_starter_pack/{frontends/streamlit/frontend/style/app_markdown.py → agents/adk_a2a_base/app/__init__.py} +3 -23
- agent_starter_pack/agents/adk_a2a_base/app/agent.py +70 -0
- agent_starter_pack/agents/adk_a2a_base/notebooks/adk_a2a_app_testing.ipynb +583 -0
- agent_starter_pack/agents/{crewai_coding_crew/notebooks/evaluating_crewai_agent.ipynb → adk_a2a_base/notebooks/evaluating_adk_agent.ipynb} +163 -199
- agent_starter_pack/agents/adk_a2a_base/tests/integration/test_agent.py +58 -0
- agent_starter_pack/agents/adk_base/app/__init__.py +2 -2
- agent_starter_pack/agents/adk_base/app/agent.py +3 -0
- agent_starter_pack/agents/adk_base/notebooks/adk_app_testing.ipynb +13 -28
- agent_starter_pack/agents/adk_live/app/__init__.py +17 -0
- agent_starter_pack/agents/adk_live/app/agent.py +3 -0
- agent_starter_pack/agents/agentic_rag/app/__init__.py +2 -2
- agent_starter_pack/agents/agentic_rag/app/agent.py +3 -0
- agent_starter_pack/agents/agentic_rag/notebooks/adk_app_testing.ipynb +13 -28
- agent_starter_pack/agents/{crewai_coding_crew → langgraph_base}/.template/templateconfig.yaml +12 -9
- agent_starter_pack/agents/langgraph_base/README.md +30 -0
- agent_starter_pack/agents/langgraph_base/app/__init__.py +17 -0
- agent_starter_pack/agents/{langgraph_base_react → langgraph_base}/app/agent.py +4 -4
- agent_starter_pack/agents/{langgraph_base_react → langgraph_base}/tests/integration/test_agent.py +1 -1
- agent_starter_pack/base_template/.gitignore +4 -2
- agent_starter_pack/base_template/Makefile +110 -16
- agent_starter_pack/base_template/README.md +97 -12
- agent_starter_pack/base_template/deployment/terraform/dev/apis.tf +4 -6
- agent_starter_pack/base_template/deployment/terraform/dev/providers.tf +5 -1
- agent_starter_pack/base_template/deployment/terraform/dev/variables.tf +5 -3
- agent_starter_pack/base_template/deployment/terraform/dev/{% if cookiecutter.is_adk %}telemetry.tf{% else %}unused_telemetry.tf{% endif %} +193 -0
- agent_starter_pack/base_template/deployment/terraform/github.tf +16 -9
- agent_starter_pack/base_template/deployment/terraform/locals.tf +7 -7
- agent_starter_pack/base_template/deployment/terraform/providers.tf +5 -1
- agent_starter_pack/base_template/deployment/terraform/sql/completions.sql +138 -0
- agent_starter_pack/base_template/deployment/terraform/storage.tf +0 -9
- agent_starter_pack/base_template/deployment/terraform/variables.tf +15 -19
- agent_starter_pack/base_template/deployment/terraform/{% if cookiecutter.cicd_runner == 'google_cloud_build' %}build_triggers.tf{% else %}unused_build_triggers.tf{% endif %} +20 -22
- agent_starter_pack/base_template/deployment/terraform/{% if cookiecutter.is_adk %}telemetry.tf{% else %}unused_telemetry.tf{% endif %} +206 -0
- agent_starter_pack/base_template/pyproject.toml +5 -17
- agent_starter_pack/base_template/{% if cookiecutter.cicd_runner == 'github_actions' %}.github{% else %}unused_github{% endif %}/workflows/deploy-to-prod.yaml +19 -4
- agent_starter_pack/base_template/{% if cookiecutter.cicd_runner == 'github_actions' %}.github{% else %}unused_github{% endif %}/workflows/staging.yaml +36 -11
- agent_starter_pack/base_template/{% if cookiecutter.cicd_runner == 'google_cloud_build' %}.cloudbuild{% else %}unused_.cloudbuild{% endif %}/deploy-to-prod.yaml +24 -5
- agent_starter_pack/base_template/{% if cookiecutter.cicd_runner == 'google_cloud_build' %}.cloudbuild{% else %}unused_.cloudbuild{% endif %}/staging.yaml +44 -9
- agent_starter_pack/base_template/{{cookiecutter.agent_directory}}/app_utils/telemetry.py +96 -0
- agent_starter_pack/base_template/{{cookiecutter.agent_directory}}/{utils → app_utils}/typing.py +4 -6
- agent_starter_pack/{agents/crewai_coding_crew/app/crew/config/agents.yaml → base_template/{{cookiecutter.agent_directory}}/app_utils/{% if cookiecutter.is_a2a and cookiecutter.agent_name == 'langgraph_base' %}converters{% else %}unused_converters{% endif %}/__init__.py } +9 -23
- agent_starter_pack/base_template/{{cookiecutter.agent_directory}}/app_utils/{% if cookiecutter.is_a2a and cookiecutter.agent_name == 'langgraph_base' %}converters{% else %}unused_converters{% endif %}/part_converter.py +138 -0
- agent_starter_pack/base_template/{{cookiecutter.agent_directory}}/app_utils/{% if cookiecutter.is_a2a and cookiecutter.agent_name == 'langgraph_base' %}executor{% else %}unused_executor{% endif %}/__init__.py +13 -0
- agent_starter_pack/base_template/{{cookiecutter.agent_directory}}/app_utils/{% if cookiecutter.is_a2a and cookiecutter.agent_name == 'langgraph_base' %}executor{% else %}unused_executor{% endif %}/a2a_agent_executor.py +265 -0
- agent_starter_pack/base_template/{{cookiecutter.agent_directory}}/app_utils/{% if cookiecutter.is_a2a and cookiecutter.agent_name == 'langgraph_base' %}executor{% else %}unused_executor{% endif %}/task_result_aggregator.py +152 -0
- agent_starter_pack/cli/commands/create.py +40 -4
- agent_starter_pack/cli/commands/enhance.py +1 -1
- agent_starter_pack/cli/commands/register_gemini_enterprise.py +1070 -0
- agent_starter_pack/cli/main.py +2 -0
- agent_starter_pack/cli/utils/cicd.py +20 -4
- agent_starter_pack/cli/utils/template.py +257 -25
- agent_starter_pack/deployment_targets/agent_engine/tests/integration/test_agent_engine_app.py +113 -16
- agent_starter_pack/deployment_targets/agent_engine/tests/load_test/README.md +2 -2
- agent_starter_pack/deployment_targets/agent_engine/tests/load_test/load_test.py +178 -9
- agent_starter_pack/deployment_targets/agent_engine/tests/{% if cookiecutter.is_a2a %}helpers.py{% else %}unused_helpers.py{% endif %} +138 -0
- agent_starter_pack/deployment_targets/agent_engine/{{cookiecutter.agent_directory}}/agent_engine_app.py +193 -307
- agent_starter_pack/deployment_targets/agent_engine/{{cookiecutter.agent_directory}}/app_utils/deploy.py +414 -0
- agent_starter_pack/deployment_targets/agent_engine/{{cookiecutter.agent_directory}}/{utils → app_utils}/{% if cookiecutter.is_adk_live %}expose_app.py{% else %}unused_expose_app.py{% endif %} +13 -14
- agent_starter_pack/deployment_targets/cloud_run/Dockerfile +4 -1
- agent_starter_pack/deployment_targets/cloud_run/deployment/terraform/dev/service.tf +85 -86
- agent_starter_pack/deployment_targets/cloud_run/deployment/terraform/service.tf +139 -107
- agent_starter_pack/deployment_targets/cloud_run/tests/integration/test_server_e2e.py +228 -12
- agent_starter_pack/deployment_targets/cloud_run/tests/load_test/README.md +4 -4
- agent_starter_pack/deployment_targets/cloud_run/tests/load_test/load_test.py +92 -12
- agent_starter_pack/deployment_targets/cloud_run/{{cookiecutter.agent_directory}}/{server.py → fast_api_app.py} +194 -121
- agent_starter_pack/frontends/adk_live_react/frontend/package-lock.json +18 -18
- agent_starter_pack/frontends/adk_live_react/frontend/src/multimodal-live-types.ts +5 -3
- agent_starter_pack/resources/docs/adk-cheatsheet.md +198 -41
- agent_starter_pack/resources/locks/uv-adk_a2a_base-agent_engine.lock +4966 -0
- agent_starter_pack/resources/locks/uv-adk_a2a_base-cloud_run.lock +5011 -0
- agent_starter_pack/resources/locks/uv-adk_base-agent_engine.lock +1443 -709
- agent_starter_pack/resources/locks/uv-adk_base-cloud_run.lock +1058 -874
- agent_starter_pack/resources/locks/uv-adk_live-agent_engine.lock +1443 -709
- agent_starter_pack/resources/locks/uv-adk_live-cloud_run.lock +1058 -874
- agent_starter_pack/resources/locks/uv-agentic_rag-agent_engine.lock +1568 -749
- agent_starter_pack/resources/locks/uv-agentic_rag-cloud_run.lock +1123 -929
- agent_starter_pack/resources/locks/{uv-langgraph_base_react-agent_engine.lock → uv-langgraph_base-agent_engine.lock} +1714 -1689
- agent_starter_pack/resources/locks/{uv-langgraph_base_react-cloud_run.lock → uv-langgraph_base-cloud_run.lock} +1285 -2374
- agent_starter_pack/utils/watch_and_rebuild.py +1 -1
- {agent_starter_pack-0.18.2.dist-info → agent_starter_pack-0.21.0.dist-info}/METADATA +3 -6
- {agent_starter_pack-0.18.2.dist-info → agent_starter_pack-0.21.0.dist-info}/RECORD +89 -93
- agent_starter_pack-0.21.0.dist-info/entry_points.txt +2 -0
- llm.txt +4 -5
- agent_starter_pack/agents/crewai_coding_crew/README.md +0 -34
- agent_starter_pack/agents/crewai_coding_crew/app/agent.py +0 -47
- agent_starter_pack/agents/crewai_coding_crew/app/crew/config/tasks.yaml +0 -37
- agent_starter_pack/agents/crewai_coding_crew/app/crew/crew.py +0 -71
- agent_starter_pack/agents/crewai_coding_crew/tests/integration/test_agent.py +0 -47
- agent_starter_pack/agents/langgraph_base_react/README.md +0 -9
- agent_starter_pack/agents/langgraph_base_react/notebooks/evaluating_langgraph_agent.ipynb +0 -1574
- agent_starter_pack/base_template/deployment/terraform/dev/log_sinks.tf +0 -69
- agent_starter_pack/base_template/deployment/terraform/log_sinks.tf +0 -79
- agent_starter_pack/base_template/{{cookiecutter.agent_directory}}/utils/tracing.py +0 -155
- agent_starter_pack/cli/utils/register_gemini_enterprise.py +0 -406
- agent_starter_pack/deployment_targets/agent_engine/deployment/terraform/{% if not cookiecutter.is_adk_live %}service.tf{% else %}unused_service.tf{% endif %} +0 -82
- agent_starter_pack/deployment_targets/agent_engine/notebooks/intro_agent_engine.ipynb +0 -1025
- agent_starter_pack/deployment_targets/agent_engine/{{cookiecutter.agent_directory}}/utils/deployment.py +0 -99
- agent_starter_pack/frontends/streamlit/frontend/side_bar.py +0 -214
- agent_starter_pack/frontends/streamlit/frontend/streamlit_app.py +0 -265
- agent_starter_pack/frontends/streamlit/frontend/utils/chat_utils.py +0 -67
- agent_starter_pack/frontends/streamlit/frontend/utils/local_chat_history.py +0 -127
- agent_starter_pack/frontends/streamlit/frontend/utils/message_editing.py +0 -59
- agent_starter_pack/frontends/streamlit/frontend/utils/multimodal_utils.py +0 -217
- agent_starter_pack/frontends/streamlit/frontend/utils/stream_handler.py +0 -310
- agent_starter_pack/frontends/streamlit/frontend/utils/title_summary.py +0 -94
- agent_starter_pack/resources/locks/uv-crewai_coding_crew-agent_engine.lock +0 -6650
- agent_starter_pack/resources/locks/uv-crewai_coding_crew-cloud_run.lock +0 -7825
- agent_starter_pack-0.18.2.dist-info/entry_points.txt +0 -3
- /agent_starter_pack/agents/{crewai_coding_crew → langgraph_base}/notebooks/evaluating_langgraph_agent.ipynb +0 -0
- /agent_starter_pack/base_template/{{cookiecutter.agent_directory}}/{utils → app_utils}/gcs.py +0 -0
- {agent_starter_pack-0.18.2.dist-info → agent_starter_pack-0.21.0.dist-info}/WHEEL +0 -0
- {agent_starter_pack-0.18.2.dist-info → agent_starter_pack-0.21.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -18,83 +18,53 @@ data "google_project" "project" {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
{%- if cookiecutter.is_adk and cookiecutter.session_type == "
|
|
21
|
+
{%- if cookiecutter.is_adk and cookiecutter.session_type == "cloud_sql" %}
|
|
22
22
|
|
|
23
|
-
#
|
|
24
|
-
resource "
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
depends_on = [resource.google_project_service.services]
|
|
23
|
+
# Generate a random password for the database user
|
|
24
|
+
resource "random_password" "db_password" {
|
|
25
|
+
length = 16
|
|
26
|
+
special = true
|
|
27
|
+
override_special = "!#$%&*()-_=+[]{}<>:?"
|
|
29
28
|
}
|
|
30
29
|
|
|
31
|
-
#
|
|
32
|
-
resource "
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
# This is required for Cloud Run VPC connectors
|
|
40
|
-
purpose = "PRIVATE"
|
|
30
|
+
# Cloud SQL Instance
|
|
31
|
+
resource "google_sql_database_instance" "session_db" {
|
|
32
|
+
project = var.dev_project_id
|
|
33
|
+
name = "${var.project_name}-db-dev"
|
|
34
|
+
database_version = "POSTGRES_15"
|
|
35
|
+
region = var.region
|
|
36
|
+
deletion_protection = false
|
|
41
37
|
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
settings {
|
|
39
|
+
tier = "db-f1-micro"
|
|
44
40
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
41
|
+
backup_configuration {
|
|
42
|
+
enabled = false # No backups for dev
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
# Enable IAM authentication
|
|
46
|
+
database_flags {
|
|
47
|
+
name = "cloudsql.iam_authentication"
|
|
48
|
+
value = "on"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
53
51
|
|
|
54
52
|
depends_on = [resource.google_project_service.services]
|
|
55
53
|
}
|
|
56
54
|
|
|
57
|
-
#
|
|
58
|
-
resource "
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
55
|
+
# Cloud SQL Database
|
|
56
|
+
resource "google_sql_database" "database" {
|
|
57
|
+
project = var.dev_project_id
|
|
58
|
+
name = "${var.project_name}" # Use project name for DB to avoid conflict with default 'postgres'
|
|
59
|
+
instance = google_sql_database_instance.session_db.name
|
|
62
60
|
}
|
|
63
61
|
|
|
64
|
-
#
|
|
65
|
-
resource "
|
|
66
|
-
project
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
network_config {
|
|
72
|
-
network = google_compute_network.default.id
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
depends_on = [
|
|
76
|
-
google_service_networking_connection.vpc_connection
|
|
77
|
-
]
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
# AlloyDB Instance
|
|
81
|
-
resource "google_alloydb_instance" "session_db_instance" {
|
|
82
|
-
cluster = google_alloydb_cluster.session_db_cluster.name
|
|
83
|
-
instance_id = "${var.project_name}-alloydb-instance"
|
|
84
|
-
instance_type = "PRIMARY"
|
|
85
|
-
|
|
86
|
-
availability_type = "REGIONAL" # Regional redundancy
|
|
87
|
-
|
|
88
|
-
machine_config {
|
|
89
|
-
cpu_count = 2
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
# Generate a random password for the database user
|
|
94
|
-
resource "random_password" "db_password" {
|
|
95
|
-
length = 16
|
|
96
|
-
special = true
|
|
97
|
-
override_special = "!#$%&*()-_=+[]{}<>:?"
|
|
62
|
+
# Cloud SQL User
|
|
63
|
+
resource "google_sql_user" "db_user" {
|
|
64
|
+
project = var.dev_project_id
|
|
65
|
+
name = "${var.project_name}" # Use project name for user to avoid conflict with default 'postgres'
|
|
66
|
+
instance = google_sql_database_instance.session_db.name
|
|
67
|
+
password = google_secret_manager_secret_version.db_password.secret_data
|
|
98
68
|
}
|
|
99
69
|
|
|
100
70
|
# Store the password in Secret Manager
|
|
@@ -114,16 +84,6 @@ resource "google_secret_manager_secret_version" "db_password" {
|
|
|
114
84
|
secret_data = random_password.db_password.result
|
|
115
85
|
}
|
|
116
86
|
|
|
117
|
-
resource "google_alloydb_user" "db_user" {
|
|
118
|
-
cluster = google_alloydb_cluster.session_db_cluster.name
|
|
119
|
-
user_id = "postgres"
|
|
120
|
-
user_type = "ALLOYDB_BUILT_IN"
|
|
121
|
-
password = random_password.db_password.result
|
|
122
|
-
database_roles = ["alloydbsuperuser"]
|
|
123
|
-
|
|
124
|
-
depends_on = [google_alloydb_instance.session_db_instance]
|
|
125
|
-
}
|
|
126
|
-
|
|
127
87
|
{%- endif %}
|
|
128
88
|
|
|
129
89
|
|
|
@@ -150,6 +110,13 @@ resource "google_cloud_run_v2_service" "app" {
|
|
|
150
110
|
containers {
|
|
151
111
|
image = "us-docker.pkg.dev/cloudrun/container/hello"
|
|
152
112
|
|
|
113
|
+
{%- if cookiecutter.is_a2a %}
|
|
114
|
+
env {
|
|
115
|
+
name = "APP_URL"
|
|
116
|
+
value = "https://${var.project_name}-${data.google_project.project.number}.${var.region}.run.app"
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
{%- endif %}
|
|
153
120
|
resources {
|
|
154
121
|
limits = {
|
|
155
122
|
cpu = "4"
|
|
@@ -186,11 +153,17 @@ resource "google_cloud_run_v2_service" "app" {
|
|
|
186
153
|
{%- endif %}
|
|
187
154
|
{%- endif %}
|
|
188
155
|
|
|
189
|
-
{%- if cookiecutter.is_adk and cookiecutter.session_type == "
|
|
156
|
+
{%- if cookiecutter.is_adk and cookiecutter.session_type == "cloud_sql" %}
|
|
157
|
+
# Mount the volume
|
|
158
|
+
volume_mounts {
|
|
159
|
+
name = "cloudsql"
|
|
160
|
+
mount_path = "/cloudsql"
|
|
161
|
+
}
|
|
190
162
|
|
|
163
|
+
# Environment variables
|
|
191
164
|
env {
|
|
192
|
-
name = "
|
|
193
|
-
value =
|
|
165
|
+
name = "INSTANCE_CONNECTION_NAME"
|
|
166
|
+
value = google_sql_database_instance.session_db.connection_name
|
|
194
167
|
}
|
|
195
168
|
|
|
196
169
|
env {
|
|
@@ -202,7 +175,27 @@ resource "google_cloud_run_v2_service" "app" {
|
|
|
202
175
|
}
|
|
203
176
|
}
|
|
204
177
|
}
|
|
178
|
+
|
|
179
|
+
env {
|
|
180
|
+
name = "DB_NAME"
|
|
181
|
+
value = "${var.project_name}"
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
env {
|
|
185
|
+
name = "DB_USER"
|
|
186
|
+
value = "${var.project_name}"
|
|
187
|
+
}
|
|
205
188
|
{%- endif %}
|
|
189
|
+
|
|
190
|
+
env {
|
|
191
|
+
name = "LOGS_BUCKET_NAME"
|
|
192
|
+
value = google_storage_bucket.logs_data_bucket.name
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
env {
|
|
196
|
+
name = "OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT"
|
|
197
|
+
value = "NO_CONTENT"
|
|
198
|
+
}
|
|
206
199
|
}
|
|
207
200
|
|
|
208
201
|
service_account = google_service_account.app_sa.email
|
|
@@ -215,12 +208,12 @@ resource "google_cloud_run_v2_service" "app" {
|
|
|
215
208
|
|
|
216
209
|
session_affinity = true
|
|
217
210
|
|
|
218
|
-
{%- if cookiecutter.is_adk and cookiecutter.session_type == "
|
|
219
|
-
#
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
211
|
+
{%- if cookiecutter.is_adk and cookiecutter.session_type == "cloud_sql" %}
|
|
212
|
+
# Cloud SQL volume
|
|
213
|
+
volumes {
|
|
214
|
+
name = "cloudsql"
|
|
215
|
+
cloud_sql_instance {
|
|
216
|
+
instances = [google_sql_database_instance.session_db.connection_name]
|
|
224
217
|
}
|
|
225
218
|
}
|
|
226
219
|
{%- endif %}
|
|
@@ -240,5 +233,11 @@ resource "google_cloud_run_v2_service" "app" {
|
|
|
240
233
|
}
|
|
241
234
|
|
|
242
235
|
# Make dependencies conditional to avoid errors.
|
|
243
|
-
depends_on = [
|
|
236
|
+
depends_on = [
|
|
237
|
+
resource.google_project_service.services,
|
|
238
|
+
{%- if cookiecutter.is_adk and cookiecutter.session_type == "cloud_sql" %}
|
|
239
|
+
google_sql_user.db_user,
|
|
240
|
+
google_secret_manager_secret_version.db_password,
|
|
241
|
+
{%- endif %}
|
|
242
|
+
]
|
|
244
243
|
}
|
|
@@ -19,98 +19,64 @@ data "google_project" "project" {
|
|
|
19
19
|
project_id = local.deploy_project_ids[each.key]
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
{%- if cookiecutter.is_adk and cookiecutter.session_type == "alloydb" %}
|
|
23
22
|
|
|
24
|
-
# VPC Network for AlloyDB
|
|
25
|
-
resource "google_compute_network" "default" {
|
|
26
|
-
for_each = local.deploy_project_ids
|
|
27
|
-
|
|
28
|
-
name = "${var.project_name}-alloydb-network"
|
|
29
|
-
project = local.deploy_project_ids[each.key]
|
|
30
|
-
auto_create_subnetworks = false
|
|
31
|
-
|
|
32
|
-
depends_on = [google_project_service.deploy_project_services]
|
|
33
|
-
}
|
|
34
23
|
|
|
35
|
-
|
|
36
|
-
resource "google_compute_subnetwork" "default" {
|
|
37
|
-
for_each = local.deploy_project_ids
|
|
38
|
-
|
|
39
|
-
name = "${var.project_name}-alloydb-network"
|
|
40
|
-
ip_cidr_range = "10.0.0.0/24"
|
|
41
|
-
region = var.region
|
|
42
|
-
network = google_compute_network.default[each.key].id
|
|
43
|
-
project = local.deploy_project_ids[each.key]
|
|
44
|
-
|
|
45
|
-
# This is required for Cloud Run VPC connectors
|
|
46
|
-
purpose = "PRIVATE"
|
|
24
|
+
{%- if cookiecutter.is_adk and cookiecutter.session_type == "cloud_sql" %}
|
|
47
25
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
# Private IP allocation for AlloyDB
|
|
52
|
-
resource "google_compute_global_address" "private_ip_alloc" {
|
|
26
|
+
# Generate a random password for the database user
|
|
27
|
+
resource "random_password" "db_password" {
|
|
53
28
|
for_each = local.deploy_project_ids
|
|
54
|
-
|
|
55
|
-
name = "${var.project_name}-private-ip"
|
|
56
|
-
project = local.deploy_project_ids[each.key]
|
|
57
|
-
address_type = "INTERNAL"
|
|
58
|
-
purpose = "VPC_PEERING"
|
|
59
|
-
prefix_length = 16
|
|
60
|
-
network = google_compute_network.default[each.key].id
|
|
61
29
|
|
|
62
|
-
|
|
30
|
+
length = 16
|
|
31
|
+
special = true
|
|
32
|
+
override_special = "!#$%&*()-_=+[]{}<>:?"
|
|
63
33
|
}
|
|
64
34
|
|
|
65
|
-
#
|
|
66
|
-
resource "
|
|
35
|
+
# Cloud SQL Instance
|
|
36
|
+
resource "google_sql_database_instance" "session_db" {
|
|
67
37
|
for_each = local.deploy_project_ids
|
|
68
|
-
|
|
69
|
-
network = google_compute_network.default[each.key].id
|
|
70
|
-
service = "servicenetworking.googleapis.com"
|
|
71
|
-
reserved_peering_ranges = [google_compute_global_address.private_ip_alloc[each.key].name]
|
|
72
|
-
}
|
|
73
38
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
cluster_id = "${var.project_name}-alloydb-cluster"
|
|
80
|
-
location = var.region
|
|
81
|
-
deletion_policy = "FORCE"
|
|
39
|
+
project = local.deploy_project_ids[each.key]
|
|
40
|
+
name = "${var.project_name}-db-${each.key}"
|
|
41
|
+
database_version = "POSTGRES_15"
|
|
42
|
+
region = var.region
|
|
43
|
+
deletion_protection = false # For easier teardown in starter packs
|
|
82
44
|
|
|
83
|
-
|
|
84
|
-
|
|
45
|
+
settings {
|
|
46
|
+
tier = each.key == "prod" ? "db-custom-1-3840" : "db-f1-micro" # Use a custom machine type for prod to avoid tier restrictions
|
|
47
|
+
|
|
48
|
+
backup_configuration {
|
|
49
|
+
enabled = true
|
|
50
|
+
start_time = "03:00"
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
# Enable IAM authentication
|
|
54
|
+
database_flags {
|
|
55
|
+
name = "cloudsql.iam_authentication"
|
|
56
|
+
value = "on"
|
|
57
|
+
}
|
|
85
58
|
}
|
|
86
59
|
|
|
87
|
-
depends_on = [
|
|
88
|
-
google_service_networking_connection.vpc_connection
|
|
89
|
-
]
|
|
60
|
+
depends_on = [google_project_service.deploy_project_services]
|
|
90
61
|
}
|
|
91
62
|
|
|
92
|
-
#
|
|
93
|
-
resource "
|
|
63
|
+
# Cloud SQL Database
|
|
64
|
+
resource "google_sql_database" "database" {
|
|
94
65
|
for_each = local.deploy_project_ids
|
|
95
|
-
|
|
96
|
-
cluster = google_alloydb_cluster.session_db_cluster[each.key].name
|
|
97
|
-
instance_id = "${var.project_name}-alloydb-instance"
|
|
98
|
-
instance_type = "PRIMARY"
|
|
99
|
-
|
|
100
|
-
availability_type = "REGIONAL" # Regional redundancy
|
|
101
66
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
67
|
+
project = local.deploy_project_ids[each.key]
|
|
68
|
+
name = "${var.project_name}" # Use project name for DB to avoid conflict with default 'postgres'
|
|
69
|
+
instance = google_sql_database_instance.session_db[each.key].name
|
|
105
70
|
}
|
|
106
71
|
|
|
107
|
-
#
|
|
108
|
-
resource "
|
|
72
|
+
# Cloud SQL User
|
|
73
|
+
resource "google_sql_user" "db_user" {
|
|
109
74
|
for_each = local.deploy_project_ids
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
75
|
+
|
|
76
|
+
project = local.deploy_project_ids[each.key]
|
|
77
|
+
name = "${var.project_name}" # Use project name for user to avoid conflict with default 'postgres'
|
|
78
|
+
instance = google_sql_database_instance.session_db[each.key].name
|
|
79
|
+
password = random_password.db_password[each.key].result
|
|
114
80
|
}
|
|
115
81
|
|
|
116
82
|
# Store the password in Secret Manager
|
|
@@ -134,21 +100,9 @@ resource "google_secret_manager_secret_version" "db_password" {
|
|
|
134
100
|
secret_data = random_password.db_password[each.key].result
|
|
135
101
|
}
|
|
136
102
|
|
|
137
|
-
resource "google_alloydb_user" "db_user" {
|
|
138
|
-
for_each = local.deploy_project_ids
|
|
139
|
-
|
|
140
|
-
cluster = google_alloydb_cluster.session_db_cluster[each.key].name
|
|
141
|
-
user_id = "postgres"
|
|
142
|
-
user_type = "ALLOYDB_BUILT_IN"
|
|
143
|
-
password = random_password.db_password[each.key].result
|
|
144
|
-
database_roles = ["alloydbsuperuser"]
|
|
145
|
-
|
|
146
|
-
depends_on = [google_alloydb_instance.session_db_instance]
|
|
147
|
-
}
|
|
148
|
-
|
|
149
103
|
{%- endif %}
|
|
150
104
|
|
|
151
|
-
resource "google_cloud_run_v2_service" "app_staging" {
|
|
105
|
+
resource "google_cloud_run_v2_service" "app_staging" {
|
|
152
106
|
name = var.project_name
|
|
153
107
|
location = var.region
|
|
154
108
|
project = var.staging_project_id
|
|
@@ -172,6 +126,13 @@ resource "google_cloud_run_v2_service" "app_staging" {
|
|
|
172
126
|
# Placeholder, will be replaced by the CI/CD pipeline
|
|
173
127
|
image = "us-docker.pkg.dev/cloudrun/container/hello"
|
|
174
128
|
|
|
129
|
+
{%- if cookiecutter.is_a2a %}
|
|
130
|
+
env {
|
|
131
|
+
name = "APP_URL"
|
|
132
|
+
value = "https://${var.project_name}-${data.google_project.project["staging"].number}.${var.region}.run.app"
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
{%- endif %}
|
|
175
136
|
resources {
|
|
176
137
|
limits = {
|
|
177
138
|
cpu = "4"
|
|
@@ -209,11 +170,17 @@ resource "google_cloud_run_v2_service" "app_staging" {
|
|
|
209
170
|
{%- endif %}
|
|
210
171
|
{%- endif %}
|
|
211
172
|
|
|
212
|
-
{%- if cookiecutter.is_adk and cookiecutter.session_type == "
|
|
173
|
+
{%- if cookiecutter.is_adk and cookiecutter.session_type == "cloud_sql" %}
|
|
174
|
+
# Mount the volume
|
|
175
|
+
volume_mounts {
|
|
176
|
+
name = "cloudsql"
|
|
177
|
+
mount_path = "/cloudsql"
|
|
178
|
+
}
|
|
213
179
|
|
|
180
|
+
# Environment variables
|
|
214
181
|
env {
|
|
215
|
-
name = "
|
|
216
|
-
value =
|
|
182
|
+
name = "INSTANCE_CONNECTION_NAME"
|
|
183
|
+
value = google_sql_database_instance.session_db["staging"].connection_name
|
|
217
184
|
}
|
|
218
185
|
|
|
219
186
|
env {
|
|
@@ -225,7 +192,27 @@ resource "google_cloud_run_v2_service" "app_staging" {
|
|
|
225
192
|
}
|
|
226
193
|
}
|
|
227
194
|
}
|
|
195
|
+
|
|
196
|
+
env {
|
|
197
|
+
name = "DB_NAME"
|
|
198
|
+
value = "${var.project_name}"
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
env {
|
|
202
|
+
name = "DB_USER"
|
|
203
|
+
value = "${var.project_name}"
|
|
204
|
+
}
|
|
228
205
|
{%- endif %}
|
|
206
|
+
|
|
207
|
+
env {
|
|
208
|
+
name = "LOGS_BUCKET_NAME"
|
|
209
|
+
value = google_storage_bucket.logs_data_bucket[var.staging_project_id].name
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
env {
|
|
213
|
+
name = "OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT"
|
|
214
|
+
value = "NO_CONTENT"
|
|
215
|
+
}
|
|
229
216
|
}
|
|
230
217
|
|
|
231
218
|
service_account = google_service_account.app_sa["staging"].email
|
|
@@ -238,12 +225,12 @@ resource "google_cloud_run_v2_service" "app_staging" {
|
|
|
238
225
|
|
|
239
226
|
session_affinity = true
|
|
240
227
|
|
|
241
|
-
{%- if cookiecutter.is_adk and cookiecutter.session_type == "
|
|
242
|
-
#
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
228
|
+
{%- if cookiecutter.is_adk and cookiecutter.session_type == "cloud_sql" %}
|
|
229
|
+
# Cloud SQL volume
|
|
230
|
+
volumes {
|
|
231
|
+
name = "cloudsql"
|
|
232
|
+
cloud_sql_instance {
|
|
233
|
+
instances = [google_sql_database_instance.session_db["staging"].connection_name]
|
|
247
234
|
}
|
|
248
235
|
}
|
|
249
236
|
{%- endif %}
|
|
@@ -263,10 +250,16 @@ resource "google_cloud_run_v2_service" "app_staging" {
|
|
|
263
250
|
}
|
|
264
251
|
|
|
265
252
|
# Make dependencies conditional to avoid errors.
|
|
266
|
-
depends_on = [
|
|
253
|
+
depends_on = [
|
|
254
|
+
google_project_service.deploy_project_services,
|
|
255
|
+
{%- if cookiecutter.is_adk and cookiecutter.session_type == "cloud_sql" %}
|
|
256
|
+
google_sql_user.db_user,
|
|
257
|
+
google_secret_manager_secret_version.db_password,
|
|
258
|
+
{%- endif %}
|
|
259
|
+
]
|
|
267
260
|
}
|
|
268
261
|
|
|
269
|
-
resource "google_cloud_run_v2_service" "app_prod" {
|
|
262
|
+
resource "google_cloud_run_v2_service" "app_prod" {
|
|
270
263
|
name = var.project_name
|
|
271
264
|
location = var.region
|
|
272
265
|
project = var.prod_project_id
|
|
@@ -290,6 +283,13 @@ resource "google_cloud_run_v2_service" "app_prod" {
|
|
|
290
283
|
# Placeholder, will be replaced by the CI/CD pipeline
|
|
291
284
|
image = "us-docker.pkg.dev/cloudrun/container/hello"
|
|
292
285
|
|
|
286
|
+
{%- if cookiecutter.is_a2a %}
|
|
287
|
+
env {
|
|
288
|
+
name = "APP_URL"
|
|
289
|
+
value = "https://${var.project_name}-${data.google_project.project["prod"].number}.${var.region}.run.app"
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
{%- endif %}
|
|
293
293
|
resources {
|
|
294
294
|
limits = {
|
|
295
295
|
cpu = "4"
|
|
@@ -327,11 +327,17 @@ resource "google_cloud_run_v2_service" "app_prod" {
|
|
|
327
327
|
{%- endif %}
|
|
328
328
|
{%- endif %}
|
|
329
329
|
|
|
330
|
-
{%- if cookiecutter.is_adk and cookiecutter.session_type == "
|
|
330
|
+
{%- if cookiecutter.is_adk and cookiecutter.session_type == "cloud_sql" %}
|
|
331
|
+
# Mount the volume
|
|
332
|
+
volume_mounts {
|
|
333
|
+
name = "cloudsql"
|
|
334
|
+
mount_path = "/cloudsql"
|
|
335
|
+
}
|
|
331
336
|
|
|
337
|
+
# Environment variables
|
|
332
338
|
env {
|
|
333
|
-
name = "
|
|
334
|
-
value =
|
|
339
|
+
name = "INSTANCE_CONNECTION_NAME"
|
|
340
|
+
value = google_sql_database_instance.session_db["prod"].connection_name
|
|
335
341
|
}
|
|
336
342
|
|
|
337
343
|
env {
|
|
@@ -343,7 +349,27 @@ resource "google_cloud_run_v2_service" "app_prod" {
|
|
|
343
349
|
}
|
|
344
350
|
}
|
|
345
351
|
}
|
|
352
|
+
|
|
353
|
+
env {
|
|
354
|
+
name = "DB_NAME"
|
|
355
|
+
value = "${var.project_name}"
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
env {
|
|
359
|
+
name = "DB_USER"
|
|
360
|
+
value = "${var.project_name}"
|
|
361
|
+
}
|
|
346
362
|
{%- endif %}
|
|
363
|
+
|
|
364
|
+
env {
|
|
365
|
+
name = "LOGS_BUCKET_NAME"
|
|
366
|
+
value = google_storage_bucket.logs_data_bucket[var.prod_project_id].name
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
env {
|
|
370
|
+
name = "OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT"
|
|
371
|
+
value = "NO_CONTENT"
|
|
372
|
+
}
|
|
347
373
|
}
|
|
348
374
|
|
|
349
375
|
service_account = google_service_account.app_sa["prod"].email
|
|
@@ -356,12 +382,12 @@ resource "google_cloud_run_v2_service" "app_prod" {
|
|
|
356
382
|
|
|
357
383
|
session_affinity = true
|
|
358
384
|
|
|
359
|
-
{%- if cookiecutter.is_adk and cookiecutter.session_type == "
|
|
360
|
-
#
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
385
|
+
{%- if cookiecutter.is_adk and cookiecutter.session_type == "cloud_sql" %}
|
|
386
|
+
# Cloud SQL volume
|
|
387
|
+
volumes {
|
|
388
|
+
name = "cloudsql"
|
|
389
|
+
cloud_sql_instance {
|
|
390
|
+
instances = [google_sql_database_instance.session_db["prod"].connection_name]
|
|
365
391
|
}
|
|
366
392
|
}
|
|
367
393
|
{%- endif %}
|
|
@@ -381,5 +407,11 @@ resource "google_cloud_run_v2_service" "app_prod" {
|
|
|
381
407
|
}
|
|
382
408
|
|
|
383
409
|
# Make dependencies conditional to avoid errors.
|
|
384
|
-
depends_on = [
|
|
410
|
+
depends_on = [
|
|
411
|
+
google_project_service.deploy_project_services,
|
|
412
|
+
{%- if cookiecutter.is_adk and cookiecutter.session_type == "cloud_sql" %}
|
|
413
|
+
google_sql_user.db_user,
|
|
414
|
+
google_secret_manager_secret_version.db_password,
|
|
415
|
+
{%- endif %}
|
|
416
|
+
]
|
|
385
417
|
}
|