Skip to content

Commit 3564da8

Browse files
pmpetitpmpetit
authored andcommitted
change version to 2.0.0
1 parent eb1c622 commit 3564da8

4 files changed

Lines changed: 157 additions & 0 deletions

File tree

pglinter/Dockerfile

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Build stage - extract extension files from .deb package
2+
FROM ghcr.io/cloudnative-pg/postgresql:18-minimal-trixie AS builder
3+
4+
ARG PG_MAJOR=18
5+
ARG EXT_VERSION=2.0.0
6+
7+
USER 0
8+
9+
RUN set -eux; \
10+
ARCH=$(dpkg --print-architecture); \
11+
mkdir -p /extension-build && \
12+
apt-get update && \
13+
apt-get install -y --no-install-recommends wget ca-certificates && \
14+
cd /tmp && \
15+
DOWNLOAD_URL="https://github.com/pmpetit/pglinter/releases/download/${EXT_VERSION}/postgresql_pglinter_${PG_MAJOR}_${EXT_VERSION}_${ARCH}.deb" && \
16+
echo "Downloading pglinter from: $DOWNLOAD_URL" && \
17+
wget -O pglinter.deb "$DOWNLOAD_URL" && \
18+
dpkg-deb -x pglinter.deb /tmp/extracted && \
19+
echo "Contents of extracted package:" && \
20+
find /tmp/extracted -type f && \
21+
# Create CloudNative-PG compliant directory structure
22+
mkdir -p /extension-build/lib /extension-build/share/extension && \
23+
# Copy shared libraries (.so files)
24+
if [ -d /tmp/extracted/usr/lib/postgresql/${PG_MAJOR}/lib ]; then \
25+
echo "Copying libraries from /usr/lib/postgresql/${PG_MAJOR}/lib/"; \
26+
find /tmp/extracted/usr/lib/postgresql/${PG_MAJOR}/lib/ -name "*.so" -exec cp {} /extension-build/lib/ \; ; \
27+
fi && \
28+
# Copy extension control and SQL files
29+
if [ -d /tmp/extracted/usr/share/postgresql/${PG_MAJOR}/extension ]; then \
30+
echo "Copying extension files from /usr/share/postgresql/${PG_MAJOR}/extension/"; \
31+
cp /tmp/extracted/usr/share/postgresql/${PG_MAJOR}/extension/* /extension-build/share/extension/ ; \
32+
fi && \
33+
echo "Final extension structure:" && \
34+
find /extension-build -type f
35+
36+
FROM scratch
37+
ARG PG_MAJOR=18
38+
39+
# Final image - scratch base following CloudNative-PG specifications
40+
# Licenses
41+
COPY copyright /licenses/postgresql-${PG_MAJOR}-pglinter/
42+
43+
COPY --from=builder /extension-build/lib/ /lib/
44+
COPY --from=builder /extension-build/share/ /share/
45+
46+
# Share
47+
COPY --from=builder /usr/share/postgresql/${PG_MAJOR}/extension/pglinter* /share/extension/
48+
49+
USER 65532:65532

pglinter/README.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# pglinter
2+
3+
[pglinter](https://github.com/pmpetit/pglinter) is an open-source extension
4+
that checks **database design** in PostgreSQL.
5+
6+
This image provides a convenient way to deploy and manage `pglinter` with
7+
[CloudNativePG](https://cloudnative-pg.io/).
8+
9+
## Usage
10+
11+
### 1. Add the pglinter extension image to your Cluster
12+
13+
Define the `pglinter` extension under the `postgresql.extensions` section of
14+
your `Cluster` resource. For example:
15+
16+
```yaml
17+
apiVersion: postgresql.cnpg.io/v1
18+
kind: Cluster
19+
metadata:
20+
name: cluster-pglinter
21+
spec:
22+
imageName: ghcr.io/cloudnative-pg/postgresql:18-minimal-trixie
23+
instances: 1
24+
25+
storage:
26+
size: 1Gi
27+
28+
postgresql:
29+
extensions:
30+
- name: pglinter
31+
image:
32+
reference: ghcr.io/cloudnative-pg/pglinter:2.0.0-18-trixie
33+
```
34+
35+
### 2. Enable the extension in a database
36+
37+
You can install `pglinter` in a specific database by creating or updating a
38+
`Database` resource. For example, to enable it in the `app` database:
39+
40+
```yaml
41+
apiVersion: postgresql.cnpg.io/v1
42+
kind: Database
43+
metadata:
44+
name: cluster-pglinter-app
45+
spec:
46+
name: app
47+
owner: app
48+
cluster:
49+
name: cluster-pglinter
50+
extensions:
51+
- name: pglinter
52+
version: '2.0.0'
53+
```
54+
55+
### 3. Verify installation
56+
57+
Once the database is ready, connect to it with `psql` and run:
58+
59+
```sql
60+
\dx
61+
```
62+
63+
You should see `pglinter` listed among the installed extensions.

pglinter/copyright

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
2+
Upstream-Name: pglinter
3+
Source: https://github.com/pmpetit/pglinter
4+
5+
Files: *
6+
Copyright: Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
7+
Portions Copyright (c) 1994, The Regents of the University of California
8+
License: PostgreSQL
9+
Permission to use, copy, modify, and distribute this software and its
10+
documentation for any purpose, without fee, and without a written agreement
11+
is hereby granted, provided that the above copyright notice and this
12+
paragraph and the following two paragraphs appear in all copies.
13+
.
14+
IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
15+
DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING
16+
LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
17+
DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE
18+
POSSIBILITY OF SUCH DAMAGE.
19+
.
20+
THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
21+
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
22+
AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
23+
ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO
24+
PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.

pglinter/metadata.hcl

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
metadata = {
2+
name = "pglinter"
3+
sql_name = "pglinter"
4+
image_name = "pglinter"
5+
shared_preload_libraries = []
6+
extension_control_path = []
7+
dynamic_library_path = []
8+
ld_library_path = []
9+
auto_update_os_libs = false
10+
11+
versions = {
12+
bookworm = {
13+
// renovate: suite=bookworm-pgdg depName=postgresql-18-pglinter
14+
"18" = "2.0.0"
15+
}
16+
trixie = {
17+
// renovate: suite=trixie-pgdg depName=postgresql-18-pglinter
18+
"18" = "2.0.0"
19+
}
20+
}
21+
}

0 commit comments

Comments
 (0)