Skip to content

Commit 911dce9

Browse files
authored
fix: staging container images fetched from the registry in the prod region (#19)
1 parent d540f0d commit 911dce9

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

deploy/Makefile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,19 @@ else
1010
endif
1111

1212
ECR_URI=$(TF_VAR_allowed_account_id).dkr.ecr.us-west-2.amazonaws.com
13+
REPLICATED_ECR_URI=$(TF_VAR_allowed_account_id).dkr.ecr.$(TF_VAR_region).amazonaws.com
1314
IMAGE_TAG_BASE=$(ECR_URI)/$(TF_VAR_app)-ecr:$(TF_WORKSPACE)
15+
REPLICATED_IMAGE_TAG_BASE=$(REPLICATED_ECR_URI)/$(TF_VAR_app)-ecr:$(TF_WORKSPACE)
1416

1517
# This is a hack to eval the image tag only when it's a dependency, cause we don't want to set it until docker builds
1618
get_image_tag = IMAGE_TAG = $$(IMAGE_TAG_BASE)-$$(shell docker inspect --format $$(format-filter) $$(IMAGE_TAG_BASE)-latest | sed -e 's/sha256://g')
19+
get_replicated_image_tag = REPLICATED_IMAGE_TAG = $$(REPLICATED_IMAGE_TAG_BASE)-$$(shell docker inspect --format $$(format-filter) $$(IMAGE_TAG_BASE)-latest | sed -e 's/sha256://g')
1720

1821
.PHONY: eval_image_tag
1922

2023
eval_image_tag:
2124
$(eval $(get_image_tag))
25+
$(eval $(get_replicated_image_tag))
2226

2327
# GET the absolute location for .env.production.local, again, only after it exists
2428

@@ -60,7 +64,7 @@ docker-push: docker-tag eval_image_tag
6064
.PHONY: clean-terraform
6165

6266
clean-terraform: eval_image_tag
63-
tofu -chdir=app destroy -var="image_tag=$(IMAGE_TAG)"
67+
tofu -chdir=app destroy -var="image_tag=$(REPLICATED_IMAGE_TAG)"
6468

6569
.PHONY: clean-shared
6670

@@ -120,7 +124,7 @@ plan-shared: shared/.terraform
120124
.PHONY: plan-app
121125

122126
plan-app: app/.terraform .tfworkspace eval_image_tag eval_env_file eval_ingest_env_file
123-
tofu -chdir=app plan -var="image_tag=$(IMAGE_TAG)" -var='env_files=["$(ENV_FILE)"]' -var='ingest_env_files=["$(INGEST_ENV_FILE)"]'
127+
tofu -chdir=app plan -var="image_tag=$(REPLICATED_IMAGE_TAG)" -var='env_files=["$(ENV_FILE)"]' -var='ingest_env_files=["$(INGEST_ENV_FILE)"]'
124128

125129
.PHONY: plan
126130

@@ -139,7 +143,7 @@ apply-shared: shared/.terraform
139143
.PHONY: apply-app
140144

141145
apply-app: app/.terraform .tfworkspace docker-push eval_image_tag eval_env_file eval_ingest_env_file
142-
tofu -chdir=app apply -var="image_tag=$(IMAGE_TAG)" -var='env_files=["$(ENV_FILE)"]' -var='ingest_env_files=["$(INGEST_ENV_FILE)"]' $(APPLY_ARGS)
146+
tofu -chdir=app apply -var="image_tag=$(REPLICATED_IMAGE_TAG)" -var='env_files=["$(ENV_FILE)"]' -var='ingest_env_files=["$(INGEST_ENV_FILE)"]' $(APPLY_ARGS)
143147

144148
.PHONY: apply
145149
apply: apply-shared apply-app
@@ -150,7 +154,7 @@ console-shared: shared/.terraform
150154

151155
.PHONY: console
152156
console: app/.terraform .tfworkspace eval_image_tag eval_env_file eval_ingest_env_file
153-
tofu -chdir=app console -var="image_tag=$(IMAGE_TAG)" -var='env_files=["$(ENV_FILE)"]' -var='ingest_env_files=["$(INGEST_ENV_FILE)"]'
157+
tofu -chdir=app console -var="image_tag=$(REPLICATED_IMAGE_TAG)" -var='env_files=["$(ENV_FILE)"]' -var='ingest_env_files=["$(INGEST_ENV_FILE)"]'
154158

155159
.PHONY: wait-deploy
156160
wait-deploy:

deploy/app/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ provider "aws" {
4141
}
4242

4343
module "app" {
44-
source = "github.com/storacha/storoku//app?ref=v0.2.43"
44+
source = "github.com/storacha/storoku//app?ref=v0.2.44"
4545
private_key = var.private_key
4646
private_key_env_var = "STORETHEINDEX_PRIV_KEY"
4747
httpport = 3000

deploy/shared/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ provider "aws" {
3333
}
3434

3535
module "shared" {
36-
source = "github.com/storacha/storoku//shared?ref=v0.2.43"
36+
source = "github.com/storacha/storoku//shared?ref=v0.2.44"
3737
create_db = false
3838
caches = []
39-
networks = ["warm"]
39+
networks = ["warm",]
4040
app = var.app
4141
zone_id = var.cloudflare_zone_id
4242
domain_base = var.domain_base

0 commit comments

Comments
 (0)