Skip to content

Commit 40cb26b

Browse files
committed
Merge develop into INDATA-378-08 and resolve conflicts
2 parents 255ff11 + 752dd55 commit 40cb26b

16 files changed

Lines changed: 87 additions & 65 deletions

.github/actions/build-ami/action.yml

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,27 @@ name: Build AMI
22
description: Build both stage 1 and stage 2 AMIs
33

44
inputs:
5-
postgres_version:
6-
description: 'PostgreSQL major version (e.g., 15)'
7-
required: true
8-
region:
9-
description: 'AWS region'
5+
ami_name_prefix:
6+
description: 'Prefix for the AMI name'
107
required: true
118
ami_regions:
129
description: 'AMI regions as JSON array (e.g., ["us-east-1"])'
1310
required: true
11+
arch:
12+
description: Architecture to build AMI for (amd64|arm64)
13+
required: true
1414
git_sha:
1515
description: 'Git SHA for this build'
1616
required: true
17-
ami_name_prefix:
18-
description: 'Prefix for the AMI name'
19-
required: false
20-
default: 'supabase-postgres'
21-
packer_template:
22-
description: 'Packer template for stage 1 (e.g., amazon-arm64-nix.pkr.hcl)'
23-
required: false
24-
default: 'amazon-arm64-nix.pkr.hcl'
2517
instance_type:
2618
description: 'EC2 instance type for the build'
27-
required: false
28-
default: 'c6g.4xlarge'
19+
required: true
20+
postgres_version:
21+
description: 'PostgreSQL major version (e.g., 15)'
22+
required: true
23+
region:
24+
description: 'AWS region'
25+
required: true
2926

3027
outputs:
3128
stage2_ami_id:
@@ -41,6 +38,13 @@ outputs:
4138
runs:
4239
using: "composite"
4340
steps:
41+
- name: Verify arch
42+
shell: bash
43+
run: |
44+
case ${{ inputs.arch }} in
45+
amd64 | arm64) ;;
46+
*) echo "Unknown arch input, expected:(amd64|arm64) got:${{ inputs.arch }}" >&2 && exit 1 ;;
47+
esac
4448
- name: Set execution ID
4549
id: set-execution-id
4650
shell: bash
@@ -68,12 +72,12 @@ runs:
6872
AWS_RETRY_MODE: adaptive
6973
AWS_REGION: ${{ inputs.region }}
7074
run: |
71-
nix run .#build-ami -- stage1 \
75+
nix run .#build-ami -- stage1 ${{ inputs.arch }} \
7276
-var "git-head-version=${{ inputs.git_sha }}" \
7377
-var "packer-execution-id=${{ env.EXECUTION_ID }}" \
7478
-var "ansible_arguments=-e postgresql_major=${{ inputs.postgres_version }}" \
7579
-var 'ami_regions=${{ inputs.ami_regions }}' \
76-
${{ inputs.packer_template }}
80+
amazon-${{ inputs.arch }}-nix.pkr.hcl
7781
7882
- name: Build AMI stage 2
7983
id: build-stage2
@@ -86,7 +90,7 @@ runs:
8690
AWS_RETRY_MODE: adaptive
8791
AWS_REGION: ${{ inputs.region }}
8892
run: |
89-
nix run .#build-ami -- stage2 \
93+
nix run .#build-ami -- stage2 ${{ inputs.arch }} \
9094
-var "git-head-version=${{ inputs.git_sha }}" \
9195
-var "packer-execution-id=${{ env.EXECUTION_ID }}" \
9296
-var "postgres_major_version=${{ inputs.postgres_version }}" \

.github/workflows/ami-release-nix-single.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ on:
1919
options:
2020
- arm64
2121
- amd64
22-
default: arm64
2322

2423
permissions:
2524
contents: write
@@ -53,19 +52,18 @@ jobs:
5352
id: arch_vars
5453
run: |
5554
ARCH="${{ github.event.inputs.arch }}"
55+
echo "arch=$ARCH" >>"$GITHUB_OUTPUT"
5656
if [ "$ARCH" = "amd64" ]; then
5757
{
58-
echo "packer_template=amazon-amd64-nix.pkr.hcl"
59-
echo "instance_type=c6i.4xlarge"
6058
echo "ami_name_prefix=supabase-postgres-x86"
6159
echo "arch_suffix=-x86"
60+
echo "instance_type=c6i.4xlarge"
6261
} >> "$GITHUB_OUTPUT"
6362
else
6463
{
65-
echo "packer_template=amazon-arm64-nix.pkr.hcl"
66-
echo "instance_type=c6g.4xlarge"
6764
echo "ami_name_prefix=supabase-postgres"
6865
echo "arch_suffix="
66+
echo "instance_type=c6g.4xlarge"
6967
} >> "$GITHUB_OUTPUT"
7068
fi
7169
@@ -83,11 +81,11 @@ jobs:
8381
with:
8482
postgres_version: ${{ github.event.inputs.postgres_version }}
8583
region: us-east-1
84+
ami_name_prefix: ${{ steps.arch_vars.outputs.ami_name_prefix }}
8685
ami_regions: '["us-east-1"]'
86+
arch: ${{ steps.arch_vars.outputs.arch }}
8787
git_sha: ${{ steps.get_sha.outputs.sha }}
88-
packer_template: ${{ steps.arch_vars.outputs.packer_template }}
8988
instance_type: ${{ steps.arch_vars.outputs.instance_type }}
90-
ami_name_prefix: ${{ steps.arch_vars.outputs.ami_name_prefix }}
9189

9290
- name: Grab release version
9391
id: process_release_version

.github/workflows/ami-release-nix.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@ jobs:
4444
- name: arm64
4545
runner: blacksmith-2vcpu-ubuntu-2404-arm
4646
packer_template: amazon-arm64-nix.pkr.hcl
47-
vars_file: development-arm.vars.pkr.hcl
47+
vars_file: development-arm64.vars.pkr.hcl
4848
instance_type: c6g.4xlarge
4949
nix_system: aarch64-linux
5050
ami_arch_filter: arm64
5151
- name: amd64
5252
runner: blacksmith-2vcpu-ubuntu-2404
5353
packer_template: amazon-amd64-nix.pkr.hcl
54-
vars_file: development-x86.vars.pkr.hcl
54+
vars_file: development-amd64.vars.pkr.hcl
5555
instance_type: c6i.4xlarge
5656
nix_system: x86_64-linux
5757
ami_arch_filter: x86_64

.github/workflows/base-image-nightly.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
nix run github:supabase/postgres/${GIT_SHA}#packer -- build \
5050
-var "git-head-version=${GIT_SHA}" \
5151
-var "packer-execution-id=${EXECUTION_ID}" \
52-
-var-file="development-arm.vars.pkr.hcl" \
52+
-var-file="development-arm64.vars.pkr.hcl" \
5353
-var "base-image-nightly=true" \
5454
-var "build-timestamp=${BUILD_TIMESTAMP}" \
5555
-var "region=us-east-1" \

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

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,14 @@ jobs:
3939
fail-fast: false
4040
matrix:
4141
postgres_version: ${{ fromJson(needs.prepare.outputs.postgres_versions) }}
42-
include:
43-
- runner: blacksmith-2vcpu-ubuntu-2404-arm
44-
arch: arm64
45-
ubuntu_release: noble
46-
ubuntu_version: 24.04
47-
mcpu: neoverse-n1
48-
runs-on: ${{ matrix.runner }}
42+
target:
43+
- arch: amd64
44+
instance_type: c6i.4xlarge
45+
runner: blacksmith-2vcpu-ubuntu-2404
46+
- arch: arm64
47+
instance_type: c6g.4xlarge
48+
runner: blacksmith-2vcpu-ubuntu-2404-arm
49+
runs-on: ${{ matrix.target.runner }}
4950
timeout-minutes: 150
5051

5152
steps:
@@ -93,11 +94,13 @@ jobs:
9394
id: build-ami
9495
uses: ./.github/actions/build-ami
9596
with:
96-
postgres_version: ${{ matrix.postgres_version }}
97-
region: ap-southeast-1
97+
ami_name_prefix: "supabase-postgres-${{ github.run_id }}-${{ matrix.target.arch }}"
9898
ami_regions: '["ap-southeast-1"]'
99+
arch: ${{ matrix.target.arch }}
99100
git_sha: ${{ github.sha }}
100-
ami_name_prefix: "supabase-postgres-${{ github.run_id }}"
101+
instance_type: ${{ matrix.target.instance_type }}
102+
postgres_version: ${{ matrix.postgres_version }}
103+
region: ap-southeast-1
101104

102105
- name: Run tests
103106
timeout-minutes: 10

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ Here's a comprehensive overview of the project's directory structure:
8787
| ansible.cfg | Ansible configuration |
8888
| amazon-arm64-nix.pkr.hcl | Packer configuration for AWS ARM64 builds |
8989
| common-nix.vars.pkr.hcl | Common Packer variables |
90-
| development-arm.vars.pkr.hcl | ARM development environment variables |
90+
| development-arm64.vars.pkr.hcl | ARM development environment variables |
9191
| CONTRIBUTING.md | Contribution guidelines |
9292
| README.md | Main project documentation |
9393

ansible/files/gotrue.service.j2

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ After=apparmor.service
1717
# We want sysctl's to be applied
1818
After=systemd-sysctl.service
1919

20+
# Ensure tuned is applied
21+
After=tuned.service
22+
2023
# UFW Is modified by cloud init, but started non-blocking, so configuration
2124
# could be in-flight while gotrue is starting. I want to ensure future rules
2225
# that are relied on for security posture are applied before gotrue runs.

ansible/tasks/setup-system.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,6 @@
154154
owner: 'root'
155155
group: 'root'
156156

157-
# Set Sysctl params specific to keepalives
158-
- name: Set net.ipv4.tcp_keepalive_time=1800
159-
ansible.builtin.sysctl:
160-
name: 'net.ipv4.tcp_keepalive_time'
161-
value: 1800
162-
state: 'present'
163-
164157
- name: Set net.ipv4.tcp_keepalive_intvl=60
165158
ansible.builtin.sysctl:
166159
name: 'net.ipv4.tcp_keepalive_intvl'

ansible/tasks/setup-tuned.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,18 +112,31 @@
112112
value: 10
113113

114114

115-
- name: tuned - Set ip_local_port_range
115+
- name: tuned - Set ip_local_reserved_ports
116116
become: true
117117
community.general.ini_file:
118118
create: true
119119
group: 'root'
120120
mode: '0644'
121121
no_extra_spaces: true
122-
option: 'net.ipv4.ip_local_port_range'
122+
option: 'net.ipv4.ip_local_reserved_ports'
123123
path: '/etc/tuned/profiles/postgresql/tuned.conf'
124124
section: 'sysctl'
125125
state: 'present'
126-
value: '1025 65499'
126+
value: '3000,3001,8085,9122,9187,9999'
127+
128+
- name: tuned - Set tcp_keepalive_time
129+
become: true
130+
community.general.ini_file:
131+
create: true
132+
group: 'root'
133+
mode: '0644'
134+
no_extra_spaces: true
135+
option: 'net.ipv4.tcp_keepalive_time'
136+
path: '/etc/tuned/profiles/postgresql/tuned.conf'
137+
section: 'sysctl'
138+
state: 'present'
139+
value: 1800
127140
- name: tuned - Load zstd compressor module
128141
become: true
129142
community.general.modprobe:

ansible/vars.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ postgres_major:
1010

1111
# Full version strings for each major version
1212
postgres_release:
13-
postgresorioledb-17: "17.6.0.090-orioledb"
14-
postgres17: "17.6.1.133"
15-
postgres15: "15.14.1.133"
13+
postgresorioledb-17: "17.6.0.091-orioledb"
14+
postgres17: "17.6.1.134"
15+
postgres15: "15.14.1.134"
1616

1717
# Non Postgres Extensions
1818
pgbouncer_release: 1.25.1

0 commit comments

Comments
 (0)