Skip to content

Commit c835b27

Browse files
Merge pull request #46 from rustprooflabs/mdbook
Move documentation to mdbook format w/ Pages
2 parents 52837b4 + bb13fdf commit c835b27

File tree

13 files changed

+776
-583
lines changed

13 files changed

+776
-583
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Based on https://github.com/rust-lang/mdBook/wiki/Automated-Deployment%3A-GitHub-Actions
2+
name: Deploy mdbook
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- mdbook
8+
9+
jobs:
10+
deploy:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
with:
15+
fetch-depth: 0
16+
- name: Install Rust
17+
run: |
18+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
19+
echo "PATH=$HOME/.cargo/bin:$PATH" >> $GITHUB_ENV
20+
- name: Install mdbook
21+
run: |
22+
cargo install mdbook
23+
- name: Deploy GitHub Pages
24+
run: |
25+
# This assumes your book is in the root of your repository.
26+
# Just add a `cd` here if you need to change to another directory.
27+
cd docs
28+
mdbook build
29+
git worktree add gh-pages
30+
git config user.name "Deploy from CI"
31+
git config user.email ""
32+
cd gh-pages
33+
# Delete the ref to avoid keeping history.
34+
git update-ref -d refs/heads/gh-pages
35+
rm -rf *
36+
mv ../book/* .
37+
git add .
38+
git commit -m "Deploy $GITHUB_SHA to gh-pages"
39+
git push --force --set-upstream origin gh-pages

ADVANCED-INSTALL.md

Lines changed: 2 additions & 233 deletions
Original file line numberDiff line numberDiff line change
@@ -1,235 +1,4 @@
1-
# PgDD Advanced installation
1+
## Documentation moved
22

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:
8-
9-
* CPU Architecture
10-
* Operating System version
11-
* Postgres version
12-
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
73-
74-
The following steps walk through creating a package on a typical
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/`.
77-
78-
79-
### Prerequisites
80-
81-
The main perquisites for PgDD are `pgrx` and its dependencies.
82-
Install prereqs and ensure PostgreSQL dev tools are installed.
83-
84-
> See the [cargo pgrx](https://github.com/pgcentralfoundation/pgrx/tree/master/cargo-pgrx)
85-
documentation for more information on using `pgrx`.
86-
87-
88-
```bash
89-
sudo apt install postgresql-server-dev-all libreadline-dev zlib1g-dev curl \
90-
libssl-dev llvm-dev libclang-dev clang \
91-
graphviz
92-
```
93-
94-
[Install Rust](https://www.rust-lang.org/tools/install) and pgrx.
95-
96-
```bash
97-
curl https://sh.rustup.rs -sSf | sh -s -- -y
98-
source $HOME/.cargo/env
99-
```
100-
101-
Install `cargo-pgrx` regularly (see dev steps below for non-standard install).
102-
103-
104-
```bash
105-
cargo install --locked cargo-pgrx
106-
```
107-
108-
109-
Install `cargo-deb` used for packaging binaries.
110-
111-
```bash
112-
cargo install cargo-deb
113-
```
114-
115-
116-
Initialize `pgrx`. Need to run this after install AND occasionally to get updates
117-
to Postgres versions or glibc updates. Not typically required to follow pgrx
118-
developments.
119-
120-
121-
```bash
122-
cargo pgrx init
123-
```
124-
125-
126-
127-
The `fpm` step requires the `fpm` Ruby gem.
128-
129-
```bash
130-
sudo apt install ruby-rubygems
131-
sudo gem i fpm
132-
```
133-
134-
Of course, the PgDD project itself is required.
135-
136-
```bash
137-
mkdir ~/git
138-
cd ~/git
139-
git clone https://github.com/rustprooflabs/pgdd.git
140-
cd ~/git/pgdd
141-
```
142-
143-
### Create package
144-
145-
> Timing note: `cargo pgrx package` takes ~ 2 minutes on my main dev machine.
146-
147-
148-
```bash
149-
cargo pgrx package --pg-config /usr/lib/postgresql/15/bin/pg_config
150-
cd target/release/pgdd-pg15/
151-
152-
find ./ -name "*.so" -exec strip {} \;
153-
OUTFILE=pgdd.deb
154-
rm ${OUTFILE} || true
155-
fpm \
156-
-s dir \
157-
-t deb -n pgdd \
158-
-v 0.5.0 \
159-
--deb-no-default-config-files \
160-
-p ${OUTFILE} \
161-
-a amd64 \
162-
.
163-
164-
sudo dpkg -i --force-overwrite ./pgdd.deb
165-
```
166-
167-
168-
169-
170-
## pgrx Generate graphviz
171-
172-
```bash
173-
cargo pgrx schema -d pgdd.dot
174-
dot -Goverlap=prism -Gspline=ortho -Tjpg pgdd.dot > pgdd.jpg
175-
```
176-
177-
![pgrx dependencies for pgdd](pgdd.jpg)
178-
179-
180-
## Non-standard dev
181-
182-
When working against pgrx installed from a non-tagged branch, install pgrx using:
183-
184-
```bash
185-
cargo install --locked --force --git "https://github.com/tcdi/pgrx" \
186-
--branch "develop" \
187-
"cargo-pgrx"
188-
```
189-
190-
191-
The following command can be used to force pgrx to overwrite the configs it needs to
192-
for various dev related changes.
193-
194-
Clean things out.
195-
196-
```bash
197-
cargo clean
198-
```
199-
200-
If you're doing the above, you probably should remove the `Cargo.lock`
201-
file while you're at it. The more cautious may want to move it aside for a backup.
202-
203-
```bash
204-
rm Cargo.lock
205-
```
206-
207-
Force build the schema.
208-
209-
210-
```bash
211-
cargo pgrx schema -f
212-
```
213-
214-
215-
## Non-standard In Docker
216-
217-
If testing this extension against non-standard pgrx install, update the
218-
Dockerfile to install from the specific branch.
219-
220-
Change
221-
222-
```bash
223-
RUN /bin/bash rustup.sh -y \
224-
&& cargo install --locked cargo-pgrx
225-
```
226-
227-
To
228-
229-
```bash
230-
RUN /bin/bash rustup.sh -y \
231-
&& cargo install --locked --force --git "https://github.com/tcdi/pgrx" \
232-
--branch "develop" \
233-
"cargo-pgrx"
234-
```
3+
Documentation from this page is [now found here](https://rustprooflabs.github.io/pgdd/create-installer.html).
2354

0 commit comments

Comments
 (0)