Skip to content

Commit ed46f2a

Browse files
committed
Rebrand BemiDB as PgStack with local Search and Audit
1 parent 67ab311 commit ed46f2a

229 files changed

Lines changed: 14560 additions & 25622 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.dockerignore‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
**
2+
!cdc/
3+
!cdc/*.go
4+
!cdc/go.mod
5+
!cdc/go.sum
6+
!processor/
7+
!processor/*.go
8+
!processor/go.mod
9+
!processor/go.sum
10+
!server/
11+
!server/*.go
12+
!server/go.mod
13+
!server/go.sum
14+
!local-entrypoint.sh
15+
!Dockerfile
16+
!local_config.py

‎.env.sample‎

Lines changed: 0 additions & 16 deletions
This file was deleted.

‎.github/workflows/build.yml‎

Lines changed: 0 additions & 21 deletions
This file was deleted.

‎.github/workflows/image.yml‎

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
name: Test and release
2+
on:
3+
push:
4+
branches: [main]
5+
pull_request:
6+
release:
7+
types: [published]
8+
workflow_dispatch:
9+
permissions:
10+
contents: read
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
13+
cancel-in-progress: ${{ github.event_name != 'release' }}
14+
jobs:
15+
test:
16+
runs-on: ubuntu-24.04
17+
timeout-minutes: 20
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
module: [cdc, processor, server]
22+
steps:
23+
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
24+
with:
25+
persist-credentials: false
26+
- uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
27+
with:
28+
go-version: '1.26'
29+
cache-dependency-path: '${{ matrix.module }}/go.sum'
30+
- run: go vet ./... && go test ./...
31+
working-directory: ${{ matrix.module }}
32+
config-checks:
33+
runs-on: ubuntu-24.04
34+
timeout-minutes: 5
35+
steps:
36+
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
37+
with:
38+
persist-credentials: false
39+
- run: sudo apt-get update && sudo apt-get install -y python3-yaml jq shellcheck
40+
- run: /usr/bin/python3 -m unittest discover -p 'test_local_config.py'
41+
- run: shellcheck local-entrypoint.sh tests/smoke.sh
42+
container:
43+
needs: [test, config-checks]
44+
timeout-minutes: 45
45+
strategy:
46+
fail-fast: false
47+
matrix:
48+
include:
49+
- runner: ubuntu-24.04
50+
arch: amd64
51+
- runner: ubuntu-24.04-arm
52+
arch: arm64
53+
runs-on: ${{ matrix.runner }}
54+
steps:
55+
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
56+
with:
57+
persist-credentials: false
58+
- uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
59+
- uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
60+
with:
61+
context: .
62+
load: true
63+
tags: pgstack:test
64+
cache-from: type=gha,scope=${{ matrix.arch }}
65+
cache-to: type=gha,mode=max,scope=${{ matrix.arch }}
66+
- run: bash tests/smoke.sh pgstack:test
67+
publish:
68+
if: github.event_name == 'release'
69+
needs: container
70+
runs-on: ubuntu-24.04
71+
timeout-minutes: 60
72+
permissions:
73+
contents: read
74+
packages: write
75+
steps:
76+
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
77+
with:
78+
persist-credentials: false
79+
- uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3
80+
- uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
81+
- uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
82+
with:
83+
registry: ghcr.io
84+
username: ${{ github.actor }}
85+
password: ${{ secrets.GITHUB_TOKEN }}
86+
- uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5
87+
id: meta
88+
with:
89+
images: ghcr.io/pgstack-io/pgstack
90+
flavor: latest=false
91+
tags: |
92+
type=ref,event=tag
93+
type=semver,pattern={{version}}
94+
type=raw,value=latest,enable=${{ !github.event.release.prerelease }}
95+
- uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
96+
with:
97+
context: .
98+
platforms: linux/amd64,linux/arm64
99+
push: true
100+
tags: ${{ steps.meta.outputs.tags }}
101+
labels: ${{ steps.meta.outputs.labels }}
102+
provenance: mode=max
103+
sbom: true
104+
cache-from: |
105+
type=gha,scope=amd64
106+
type=gha,scope=arm64
107+
- name: Verify anonymous image access
108+
env:
109+
IMAGE_TAG: ${{ github.event.release.tag_name }}
110+
run: |
111+
docker logout ghcr.io
112+
if ! docker buildx imagetools inspect "ghcr.io/pgstack-io/pgstack:${IMAGE_TAG}"; then
113+
echo "Set the GHCR package visibility to public, then verify an anonymous pull." >&2
114+
exit 1
115+
fi

‎.gitignore‎

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
1-
/iceberg
2-
/iceberg-test
3-
/src/iceberg
4-
/src/iceberg-test
5-
.DS_Store
6-
.vscode
71
.env
8-
/benchmark/tpch-kit
9-
/benchmark/data/*.tbl
10-
/build
11-
bemidb
12-
/src/__debug*
2+
.env.*
3+
!.env.example
4+
.devbox/
5+
.DS_Store
6+
*.log
7+
__pycache__/

‎CHANGELOG.md‎

Lines changed: 0 additions & 3 deletions
This file was deleted.

‎CONTRIBUTING.md‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Contributing
2+
3+
Bug reports and focused pull requests are welcome. Include a minimal reproduction, source Postgres version, PgStack version, and redacted logs. Never include database credentials, API keys, or customer data.
4+
5+
The repository contains three Go modules:
6+
7+
- `cdc`: Postgres logical replication and initial Search snapshots.
8+
- `processor`: Audit storage and Search indexing.
9+
- `server`: SQL compatibility, query execution, and authentication.
10+
11+
Use `make test` and `make lint` with Devbox, then `make build` to check the complete local image. Add regression tests for behavior changes. Keep fixtures synthetic. Document public configuration changes in the README and preserve the simple local quickstart.
12+
13+
BemiDB 1.x history remains available in Git. PgStack 2.x is a new runtime and configuration; do not assume compatibility with old deployment instructions or storage layouts.
14+
15+
Contributions are provided under the repository's AGPL-3.0 license.

‎Dockerfile‎

Lines changed: 40 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,60 @@
1-
ARG PLATFORM=linux/arm64
1+
FROM golang:1.26-bookworm AS go-builder
22

3-
FROM --platform=$PLATFORM debian:12-slim AS base
3+
WORKDIR /src
44

5-
RUN apt-get update \
6-
&& apt-get install -y --no-install-recommends \
7-
curl ca-certificates \
8-
postgresql-client \
9-
gcc g++ libc6-dev \
10-
&& rm -rf /var/lib/apt/lists/*
5+
COPY cdc/ ./cdc/
6+
COPY processor/ ./processor/
7+
COPY server/ ./server/
118

12-
RUN adduser --disabled-login app
9+
RUN --mount=type=cache,target=/go/pkg/mod \
10+
--mount=type=cache,target=/root/.cache/go-build \
11+
cd cdc && CGO_ENABLED=1 go build -mod=readonly -trimpath -ldflags="-s -w" -o /out/cdc . && \
12+
cd ../processor && CGO_ENABLED=1 go build -mod=readonly -trimpath -ldflags="-s -w" -o /out/processor . && \
13+
cd ../server && CGO_ENABLED=1 go build -mod=readonly -trimpath -ldflags="-s -w" -o /out/server .
1314

14-
WORKDIR /app
15-
16-
COPY --chown=app:app scripts/catalog.sql /app/scripts/
17-
18-
# Set up syncers and server ########################################################################
19-
20-
FROM base AS compile
15+
################################################################################
2116

22-
# Install Go
17+
FROM nats:2.11.8 AS nats-server
2318

24-
ENV GOROOT /usr/local/go
25-
ENV GOPATH /go
26-
ENV PATH $GOPATH/bin:$GOROOT/bin:$PATH
19+
################################################################################
2720

28-
RUN \
29-
ARCH=$(dpkg --print-architecture) \
30-
&& curl -L "https://go.dev/dl/go1.24.4.linux-$ARCH.tar.gz" -o go.tar.gz \
31-
&& tar -C /usr/local -xzf go.tar.gz \
32-
&& rm go.tar.gz \
33-
&& mkdir -p "$GOPATH/src" "$GOPATH/bin" \
34-
&& chmod -R 777 "$GOPATH"
21+
FROM natsio/nats-box:0.19.7 AS nats-box
3522

36-
# Compile syncers and server
23+
################################################################################
3724

38-
COPY --chown=app:app src/common/go.mod src/common/go.sum /app/src/common/
25+
FROM rclone/rclone:1.74.2 AS rclone
3926

40-
COPY --chown=app:app src/syncer-postgres/lib/go.mod src/syncer-postgres/lib/go.sum /app/src/syncer-postgres/lib/
41-
COPY --chown=app:app src/syncer-postgres/go.mod src/syncer-postgres/go.sum /app/src/syncer-postgres/
42-
RUN cd /app/src/syncer-postgres && go mod download
27+
################################################################################
4328

44-
COPY --chown=app:app src/syncer-amplitude/lib/go.mod src/syncer-amplitude/lib/go.sum /app/src/syncer-amplitude/lib/
45-
COPY --chown=app:app src/syncer-amplitude/go.mod src/syncer-amplitude/go.sum /app/src/syncer-amplitude/
46-
RUN cd /app/src/syncer-amplitude && go mod download
29+
FROM debian:bookworm-slim
4730

48-
COPY --chown=app:app src/syncer-attio/lib/go.mod src/syncer-attio/lib/go.sum /app/src/syncer-attio/lib/
49-
COPY --chown=app:app src/syncer-attio/go.mod src/syncer-attio/go.sum /app/src/syncer-attio/
50-
RUN cd /app/src/syncer-attio && go mod download
31+
RUN apt-get update && \
32+
apt-get install -y --no-install-recommends ca-certificates libstdc++6 postgresql-client tini jq python3-yaml && \
33+
rm -rf /var/lib/apt/lists/*
5134

52-
COPY --chown=app:app src/syncer-dialpad/lib/go.mod src/syncer-dialpad/lib/go.sum /app/src/syncer-dialpad/lib/
53-
COPY --chown=app:app src/syncer-dialpad/go.mod src/syncer-dialpad/go.sum /app/src/syncer-dialpad/
54-
RUN cd /app/src/syncer-dialpad && go mod download
35+
RUN useradd --create-home --uid 10001 app && \
36+
mkdir -p /app/bin /var/lib/pgstack && \
37+
chown -R app:app /app /var/lib/pgstack
5538

56-
COPY --chown=app:app src/server/go.mod src/server/go.sum /app/src/server/
57-
RUN cd /app/src/server && go mod download
39+
COPY --from=nats-server /nats-server /usr/local/bin/nats-server
40+
COPY --from=nats-box /usr/local/bin/nats /usr/local/bin/nats
41+
COPY --from=rclone /usr/local/bin/rclone /usr/local/bin/rclone
42+
COPY --from=go-builder /out/cdc /app/bin/cdc
43+
COPY --from=go-builder /out/processor /app/bin/processor
44+
COPY --from=go-builder /out/server /app/bin/server
45+
COPY --chown=app:app local-entrypoint.sh /app/local-entrypoint.sh
5846

59-
COPY --chown=app:app src/common /app/src/common
60-
COPY --chown=app:app src/syncer-postgres /app/src/syncer-postgres
61-
COPY --chown=app:app src/syncer-amplitude /app/src/syncer-amplitude
62-
COPY --chown=app:app src/syncer-attio /app/src/syncer-attio
63-
COPY --chown=app:app src/syncer-dialpad /app/src/syncer-dialpad
64-
COPY --chown=app:app src/server /app/src/server
47+
COPY --chown=app:app local_config.py /app/local_config.py
6548

66-
RUN ARCH=$(dpkg --print-architecture) \
67-
&& cd /app/src/syncer-postgres && CGO_ENABLED=1 GOOS=linux GOARCH=$ARCH go build -o /app/bin/syncer-postgres \
68-
&& cd /app/src/syncer-amplitude && CGO_ENABLED=1 GOOS=linux GOARCH=$ARCH go build -o /app/bin/syncer-amplitude \
69-
&& cd /app/src/syncer-attio && CGO_ENABLED=1 GOOS=linux GOARCH=$ARCH go build -o /app/bin/syncer-attio \
70-
&& cd /app/src/syncer-dialpad && CGO_ENABLED=1 GOOS=linux GOARCH=$ARCH go build -o /app/bin/syncer-dialpad \
71-
&& cd /app/src/server && CGO_ENABLED=1 GOOS=linux GOARCH=$ARCH go build -o /app/bin/server
72-
73-
# Prepare final image ##############################################################################
49+
USER app
50+
WORKDIR /app
7451

75-
FROM base AS final
52+
LABEL org.opencontainers.image.title="PgStack" \
53+
org.opencontainers.image.source="https://github.com/pgstack-io/pgstack" \
54+
org.opencontainers.image.licenses="AGPL-3.0"
7655

77-
COPY --chown=app:app --from=compile \
78-
/app/bin/syncer-postgres \
79-
/app/bin/syncer-amplitude \
80-
/app/bin/syncer-attio \
81-
/app/bin/syncer-dialpad \
82-
/app/bin/server \
83-
/app/bin/
84-
COPY --chown=app:app docker/bin /app/bin/
56+
ENV PGHOST=127.0.0.1 PGPORT=54321 PGDATABASE=pgstack PGUSER=pgstack
8557

86-
USER app
58+
EXPOSE 54321
8759

88-
ENTRYPOINT ["/app/bin/run.sh"]
60+
ENTRYPOINT ["/usr/bin/tini", "-g", "--", "/app/local-entrypoint.sh"]

0 commit comments

Comments
 (0)