Repository navigation
Commit 1293179
refactor(ami): share provisioning steps between qemu and ami builds (#2567)
* refactor(ami): share provisioning steps between qemu and ami builds
Move the Nix install, playbook run, Nix GC and report steps that
qemu-bootstrap-nix.sh and nix-provision.sh duplicated into
provision-common.sh. Both Packer builds upload it to /tmp.
Refs: MPG-1383
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* refactor(ami): share stage 1 and cleanup steps between builds
Move locale, postgres env, sshd password auth and the image cleanup
tail into provision-common.sh. The AMI chroot scripts get the library
copied into /mnt/tmp.
Refs: MPG-1383
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* fix(ami): set vector-readable wal-g log modes on the ami
Share the image log setup between both builds. The AMI now ships
/var/log/wal-g as 0310 and pitr.log as 0340, matching QEMU and the
salt vector formula, so vector can read pitr.log without salt.
Refs: MPG-1383
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* fix(ami): source the shared script in the surrogate bootstrap
clean_system calls setup_image_logs, which lives in provision-common.sh.
The surrogate script copied the library into the chroot but never
sourced it on the host.
Refs: MPG-1383
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* refactor(ami): share the ansible install and drop qemu-vars
Add install_ansible to provision-common.sh for all three bootstrap
scripts. Delete ansible/qemu-vars.yaml: it set a var the templates
never read, so the QEMU splay was always the vars.yml default.
Refs: MPG-1383
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* refactor(ami): run the ami stage 1 playbook through run_playbook
run_playbook takes the inventory host and connection as arguments, so
the chroot run shares it with the local runs. Drop the sed that
rewrote the playbook hosts line and use -i localhost, -c local instead.
Refs: MPG-1383
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* refactor(ami): stop shadowing library functions in the chroot scripts
Drop the update_and_upgrade_apt copies that matched the library. Rename
the chroot cleanup_apt and report_packages, which differ from the
library versions, to clean_apt_cache and report_chroot_packages.
Refs: MPG-1383
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* refactor(ami): share apt setup, boot wait and file cleanup
Move the apt mirror fallback, DEBIAN_FRONTEND export, cloud-init wait
and the unwanted-files removal into provision-common.sh. Mark only
zlib1g-dev for autoremove on QEMU.
Refs: MPG-1383
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* fix(ami): remove /usr/share/doc on qemu and drop libgcc-8-dev purge
The qemu doc removal used an /mnt path and did nothing on the live VM.
Do it in remove_unwanted_files for both targets. noble has no
libgcc-8-dev, so drop it from the aarch64 purge list.
Refs: MPG-1383
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* refactor(ami): share the package purge between cleanup scripts
Add purge_packages to provision-common.sh with the build leftovers both
targets remove and the shared autoremove, autoclean and upgrade tail.
cleanup-qemu.sh passes its extra names. The purge sets are unchanged.
Refs: MPG-1383
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* refactor(ansible): move qemu-specific values into per-target vars
Load ansible/vars/aws.yml or qemu.yml from the playbook. The UID and
GID pins, the supascan baseline prefix and the differing values in the
adminapi, gotrue, postgres_exporter and admin-agent templates now come
from vars. Rendered templates and pins are unchanged for both targets.
Refs: MPG-1383
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* fix(ami): mark zlib1g and zlib1g-dev auto on qemu
Restore both packages to the base image state after the Kong purge.
setup-kong.yml marks them manual, and the previous change left zlib1g
manual.
Refs: MPG-1383
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* refactor(ami): zero and trim the disk at the end of each build
Add finalize_disk to provision-common.sh and call it as the last step
of the qemu build, the ami stage 1 clean_system and the ami stage 2
script. Stage 2 only trims. Zeroing and fstrim leave cleanup.sh and
cleanup-qemu.sh, and the login records are emptied before them.
Refs: MPG-1383, MPG-90
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* refactor(ami): address review nits on the stage 2 call and gotrue comments
Inline execute_stage2_playbook in nix-provision.sh. Replace the
per-target gotrue comment vars with one static comment.
Refs: MPG-1383
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* fix(ami): skip fstrim on the ebs-backed ami builds
EBS does not support discard, so fstrim failed the ami stage 1 build.
Add a trim argument to finalize_disk, zero without trimming in stage 1,
and drop the trim-only call from stage 2.
Refs: MPG-1383, MPG-90
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* refactor(ami): default the finalize_disk root to /
An empty root has no use here. dd and rm on //zerofile hit the same
file as /zerofile.
Refs: MPG-1383, MPG-90
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>1 parent 05749ee commit 1293179
28 files changed
Lines changed: 433 additions & 565 deletions
File tree
- ansible
- files
- supabase_admin_agent_config
- tasks
- internal
- vars
- packer
- scripts
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | | - | |
19 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
102 | 97 | | |
103 | 98 | | |
104 | 99 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | | - | |
| 9 | + | |
11 | 10 | | |
12 | 11 | | |
13 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
18 | 12 | | |
19 | 13 | | |
20 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
8 | | - | |
| 6 | + | |
9 | 7 | | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
18 | 11 | | |
| 12 | + | |
19 | 13 | | |
20 | 14 | | |
21 | 15 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
186 | 187 | | |
187 | 188 | | |
188 | 189 | | |
189 | | - | |
| 190 | + | |
190 | 191 | | |
191 | 192 | | |
192 | 193 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
0 commit comments