Skip to content

Commit 2ca21b2

Browse files
authored
pgcat deb package (#539)
1 parent 3986eaa commit 2ca21b2

File tree

3 files changed

+90
-0
lines changed

3 files changed

+90
-0
lines changed
+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: pgcat package (deb)
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
packageVersion:
7+
default: "1.1.1"
8+
jobs:
9+
build:
10+
strategy:
11+
max-parallel: 1
12+
fail-fast: false # Let the other job finish, or they can lock each other out
13+
matrix:
14+
os: ["buildjet-4vcpu-ubuntu-2204", "buildjet-4vcpu-ubuntu-2204-arm"]
15+
16+
runs-on: ${{ matrix.os }}
17+
steps:
18+
- uses: actions/checkout@v3
19+
- uses: actions-rs/toolchain@v1
20+
with:
21+
toolchain: stable
22+
- name: Install dependencies
23+
env:
24+
DEBIAN_FRONTEND: noninteractive
25+
TZ: Etc/UTC
26+
run: |
27+
curl -sLO https://github.com/deb-s3/deb-s3/releases/download/0.11.4/deb-s3-0.11.4.gem
28+
sudo gem install deb-s3-0.11.4.gem
29+
dpkg-deb --version
30+
- name: Build and release package
31+
env:
32+
AWS_ACCESS_KEY_ID: ${{ vars.AWS_ACCESS_KEY_ID }}
33+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
34+
AWS_DEFAULT_REGION: ${{ vars.AWS_DEFAULT_REGION }}
35+
run: |
36+
if [[ $(arch) == "x86_64" ]]; then
37+
export ARCH=amd64
38+
else
39+
export ARCH=arm64
40+
fi
41+
42+
bash utilities/deb.sh ${{ inputs.packageVersion }}
43+
44+
deb-s3 upload \
45+
--lock \
46+
--bucket apt.postgresml.org \
47+
pgcat-${{ inputs.packageVersion }}-ubuntu22.04-${ARCH}.deb \
48+
--codename $(lsb_release -cs)

control

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Package: pgcat
2+
Version: ${PACKAGE_VERSION}
3+
Section: database
4+
Priority: optional
5+
Architecture: ${ARCH}
6+
Maintainer: PostgresML <[email protected]>
7+
Homepage: https://postgresml.org
8+
Description: PgCat - NextGen PostgreSQL Pooler
9+
PostgreSQL pooler and proxy (like PgBouncer) with support for sharding, load balancing, failover and mirroring.

utilities/deb.sh

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash
2+
#
3+
# Build an Ubuntu deb.
4+
#
5+
script_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
6+
deb_dir="/tmp/pgcat-build"
7+
export PACKAGE_VERSION=${1:-"1.1.1"}
8+
if [[ $(arch) == "x86_64" ]]; then
9+
export ARCH=amd64
10+
else
11+
export ARCH=arm64
12+
fi
13+
14+
cd "$script_dir/.."
15+
cargo build --release
16+
17+
rm -rf "$deb_dir"
18+
mkdir -p "$deb_dir/DEBIAN"
19+
mkdir -p "$deb_dir/usr/bin"
20+
mkdir -p "$deb_dir/etc"
21+
22+
cp target/release/pgcat "$deb_dir/usr/bin/pgcat"
23+
chmod +x "$deb_dir/usr/bin/pgcat"
24+
25+
cp pgcat.toml "$deb_dir/etc/pgcat.toml"
26+
27+
(cat control | envsubst) > "$deb_dir/DEBIAN/control"
28+
29+
dpkg-deb \
30+
--root-owner-group \
31+
-z1 \
32+
--build "$deb_dir" \
33+
pgcat-${PACKAGE_VERSION}-ubuntu22.04-${ARCH}.deb

0 commit comments

Comments
 (0)