Skip to content

Commit 52837b4

Browse files
Merge pull request #44 from rustprooflabs/ubuntu-2304-dockerfile
OS Support improvements
2 parents 85d8886 + 7c33b58 commit 52837b4

File tree

5 files changed

+150
-30
lines changed

5 files changed

+150
-30
lines changed

ADVANCED-INSTALL.md

Lines changed: 76 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,88 @@
11
# PgDD Advanced installation
22

3-
This page covers installing PgDD from source locally, and the Docker build
4-
method based on [ZomboDB's build system](https://github.com/zombodb/zombodb)
5-
used to create the binaries for multiple versions.
3+
This page covers two methods that can be used to build binary installers
4+
for PgDD.
5+
The two methods that can be used to build binaries are the Docker build system
6+
and manually installing `pgrx` on the target OS and architecture.
7+
Installers are specific to three (3) details:
68

9+
* CPU Architecture
10+
* Operating System version
11+
* Postgres version
712

8-
## Create Binary installer for your system
13+
14+
The Docker build method uses OS specific `Dockerfile` to provide one binary
15+
installer for each supported Postgres version. This is the best approach
16+
when the appropriate `Dockerfile` already exists.
17+
18+
19+
## Use Docker to build binary packages
20+
21+
The Docker build method was originally based on
22+
[ZomboDB's build system](https://github.com/zombodb/zombodb) and has
23+
evolved with this project since then.
24+
25+
To generate the full suite of binaries change into the `./build` directory
26+
and run `build.sh`. This currently creates 15 total binary installers for
27+
3 different OSs (Postgres 12 - 16).
28+
29+
```bash
30+
cd build/
31+
time bash ./build.sh
32+
```
33+
34+
Individual installers can be found under `./target/artifacts`. A package of
35+
all installers is saved to `./build/pgdd-binaries.tar.gz`.
36+
37+
> Tagged versions of PgDD include LTS OS binaries with their [release notes](https://github.com/rustprooflabs/pgdd/releases).
38+
39+
40+
### Customize Docker Build system
41+
42+
The Docker build system can be adjusted locally to build a binary for
43+
a specific Postgres version and/or specific OS.
44+
45+
The `./build/build.sh` script has the logic to be adjusted to control this.
46+
The Postgres versions can be altered manually by commenting out the line
47+
with all versions and uncommenting the line with a specific Postgres version.
48+
The two lines in the script are shown below.
49+
50+
```bash
51+
PG_VERS=("pg12" "pg13" "pg14" "pg15" "pg16")
52+
#PG_VERS=("pg16")
53+
```
54+
55+
56+
To only build for Postgres on a single OS, add a `grep <osname` command to the
57+
loop logic. The original file that runs for all OSs with Dockerfiles looks like
58+
the following line.
59+
60+
```bash
61+
for image in `ls docker/ ` ; do
62+
```
63+
64+
To build for only `lunar` (Ubuntu 23.04) add ` | grep lunar ` as shown in the
65+
following example.
66+
67+
```bash
68+
for image in `ls docker/ | grep lunar ` ; do
69+
```
70+
71+
72+
## Create Binary Installer w/out Docker
973
1074
The following steps walk through creating a package on a typical
11-
Ubuntu based system with Postgres 15.
75+
Ubuntu based system with Postgres 15. These manual instructions can be used
76+
when you do not want to use the Docker based build system under `./build/`.
1277
1378
14-
### Prereqs
79+
### Prerequisites
1580
16-
pgrx and its dependencies are the main prereq for PgDD.
17-
Install Prereqs and ensure PostgreSQL dev tools are installed.
81+
The main perquisites for PgDD are `pgrx` and its dependencies.
82+
Install prereqs and ensure PostgreSQL dev tools are installed.
1883
19-
> See the [Cargo pgrx](https://github.com/tcdi/pgrx/tree/master/cargo-pgrx)
20-
documentation for more information on using pgrx.
84+
> See the [cargo pgrx](https://github.com/pgcentralfoundation/pgrx/tree/master/cargo-pgrx)
85+
documentation for more information on using `pgrx`.
2186
2287
2388
```bash
@@ -48,7 +113,7 @@ cargo install cargo-deb
48113
```
49114
50115
51-
Initialize pgrx. Need to run this after install AND occasionally to get updates
116+
Initialize `pgrx`. Need to run this after install AND occasionally to get updates
52117
to Postgres versions or glibc updates. Not typically required to follow pgrx
53118
developments.
54119
@@ -101,19 +166,6 @@ sudo dpkg -i --force-overwrite ./pgdd.deb
101166
102167
103168
104-
## Use Docker to build binary packages
105-
106-
Ubuntu 22.04 (Jammy) binaries are available for 0.5.0 for Postgres 11
107-
through Postgres 15.
108-
109-
110-
```bash
111-
cd build/
112-
time bash ./build.sh
113-
```
114-
115-
Tagged versions will be attached to their [releases](https://github.com/rustprooflabs/pgdd/releases).
116-
117169
118170
## pgrx Generate graphviz
119171

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ pg16 = ["pgrx/pg16"]
1717
pg_test = []
1818

1919
[dependencies]
20-
pgrx = "=0.10.1"
21-
pgrx-macros = "=0.10.1"
20+
pgrx = "=0.10.2"
21+
pgrx-macros = "=0.10.2"
2222

2323

2424
[dev-dependencies]
25-
pgrx-tests = "=0.10.1"
25+
pgrx-tests = "=0.10.2"
2626

2727

2828
[profile.dev]

README.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,13 @@ PgDD has been tested to work for PostgreSQL 12 through 16.
1414

1515
## Install from binary
1616

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.
17+
Binaries for supported Postgres versions are made available for each release.
18+
See the individual release from the [releases](https://github.com/rustprooflabs/pgdd/releases)
19+
page for the full list of binaries.
20+
This includes binaries for two main LTS supported OS's using the AMD64 architecture.
21+
The latest Ubuntu LTS (currently Jammy, 22.04) and the "PostGIS" image
22+
(currently Debian 11). The PostGIS image is provided to allow inclusion
23+
in the [PgOSM Flex](https://pgosm-flex.com) project's Docker image.
1924

2025
Download and install for Postgres 16 on Ubuntu 22.04.
2126

@@ -48,6 +53,20 @@ SELECT extname, extversion
4853
```
4954

5055

56+
## Non-LTS OS Support
57+
58+
Interim Ubuntu OS versions, such as 23.04, may have minimal support
59+
through the inclusion of a `Dockerfile` under
60+
[`./build/docker/`](https://github.com/rustprooflabs/pgdd/tree/main/build/docker).
61+
The intent with these is to prepare for potential changes in the upcoming LTS
62+
version, e.g. 24.04.
63+
64+
Binaries will not be provided for these interim OS's. To get the binary for
65+
one of these releases follow the instructions in the
66+
[Advanced Installation](./ADVANCED-INSTALL.md) section, under
67+
[the Docker section](ADVANCED-INSTALL.md#use-docker-to-build-binary-packages).
68+
69+
5170

5271
## Use Data Dictionary
5372

build/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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-
PGRXVERSION=0.10.1
24+
PGRXVERSION=0.10.2
2525

2626
PG_VERS=("pg12" "pg13" "pg14" "pg15" "pg16")
2727
#PG_VERS=("pg16")
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Ubuntu Lunar is an intermediate release of Ubuntu, not an LTS version.
2+
# Non-LTS veresion are minimally supported until the next LTS version is released.
3+
FROM ubuntu:lunar
4+
5+
LABEL maintainer="PgDD Project - https://github.com/rustprooflabs/pgdd"
6+
7+
ARG USER=ubuntu
8+
ARG UID=1000
9+
ARG GID=1000
10+
ARG PGRXVERSION
11+
12+
# Ubuntu Lunar (23.04) has the ubuntu user as ID 1000. Why now when not in jmmay?
13+
#RUN useradd -m ${USER} --uid=${UID}
14+
15+
16+
ARG DEBIAN_FRONTEND=noninteractive
17+
RUN apt-get update && apt-get upgrade -y \
18+
&& apt-get install -y make wget curl gnupg git postgresql-common
19+
20+
RUN sh /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y
21+
22+
RUN apt-get update && apt-get upgrade -y --fix-missing
23+
RUN apt-get install -y --fix-missing \
24+
clang-14 llvm-14 clang libz-dev strace pkg-config \
25+
libxml2 libxml2-dev libreadline8 libreadline-dev \
26+
flex bison libbison-dev build-essential \
27+
zlib1g-dev libxslt-dev libssl-dev libxml2-utils xsltproc libgss-dev \
28+
libldap-dev libkrb5-dev gettext tcl-tclreadline tcl-dev libperl-dev \
29+
libpython3-dev libprotobuf-c-dev libprotobuf-dev gcc \
30+
ruby ruby-dev rubygems \
31+
postgresql-12 postgresql-server-dev-12 \
32+
postgresql-13 postgresql-server-dev-13 \
33+
postgresql-14 postgresql-server-dev-14 \
34+
postgresql-15 postgresql-server-dev-15 \
35+
postgresql-16 postgresql-server-dev-16 \
36+
&& apt autoremove -y
37+
38+
39+
RUN gem install --no-document fpm
40+
41+
42+
USER ${UID}:${GID}
43+
WORKDIR /home/${USER}
44+
45+
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup.sh
46+
ENV PATH="/home/${USER}/.cargo/bin:${PATH}"
47+
48+
RUN /bin/bash rustup.sh -y \
49+
&& cargo install --locked cargo-pgrx --version ${PGRXVERSION}

0 commit comments

Comments
 (0)