Skip to content

Commit f52a984

Browse files
authored
infra: configure forge-test environment (#295)
Ref. storacha/project-tracking#667 Deploy the `indexer` to the new `forge-test` demo environment.
1 parent f92e2ce commit f52a984

File tree

9 files changed

+137
-106
lines changed

9 files changed

+137
-106
lines changed

.github/workflows/deploy.yml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ on:
2020
options:
2121
- production
2222
- forge-production
23+
- forge-test
2324

2425
permissions:
2526
id-token: write # This is required for requesting the JWT
@@ -71,7 +72,7 @@ jobs:
7172
cloudflare-api-token: ${{ secrets.WARM_STAGING_CLOUDFLARE_API_TOKEN }}
7273
sentry-dsn: ${{ secrets.WARM_STAGING_SENTRY_DSN }}
7374

74-
# apply prod on successful release, plan otherwise
75+
# apply prod and test on successful release, plan otherwise
7576
production:
7677
uses: ./.github/workflows/terraform.yml
7778
with:
@@ -115,3 +116,25 @@ jobs:
115116
cloudflare-zone-id: ${{ secrets.FORGE_PROD_CLOUDFLARE_ZONE_ID }}
116117
cloudflare-api-token: ${{ secrets.FORGE_PROD_CLOUDFLARE_API_TOKEN }}
117118
sentry-dsn: ${{ secrets.FORGE_PROD_SENTRY_DSN }}
119+
120+
forge-test:
121+
uses: ./.github/workflows/terraform.yml
122+
with:
123+
env: forge-test
124+
workspace: forge-test
125+
network: test
126+
did: did:web:indexer.test.storacha.network
127+
ipni-endpoint: ${{ vars.FORGE_TEST_IPNI_ENDPOINT }}
128+
ipni-fallback-endpoints: ${{ vars.FORGE_TEST_IPNI_FALLBACK_ENDPOINTS }}
129+
ipni-announce-urls: ${{ vars.FORGE_TEST_IPNI_ANNOUNCE_URLS }}
130+
ipni-format-peer-id: ${{ vars.FORGE_TEST_IPNI_FORMAT_PEER_ID }}
131+
ipni-format-endpoint: ${{ vars.FORGE_TEST_IPNI_FORMAT_ENDPOINT }}
132+
apply: ${{ (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') || (github.event_name == 'workflow_dispatch' && contains(github.ref, 'refs/tags')) || (github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'forge-test') }}
133+
secrets:
134+
aws-account-id: ${{ secrets.FORGE_TEST_AWS_ACCOUNT_ID }}
135+
aws-region: ${{ secrets.FORGE_TEST_AWS_REGION }}
136+
region: ${{ secrets.FORGE_TEST_AWS_REGION }}
137+
private-key: ${{ secrets.FORGE_TEST_PRIVATE_KEY }}
138+
cloudflare-zone-id: ${{ secrets.FORGE_TEST_CLOUDFLARE_ZONE_ID }}
139+
cloudflare-api-token: ${{ secrets.FORGE_TEST_CLOUDFLARE_API_TOKEN }}
140+
sentry-dsn: ${{ secrets.FORGE_TEST_SENTRY_DSN }}

.github/workflows/terraform.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,6 @@ jobs:
9696
with:
9797
aws-region: ${{ env.AWS_REGION }}
9898
role-to-assume: arn:aws:iam::${{ env.AWS_ACCOUNT_ID }}:role/terraform-ci
99-
100-
- name: Set up Docker Buildx
101-
uses: docker/setup-buildx-action@v3
10299

103100
- uses: opentofu/setup-opentofu@v1
104101

@@ -108,17 +105,24 @@ jobs:
108105
make init
109106
working-directory: deploy
110107

111-
- name: Build + Push Docker ECR
112-
run: |
113-
make docker-push
114-
working-directory: deploy
115-
108+
# just plan if !inputs.apply
116109
- name: Terraform Plan
117110
if: ${{ !inputs.apply }}
118111
run: |
119112
make plan
120113
working-directory: deploy
121114

115+
# build and push docker image and apply if inputs.apply
116+
- name: Set up Docker Buildx
117+
if: ${{ inputs.apply }}
118+
uses: docker/setup-buildx-action@v3
119+
120+
- name: Build + Push Docker ECR
121+
if: ${{ inputs.apply }}
122+
run: |
123+
make docker-push
124+
working-directory: deploy
125+
122126
- name: Terraform Apply
123127
if: ${{ inputs.apply }}
124128
run: |

.storoku.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@
9393
],
9494
"networks": [
9595
"warm",
96-
"forge"
96+
"forge",
97+
"test"
9798
],
9899
"writeToContainer": false
99100
}

deploy/.env.production.local.tpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<%
2-
if [[ "$TF_WORKSPACE" == "prod" || "$TF_WORKSPACE" == "forge-prod" || ${TF_VAR_use_prod_vars:-""} == "true" ]]; then
2+
if [[ "$TF_WORKSPACE" == "prod" || "$TF_WORKSPACE" == "forge-prod" || "$TF_WORKSPACE" == "forge-test" || ${TF_VAR_use_prod_vars:-""} == "true" ]]; then
33
PROVIDERS_CACHE_EXPIRATION_SECONDS=$((30 * 24 * 60 * 60))
44
NO_PROVIDERS_CACHE_EXPIRATION_SECONDS=$((24 * 60 * 60))
55
INDEXES_CACHE_EXPIRATION_SECONDS=$((24 * 60 * 60))
@@ -47,7 +47,7 @@ else
4747
BASE_TRACE_SAMPLE_RATIO="1.0"
4848
fi
4949

50-
if [[ "$TF_WORKSPACE" == "forge-prod" || "$TF_WORKSPACE" == "forge-staging" || "$TF_WORKSPACE" == "warm-staging" ]]; then
50+
if [[ "$TF_WORKSPACE" == "forge-prod" || "$TF_WORKSPACE" == "forge-test" || "$TF_WORKSPACE" == "forge-staging" || "$TF_WORKSPACE" == "warm-staging" ]]; then
5151
SUPPORT_LEGACY_SERVICES="false"
5252
else
5353
SUPPORT_LEGACY_SERVICES="true"

deploy/app/.terraform.lock.hcl

Lines changed: 40 additions & 36 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deploy/app/main.tf

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ terraform {
22
required_providers {
33
aws = {
44
source = "hashicorp/aws"
5-
version = ">= 5.86.0"
5+
version = ">= 6.0.0"
66
}
77
archive = {
88
source = "hashicorp/archive"
@@ -31,16 +31,10 @@ provider "aws" {
3131
}
3232
}
3333

34-
# CloudFront is a global service. Certs must be created in us-east-1, where the core ACM infra lives
35-
provider "aws" {
36-
region = "us-east-1"
37-
alias = "acm"
38-
}
39-
4034

4135

4236
module "app" {
43-
source = "github.com/storacha/storoku//app?ref=v0.5.1"
37+
source = "github.com/storacha/storoku//app?ref=v0.6.2"
4438
private_key = var.private_key
4539
httpport = 8080
4640
principal_mapping = var.principal_mapping
@@ -61,6 +55,8 @@ module "app" {
6155
# as env vars in the container at runtime
6256
secrets = {
6357
}
58+
# enter external secrets (provisioned out-of-band) here
59+
external_secrets = []
6460
# enter any sqs queues you want to create here
6561
queues = [
6662
{
@@ -84,7 +80,7 @@ module "app" {
8480
message_retention_seconds = 86400
8581
},
8682
]
87-
caches = ["providers", "no-providers", "indexes", "claims", ]
83+
caches = ["providers","no-providers","indexes","claims",]
8884
topics = []
8985
tables = [
9086
{
@@ -142,10 +138,6 @@ module "app" {
142138
object_expiration_days = 14
143139
},
144140
]
145-
providers = {
146-
aws = aws
147-
aws.acm = aws.acm
148-
}
149141
env_files = var.env_files
150142
domain_base = var.domain_base
151143
}

deploy/shared/.terraform.lock.hcl

Lines changed: 49 additions & 44 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deploy/shared/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ provider "aws" {
4949
}
5050

5151
module "shared" {
52-
source = "github.com/storacha/storoku//shared?ref=v0.5.1"
52+
source = "github.com/storacha/storoku//shared?ref=v0.6.2"
5353
providers = {
5454
aws = aws
5555
aws.dev = aws.dev

0 commit comments

Comments
 (0)