Skip to content

Commit 6f7e93a

Browse files
committed
fix: relocate all build ops to us-east-1
1 parent 5244ff1 commit 6f7e93a

File tree

10 files changed

+23
-23
lines changed

10 files changed

+23
-23
lines changed

.github/workflows/publish-migrations-prod.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
uses: aws-actions/configure-aws-credentials@v1
3333
with:
3434
role-to-assume: ${{ secrets.PROD_AWS_ROLE }}
35-
aws-region: "ap-southeast-1"
35+
aws-region: "us-east-1"
3636

3737
- name: Deploy to S3 prod
3838
shell: bash

.github/workflows/publish-migrations-staging.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
uses: aws-actions/configure-aws-credentials@v1
2626
with:
2727
role-to-assume: ${{ secrets.DEV_AWS_ROLE }}
28-
aws-region: "ap-southeast-1"
28+
aws-region: "us-east-1"
2929

3030
- name: Deploy to S3 staging
3131
shell: bash

.github/workflows/testinfra-ami-build.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,13 @@ jobs:
112112
run: |
113113
GIT_SHA=${{github.sha}}
114114
nix run github:supabase/postgres/${GIT_SHA}#packer -- init amazon-arm64-nix.pkr.hcl
115-
nix run github:supabase/postgres/${GIT_SHA}#packer -- build -var "git-head-version=${GIT_SHA}" -var "packer-execution-id=${EXECUTION_ID}" -var-file="development-arm.vars.pkr.hcl" -var-file="common-nix.vars.pkr.hcl" -var "ansible_arguments=" -var "postgres-version=${{ steps.random.outputs.random_string }}" -var "region=ap-southeast-1" -var 'ami_regions=["ap-southeast-1"]' -var "force-deregister=true" -var "ansible_arguments=-e postgresql_major=${POSTGRES_MAJOR_VERSION}" amazon-arm64-nix.pkr.hcl
115+
nix run github:supabase/postgres/${GIT_SHA}#packer -- build -var "git-head-version=${GIT_SHA}" -var "packer-execution-id=${EXECUTION_ID}" -var-file="development-arm.vars.pkr.hcl" -var-file="common-nix.vars.pkr.hcl" -var "ansible_arguments=" -var "postgres-version=${{ steps.random.outputs.random_string }}" -var "region=us-east-1" -var 'ami_regions=["us-east-1"]' -var "force-deregister=true" -var "ansible_arguments=-e postgresql_major=${POSTGRES_MAJOR_VERSION}" amazon-arm64-nix.pkr.hcl
116116
117117
- name: Build AMI stage 2
118118
run: |
119119
GIT_SHA=${{github.sha}}
120120
nix run github:supabase/postgres/${GIT_SHA}#packer -- init stage2-nix-psql.pkr.hcl
121-
nix run github:supabase/postgres/${GIT_SHA}#packer -- build -var "git-head-version=${GIT_SHA}" -var "packer-execution-id=${EXECUTION_ID}" -var "postgres_major_version=${POSTGRES_MAJOR_VERSION}" -var-file="development-arm.vars.pkr.hcl" -var-file="common-nix.vars.pkr.hcl" -var "postgres-version=${{ steps.random.outputs.random_string }}" -var "region=ap-southeast-1" -var 'ami_regions=["ap-southeast-1"]' -var "force-deregister=true" -var "git_sha=${GITHUB_SHA}" stage2-nix-psql.pkr.hcl
121+
nix run github:supabase/postgres/${GIT_SHA}#packer -- build -var "git-head-version=${GIT_SHA}" -var "packer-execution-id=${EXECUTION_ID}" -var "postgres_major_version=${POSTGRES_MAJOR_VERSION}" -var-file="development-arm.vars.pkr.hcl" -var-file="common-nix.vars.pkr.hcl" -var "postgres-version=${{ steps.random.outputs.random_string }}" -var "region=us-east-1" -var 'ami_regions=["us-east-1"]' -var "force-deregister=true" -var "git_sha=${GITHUB_SHA}" stage2-nix-psql.pkr.hcl
122122
123123
- name: Run tests
124124
timeout-minutes: 10
@@ -132,12 +132,12 @@ jobs:
132132
- name: Cleanup resources on build cancellation
133133
if: ${{ cancelled() }}
134134
run: |
135-
aws ec2 --region ap-southeast-1 describe-instances --filters "Name=tag:packerExecutionId,Values=${EXECUTION_ID}" --query "Reservations[].Instances[].InstanceId" --output text | xargs -r aws ec2 terminate-instances --region ap-southeast-1 --instance-ids
135+
aws ec2 --region us-east-1 describe-instances --filters "Name=tag:packerExecutionId,Values=${EXECUTION_ID}" --query "Reservations[].Instances[].InstanceId" --output text | xargs -r aws ec2 terminate-instances --region us-east-1 --instance-ids
136136
137137
- name: Cleanup resources after build
138138
if: ${{ always() }}
139139
run: |
140-
aws ec2 --region ap-southeast-1 describe-instances --filters "Name=tag:testinfra-run-id,Values=${EXECUTION_ID}" --query "Reservations[].Instances[].InstanceId" --output text | xargs -r aws ec2 terminate-instances --region ap-southeast-1 --instance-ids || true
140+
aws ec2 --region us-east-1 describe-instances --filters "Name=tag:testinfra-run-id,Values=${EXECUTION_ID}" --query "Reservations[].Instances[].InstanceId" --output text | xargs -r aws ec2 terminate-instances --region us-east-1 --instance-ids || true
141141
142142
- name: Cleanup AMIs
143143
if: always()
@@ -149,10 +149,10 @@ jobs:
149149
# Function to deregister AMIs by name pattern
150150
deregister_ami_by_name() {
151151
local ami_name_pattern=$1
152-
local ami_ids=$(aws ec2 describe-images --region ap-southeast-1 --owners self --filters "Name=name,Values=${ami_name_pattern}" --query 'Images[*].ImageId' --output text)
152+
local ami_ids=$(aws ec2 describe-images --region us-east-1 --owners self --filters "Name=name,Values=${ami_name_pattern}" --query 'Images[*].ImageId' --output text)
153153
for ami_id in $ami_ids; do
154154
echo "Deregistering AMI: $ami_id"
155-
aws ec2 deregister-image --region ap-southeast-1 --image-id $ami_id
155+
aws ec2 deregister-image --region us-east-1 --image-id $ami_id
156156
done
157157
}
158158

amazon-arm64-nix.pkr.hcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ variable "ami_name" {
1515

1616
variable "ami_regions" {
1717
type = list(string)
18-
default = ["ap-southeast-2"]
18+
default = ["us-east-1"]
1919
}
2020

2121
variable "ansible_arguments" {

nix/docs/development-workflow.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ This will:
110110

111111
The following environment variables are used:
112112
- `AWS_VAULT`: AWS Vault profile name (default: staging)
113-
- `AWS_REGION`: AWS region (default: ap-southeast-1)
113+
- `AWS_REGION`: AWS region (default: us-east-1)
114114
- `AMI_NAME`: Name of the AMI to test
115115

116116
## Best Practices

nix/packages/build-test-ami.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ runCommand "build-test-ami"
8484
fi
8585
8686
# Set values
87-
REGION="ap-southeast-1"
87+
REGION="us-east-1"
8888
POSTGRES_VERSION="$1"
8989
RANDOM_STRING=$(openssl rand -hex 8)
9090
GIT_SHA=$(git rev-parse HEAD)

nix/packages/cleanup-ami.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ runCommand "cleanup-ami"
4545
fi
4646
4747
AMI_NAME="$1"
48-
REGION="ap-southeast-1"
48+
REGION="us-east-1"
4949
5050
# Deregister AMIs
5151
for AMI_PATTERN in "supabase-postgres-ci-ami-test-stage-1" "$AMI_NAME"; do

nix/packages/run-testinfra.nix

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,19 +93,19 @@ runCommand "run-testinfra"
9393
fi
9494
9595
# Set environment variables
96-
export AWS_REGION="ap-southeast-1"
97-
export AWS_DEFAULT_REGION="ap-southeast-1"
96+
export AWS_REGION="us-east-1"
97+
export AWS_DEFAULT_REGION="us-east-1"
9898
export AMI_NAME="$AMI_NAME" # Export AMI_NAME for pytest
9999
export RUN_ID="local-$(date +%s)" # Generate a unique RUN_ID
100100
101101
# Function to terminate EC2 instances
102102
terminate_instances() {
103103
echo "Terminating EC2 instances with tag testinfra-run-id=$RUN_ID..."
104-
aws-vault exec $AWS_VAULT_PROFILE -- aws ec2 --region ap-southeast-1 describe-instances \
104+
aws-vault exec $AWS_VAULT_PROFILE -- aws ec2 --region us-east-1 describe-instances \
105105
--filters "Name=tag:testinfra-run-id,Values=$RUN_ID" \
106106
--query "Reservations[].Instances[].InstanceId" \
107107
--output text | xargs -r aws-vault exec $AWS_VAULT_PROFILE -- aws ec2 terminate-instances \
108-
--region ap-southeast-1 --instance-ids || true
108+
--region us-east-1 --instance-ids || true
109109
}
110110
111111
# Set up traps for various signals to ensure cleanup

testinfra/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ AWS_PROFILE=supabase-dev packer build \
5656
-var-file=common.vars.pkr.hcl \
5757
-var "ansible_arguments=" \
5858
-var "postgres-version=ci-ami-test" \
59-
-var "region=ap-southeast-1" \
60-
-var 'ami_regions=["ap-southeast-1"]' \
59+
-var "region=us-east-1" \
60+
-var 'ami_regions=["us-east-1"]' \
6161
-var "force-deregister=true" \
6262
amazon-arm64.pkr.hcl
6363

testinfra/test_ami_nix.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
"""
133133
walg_config_json_content = """
134134
{
135-
"AWS_REGION": "ap-southeast-1",
135+
"AWS_REGION": "us-east-1",
136136
"WALG_S3_PREFIX": "",
137137
"PGDATABASE": "postgres",
138138
"PGUSER": "supabase_admin",
@@ -158,7 +158,7 @@
158158
"service_key": "{service_role_key}",
159159
"supabase_admin_key": "{supabase_admin_key}",
160160
"common_name": "db.aaaaaaaaaaaaaaaaaaaa.supabase.red",
161-
"region": "ap-southeast-1",
161+
"region": "us-east-1",
162162
"init_database_only": false
163163
}}
164164
"""
@@ -223,7 +223,7 @@ def run_ssh_command(ssh, command, timeout=None):
223223
# scope='function' uses a new container per test function.
224224
@pytest.fixture(scope="session")
225225
def host():
226-
ec2 = boto3.resource("ec2", region_name="ap-southeast-1")
226+
ec2 = boto3.resource("ec2", region_name="us-east-1")
227227
images = list(
228228
ec2.images.filter(
229229
Filters=[{"Name": "name", "Values": [AMI_NAME]}],
@@ -256,7 +256,7 @@ def gzip_then_base64_encode(s: str) -> str:
256256
"HttpTokens": "required",
257257
"HttpEndpoint": "enabled",
258258
},
259-
IamInstanceProfile={"Name": "pg-ap-southeast-1"},
259+
IamInstanceProfile={"Name": "pg-us-east-1"},
260260
InstanceType="t4g.micro",
261261
MinCount=1,
262262
MaxCount=1,
@@ -281,7 +281,7 @@ def gzip_then_base64_encode(s: str) -> str:
281281
- {{path: /tmp/init.json, content: {gzip_then_base64_encode(init_json_content)}, permissions: '0600', encoding: gz+b64}}
282282
runcmd:
283283
- 'sudo echo \"pgbouncer\" \"postgres\" >> /etc/pgbouncer/userlist.txt'
284-
- 'cd /tmp && aws s3 cp --region ap-southeast-1 s3://init-scripts-staging/project/init.sh .'
284+
- 'cd /tmp && aws s3 cp --region us-east-1 s3://init-scripts-staging/project/init.sh .'
285285
- 'bash init.sh "staging"'
286286
- 'touch /var/lib/init-complete'
287287
- 'rm -rf /tmp/*'

0 commit comments

Comments
 (0)