Skip to content

Commit 45cbc79

Browse files
committed
add deployment
1 parent 9767e43 commit 45cbc79

9 files changed

Lines changed: 435 additions & 16 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,3 +211,5 @@ dmypy.json
211211
.pyre/
212212

213213
# End of https://www.gitignore.io/api/python,pycharm
214+
215+
*.terraform*

DEPLOY.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
4. **gcloud CLI** authenticated: `gcloud auth login`
2525
5. Configure Docker for Artifact Registry:
2626
```
27-
gcloud auth configure-docker REGION-docker.pkg.dev
27+
gcloud auth configure-docker us-central1-docker.pkg.dev
2828
```
2929

3030
---
@@ -36,7 +36,7 @@ cd terraform
3636

3737
# Create terraform.tfvars
3838
cat > terraform.tfvars <<EOF
39-
project_id = "your-gcp-project-id"
39+
project_id = "website-489802"
4040
region = "us-central1"
4141
EOF
4242

@@ -57,7 +57,7 @@ Run from the project root each time you want to update:
5757

5858
```bash
5959
# Set your values
60-
PROJECT_ID="your-gcp-project-id"
60+
PROJECT_ID="website-489802"
6161
REGION="us-central1"
6262
SERVICE="dc-deck-builder"
6363
IMAGE="${REGION}-docker.pkg.dev/${PROJECT_ID}/${SERVICE}/${SERVICE}"
@@ -84,7 +84,7 @@ gcloud run deploy ${SERVICE} \
8484
The `frontend/` folder is served directly by the Flask backend. For the **standalone S3 website** you already have, update `game.js` line 7:
8585

8686
```javascript
87-
const SERVER_URL = 'https://YOUR-CLOUD-RUN-URL.run.app';
87+
const SERVER_URL = 'https://dc-deck-builder-35l4saorlq-uc.a.run.app"';
8888
```
8989

9090
Then copy the frontend files to S3:

frontend/game.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
'use strict';
66

77
// ── Config ─────────────────────────────────────────────────────────────────
8-
const SERVER_URL = window.location.origin; // same origin as Flask
8+
// const SERVER_URL = window.location.origin; // same origin as Flask
9+
const SERVER_URL = 'https://dc-deck-builder-35l4saorlq-uc.a.run.app"';
910
const IMG_ROOT = '/card-images/';
1011

1112
// ── Socket.IO ───────────────────────────────────────────────────────────────

frontend/style.css

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020
/* Card type glows */
2121
--glow-hero: #1e88e5;
2222
--glow-villain: #c62828;
23-
--glow-super: #7b1fa2;
24-
--glow-equip: #2e7d32;
25-
--glow-location: #e65100;
26-
--glow-starter: #546e7a;
27-
--glow-weakness: #4a148c;
23+
--glow-super: #ffae33;
24+
--glow-equip: #747574;
25+
--glow-location: #a35ec4;
26+
--glow-starter: #fae588;
27+
--glow-weakness: #1ba022;
2828
--glow-sv: #b71c1c;
2929

3030
/* Card sizes */

terraform/main.tf

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ resource "google_cloud_run_v2_service" "game" {
3939
container_port = 8080
4040
}
4141

42-
env {
43-
name = "PORT"
44-
value = "8080"
45-
}
42+
#env {
43+
# name = "PORT"
44+
# value = "8080"
45+
#}
4646
env {
4747
name = "USE_GEVENT"
4848
value = "1"
@@ -58,8 +58,8 @@ resource "google_cloud_run_v2_service" "game" {
5858
}
5959
}
6060

61-
# Allow long-lived WebSocket connections (30 min timeout)
62-
timeout = "1800s"
61+
# Allow long-lived WebSocket connections (60 min timeout)
62+
timeout = "3600s"
6363
}
6464

6565
# Required for WebSockets on Cloud Run

terraform/terraform.tfstate

Lines changed: 252 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,252 @@
1+
{
2+
"version": 4,
3+
"terraform_version": "1.14.6",
4+
"serial": 9,
5+
"lineage": "eca8a4ff-294d-64b8-d821-e3918df21dd5",
6+
"outputs": {
7+
"image_repo": {
8+
"value": "us-central1-docker.pkg.dev/website-489802/dc-deck-builder/dc-deck-builder",
9+
"type": "string"
10+
},
11+
"service_url": {
12+
"value": "https://dc-deck-builder-35l4saorlq-uc.a.run.app",
13+
"type": "string"
14+
}
15+
},
16+
"resources": [
17+
{
18+
"mode": "managed",
19+
"type": "google_artifact_registry_repository",
20+
"name": "repo",
21+
"provider": "provider[\"registry.terraform.io/hashicorp/google\"]",
22+
"instances": [
23+
{
24+
"schema_version": 0,
25+
"attributes": {
26+
"cleanup_policies": [],
27+
"cleanup_policy_dry_run": false,
28+
"create_time": "2026-03-11T04:41:09.350964Z",
29+
"description": "DC Deck Builder container images",
30+
"docker_config": [],
31+
"effective_labels": {},
32+
"format": "DOCKER",
33+
"id": "projects/website-489802/locations/us-central1/repositories/dc-deck-builder",
34+
"kms_key_name": "",
35+
"labels": {},
36+
"location": "us-central1",
37+
"maven_config": [],
38+
"mode": "STANDARD_REPOSITORY",
39+
"name": "dc-deck-builder",
40+
"project": "website-489802",
41+
"remote_repository_config": [],
42+
"repository_id": "dc-deck-builder",
43+
"terraform_labels": {},
44+
"timeouts": null,
45+
"update_time": "2026-03-12T00:53:25.129293Z",
46+
"virtual_repository_config": []
47+
},
48+
"sensitive_attributes": [],
49+
"identity_schema_version": 0,
50+
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxMjAwMDAwMDAwMDAwLCJkZWxldGUiOjEyMDAwMDAwMDAwMDAsInVwZGF0ZSI6MTIwMDAwMDAwMDAwMH19"
51+
}
52+
]
53+
},
54+
{
55+
"mode": "managed",
56+
"type": "google_cloud_run_v2_service",
57+
"name": "game",
58+
"provider": "provider[\"registry.terraform.io/hashicorp/google\"]",
59+
"instances": [
60+
{
61+
"schema_version": 0,
62+
"attributes": {
63+
"annotations": null,
64+
"binary_authorization": [],
65+
"client": "terraform",
66+
"client_version": "",
67+
"conditions": [
68+
{
69+
"execution_reason": "",
70+
"last_transition_time": "2026-03-12T00:57:39.078551Z",
71+
"message": "",
72+
"reason": "",
73+
"revision_reason": "",
74+
"severity": "",
75+
"state": "CONDITION_SUCCEEDED",
76+
"type": "RoutesReady"
77+
},
78+
{
79+
"execution_reason": "",
80+
"last_transition_time": "2026-03-12T00:57:33.136404Z",
81+
"message": "",
82+
"reason": "",
83+
"revision_reason": "",
84+
"severity": "",
85+
"state": "CONDITION_SUCCEEDED",
86+
"type": "ConfigurationsReady"
87+
}
88+
],
89+
"create_time": "2026-03-12T00:57:32.108636Z",
90+
"creator": "elijahmad@gmail.com",
91+
"custom_audiences": null,
92+
"delete_time": "",
93+
"description": "",
94+
"effective_annotations": {},
95+
"effective_labels": {},
96+
"etag": "\"CPyeyM0GEODO5jM/cHJvamVjdHMvd2Vic2l0ZS00ODk4MDIvbG9jYXRpb25zL3VzLWNlbnRyYWwxL3NlcnZpY2VzL2RjLWRlY2stYnVpbGRlcg\"",
97+
"expire_time": "",
98+
"generation": "1",
99+
"id": "projects/website-489802/locations/us-central1/services/dc-deck-builder",
100+
"ingress": "INGRESS_TRAFFIC_ALL",
101+
"labels": null,
102+
"last_modifier": "elijahmad@gmail.com",
103+
"latest_created_revision": "projects/website-489802/locations/us-central1/services/dc-deck-builder/revisions/dc-deck-builder-00001-7tq",
104+
"latest_ready_revision": "projects/website-489802/locations/us-central1/services/dc-deck-builder/revisions/dc-deck-builder-00001-7tq",
105+
"launch_stage": "GA",
106+
"location": "us-central1",
107+
"name": "dc-deck-builder",
108+
"observed_generation": "1",
109+
"project": "website-489802",
110+
"reconciling": false,
111+
"template": [
112+
{
113+
"annotations": null,
114+
"containers": [
115+
{
116+
"args": null,
117+
"command": null,
118+
"depends_on": null,
119+
"env": [
120+
{
121+
"name": "USE_GEVENT",
122+
"value": "1",
123+
"value_source": []
124+
}
125+
],
126+
"image": "us-central1-docker.pkg.dev/website-489802/dc-deck-builder/dc-deck-builder:latest",
127+
"liveness_probe": [],
128+
"name": "",
129+
"ports": [
130+
{
131+
"container_port": 8080,
132+
"name": "http1"
133+
}
134+
],
135+
"resources": [
136+
{
137+
"cpu_idle": false,
138+
"limits": {
139+
"cpu": "1",
140+
"memory": "512Mi"
141+
},
142+
"startup_cpu_boost": false
143+
}
144+
],
145+
"startup_probe": [
146+
{
147+
"failure_threshold": 1,
148+
"grpc": [],
149+
"http_get": [],
150+
"initial_delay_seconds": 0,
151+
"period_seconds": 240,
152+
"tcp_socket": [
153+
{
154+
"port": 8080
155+
}
156+
],
157+
"timeout_seconds": 240
158+
}
159+
],
160+
"volume_mounts": [],
161+
"working_dir": ""
162+
}
163+
],
164+
"encryption_key": "",
165+
"execution_environment": "",
166+
"labels": null,
167+
"max_instance_request_concurrency": 80,
168+
"revision": "",
169+
"scaling": [
170+
{
171+
"max_instance_count": 1,
172+
"min_instance_count": 0
173+
}
174+
],
175+
"service_account": "16370628759-compute@developer.gserviceaccount.com",
176+
"session_affinity": false,
177+
"timeout": "3600s",
178+
"volumes": [],
179+
"vpc_access": []
180+
}
181+
],
182+
"terminal_condition": [
183+
{
184+
"execution_reason": "",
185+
"last_transition_time": "2026-03-12T00:57:39.110913Z",
186+
"message": "",
187+
"reason": "",
188+
"revision_reason": "",
189+
"severity": "",
190+
"state": "CONDITION_SUCCEEDED",
191+
"type": "Ready"
192+
}
193+
],
194+
"terraform_labels": {},
195+
"timeouts": null,
196+
"traffic": [
197+
{
198+
"percent": 100,
199+
"revision": "",
200+
"tag": "",
201+
"type": "TRAFFIC_TARGET_ALLOCATION_TYPE_LATEST"
202+
}
203+
],
204+
"traffic_statuses": [
205+
{
206+
"percent": 100,
207+
"revision": "",
208+
"tag": "",
209+
"type": "TRAFFIC_TARGET_ALLOCATION_TYPE_LATEST",
210+
"uri": ""
211+
}
212+
],
213+
"uid": "5351856f-e4b1-4954-b2f0-c6b3693a9d7d",
214+
"update_time": "2026-03-12T00:57:32.108636Z",
215+
"uri": "https://dc-deck-builder-35l4saorlq-uc.a.run.app"
216+
},
217+
"sensitive_attributes": [],
218+
"identity_schema_version": 0,
219+
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxMjAwMDAwMDAwMDAwLCJkZWxldGUiOjEyMDAwMDAwMDAwMDAsInVwZGF0ZSI6MTIwMDAwMDAwMDAwMH19"
220+
}
221+
]
222+
},
223+
{
224+
"mode": "managed",
225+
"type": "google_cloud_run_v2_service_iam_member",
226+
"name": "public",
227+
"provider": "provider[\"registry.terraform.io/hashicorp/google\"]",
228+
"instances": [
229+
{
230+
"schema_version": 0,
231+
"attributes": {
232+
"condition": [],
233+
"etag": "BwZMyT1zPDg=",
234+
"id": "projects/website-489802/locations/us-central1/services/dc-deck-builder/roles/run.invoker/allUsers",
235+
"location": "us-central1",
236+
"member": "allUsers",
237+
"name": "projects/website-489802/locations/us-central1/services/dc-deck-builder",
238+
"project": "website-489802",
239+
"role": "roles/run.invoker"
240+
},
241+
"sensitive_attributes": [],
242+
"identity_schema_version": 0,
243+
"private": "bnVsbA==",
244+
"dependencies": [
245+
"google_cloud_run_v2_service.game"
246+
]
247+
}
248+
]
249+
}
250+
],
251+
"check_results": null
252+
}

0 commit comments

Comments
 (0)