-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmise.toml
More file actions
206 lines (179 loc) · 7.83 KB
/
mise.toml
File metadata and controls
206 lines (179 loc) · 7.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
[tools]
dprint = "latest"
rust = { version = "1.92", components = "rustfmt,clippy", targets = "aarch64-unknown-linux-gnu,x86_64-unknown-linux-gnu,aarch64-unknown-linux-musl,x86_64-unknown-linux-musl" }
cargo-binstall = "latest"
"cargo:cross" = "latest"
postgres = "18"
yamlfmt = "latest"
[tasks."test:unit"]
description = "Run unit tests only (no Docker required)"
run = "cargo test --workspace"
[tasks."e2e"]
description = "Run all end-to-end tests sequentially (requires Docker and pg_receivewal on PATH). Use test:e2e:sink / test:e2e:cdc to run individually."
run = """
cargo test -p beyond-pg-sink --test e2e -- --include-ignored --nocapture
cargo test -p beyond-pg-cdc --test e2e -- --include-ignored --nocapture
"""
[tasks."test:boot"]
description = "Run beyond-pg boot end-to-end tests (requires Docker + musl target)"
run = "cargo test --test boot -- --include-ignored --nocapture"
[tasks."test:supervisor"]
description = "Run supervisor lifecycle tests (requires Docker + musl target + beyond-pg-test image)"
run = "cargo test --test supervisor -- --include-ignored --nocapture"
[tasks."test:handoff"]
description = "Run beyond-pg-init → supervisor handoff e2e tests (requires Docker + musl target + beyond-pg-test image)"
run = "cargo test --release --test handoff_e2e -- --include-ignored --nocapture --test-threads=1"
[tasks."test:e2e:sink"]
description = "Run WAL sink end-to-end test (requires Docker and pg_receivewal on PATH)"
run = "cargo test -p beyond-pg-sink --test e2e -- --include-ignored --nocapture"
[tasks."test:e2e:cdc"]
description = "Run CDC end-to-end test (requires Docker)"
run = "cargo test -p beyond-pg-cdc --test e2e -- --include-ignored --nocapture"
[tasks."build:rs"]
run = "cargo build"
[tasks."build:rs:release"]
run = "cargo build --release"
[tasks."build:beyond-pg"]
description = "Cross-compile beyond-pg + beyond-pg-init for Linux amd64 + arm64 as musl static binaries"
run = '''
cross build --release -p beyond-pg --target x86_64-unknown-linux-musl
cross build --release -p beyond-pg --target aarch64-unknown-linux-musl
cross build --release -p beyond-pg-init --target x86_64-unknown-linux-musl
cross build --release -p beyond-pg-init --target aarch64-unknown-linux-musl
'''
[tasks."build:sink"]
description = "Cross-compile beyond-pg-sink for Linux amd64 + arm64 as musl static binaries"
run = '''
cross build --release -p beyond-pg-sink --target x86_64-unknown-linux-musl
cross build --release -p beyond-pg-sink --target aarch64-unknown-linux-musl
'''
[tasks."build:test-image"]
description = "Build Docker test image with pgbouncer + pg_cron + stub extensions for supervisor tests"
run = '''
docker build -f docker/test/Dockerfile -t beyond-pg-test:latest docker/test
echo "==> Test image built: beyond-pg-test:latest"
'''
[tasks."check:rs"]
run = "cargo clippy --workspace -- -D warnings"
[tasks."check:fmt"]
run = "dprint check"
[tasks."format"]
run = "dprint fmt"
[tasks."build:image"]
description = "Build Postgres rootfs image with Packer"
usage = '''
arg "[version]" help="Ubuntu version (noble)" default="noble"
arg "[output_dir]" help="Output directory" default="/beyond/images/postgres"
flag "--arch <arch>" help="Target architecture (amd64, arm64). Auto-detected if not specified."
flag "--bless" help="Bless image for GlideFS direct boot after build"
flag "--tier <tier>" help="Space-separated tiers to build (e.g. '16g' or '16g 32g'). Default: 16g"
'''
run = '''
#!/usr/bin/env bash
set -euo pipefail
UBUNTU_VERSION="${version:-noble}"
OUTPUT_DIR="${output_dir:-/beyond/images/postgres}"
ARCH="${arch:-amd64}"
BUILD_TIERS="${tier:-16g}"
# Parse pinned versions from extensions.toml using python3 tomllib (stdlib 3.11+)
_toml() { python3 -c "import tomllib,sys; d=tomllib.load(open('extensions.toml','rb')); print(d$1)"; }
AUTH_GIT=$(_toml "['beyond']['auth']['git']")
AUTH_TAG=$(_toml "['beyond']['auth']['tag']")
QUEUE_GIT=$(_toml "['beyond']['queue']['git']")
QUEUE_TAG=$(_toml "['beyond']['queue']['tag']")
PGVECTOR_VER=$(_toml "['pgdg']['pgvector']")
PGVECTORSCALE_VER=$(_toml "['pgdg']['pgvectorscale']")
POSTGIS_VER=$(_toml "['pgdg']['postgis']")
PG_CRON_VER=$(_toml "['pgdg']['pg_cron']")
PG_PARTMAN_VER=$(_toml "['pgdg']['pg_partman']")
PG_JSONSCHEMA_VER=$(_toml "['pgdg']['pg_jsonschema']")
HYPOPG_VER=$(_toml "['pgdg']['hypopg']")
PG_REPACK_VER=$(_toml "['pgdg']['pg_repack']")
PG_SEARCH_VER=$(_toml "['paradedb']['pg_search']")
# Cross-compile musl static binaries for the target arch.
case "${ARCH}" in
arm64) MUSL_TARGET="aarch64-unknown-linux-musl" ;;
*) MUSL_TARGET="x86_64-unknown-linux-musl" ;;
esac
echo "==> Building musl static binaries for ${MUSL_TARGET}..."
cross build --release -p beyond-pg --target "${MUSL_TARGET}"
cross build --release -p beyond-pg-init --target "${MUSL_TARGET}"
cross build --release -p beyond-pg-sink --target "${MUSL_TARGET}"
# Stage pre-built binaries for Packer to install.
mkdir -p packer/staging/beyond-pg-bin
cp "target/${MUSL_TARGET}/release/beyond-pg" packer/staging/beyond-pg-bin/
cp "target/${MUSL_TARGET}/release/beyond-pg-init" packer/staging/beyond-pg-bin/
cp "target/${MUSL_TARGET}/release/beyond-pg-sink" packer/staging/beyond-pg-bin/
IMAGE_VERSION=$(git rev-parse --short HEAD)
packer build \
-var "ubuntu_version=${UBUNTU_VERSION}" \
-var "image_version=${IMAGE_VERSION}" \
-var "target_arch=${ARCH}" \
-var "output_dir=${OUTPUT_DIR}" \
-var "build_tiers=${BUILD_TIERS}" \
-var "auth_ext_git=${AUTH_GIT}" \
-var "auth_ext_tag=${AUTH_TAG}" \
-var "queue_ext_git=${QUEUE_GIT}" \
-var "queue_ext_tag=${QUEUE_TAG}" \
-var "pgvector_version=${PGVECTOR_VER}" \
-var "pgvectorscale_version=${PGVECTORSCALE_VER}" \
-var "postgis_version=${POSTGIS_VER}" \
-var "pg_cron_version=${PG_CRON_VER}" \
-var "pg_partman_version=${PG_PARTMAN_VER}" \
-var "pg_jsonschema_version=${PG_JSONSCHEMA_VER}" \
-var "hypopg_version=${HYPOPG_VER}" \
-var "pg_repack_version=${PG_REPACK_VER}" \
-var "pg_search_version=${PG_SEARCH_VER}" \
packer/templates/postgres-rootfs.pkr.hcl
if [[ "${bless:-}" == "true" ]]; then
IMAGE_NAME="postgres-${UBUNTU_VERSION}"
for tier in ${BUILD_TIERS}; do
IMG="${OUTPUT_DIR}/${IMAGE_NAME}-${tier}-${IMAGE_VERSION}.img"
BASE="${IMAGE_NAME}-${tier}"
echo "==> Blessing ${BASE}..."
packer/scripts/bless.sh --image "${IMG}" --name "${BASE}"
done
fi
'''
[tasks."bless:image"]
description = "Bless an existing Postgres image for GlideFS direct boot"
usage = '''
arg "<image_path>" help="Path to the .img file to bless"
arg "<base_name>" help="Human-readable base name (e.g., postgres-noble-16g)"
'''
run = '''
#!/usr/bin/env bash
set -euo pipefail
exec packer/scripts/bless.sh --image "${image_path}" --name "${base_name}"
'''
[tasks."bench:substrate"]
description = "GlideFS x Postgres substrate-tuning benchmark (measure-first rig)"
usage = '''
flag "--conf <conf>" help="Candidate postgresql.conf overlay" default="bench/glidefs-pg/conf/baseline.conf"
flag "--label <label>" help="Run label" default="baseline"
flag "--backend <backend>" help="Object store: file|memory|minio" default="file"
flag "--scale <scale>" help="pgbench scale" default="25"
flag "--duration <duration>" help="pgbench seconds" default="120"
flag "--cooldown <cooldown>" help="GlideFS compaction_cooldown" default="0"
'''
run = '''
#!/usr/bin/env bash
set -euo pipefail
exec bench/glidefs-pg/run.sh \
--conf "${conf}" --label "${label}" --backend "${backend}" \
--scale "${scale}" --duration "${duration}" --cooldown "${cooldown}"
'''
[tasks."publish:image"]
description = "Publish Postgres rootfs image to S3"
usage = '''
arg "[image_name]" help="Image name to publish" default="postgres-noble"
arg "[tier]" help="Tier to publish" default="16g"
'''
run = '''
#!/usr/bin/env bash
set -euo pipefail
: "${S3_BUCKET:?S3_BUCKET required}"
IMAGE_DIR="${OUTPUT_DIR:-/beyond/images/postgres}"
exec env IMAGE_DIR="${IMAGE_DIR}" packer/scripts/publish.sh \
"${image_name:-postgres-noble}" "${tier:-16g}"
'''