Skip to content

Commit f329fcf

Browse files
committed
Merge branch 'docs-and-pgrx-upgrade'
2 parents 601c76a + 12e5438 commit f329fcf

File tree

7 files changed

+59
-78
lines changed

7 files changed

+59
-78
lines changed

ADVANCED-INSTALL.md

Lines changed: 33 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,21 @@
22

33
This page covers installing PgDD from source locally, and the Docker build
44
method based on [ZomboDB's build system](https://github.com/zombodb/zombodb)
5-
used to create the binaries.
5+
used to create the binaries for multiple versions.
66

77

8-
## Install `pgdd` from source
8+
## Create Binary installer for your system
99

10+
The following steps walk through creating a package on a typical
11+
Ubuntu based system with Postgres 15.
1012

11-
One way to install `pgdd` is to install from source by cloning this repository.
1213

1314
### Prereqs
1415

1516
pgrx and its dependencies are the main prereq for PgDD.
1617
Install Prereqs and ensure PostgreSQL dev tools are installed.
1718

18-
> See the [Cargo pgrx](https://github.com/zombodb/pgrx/tree/master/cargo-pgrx)
19+
> See the [Cargo pgrx](https://github.com/tcdi/pgrx/tree/master/cargo-pgrx)
1920
documentation for more information on using pgrx.
2021

2122

@@ -57,68 +58,53 @@ cargo pgrx init
5758
```
5859

5960

60-
### Clone PgDD repo
61+
62+
The `fpm` step requires the `fpm` Ruby gem.
6163

6264
```bash
63-
mkdir ~/git
64-
cd ~/git
65-
git clone https://github.com/rustprooflabs/pgdd.git
66-
cd ~/git/pgdd
65+
sudo apt install ruby-rubygems
66+
sudo gem i fpm
6767
```
6868

69-
### Test deployment
70-
71-
Specify version, `pg10` through `pg13` are currently supported. This command will
72-
start a test instance of Postgres on port `28812`. Using a different version
73-
changes the last two digits of the port!
74-
69+
Of course, the PgDD project itself is required.
7570

7671
```bash
77-
cargo pgrx run pg14
72+
mkdir ~/git
73+
cd ~/git
74+
git clone https://github.com/rustprooflabs/pgdd.git
75+
cd ~/git/pgdd
7876
```
7977

80-
The output starts with something similar to:
78+
### Create package
8179

82-
```bash
83-
building extension with features `pg14`
84-
"cargo" "build" "--lib" "--features" "pg14" "--no-default-features"
85-
Updating crates.io index
86-
```
80+
> Timing note: `cargo pgrx package` takes ~ 2 minutes on my main dev machine.
8781
8882

8983
```bash
90-
Copying control file to `/home/username/.pgrx/14.0/pgrx-install/share/postgresql/extension/pgdd.control`
91-
Copying shared library to `/home/username/.pgrx/14.0/pgrx-install/lib/postgresql/pgdd.so`
92-
Building SQL generator with features `pg14`
93-
"cargo" "build" "--bin" "sql-generator" "--features" "pg14" "--no-default-features"
94-
Compiling pgdd v0.4.0 (/home/username/git/pgdd)
95-
Finished dev [unoptimized + debuginfo] target(s) in 13.84s
96-
Discovering SQL entities
97-
Discovered 9 SQL entities: 0 schemas (0 unique), 6 functions, 0 types, 0 enums, 3 sqls, 0 ords, 0 hashes
98-
running SQL generator with features `pg14`
99-
"cargo" "run" "--bin" "sql-generator" "--features" "pg14" "--no-default-features" "--" "--sql" "/home/username/.pgrx/14.0/pgrx-install/share/postgresql/extension/pgdd--0.4.1-dev.sql"
100-
Finished dev [unoptimized + debuginfo] target(s) in 0.06s
101-
Running `target/debug/sql-generator --sql /home/username/.pgrx/14.0/pgrx-install/share/postgresql/extension/pgdd--0.4.1-dev.sql`
102-
Copying extension schema file to `/home/username/.pgrx/14.0/pgrx-install/share/postgresql/extension/pgdd--0.4.1-dev.sql`
103-
Finished installing pgdd
104-
Starting Postgres v14 on port 28814
105-
Re-using existing database pgdd
106-
```
84+
cargo pgrx package --pg-config /usr/lib/postgresql/15/bin/pg_config
85+
cd target/release/pgdd-pg15/
10786

108-
In the test instance of psql, create the extension in database.
87+
find ./ -name "*.so" -exec strip {} \;
88+
OUTFILE=pgdd.deb
89+
rm ${OUTFILE} || true
90+
fpm \
91+
-s dir \
92+
-t deb -n pgdd \
93+
-v 0.5.0 \
94+
--deb-no-default-config-files \
95+
-p ${OUTFILE} \
96+
-a amd64 \
97+
.
10998

110-
```bash
111-
CREATE EXTENSION pgdd;
99+
sudo dpkg -i --force-overwrite ./pgdd.deb
112100
```
113101

114-
> Note: When you see "Re-using existing database pgdd" your previous installed version of `pgdd` will be available. To ensure you are working with the latest version of the `pgdd` extension you must drop/create the extension, quit the psql shell, and re-run the `cargo pgrx run` command.
115102

116103

117-
## Build binary packages
104+
## Use Docker to build binary packages
118105

119-
Debian/Ubuntu Bionic binaries are available for 0.4.0
120-
(first [pgrx](https://github.com/tcdi/pgrx) version)
121-
and later. More distributions will likely have binaries available in the future.
106+
Ubuntu 22.04 (Jammy) binaries are available for 0.5.0 for Postgres 11
107+
through Postgres 15.
122108

123109

124110
```bash
@@ -128,11 +114,6 @@ time bash ./build.sh
128114

129115
Tagged versions will be attached to their [releases](https://github.com/rustprooflabs/pgdd/releases).
130116

131-
During development some versions may be copied to the `./standalone/` directory.
132-
133-
```bash
134-
cp ./target/artifacts/* ./standalone/
135-
```
136117

137118
## pgrx Generate graphviz
138119

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "pgdd"
3-
version = "0.5.0-dev"
3+
version = "0.5.0"
44
edition = "2018"
55
description = "In-database (PostgreSQL) data dictionary providing database introspection via standard SQL query syntax."
66

@@ -17,12 +17,12 @@ pg15 = ["pgrx/pg15"]
1717
pg_test = []
1818

1919
[dependencies]
20-
pgrx = "=0.7.4"
21-
pgrx-macros = "=0.7.4"
20+
pgrx = "=0.9.5"
21+
pgrx-macros = "=0.9.5"
2222

2323

2424
[dev-dependencies]
25-
pgrx-tests = "=0.7.4"
25+
pgrx-tests = "=0.9.5"
2626

2727

2828
[profile.dev]

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,19 @@ The extension is built on the Rust [pgrx framework](https://github.com/tcdi/pgrx
99

1010
## Compatibility
1111

12-
PgDD has been tested to work for PostgreSQL 10 through 14.
12+
PgDD has been tested to work for PostgreSQL 11 through 15.
1313

1414

1515
## Install from binary
1616

17-
Binaries are available for Ubuntu 20.04 (focal) and Ubuntu 21.04 (hirsute).
18-
See [releases](https://github.com/rustprooflabs/pgdd/releases) for the full list
19-
of binaries.
17+
Binaries are available for Ubuntu 22.04 (jammy) for AMD 64 architectures.
18+
See [releases](https://github.com/rustprooflabs/pgdd/releases) for the full list of binaries.
2019

21-
Download and install for Postgres 14 on Ubuntu 20.04 (focal).
20+
Download and install for Postgres 15 on Ubuntu 22.04.
2221

2322
```bash
24-
wget https://github.com/rustprooflabs/pgdd/releases/download/0.4.0/pgdd_0.4.0_focal_pg14_amd64.deb
25-
sudo dpkg -i ./pgdd_0.4.0_focal_pg14_amd64.deb
23+
wget https://github.com/rustprooflabs/pgdd/releases/download/0.5.0/pgdd_0.5.0_focal_pg15_amd64.deb
24+
sudo dpkg -i ./pgdd_0.5.0_focal_pg15_amd64.deb
2625
```
2726

2827
Create the extension in your database.
@@ -50,6 +49,7 @@ SELECT extname, extversion
5049
```
5150

5251

52+
5353
## Use Data Dictionary
5454

5555
Connect to your database using your favorite SQL client. This
@@ -275,7 +275,7 @@ extension to using the [pgrx framework](https://github.com/zombodb/pgrx).
275275

276276
Upgrading versions currently requires `DROP EXTENSION pgdd; CREATE EXTENSION pgdd;`
277277
to recreate the extension.
278-
This is unlikely to change until [pgrx #121 is resolved](https://github.com/zombodb/pgrx/issues/121).
278+
This is unlikely to change until [pgrx #121 is resolved](https://github.com/tcdi/pgrx/issues/121).
279279

280280

281281

build/build.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Borrowed heavily from https://github.com/zombodb/zombodb/blob/master/build/build.sh
22
#
3-
# Copyright 2018-2021 RustProof Labs
3+
# Copyright 2018-2023 RustProof Labs
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.
@@ -21,7 +21,7 @@ BASE=$(dirname `pwd`)
2121
VERSION=$(cat $BASE/pgdd.control | grep default_version | cut -f2 -d\')
2222
LOGDIR=${BASE}/target/logs
2323
ARTIFACTDIR=${BASE}/target/artifacts
24-
PGXVERSION=0.6.0
24+
PGRXVERSION=0.9.5
2525

2626
PG_VERS=("pg11" "pg12" "pg13" "pg14" "pg15")
2727
#PG_VERS=("pg15")
@@ -30,7 +30,7 @@ echo $BASE
3030
echo $VERSION
3131
echo $LOGDIR
3232
echo $ARTIFACTDIR
33-
echo "PGX Version: ${PGXVERSION}"
33+
echo "PGRX Version: ${PGRXVERSION}"
3434

3535
mkdir -p ${LOGDIR}
3636
mkdir -p ${ARTIFACTDIR}
@@ -49,7 +49,7 @@ for image in `ls docker/ ` ; do
4949

5050
cd docker/${image}
5151
echo " Building Docker image: ${image}"
52-
docker build -t ${image} --build-arg PGXVERSION=${PGXVERSION} . 2>&1 > ${LOGDIR}/${image}-build.log || exit 1
52+
docker build -t ${image} --build-arg PGRXVERSION=${PGRXVERSION} . 2>&1 > ${LOGDIR}/${image}-build.log || exit 1
5353

5454
for PG_VER in ${PG_VERS[@]} ; do
5555

build/docker/pgdd-ubuntu-jammy/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LABEL maintainer="PgDD Project - https://github.com/rustprooflabs/pgdd"
55
ARG USER=docker
66
ARG UID=1000
77
ARG GID=1000
8-
ARG PGXVERSION
8+
ARG PGRXVERSION
99

1010
RUN useradd -m ${USER} --uid=${UID}
1111

@@ -43,4 +43,4 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup.sh
4343
ENV PATH="/home/${USER}/.cargo/bin:${PATH}"
4444

4545
RUN /bin/bash rustup.sh -y \
46-
&& cargo install --locked cargo-pgx --version ${PGXVERSION}
46+
&& cargo install --locked cargo-pgrx --version ${PGRXVERSION}

build/package.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Borrowed heavily from https://github.com/zombodb/zombodb/blob/master/build/package.sh
22
#
3-
# Copyright 2021-2022 RustProof Labs
3+
# Copyright 2021-2023 RustProof Labs
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.
@@ -28,11 +28,11 @@ fi
2828
PKG_FORMAT=deb
2929

3030
PG_VER_SHORT=${PG_VER: -2}
31-
echo " Running pgx init for ${PG_VER} (${PG_VER_SHORT})"
31+
echo " Running pgrx init for ${PG_VER} (${PG_VER_SHORT})"
3232

33-
mkdir -p /home/docker/.pgx/data-${PG_VER_SHORT}
33+
mkdir -p /home/docker/.pgrx/data-${PG_VER_SHORT}
3434

35-
cargo pgx init --${PG_VER} /usr/lib/postgresql/${PG_VER_SHORT}/bin/pg_config
35+
cargo pgrx init --${PG_VER} /usr/lib/postgresql/${PG_VER_SHORT}/bin/pg_config
3636

3737
echo "Changing to build dir..."
3838
cd /build
@@ -42,11 +42,11 @@ VERSION=$(cat pgdd.control | grep default_version | cut -f2 -d\')
4242

4343
echo "PgDD Building for: ${OSNAME}-${VERSION}"
4444

45-
PG_CONFIG_DIR=$(dirname $(grep ${PG_VER} ~/.pgx/config.toml | cut -f2 -d= | cut -f2 -d\"))
45+
PG_CONFIG_DIR=$(dirname $(grep ${PG_VER} ~/.pgrx/config.toml | cut -f2 -d= | cut -f2 -d\"))
4646
export PATH=${PG_CONFIG_DIR}:${PATH}
4747

48-
echo " Packaging pgx"
49-
cargo pgx package || exit $?
48+
echo " Packaging pgrx"
49+
cargo pgrx package || exit $?
5050

5151

5252
#

pgdd.control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
comment = 'An in-database data dictionary providing database introspection via standard SQL query syntax. Developed using pgx (https://github.com/zombodb/pgx).'
2-
default_version = '0.4.1'
2+
default_version = '0.5.0'
33
module_pathname = '$libdir/pgdd'
44
relocatable = false
55
schema = dd

0 commit comments

Comments
 (0)