Move storage initialization into the backend executable
This commit is contained in:
@@ -8,6 +8,6 @@ docker run --rm \
|
||||
--mount "type=bind,source=$output,target=/out" \
|
||||
-w /work -e CARGO_TARGET_DIR=/tmp/bedrock-target \
|
||||
rust:1.91.1-bookworm sh -ec '
|
||||
cargo build --locked --release --bin bedrock
|
||||
install -m 755 /tmp/bedrock-target/release/bedrock /out/bedrock
|
||||
cargo build --locked --release -p backend
|
||||
install -m 755 /tmp/bedrock-target/release/backend /out/bedrock
|
||||
'
|
||||
|
||||
@@ -25,12 +25,12 @@ release="$revision.${stage##*.}"
|
||||
python3 "$(dirname "$0")/render-postgres.py" "$stage/bedrock.yaml" \
|
||||
--deployment production --config-version "$release"
|
||||
|
||||
# The current binary is a one-shot storage initializer. It publishes no ports.
|
||||
# Run storage initialization as a one-shot command in the release container.
|
||||
docker run --rm --network "$network" \
|
||||
--user "$(id -u):$(id -g)" --read-only --cap-drop ALL --security-opt no-new-privileges \
|
||||
--mount "type=bind,source=$stage,target=/release,readonly" \
|
||||
-e BEDROCK_DB_CONFIG=/release/bedrock.yaml \
|
||||
debian:bookworm-slim /release/bedrock
|
||||
debian:bookworm-slim /release/bedrock --init-storage
|
||||
|
||||
# Keep the final release private; only switch current after initialization succeeds.
|
||||
python3 - "$stage" "$root" "$release" <<'PY'
|
||||
|
||||
Reference in New Issue
Block a user