|
1 | | -# PgDD Advanced installation |
| 1 | +## Documentation moved |
2 | 2 |
|
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 | | - |
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). |
235 | 4 |
|
0 commit comments